The question I am about to ask has been asked here before. An answer has been given by David Ingham reciting this Microsoft Document. A confirmation has been provided by Sentinel that the solution works.
Yet, I have the same problem. I follow the Microsoft document to the letter, however, still have the same issue.
At the risk of being redundant, the issue is that when using Qpid-JMS Client libraries(versions 0.22 or 0.26) to connect to the Service Bus (1.1) on Windows Server (NOT Azure) and following all directions from Microsoft which include
Context lookups, connection creation, session creation all work fine. But when it is time to create a MessageProducer or MessageConsumer I get errors.
For MessageProducer creation (does not matter if it is for a queue or a topic) I always get
Caused by: org.apache.qpid.amqp_1_0.client.Sender$SenderCreationException:
Peer did not create remote endpoint for link, target: testns/testq1
at org.apache.qpid.amqp_1_0.client.Sender.<init>(Sender.java:171)
For MessageConsumer creation I get
javax.jms.JMSException
at org.apache.qpid.amqp_1_0.jms.impl.MessageConsumerImpl.createClientReceiver(MessageConsumerImpl.java:164)
at org.apache.qpid.amqp_1_0.jms.impl.MessageConsumerImpl.<init>(MessageConsumerImpl.java:120)
Here are several things I have tried.
What did I miss from the original Microsoft documentation (which is confirmed by the user named Sentinel that it works)?
Any help would be greatly appreciated. Thank you, -Dogan Atay
UPDATE and ANSWER. Well it turned out that we were doing everything right.(almost)
When creating the service bus using the service management console I had added my username as a Windows user. On the client side I was using the same username and its password in the connection string. I would pass the authetication step without problem. The connection would be created. If I changed my password to a wrong password, I would get authetication error. I was convinced at that time that security is not the issue here.
But with the right username and password I was still not able to create a consumer or producer.
Then, I enabled the Qpid JMS package logging. The log showed
amqp:unauthorized-access Attempted to perform an unauthorized operation
Why would that be? It turned out (by trial and error) when you are using your username in the connection string you are supposed to use fully qualified as it appears in the service management console. i.e. username@domainname.com. And you will need to URL encode that as well)
Below in the answers, Aurvoir, says if they create the queues programtically things work out. I have not tried this solution. But I can see how it would work if you create your own queue using your own credentials and put messages in the same queue using the same credentials on the connection.