move internal definitions etc out of amqp_client.hrl

...in order to avoid application name space polution
This commit is contained in:
Matthias Radestock 2012-07-02 16:54:31 +01:00
parent e08e4421c7
commit 7749390ecf
13 changed files with 66 additions and 46 deletions

View File

@ -20,16 +20,6 @@
-include_lib("rabbit_common/include/rabbit.hrl").
-include_lib("rabbit_common/include/rabbit_framing.hrl").
-define(PROTOCOL_VERSION_MAJOR, 0).
-define(PROTOCOL_VERSION_MINOR, 9).
-define(PROTOCOL_HEADER, <<"AMQP", 0, 0, 9, 1>>).
-define(PROTOCOL, rabbit_framing_amqp_0_9_1).
-define(MAX_CHANNEL_NUMBER, 65535).
-define(DEFAULT_CONSUMER, {amqp_selective_consumer, []}).
-define(PROTOCOL_SSL_PORT, (?PROTOCOL_PORT - 1)).
-record(amqp_msg, {props = #'P_basic'{}, payload = <<>>}).
-record(amqp_params_network, {username = <<"guest">>,
@ -54,21 +44,4 @@
adapter_info = none,
client_properties = []}).
-record(adapter_info, {address = unknown,
port = unknown,
peer_address = unknown,
peer_port = unknown,
name = unknown,
protocol = unknown,
additional_info = []}).
-define(LOG_DEBUG(Format), error_logger:info_msg(Format)).
-define(LOG_INFO(Format, Args), error_logger:info_msg(Format, Args)).
-define(LOG_WARN(Format, Args), error_logger:warning_msg(Format, Args)).
-define(CLIENT_CAPABILITIES, [{<<"publisher_confirms">>, bool, true},
{<<"exchange_exchange_bindings">>, bool, true},
{<<"basic.nack">>, bool, true},
{<<"consumer_cancel_notify">>, bool, true}]).
-endif.

View File

@ -0,0 +1,41 @@
%% The contents of this file are subject to the Mozilla Public License
%% Version 1.1 (the "License"); you may not use this file except in
%% compliance with the License. You may obtain a copy of the License at
%% http://www.mozilla.org/MPL/
%%
%% Software distributed under the License is distributed on an "AS IS"
%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
%% License for the specific language governing rights and limitations
%% under the License.
%%
%% The Original Code is RabbitMQ.
%%
%% The Initial Developer of the Original Code is VMware, Inc.
%% Copyright (c) 2007-2012 VMware, Inc. All rights reserved.
%%
-include("amqp_client.hrl").
-define(PROTOCOL_VERSION_MAJOR, 0).
-define(PROTOCOL_VERSION_MINOR, 9).
-define(PROTOCOL_HEADER, <<"AMQP", 0, 0, 9, 1>>).
-define(PROTOCOL, rabbit_framing_amqp_0_9_1).
-define(MAX_CHANNEL_NUMBER, 65535).
-record(adapter_info, {address = unknown,
port = unknown,
peer_address = unknown,
peer_port = unknown,
name = unknown,
protocol = unknown,
additional_info = []}).
-define(LOG_DEBUG(Format), error_logger:info_msg(Format)).
-define(LOG_INFO(Format, Args), error_logger:info_msg(Format, Args)).
-define(LOG_WARN(Format, Args), error_logger:warning_msg(Format, Args)).
-define(CLIENT_CAPABILITIES, [{<<"publisher_confirms">>, bool, true},
{<<"exchange_exchange_bindings">>, bool, true},
{<<"basic.nack">>, bool, true},
{<<"consumer_cancel_notify">>, bool, true}]).

View File

@ -62,7 +62,7 @@
%% See type definitions below.
-module(amqp_channel).
-include("amqp_client.hrl").
-include("amqp_client_internal.hrl").
-behaviour(gen_server).

View File

@ -17,7 +17,7 @@
%% @private
-module(amqp_channel_sup).
-include("amqp_client.hrl").
-include("amqp_client_internal.hrl").
-behaviour(supervisor2).

View File

@ -17,7 +17,7 @@
%% @private
-module(amqp_channels_manager).
-include("amqp_client.hrl").
-include("amqp_client_internal.hrl").
-behaviour(gen_server).

View File

@ -67,13 +67,17 @@
%% See type definitions below.
-module(amqp_connection).
-include("amqp_client.hrl").
-include("amqp_client_internal.hrl").
-export([open_channel/1, open_channel/2, open_channel/3]).
-export([start/1]).
-export([close/1, close/3]).
-export([info/2, info_keys/1, info_keys/0]).
-define(DEFAULT_CONSUMER, {amqp_selective_consumer, []}).
-define(PROTOCOL_SSL_PORT, (?PROTOCOL_PORT - 1)).
%%---------------------------------------------------------------------------
%% Type Definitions
%%---------------------------------------------------------------------------
@ -163,9 +167,10 @@ start(AmqpParams) ->
%% Commands
%%---------------------------------------------------------------------------
%% @doc Invokes open_channel(ConnectionPid, none, ?DEFAULT_CONSUMER).
%% Opens a channel without having to specify a channel number. This uses the
%% default consumer implementation.
%% @doc Invokes open_channel(ConnectionPid, none,
%% {amqp_selective_consumer, []}). Opens a channel without having to
%% specify a channel number. This uses the default consumer
%% implementation.
open_channel(ConnectionPid) ->
open_channel(ConnectionPid, none, ?DEFAULT_CONSUMER).
@ -174,8 +179,9 @@ open_channel(ConnectionPid) ->
open_channel(ConnectionPid, {_, _} = Consumer) ->
open_channel(ConnectionPid, none, Consumer);
%% @doc Invokes open_channel(ConnectionPid, ChannelNumber, ?DEFAULT_CONSUMER).
%% Opens a channel, using the default consumer implementation.
%% @doc Invokes open_channel(ConnectionPid, ChannelNumber,
%% {amqp_selective_consumer, []}). Opens a channel, using the default
%% consumer implementation.
open_channel(ConnectionPid, ChannelNumber)
when is_number(ChannelNumber) orelse ChannelNumber =:= none ->
open_channel(ConnectionPid, ChannelNumber, ?DEFAULT_CONSUMER).
@ -196,9 +202,9 @@ open_channel(ConnectionPid, ChannelNumber)
%% is passed as parameter to ConsumerModule:init/1.<br/>
%% This function assumes that an AMQP connection (networked or direct)
%% has already been successfully established.<br/>
%% ChannelNumber must be less than or equal to the negotiated max_channel value,
%% or less than or equal to ?MAX_CHANNEL_NUMBER if the negotiated max_channel
%% value is 0.<br/>
%% ChannelNumber must be less than or equal to the negotiated
%% max_channel value, or less than or equal to ?MAX_CHANNEL_NUMBER
%% (65535) if the negotiated max_channel value is 0.<br/>
%% In the direct connection, max_channel is always 0.
open_channel(ConnectionPid, ChannelNumber,
{_ConsumerModule, _ConsumerArgs} = Consumer) ->

View File

@ -17,7 +17,7 @@
%% @private
-module(amqp_connection_type_sup).
-include("amqp_client.hrl").
-include("amqp_client_internal.hrl").
-behaviour(supervisor2).

View File

@ -17,7 +17,7 @@
%% @private
-module(amqp_direct_connection).
-include("amqp_client.hrl").
-include("amqp_client_internal.hrl").
-behaviour(amqp_gen_connection).

View File

@ -17,7 +17,7 @@
%% @private
-module(amqp_gen_connection).
-include("amqp_client.hrl").
-include("amqp_client_internal.hrl").
-behaviour(gen_server).

View File

@ -17,7 +17,7 @@
%% @private
-module(amqp_main_reader).
-include("amqp_client.hrl").
-include("amqp_client_internal.hrl").
-behaviour(gen_server).

View File

@ -17,7 +17,7 @@
%% @private
-module(amqp_network_connection).
-include("amqp_client.hrl").
-include("amqp_client_internal.hrl").
-behaviour(amqp_gen_connection).

View File

@ -16,7 +16,7 @@
-module(negative_test_util).
-include("amqp_client.hrl").
-include("amqp_client_internal.hrl").
-include_lib("eunit/include/eunit.hrl").
-compile(export_all).

View File

@ -17,7 +17,7 @@
-module(test_util).
-include_lib("eunit/include/eunit.hrl").
-include("amqp_client.hrl").
-include("amqp_client_internal.hrl").
-compile([export_all]).