I am trying to connect Azure service bus from Java client with AMQP protocol
I follow the instruction in the following link:
http://azure.microsoft.com/en-us/documentation/articles/service-bus-java-how-to-use-jms-api-amqp/
1) created service bus in Azure portal with the name space 'availo' and a queue named 'queue1'
2) from service bus connection information I've got the following:
SharedAccessKeyName=RootManageSharedAccessKey
SharedAccessKey={key}
3) created "servicebus.properties" file for the JNDI lookup
connectionfactory.SBCF = amqps://RootManageSharedAccessKey:encoded(key)@availo.servicebus.windows.net
queue.QUEUE = queue1
4) below is my simple java main application with all the required jars (qpid) in the class path.
public static void main(String[] args) {
try {
Hashtable<String, String> env = new Hashtable<String, String>();
env.put(Context.INITIAL_CONTEXT_FACTORY,
"org.apache.qpid.amqp_1_0.jms.jndi.PropertiesFileInitialContextFactory");
env.put(Context.PROVIDER_URL,
"C:\\Users\\Assaf-PC\\Documents\\GitHub\\availo\\rest-api\\src\\main\\resources\\servicebus.properties");
Context context = new InitialContext(env);
// Lookup ConnectionFactory and Queue
ConnectionFactory cf = (ConnectionFactory) context.lookup("SBCF");
Destination queue = (Destination) context.lookup("QUEUE");
// Create Connection
Connection connection = cf.createConnection();
// Create sender-side Session and MessageProducer
Session sendSession = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
MessageProducer producer = sendSession.createProducer(queue);
} catch (Exception e) {
e.getLocalizedMessage();
}
}
When I run the program I am getting the exception below in the code line:
MessageProducer producer = sendSession.createProducer(queue);
Exception:
Exception in thread "main" javax.jms.JMSException: Peer did not create remote endpoint for link, target: queue1
at org.apache.qpid.amqp_1_0.jms.impl.MessageProducerImpl.<init>(MessageProducerImpl.java:98)
at org.apache.qpid.amqp_1_0.jms.impl.SessionImpl.createProducer(SessionImpl.java:390)
at org.apache.qpid.amqp_1_0.jms.impl.SessionImpl.createProducer(SessionImpl.java:59)
at availo.rest.services.ServiceBus.main(ServiceBus.java:43)
Caused by: org.apache.qpid.amqp_1_0.client.Sender$SenderCreationException: Peer did not create remote endpoint for link, target: queue1
at org.apache.qpid.amqp_1_0.client.Sender.<init>(Sender.java:191)
at org.apache.qpid.amqp_1_0.client.Sender.<init>(Sender.java:119)
at org.apache.qpid.amqp_1_0.client.Sender.<init>(Sender.java:112)
at org.apache.qpid.amqp_1_0.client.Sender.<init>(Sender.java:98)
at org.apache.qpid.amqp_1_0.client.Sender.<init>(Sender.java:84)
at org.apache.qpid.amqp_1_0.client.Sender.<init>(Sender.java:78)
at org.apache.qpid.amqp_1_0.client.Session$1.<init>(Session.java:90)
at org.apache.qpid.amqp_1_0.client.Session.createSender(Session.java:89)
at org.apache.qpid.amqp_1_0.jms.impl.MessageProducerImpl.<init>(MessageProducerImpl.java:86)
... 3 more
Wasted many hours to understand what am I doing wrong without success can anyone help?
your answer is highly appreciated.