Skip to content

Commit 542bfbd

Browse files
Instantiate frame handler for the correct vhost
Fixes #153.
1 parent 23c4d4f commit 542bfbd

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

projects/client/RabbitMQ.Client/src/client/api/ConnectionFactory.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -402,6 +402,11 @@ public IFrameHandler CreateFrameHandler(AmqpTcpEndpoint endpoint)
402402
return ConfigureFrameHandler(fh);
403403
}
404404

405+
public IFrameHandler CreateFrameHandlerForHostname(string hostname)
406+
{
407+
return CreateFrameHandler(this.Endpoint.CloneWithHostname(hostname));
408+
}
409+
405410
private IFrameHandler ConfigureFrameHandler(IFrameHandler fh)
406411
{
407412
// make sure socket timeouts are higher than heartbeat

projects/client/RabbitMQ.Client/src/client/impl/AutorecoveringConnection.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -574,7 +574,8 @@ public void Init(IList<string> hostnames)
574574

575575
protected void Init(string hostname)
576576
{
577-
m_delegate = new Connection(m_factory, false, m_factory.CreateFrameHandler());
577+
m_delegate = new Connection(m_factory, false,
578+
m_factory.CreateFrameHandlerForHostname(hostname));
578579

579580
AutorecoveringConnection self = this;
580581
EventHandler<ShutdownEventArgs> recoveryListener = (_, args) =>

0 commit comments

Comments
 (0)