[rabbitmq-discuss] Suggestion: add start/4 to amqp_connection in Erlang client

Edwin Fine rabbitmq-discuss_efine at usa.net
Wed Jun 18 00:19:51 BST 2008

There's no way to start a connection on a given vhost in the current version
of the Erlang client. amqp_connection only has start/2 and start/3

I propose adding start/4 to amqp_connection by modifying it as follows:

%% Starts a networked conection to a remote AMQP server.
start(User, Password, Host) ->
    start(User, Password, Host, <<"/">>).

start(User, Password, Host, Vhost) when is_binary(Vhost) ->
    Handshake = fun amqp_network_driver:handshake/1,
    InitialState = #connection_state{username = User,
                                     password = Password,
                                     serverhost = Host,
                                     vhostpath = Vhost},
    {ok, Pid} = gen_server:start_link(?MODULE, [InitialState, Handshake],
    {Pid, network}.

This does work, as I have been using the modified code for some months now.

Any takers?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20080617/9ed67318/attachment.htm 

More information about the rabbitmq-discuss mailing list