You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by ha...@apache.org on 2025/04/14 08:32:51 UTC
(activemq-nms-amqp) branch main updated (5e4e137 -> f16601c)
This is an automated email from the ASF dual-hosted git repository.
havret pushed a change to branch main
in repository https://gitbox.apache.org/repos/asf/activemq-nms-amqp.git
from 5e4e137 AMQNET-735 Add AsyncMessageListener to Consumer API
new 02349e8 AMQNET-817 - Ability to configure hostname
new de438fb Use `amqp.vost` to configure hostname and added some tests.
new 898d510 For sure `AMQP` related stuff should go to the related classes - so just moved code.
new f16601c Use String.IsNullOrWhiteSpace to also handle cases where VHost is a whitespace-only string.
The 4 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
docs/configuration.md | 4 ++++
src/NMS.AMQP/Provider/Amqp/AmqpConnection.cs | 2 +-
src/NMS.AMQP/Provider/Amqp/AmqpProvider.cs | 8 ++++++++
.../Apache-NMS-AMQP-Test/Provider/Amqp/AmqpProviderFactoryTest.cs | 8 ++++++--
4 files changed, 19 insertions(+), 3 deletions(-)
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@activemq.apache.org
For additional commands, e-mail: commits-help@activemq.apache.org
For further information, visit: https://activemq.apache.org/contact
(activemq-nms-amqp) 04/04: Use String.IsNullOrWhiteSpace to also handle cases where VHost is a whitespace-only string.
Posted by ha...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
havret pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/activemq-nms-amqp.git
commit f16601cf55aec72b0b5159ec45010a2ab8031edd
Author: Andreas Ländle <96...@users.noreply.github.com>
AuthorDate: Tue Apr 8 07:51:30 2025 +0000
Use String.IsNullOrWhiteSpace to also handle cases where VHost is a whitespace-only string.
---
src/NMS.AMQP/Provider/Amqp/AmqpConnection.cs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/NMS.AMQP/Provider/Amqp/AmqpConnection.cs b/src/NMS.AMQP/Provider/Amqp/AmqpConnection.cs
index 6ca101c..85c2edb 100644
--- a/src/NMS.AMQP/Provider/Amqp/AmqpConnection.cs
+++ b/src/NMS.AMQP/Provider/Amqp/AmqpConnection.cs
@@ -114,7 +114,7 @@ namespace Apache.NMS.AMQP.Provider.Amqp
open.ContainerId = Info.ClientId;
open.ChannelMax = Info.ChannelMax;
open.MaxFrameSize = (uint) Info.MaxFrameSize;
- open.HostName = String.IsNullOrEmpty(this.Provider.VHost) ? remoteUri.Host : this.Provider.VHost;
+ open.HostName = String.IsNullOrWhiteSpace(this.Provider.VHost) ? remoteUri.Host : this.Provider.VHost;
open.IdleTimeOut = (uint) Info.IdleTimeOut;
open.DesiredCapabilities = new[]
{
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@activemq.apache.org
For additional commands, e-mail: commits-help@activemq.apache.org
For further information, visit: https://activemq.apache.org/contact
(activemq-nms-amqp) 02/04: Use `amqp.vost` to configure hostname and added some tests.
Posted by ha...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
havret pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/activemq-nms-amqp.git
commit de438fb58ac000842559deb3ca559b44833deaa7
Author: Andreas Ländle <96...@users.noreply.github.com>
AuthorDate: Mon Apr 7 10:12:26 2025 +0000
Use `amqp.vost` to configure hostname and added some tests.
---
docs/configuration.md | 5 ++++-
src/NMS.AMQP/Meta/NmsConnectionInfo.cs | 2 +-
src/NMS.AMQP/NmsConnectionFactory.cs | 9 ++++++---
src/NMS.AMQP/Provider/Amqp/AmqpConnection.cs | 2 +-
test/Apache-NMS-AMQP-Test/ConnectionFactoryTest.cs | 8 ++++++--
5 files changed, 18 insertions(+), 8 deletions(-)
diff --git a/docs/configuration.md b/docs/configuration.md
index 4500d3b..c4f8ab7 100644
--- a/docs/configuration.md
+++ b/docs/configuration.md
@@ -18,7 +18,6 @@ The options apply to the behavior of the NMS objects such as Connection, Session
- **nms.username** User name value used to authenticate the connection.
- **nms.password** The password value used to authenticate the connection.
- **nms.clientId** The ClientId value that is applied to the connection.
-- **nms.hostname** Optional, the name of the host to which we are connecting. By default this value is derived from the URI. Can be used to determine the correct service if connecting to an AMQP proxy.
- **nms.localMessageExpiry** Controls whether MessageConsumer instances will locally filter expired Messages or deliver them. By default this value is set to true and expired messages will be filtered.
- **nms.sendTimeout** Timeout value that controls how long the client waits on completion of a synchronous message send before returning an error. By default the client will wait indefinitely for a send to complete.
- **nms.requestTimeout** Timeout value that controls how long the client waits on completion of various synchronous interactions, such as opening a producer or consumer, before returning an error. Does not affect synchronous message sends. By default the client will wait indefinitely for a request to complete.
@@ -31,6 +30,10 @@ The options apply to the behavior of the NMS objects such as Connection, Session
- **nms.prefetchPolicy.queueBrowserPrefetch** Link credit value that will be assigned to new queue browser. The default value is 1000..
- **nms.prefetchPolicy.durableTopicPrefetch** Link credit value that will be assigned to new consumers of durable topic. The default value is 1000..
+### AMQP Configuration options
+
+- **amqp.vhost** Optional, the name of the host to which we are connecting. By default this value is derived from the URI. Can be used to determine the correct service if connecting to an AMQP proxy.
+
### TCP Transport Configuration options
When connected to a remote using plain TCP these options configure the behaviour of the underlying socket. These options are appended to the connection URI along with the other configuration options, for example:
diff --git a/src/NMS.AMQP/Meta/NmsConnectionInfo.cs b/src/NMS.AMQP/Meta/NmsConnectionInfo.cs
index dc56d3c..d498058 100644
--- a/src/NMS.AMQP/Meta/NmsConnectionInfo.cs
+++ b/src/NMS.AMQP/Meta/NmsConnectionInfo.cs
@@ -60,7 +60,7 @@ namespace Apache.NMS.AMQP.Meta
public NmsConnectionId Id { get; }
public bool IsExplicitClientId { get; private set; }
public string ClientId { get; private set; }
- public string HostName { get; set; }
+ public string VHost { get; set; }
public string UserName { get; set; }
public string Password { get; set; }
public Uri ConfiguredUri { get; set; }
diff --git a/src/NMS.AMQP/NmsConnectionFactory.cs b/src/NMS.AMQP/NmsConnectionFactory.cs
index bd4935f..c35044a 100644
--- a/src/NMS.AMQP/NmsConnectionFactory.cs
+++ b/src/NMS.AMQP/NmsConnectionFactory.cs
@@ -169,11 +169,11 @@ namespace Apache.NMS.AMQP
public string ClientId { get; set; }
/// <summary>
- /// Sets and gets the name of the host to which we are connecting.
+ /// Sets and gets the name of the virtual host to which we are connecting.
/// By default this value is derived from the URI.
/// Can be used to determine the correct service if connecting to an AMQP proxy.
/// </summary>
- public string HostName { get; set; }
+ public string VHost { get; set; }
/// <summary>
/// Sets and gets the prefetch values for consumers
@@ -347,7 +347,7 @@ namespace Apache.NMS.AMQP
{
UserName = userName,
Password = password,
- HostName = HostName,
+ VHost = VHost,
ConfiguredUri = BrokerUri,
RequestTimeout = RequestTimeout,
SendTimeout = SendTimeout,
@@ -375,6 +375,9 @@ namespace Apache.NMS.AMQP
{
StringDictionary nmsOptions = PropertyUtil.FilterProperties(options, "nms.");
PropertyUtil.SetProperties(this, nmsOptions);
+
+ StringDictionary amqpOptions = PropertyUtil.FilterProperties(options, "amqp.");
+ PropertyUtil.SetProperties(this, amqpOptions);
// TODO: Check if there are any unused options, if so throw argument exception
}
diff --git a/src/NMS.AMQP/Provider/Amqp/AmqpConnection.cs b/src/NMS.AMQP/Provider/Amqp/AmqpConnection.cs
index 107c31d..bbb333d 100644
--- a/src/NMS.AMQP/Provider/Amqp/AmqpConnection.cs
+++ b/src/NMS.AMQP/Provider/Amqp/AmqpConnection.cs
@@ -114,7 +114,7 @@ namespace Apache.NMS.AMQP.Provider.Amqp
open.ContainerId = Info.ClientId;
open.ChannelMax = Info.ChannelMax;
open.MaxFrameSize = (uint) Info.MaxFrameSize;
- open.HostName = String.IsNullOrEmpty(Info.HostName) ? remoteUri.Host : Info.HostName;
+ open.HostName = String.IsNullOrEmpty(Info.VHost) ? remoteUri.Host : Info.VHost;
open.IdleTimeOut = (uint) Info.IdleTimeOut;
open.DesiredCapabilities = new[]
{
diff --git a/test/Apache-NMS-AMQP-Test/ConnectionFactoryTest.cs b/test/Apache-NMS-AMQP-Test/ConnectionFactoryTest.cs
index 6c62465..0b2b361 100644
--- a/test/Apache-NMS-AMQP-Test/ConnectionFactoryTest.cs
+++ b/test/Apache-NMS-AMQP-Test/ConnectionFactoryTest.cs
@@ -93,7 +93,8 @@ namespace NMS.AMQP.Test
"&nms.requestTimeout=1000" +
"&nms.sendTimeout=1000" +
"&nms.localMessageExpiry=false" +
- "&nms.maxNewConnectionRatePerSec=4";
+ "&nms.maxNewConnectionRatePerSec=4" +
+ "&amqp.vhost=test-vhost";
NmsConnectionFactory factory = new NmsConnectionFactory(configuredUri);
@@ -105,6 +106,7 @@ namespace NMS.AMQP.Test
Assert.AreEqual(1000, factory.RequestTimeout);
Assert.AreEqual(1000, factory.SendTimeout);
Assert.AreEqual(4, factory.MaxNewConnectionRatePerSec);
+ Assert.AreEqual("test-vhost", factory.VHost);
Assert.IsFalse(factory.LocalMessageExpiry);
}
@@ -122,7 +124,8 @@ namespace NMS.AMQP.Test
"&nms.sendTimeout=1000" +
"&nms.closeTimeout=2000" +
"&nms.localMessageExpiry=false" +
- "&nms.prefetchPolicy.all=55";
+ "&nms.prefetchPolicy.all=55" +
+ "&amqp.vhost=test-vhost";
NmsConnectionFactory factory = new NmsConnectionFactory(new Uri(configuredUri));
@@ -138,6 +141,7 @@ namespace NMS.AMQP.Test
Assert.AreEqual(55, factory.PrefetchPolicy.TopicPrefetch);
Assert.AreEqual(55, factory.PrefetchPolicy.DurableTopicPrefetch);
Assert.AreEqual(55, factory.PrefetchPolicy.QueueBrowserPrefetch);
+ Assert.AreEqual("test-vhost", factory.VHost);
Assert.IsFalse(factory.LocalMessageExpiry);
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@activemq.apache.org
For additional commands, e-mail: commits-help@activemq.apache.org
For further information, visit: https://activemq.apache.org/contact
(activemq-nms-amqp) 03/04: For sure `AMQP` related stuff should go to the related classes - so just moved code.
Posted by ha...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
havret pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/activemq-nms-amqp.git
commit 898d51035890559f1d1c94755f944defaf98ab2f
Author: Andreas Ländle <96...@users.noreply.github.com>
AuthorDate: Tue Apr 8 07:46:18 2025 +0000
For sure `AMQP` related stuff should go to the related classes - so just moved code.
---
docs/configuration.md | 2 +-
src/NMS.AMQP/Meta/NmsConnectionInfo.cs | 1 -
src/NMS.AMQP/NmsConnectionFactory.cs | 11 -----------
src/NMS.AMQP/Provider/Amqp/AmqpConnection.cs | 2 +-
src/NMS.AMQP/Provider/Amqp/AmqpProvider.cs | 8 ++++++++
test/Apache-NMS-AMQP-Test/ConnectionFactoryTest.cs | 8 ++------
.../Provider/Amqp/AmqpProviderFactoryTest.cs | 8 ++++++--
7 files changed, 18 insertions(+), 22 deletions(-)
diff --git a/docs/configuration.md b/docs/configuration.md
index c4f8ab7..126b101 100644
--- a/docs/configuration.md
+++ b/docs/configuration.md
@@ -32,7 +32,7 @@ The options apply to the behavior of the NMS objects such as Connection, Session
### AMQP Configuration options
-- **amqp.vhost** Optional, the name of the host to which we are connecting. By default this value is derived from the URI. Can be used to determine the correct service if connecting to an AMQP proxy.
+- **amqp.vhost** Optional, the name of the virtual host to which we are connecting. By default this value is derived from the URI. Can be used to determine the correct service if connecting to an AMQP proxy.
### TCP Transport Configuration options
When connected to a remote using plain TCP these options configure the behaviour of the underlying socket. These options are appended to the connection URI along with the other configuration options, for example:
diff --git a/src/NMS.AMQP/Meta/NmsConnectionInfo.cs b/src/NMS.AMQP/Meta/NmsConnectionInfo.cs
index d498058..f9120c6 100644
--- a/src/NMS.AMQP/Meta/NmsConnectionInfo.cs
+++ b/src/NMS.AMQP/Meta/NmsConnectionInfo.cs
@@ -60,7 +60,6 @@ namespace Apache.NMS.AMQP.Meta
public NmsConnectionId Id { get; }
public bool IsExplicitClientId { get; private set; }
public string ClientId { get; private set; }
- public string VHost { get; set; }
public string UserName { get; set; }
public string Password { get; set; }
public Uri ConfiguredUri { get; set; }
diff --git a/src/NMS.AMQP/NmsConnectionFactory.cs b/src/NMS.AMQP/NmsConnectionFactory.cs
index c35044a..7684f30 100644
--- a/src/NMS.AMQP/NmsConnectionFactory.cs
+++ b/src/NMS.AMQP/NmsConnectionFactory.cs
@@ -168,13 +168,6 @@ namespace Apache.NMS.AMQP
/// </summary>
public string ClientId { get; set; }
- /// <summary>
- /// Sets and gets the name of the virtual host to which we are connecting.
- /// By default this value is derived from the URI.
- /// Can be used to determine the correct service if connecting to an AMQP proxy.
- /// </summary>
- public string VHost { get; set; }
-
/// <summary>
/// Sets and gets the prefetch values for consumers
/// </summary>
@@ -347,7 +340,6 @@ namespace Apache.NMS.AMQP
{
UserName = userName,
Password = password,
- VHost = VHost,
ConfiguredUri = BrokerUri,
RequestTimeout = RequestTimeout,
SendTimeout = SendTimeout,
@@ -375,9 +367,6 @@ namespace Apache.NMS.AMQP
{
StringDictionary nmsOptions = PropertyUtil.FilterProperties(options, "nms.");
PropertyUtil.SetProperties(this, nmsOptions);
-
- StringDictionary amqpOptions = PropertyUtil.FilterProperties(options, "amqp.");
- PropertyUtil.SetProperties(this, amqpOptions);
// TODO: Check if there are any unused options, if so throw argument exception
}
diff --git a/src/NMS.AMQP/Provider/Amqp/AmqpConnection.cs b/src/NMS.AMQP/Provider/Amqp/AmqpConnection.cs
index bbb333d..6ca101c 100644
--- a/src/NMS.AMQP/Provider/Amqp/AmqpConnection.cs
+++ b/src/NMS.AMQP/Provider/Amqp/AmqpConnection.cs
@@ -114,7 +114,7 @@ namespace Apache.NMS.AMQP.Provider.Amqp
open.ContainerId = Info.ClientId;
open.ChannelMax = Info.ChannelMax;
open.MaxFrameSize = (uint) Info.MaxFrameSize;
- open.HostName = String.IsNullOrEmpty(Info.VHost) ? remoteUri.Host : Info.VHost;
+ open.HostName = String.IsNullOrEmpty(this.Provider.VHost) ? remoteUri.Host : this.Provider.VHost;
open.IdleTimeOut = (uint) Info.IdleTimeOut;
open.DesiredCapabilities = new[]
{
diff --git a/src/NMS.AMQP/Provider/Amqp/AmqpProvider.cs b/src/NMS.AMQP/Provider/Amqp/AmqpProvider.cs
index 0720820..bff0b27 100644
--- a/src/NMS.AMQP/Provider/Amqp/AmqpProvider.cs
+++ b/src/NMS.AMQP/Provider/Amqp/AmqpProvider.cs
@@ -33,6 +33,14 @@ namespace Apache.NMS.AMQP.Provider.Amqp
private readonly ITransportContext transport;
private NmsConnectionInfo connectionInfo;
private AmqpConnection connection;
+
+ /// <summary>
+ /// Sets and gets the name of the virtual host to which we are connecting.
+ /// By default this value is derived from the URI.
+ /// Can be used to determine the correct service if connecting to an AMQP proxy.
+ /// </summary>
+ public string VHost { get; set; }
+
public AmqpProvider(Uri remoteUri, ITransportContext transport)
{
RemoteUri = remoteUri;
diff --git a/test/Apache-NMS-AMQP-Test/ConnectionFactoryTest.cs b/test/Apache-NMS-AMQP-Test/ConnectionFactoryTest.cs
index 0b2b361..6c62465 100644
--- a/test/Apache-NMS-AMQP-Test/ConnectionFactoryTest.cs
+++ b/test/Apache-NMS-AMQP-Test/ConnectionFactoryTest.cs
@@ -93,8 +93,7 @@ namespace NMS.AMQP.Test
"&nms.requestTimeout=1000" +
"&nms.sendTimeout=1000" +
"&nms.localMessageExpiry=false" +
- "&nms.maxNewConnectionRatePerSec=4" +
- "&amqp.vhost=test-vhost";
+ "&nms.maxNewConnectionRatePerSec=4";
NmsConnectionFactory factory = new NmsConnectionFactory(configuredUri);
@@ -106,7 +105,6 @@ namespace NMS.AMQP.Test
Assert.AreEqual(1000, factory.RequestTimeout);
Assert.AreEqual(1000, factory.SendTimeout);
Assert.AreEqual(4, factory.MaxNewConnectionRatePerSec);
- Assert.AreEqual("test-vhost", factory.VHost);
Assert.IsFalse(factory.LocalMessageExpiry);
}
@@ -124,8 +122,7 @@ namespace NMS.AMQP.Test
"&nms.sendTimeout=1000" +
"&nms.closeTimeout=2000" +
"&nms.localMessageExpiry=false" +
- "&nms.prefetchPolicy.all=55" +
- "&amqp.vhost=test-vhost";
+ "&nms.prefetchPolicy.all=55";
NmsConnectionFactory factory = new NmsConnectionFactory(new Uri(configuredUri));
@@ -141,7 +138,6 @@ namespace NMS.AMQP.Test
Assert.AreEqual(55, factory.PrefetchPolicy.TopicPrefetch);
Assert.AreEqual(55, factory.PrefetchPolicy.DurableTopicPrefetch);
Assert.AreEqual(55, factory.PrefetchPolicy.QueueBrowserPrefetch);
- Assert.AreEqual("test-vhost", factory.VHost);
Assert.IsFalse(factory.LocalMessageExpiry);
}
diff --git a/test/Apache-NMS-AMQP-Test/Provider/Amqp/AmqpProviderFactoryTest.cs b/test/Apache-NMS-AMQP-Test/Provider/Amqp/AmqpProviderFactoryTest.cs
index ea0de01..9b09240 100644
--- a/test/Apache-NMS-AMQP-Test/Provider/Amqp/AmqpProviderFactoryTest.cs
+++ b/test/Apache-NMS-AMQP-Test/Provider/Amqp/AmqpProviderFactoryTest.cs
@@ -26,7 +26,9 @@ namespace NMS.AMQP.Test.Provider.Amqp
[TestFixture]
public class AmqpProviderFactoryTest
{
- private uint customMaxHandle = 2048;
+ private const uint customMaxHandle = 2048;
+
+ private const string customVHost = "test-vhost";
[Test]
public void TestCreateAmqpProvider()
@@ -50,13 +52,15 @@ namespace NMS.AMQP.Test.Provider.Amqp
{
Uri uri = new Uri("amqp://localhost:5672" +
"?amqp.maxHandle=" + customMaxHandle +
- "&amqp.traceFrames=true");
+ "&amqp.traceFrames=true" +
+ "&amqp.vhost=" + customVHost);
AmqpProvider provider = ProviderFactory.Create(uri) as AmqpProvider;
Assert.IsNotNull(provider);
Assert.AreEqual(customMaxHandle, provider.MaxHandle);
Assert.IsTrue(provider.TraceFrames);
+ Assert.AreEqual(customVHost, provider.VHost);
}
[TearDown]
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@activemq.apache.org
For additional commands, e-mail: commits-help@activemq.apache.org
For further information, visit: https://activemq.apache.org/contact
(activemq-nms-amqp) 01/04: AMQNET-817 - Ability to configure hostname
Posted by ha...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
havret pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/activemq-nms-amqp.git
commit 02349e8ec4b30d4d61c68cbfe10711804ca4ab87
Author: Andreas Ländle <96...@users.noreply.github.com>
AuthorDate: Thu Apr 3 06:59:30 2025 +0000
AMQNET-817 - Ability to configure hostname
---
docs/configuration.md | 1 +
src/NMS.AMQP/Meta/NmsConnectionInfo.cs | 1 +
src/NMS.AMQP/NmsConnectionFactory.cs | 8 ++++++++
src/NMS.AMQP/Provider/Amqp/AmqpConnection.cs | 2 +-
4 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/docs/configuration.md b/docs/configuration.md
index c414126..4500d3b 100644
--- a/docs/configuration.md
+++ b/docs/configuration.md
@@ -18,6 +18,7 @@ The options apply to the behavior of the NMS objects such as Connection, Session
- **nms.username** User name value used to authenticate the connection.
- **nms.password** The password value used to authenticate the connection.
- **nms.clientId** The ClientId value that is applied to the connection.
+- **nms.hostname** Optional, the name of the host to which we are connecting. By default this value is derived from the URI. Can be used to determine the correct service if connecting to an AMQP proxy.
- **nms.localMessageExpiry** Controls whether MessageConsumer instances will locally filter expired Messages or deliver them. By default this value is set to true and expired messages will be filtered.
- **nms.sendTimeout** Timeout value that controls how long the client waits on completion of a synchronous message send before returning an error. By default the client will wait indefinitely for a send to complete.
- **nms.requestTimeout** Timeout value that controls how long the client waits on completion of various synchronous interactions, such as opening a producer or consumer, before returning an error. Does not affect synchronous message sends. By default the client will wait indefinitely for a request to complete.
diff --git a/src/NMS.AMQP/Meta/NmsConnectionInfo.cs b/src/NMS.AMQP/Meta/NmsConnectionInfo.cs
index f9120c6..dc56d3c 100644
--- a/src/NMS.AMQP/Meta/NmsConnectionInfo.cs
+++ b/src/NMS.AMQP/Meta/NmsConnectionInfo.cs
@@ -60,6 +60,7 @@ namespace Apache.NMS.AMQP.Meta
public NmsConnectionId Id { get; }
public bool IsExplicitClientId { get; private set; }
public string ClientId { get; private set; }
+ public string HostName { get; set; }
public string UserName { get; set; }
public string Password { get; set; }
public Uri ConfiguredUri { get; set; }
diff --git a/src/NMS.AMQP/NmsConnectionFactory.cs b/src/NMS.AMQP/NmsConnectionFactory.cs
index 7684f30..bd4935f 100644
--- a/src/NMS.AMQP/NmsConnectionFactory.cs
+++ b/src/NMS.AMQP/NmsConnectionFactory.cs
@@ -168,6 +168,13 @@ namespace Apache.NMS.AMQP
/// </summary>
public string ClientId { get; set; }
+ /// <summary>
+ /// Sets and gets the name of the host to which we are connecting.
+ /// By default this value is derived from the URI.
+ /// Can be used to determine the correct service if connecting to an AMQP proxy.
+ /// </summary>
+ public string HostName { get; set; }
+
/// <summary>
/// Sets and gets the prefetch values for consumers
/// </summary>
@@ -340,6 +347,7 @@ namespace Apache.NMS.AMQP
{
UserName = userName,
Password = password,
+ HostName = HostName,
ConfiguredUri = BrokerUri,
RequestTimeout = RequestTimeout,
SendTimeout = SendTimeout,
diff --git a/src/NMS.AMQP/Provider/Amqp/AmqpConnection.cs b/src/NMS.AMQP/Provider/Amqp/AmqpConnection.cs
index 8644c8e..107c31d 100644
--- a/src/NMS.AMQP/Provider/Amqp/AmqpConnection.cs
+++ b/src/NMS.AMQP/Provider/Amqp/AmqpConnection.cs
@@ -114,7 +114,7 @@ namespace Apache.NMS.AMQP.Provider.Amqp
open.ContainerId = Info.ClientId;
open.ChannelMax = Info.ChannelMax;
open.MaxFrameSize = (uint) Info.MaxFrameSize;
- open.HostName = remoteUri.Host;
+ open.HostName = String.IsNullOrEmpty(Info.HostName) ? remoteUri.Host : Info.HostName;
open.IdleTimeOut = (uint) Info.IdleTimeOut;
open.DesiredCapabilities = new[]
{
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@activemq.apache.org
For additional commands, e-mail: commits-help@activemq.apache.org
For further information, visit: https://activemq.apache.org/contact