Azure Service Bus Connection issue

Elther Barrientos 1 Reputation point
2020-11-26T16:35:06.06+00:00

Would like to ask your help regarding my issue on sending message to azure service bus topic using TopicClient.

We have dotnet test running in pipeline. One of the test there is sending a message to azure service bus.
The problem is when calling topicClient sendasyc it is getting an error like this
"http://Microsoft.Azure.ServiceBus.ServiceBusCommunicationException: A connection attempt failed because the connected party did not properly respond after a period of time".

We also have ManagementClient that is getting the messagecount in queue.
Both libraries are using the same service bus connection string.
ManagementClient is working. But TopicClient SendAsync is having an exception.

What would be the possible cause for this?

2020-11-26T14:57:29.3263990Z Microsoft.Azure.ServiceBus.ServiceBusCommunicationException: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. ErrorCode: TimedOut ---> System.Net.Sockets.SocketException: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.

2020-11-26T14:57:29.3265454Z Stack Trace:
2020-11-26T14:57:29.3265682Z at Microsoft.Azure.ServiceBus.ServiceBusConnection.CreateConnectionAsync(TimeSpan timeout)
2020-11-26T14:57:29.3265981Z at Microsoft.Azure.Amqp.FaultTolerantAmqpObject1.OnCreateAsync(TimeSpan timeout) 2020-11-26T14:57:29.3266271Z at Microsoft.Azure.Amqp.Singleton1.GetOrCreateAsync(TimeSpan timeout)
2020-11-26T14:57:29.3266527Z at Microsoft.Azure.Amqp.Singleton1.GetOrCreateAsync(TimeSpan timeout) 2020-11-26T14:57:29.3267009Z at Microsoft.Azure.ServiceBus.Amqp.AmqpLinkCreator.CreateAndOpenAmqpLinkAsync() 2020-11-26T14:57:29.3267308Z at Microsoft.Azure.ServiceBus.Core.MessageSender.CreateLinkAsync(TimeSpan timeout) 2020-11-26T14:57:29.3267592Z at Microsoft.Azure.Amqp.FaultTolerantAmqpObject1.OnCreateAsync(TimeSpan timeout)
2020-11-26T14:57:29.3267860Z at Microsoft.Azure.Amqp.Singleton1.GetOrCreateAsync(TimeSpan timeout) 2020-11-26T14:57:29.3268293Z at Microsoft.Azure.Amqp.Singleton1.GetOrCreateAsync(TimeSpan timeout)
2020-11-26T14:57:29.3268605Z at Microsoft.Azure.ServiceBus.Core.MessageSender.OnSendAsync(IList1 messageList) 2020-11-26T14:57:29.3268853Z --- End of inner exception stack trace --- 2020-11-26T14:57:29.3269103Z at Microsoft.Azure.ServiceBus.Core.MessageSender.OnSendAsync(IList1 messageList)
2020-11-26T14:57:29.3269429Z at Microsoft.Azure.ServiceBus.RetryPolicy.RunOperation(Func1 operation, TimeSpan operationTimeout) 2020-11-26T14:57:29.3270268Z at Microsoft.Azure.ServiceBus.RetryPolicy.RunOperation(Func1 operation, TimeSpan operationTimeout)
2020-11-26T14:57:29.3270968Z at Microsoft.Azure.ServiceBus.Core.MessageSender.SendAsync(IList`1 messageList)
2020-11-26T14:57:29.3271993Z at Engine.QA.Tests.ServiceBusTests.TestTopicClientDirectly() in F:\agent_work\r24\a\QAAutomation\Tests\ServiceBus\ServiceBusTests.cs:line 127
2020-11-26T14:57:29.3272818Z at Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices.ThreadOperations.ExecuteWithAbortSafety(Action action)

Blockquote

From my twitter post

Azure Service Bus
Azure Service Bus
An Azure service that provides cloud messaging as a service and hybrid integration.
700 questions
{count} votes

1 answer

Sort by: Most helpful
  1. MayankBargali-MSFT 70,936 Reputation points Moderator
    2020-12-10T08:28:10.81+00:00

    Looking into the source code we can see that AMQP connection was used for communicating with the service bus. Suggested to verify whether there is any network or configuration that is blocking at the client end.
    Reference : https://learn.microsoft.com/en-us/azure/service-bus-messaging/service-bus-faq#what-ports-do-i-need-to-open-on-the-firewall

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.