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

Edwin Fine rabbitmq-discuss_efine at usa.net
Sun Sep 7 22:32:26 BST 2008


> src/rabbit_amqqueue.erl
> src/rabbit_channel.erl
> These should not be required since they are only used by the direct

   - As the most up to date client code currently stands, amqp_channel calls
   rabbit_amqqueue in a handle_info function. Although this handle_info
   function is used only by the direct client, I am uncomfortable with having
   server-specific code mixed in with pure client code. There should be a clean
   separation of concerns and all "direct" code, which calls into the
   server-specific code, should be in one module, and the network-only code in

   - amqp_network_driver calls rabbit_framing_channel, which in turn calls
   rabbit_channel. So indirectly, the network client uses rabbit_channel and
   needs it in the common distribution.

I wrote a small program that uses xref to compute all the dependencies
(transitive closure, I think) of the network client code, after commenting
out all code (that I could find, anyway) used for or by the direct driver.
This commented-out code needs to be separated so that there is a network
client, an orthogonal direct client, and functions in a common app that is
used both by clients and the server. I will look into how this can be done

The output is as follows (I removed dependencies of test code and direct
code modules):


So, ignoring modules provided by Erlang/OTP, and the network client modules
themselves, the following modules are needed by the network client:


I'd say that would be the basis of a common app.


On Sun, Sep 7, 2008 at 4:51 AM, Matthias Radestock <matthias at lshift.net>wrote:

> Edwin,
> Edwin Fine wrote:
>> 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.
> Bear in mind that the Erlang client code base can operate in both direct
> and networked mode. For the former you definitely need a server.
>  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.
> The above is on our todo list. Refactoring the code is the easy part. The
> challenges are in:
> - updating the module structure of the VCS - is rabbitmq_common going to be
> a separate HG module?
> - figuring out how rabbitmq_common will be distributed. This can be a
> combination of all of the following: a) separately, b) as part of the Erlang
> client and server source packages, c) as part of the Erlang client and
> server binary packages. Then there also the Debian and RPM packages to
> consider - are we going to have a separate packages for rabbitmq_common or
> will it be bundled with the existing packages?
> Depending on the above choices a significant amount of work needs to be put
> into revising the build system, the packaging system, our automated
> deployment system, the documentation, and parts of the web site.
> That's why it hasn't happened yet.
>  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.
> We definitely appreciate your help in this. Please give the above points
> some thought. Also, rather than basing your work on 1.4.0, I'd suggest
> working off the current 'default' branches in hg.
> Some comments on the list of files you came up with:
>  src/rabbit_misc.erl
> This should probably be split into the truly common part, the server part
> and the client part.
> > include/rabbit.hrl
> Ditto, though this is less important.
>  src/rabbit_amqqueue.erl
> > src/rabbit_channel.erl
> These should not be required since they are only used by the direct client.
> Regards,
> Matthias.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20080907/f1905a1e/attachment.htm 

More information about the rabbitmq-discuss mailing list