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.<br><br>I propose adding start/4 to amqp_connection by modifying it as follows:<br>
<br><span style="font-family: courier new,monospace;">%% Starts a networked conection to a remote AMQP server.</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">start(User, Password, Host) -></span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> start(User, Password, Host, <<"/">>).</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">start(User, Password, Host, Vhost) when is_binary(Vhost) -></span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> Handshake = fun amqp_network_driver:handshake/1,</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> InitialState = #connection_state{username = User,</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> password = Password,</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> serverhost = Host,</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> vhostpath = Vhost},</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> {ok, Pid} = gen_server:start_link(?MODULE, [InitialState, Handshake], []),</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> {Pid, network}.</span><br><br>This does work, as I have been using the modified code for some months now.<br><br>Any takers?<br><br>