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

Ben Hood 0x6e6562 at gmail.com
Wed Jun 18 07:12:11 BST 2008


On Wed, Jun 18, 2008 at 12:19 AM, Edwin Fine
<rabbitmq-discuss_efine at usa.net> wrote:
> 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
> functions.
> 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?

I've already applied this patch as part of a previous discussion on
the list, so it's in the latest version of the Erlang client. The
Erlang client has been migrated from monotone to hg, we are just
waiting on some infrastructure changes to go through to make the
Erlang client public again. Let me know if you want me to send you a
zipped image of the latest version for the meantime.



More information about the rabbitmq-discuss mailing list