[rabbitmq-discuss] [BUG] Erlang RabbitMQ client requires installed server code

Edwin Fine rabbitmq-discuss_efine at usa.net
Sun Sep 7 08:48:29 BST 2008


 Further to my previous email, a minimal list of required modules for the
proposed "rabbit_common" application are listed below (these are the ones I
needed to get things up and running). I am going to make my own
rabbit_common OTP application, and change the Erlang client to depend on it
rather than the server. I will also see what it takes to change the rabbit
1.4.0 server itself to factor out the common code and to use this
rabbit_common application. Perhaps I can use Dialyzer to ensure that I get
all dependencies. If this would be of interest I would be glad to share it.

src/rabbit_binary_generator.erl
src/rabbit_misc.erl
src/rabbit_heartbeat.erl
src/rabbit_reader.erl
src/rabbit_framing_channel.erl
src/rabbit_writer.erl
src/rabbit_amqqueue.erl
src/rabbit_framing.erl
src/rabbit_binary_parser.erl
src/rabbit_channel.erl
include/rabbit_framing.hrl
include/rabbit_framing_spec.hrl
include/rabbit.hrl

Regards,
Edwin Fine

On Sun, Sep 7, 2008 at 2:56 AM, Edwin Fine
<rabbitmq-discuss_efine at usa.net>wrote:

> I had a surprise when trying to use the Erlang client on a node on which
> RabbitMQ Server was not installed.
>
> =CRASH REPORT==== 7-Sep-2008::02:41:39 ===
>   crasher:
>     pid: <0.165.0>
>     registered_name: []
>     exception exit: {undef,
> *                        [{rabbit_framing_channel,start_link,
> *                             [#Fun<amqp_network_driver.0.106693221>,
>                               [<0.165.0>]]},
>                          {amqp_network_driver,handshake,1},
>
> A network client should not require server code to be installed on the same
> node. This is certainly true of other clients I have used.
>
> On further investigation, I found a number of direct calls and references
> to an installed server:
>
>
> amqp_channel.erl:-include_lib("rabbitmq_server/include/rabbit_framing.hrl").
> amqp_channel.erl:    rabbit_amqqueue:notify_sent(Q, ChPid),
>
> amqp_connection.erl:-include_lib("rabbitmq_server/include/rabbit_framing.hrl").
>
> amqp_consumer.erl:-include_lib("rabbitmq_server/include/rabbit_framing.hrl").
>
> amqp_network_driver.erl:-include_lib("rabbitmq_server/include/rabbit_framing.hrl").
> amqp_network_driver.erl:            FramingPid =
> rabbit_framing_channel:start_link(fun(X) -> X end, [Parent]),
> amqp_network_driver.erl:    rabbit_writer:shutdown(WriterPid).
> amqp_network_driver.erl:    rabbit_writer:send_command(Writer, Close),
> amqp_network_driver.erl:    rabbit_writer:shutdown(Writer),
> amqp_network_driver.erl:do(Writer, Method) ->
> rabbit_writer:send_command(Writer, Method).
> amqp_network_driver.erl:do(Writer, Method, Content) ->
> rabbit_writer:send_command(Writer, Method, Content).
> amqp_network_driver.erl:    rabbit_framing_channel:process(ChPid, Frame).
> amqp_network_driver.erl:           response =
> rabbit_binary_generator:generate_table(LoginTable),
> amqp_network_driver.erl:    rabbit_writer:start(Sock, Channel,
> ?FRAME_MIN_SIZE).
> amqp_network_driver.erl:            rabbit_heartbeat:start_heartbeat(Sock,
> Heartbeat),
> amqp_network_driver.erl:    FramingPid =
> rabbit_framing_channel:start_link(fun(X) -> link(X), X end, [ChannelPid]),
> amqp_network_driver.erl:    case rabbit_reader:analyze_frame(Type, Payload)
> of
> amqp_network_driver.erl:            rabbit_misc:die(frame_error);
> amqp_network_driver.erl:            rabbit_misc:die(frame_error);
>
> amqp_rpc_client.erl:-include_lib("rabbitmq_server/include/rabbit_framing.hrl").
> amqp_rpc_client.erl:               content_type = ContentType} =
> rabbit_framing:decode_properties(ClassId, PropertiesBin),
>
> amqp_rpc_handler.erl:-include_lib("rabbitmq_server/include/rabbit_framing.hrl").
> amqp_rpc_handler.erl:    = rabbit_framing:decode_properties(ClassId,
> PropertiesBin),
>
> amqp_rpc_util.erl:-include_lib("rabbitmq_server/include/rabbit_framing.hrl").
> amqp_util.erl:-include_lib("rabbitmq_server/include/rabbit_framing.hrl").
>
> I left out the direct driver modules because by definition they need to be
> on the same node.
>
> I respectfully suggest that the above RabbitMQ server modules, and their
> dependencies, be bundled with the Erlang client. Ideally, I would think it
> would be best perhaps to put them a separate Erlang library application
> (maybe "rabbitmq_common") that is used both by the server and the Erlang
> client.
>
> In addition to that, the include_lib("rabbitmq_server/include/xxx.hrl")
> statements prevent one from even compiling the client unless the server is
> installed and this should be changed to use the common library app. I was
> forced to copy the include files and make a dummy rabbitmq_server
> application to be able to compile the client on a different node to the
> server.
>
> Regards,
> Edwin Fine
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20080907/3db504e3/attachment.htm 


More information about the rabbitmq-discuss mailing list