Erlang/OTP Forums

Author Message

<  RabbitMQ mailing list  ~  Suggestion: add start/4 to amqp_connection in Erlang client

Guest
Posted: Tue Jun 17, 2008 11:20 pm Reply with quote
Guest
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) ->
0x6e6562
Posted: Wed Jun 18, 2008 6:12 am Reply with quote
User Joined: 12 Jul 2007 Posts: 250
Edwin,

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

HTH,

Ben

_______________________________________________
rabbitmq-discuss mailing list
rabbitmq-discuss@lists.rabbitmq.com
http://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss
Post received from mailinglist
View user's profile Send private message

Display posts from previous:  

All times are GMT
Page 1 of 1
This forum is locked: you cannot post, reply to, or edit topics.

Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum