Search code examples
javaspring-bootazureazure-servicebus-topicsjms-topic

Failed to connect Azure servicebus topic using JMS - Java


I followed steps as mentioned in Azure ServiceBus JMS Sample with below properties

spring.jms.servicebus.connection-string=Endpoint=sb://test-dt.servicebus.windows.net/;SharedAccessKeyName=RootManageSharedAccessKey;SharedAccessKey=key
spring.jms.servicebus.topic-client-id=12345
spring.jms.servicebus.idle-timeout=18000
spring.jms.servicebus.pricing-tier=Standard

however I get below error

ERROR 43904 --- [ntContainer#0-1] org.apache.qpid.jms.JmsConnection        : Failed to connect to remote at: amqps://test-dt.servicebus.windows.net:-1
ERROR 43904 --- [ntContainer#0-1] o.s.j.l.DefaultMessageListenerContainer  : Could not refresh JMS Connection for destination 'test-topic' - retrying using FixedBackOff{interval=5000, currentAttempts=6, maxAttempts=unlimited}. Cause: handshake timed out after 10000ms

On the other hand, I followed steps as mentioned in ServiceBus without JMS and added transportType as AmqpTransportType.AMQP_WEB_SOCKETS then I am able to connect.

We want to implement using spring boot starter and listener method, instead of calling from (public static void main) method.

Please guide on what am I missing when following first link


Solution

  • ERROR 43904 --- [ntContainer#0-1] org.apache.qpid.jms.JmsConnection : Failed to connect to remote at: amqps://test-dt.servicebus.windows.net:-1

    To resolve above error, try as suggested by Anand Sowmithiran:

    Check if port 5671 is blocked:

    telnet <yournamespacename>.servicebus.windows.net 5671
    

    Note: Clients that use AMQP connections over TCP require ports 5671 and 5672 to be opened in the firewall. Along with these ports, it might be necessary to open additional ports if the EnableLinkRedirect feature is enabled.

    You can refer to Troubleshooting guide for Azure Service Bus, AMQP outbound port requirements and Port 5671 Blocked :(. What are other options?