I'm using a Connection string to connect with the Azure Event Hub.
In order to avoid the usage of TCP ports 104XX Microsoft has documented to turn the EnableAmqpLinkRedirect property to false. The default is True
The EventHubsConnectionStringBuilder does not have this property at all. And the ServiceBusConnectionStringBuilder creates a connection string that the EventHubClient does not accept.
So... how do I then disable this flag in order to avoid the usage of port 104xx ?
The following sample code has both connection string builders
``` c#
// var s = new Microsoft.ServiceBus.ServiceBusConnectionStringBuilder(azureEventHubOption.EventHubConnectionString)
var s = new EventHubsConnectionStringBuilder(azureEventHubOption.EventHubConnectionString)
{
EntityPath = azureEventHubOption.EventHubName,
/* EnableAmqpLinkRedirect is not accepted as a valid connection string
Maybe future versions will allow this
EnableAmqpLinkRedirect = azureEventHubOption.EnableAmqpLinkRedirect
*/
};
var eventHubClient = EventHubClient.CreateFromConnectionString(s.ToString());
``` c#
System.ArgumentException
HResult=0x80070057
Message=Illegal connection string parameter name 'EnableAmqpLinkRedirect'
Parameter name: connectionString
Source=Microsoft.Azure.EventHubs
StackTrace:
at Microsoft.Azure.EventHubs.EventHubsConnectionStringBuilder.ParseConnectionString(String connectionString)
at Microsoft.Azure.EventHubs.EventHubsConnectionStringBuilder..ctor(String connectionString)
at Microsoft.Azure.EventHubs.EventHubClient.CreateFromConnectionString(String connectionString)
at Nodinite.LogAgent.PickupService.Helpers.AzureEventHubHelper.GetEventHubClient() in C:\Projects\Nodinite\LogAgent.PickupService\Nodinite.LogAgent.PickupService\Helpers\EventHubHelper.cs:line 59
Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @jfggdl.
Hi @zodapoplinsky. We're sorry that you're experiencing difficulties and appreciate you reaching out to let us know.
If I understand the context of your question, it looks as if you're using the Microsoft.Azure.EventHubs library, and are looking to disable the EnableAmqpLinkRedirect feature that the Microsoft.ServiceBus.Messaging provided. My understanding is that feature was not included in Microsoft.Azure.EventHubs and, thus, there is no need to disable it. I'll defer to @serkantkaraca and @JamesBirdsall as the authoritative voices, should they have additional thoughts to offer or my understanding is not correct.
May I ask if this is something that you were looking to do preemptively or if you're looking to make this adjustment in response to a problem that you're running into?
Hi, please review the following documentation
I would like to limit the number of ports used for the EventHub and from what I can read, this feature should exists for the eventhub.
In my code example I'm testing both the ServiceBusConnectionStringBuilder and the EventHubsConnectionStringBuilder
None of them provides a connection string that the EventHubClient class accepts where the EnableAmqpLinkRedirect property is set (true or false)
Thank you for the additional context.
To clarify, the feature exists within the Event Hubs service, but a client must opt-in. It works by establishing a connection to the Event Hubs gateway using the standard AMQP ports (5671, 5672) and requesting that the service provide discovery for partition nodes to directly connect to, which is where the 104xx port range would be used.
The client must take action should the service provide that information, it isn't something that the service can perform directly. While this was behavior that the Microsoft.ServiceBus.Messaging client contained, this functionality does not exist in the Microsoft.Azure.EventHubs client for .NET.
As a result, there is nothing to disable within the Microsoft.Azure.EventHubs client, and you should only be seeing Event Hubs traffic over the standard AMQP ports.
According to this part of the documentation. The Client can control this behaviour by the usage of the EnableAmqpLinkRedirect property.
If this is not a bug, then at least it's a feature request to get the same functionality for the client in the Microsoft.Azure.EventHubs as for Microsoft.ServiceBus.Messaging

Forgive me, but I'm a bit confused as to your request. As I understand it, you were asking to opt-out of the redirect behavior and ensure that traffic uses only the standard AMQP ports. As mentioned, that is the behavior for the Microsoft.Azure.EventHubs library. To be clear: Microsoft.Azure.EventHubs will NOT make use of the 104XX port range.
I'm not sure if I misunderstood your intent, you are now expressing a different ask, or you believe that there is an issue with the library that you're observing. Would you please be so kind as to help me understand?
For wider context, the Microsoft.Azure.EventHubs library has been superseded by the Azure.Messaging.EventHubs library and is currently in maintenance mode. Microsoft.Azure.EventHubs will continue to be supported for the foreseeable future, but is no longer delivering new features. The Azure.Messaging.EventHubs library is under active development and does not yet offer direct connections to partition nodes (aka AmqpLinkRedirect), meaning that it also will NOT not use the 104XX range of ports.
We are planning supporting this feature in the near term, but intend for it to be an opt-in behavior, not the default. The design and details for support can be found [here], and the work can be tracked [here].
Ok, thanks for the clarifications