jms - How to configure Apache QPID to work with RabbitMQ? -
hello happy understand how can write simple java standalone program sends , receives messages rabbitmq using apache qpid jms client.
how can create initial context qpid , lookup destination rabbitmq?
i searched lot in internet not able find solution helps me better understanding on creating connection between two.
i believe should possible due fact both rabbitmq , qpid using amqp protocol.
i tried create context following jndi.properties:
java.naming.factory.initial = org.apache.qpid.jms.jndi.jmsinitialcontextfactory connectionfactory.myfactorylookup = amqp://:5672 queue.myqueuelookup = queue
and following code:
context context = new initialcontext(); connectionfactory factory = (connectionfactory) context.lookup("myfactorylookup"); destination queue = (destination) context.lookup("myqueuelookup"); connection connection = factory.createconnection(user, password); connection.setexceptionlistener(new myexceptionlistener()); connection.start();
but getting exception:
javax.jms.jmsexception: existing connection forcibly closed remote host @ org.apache.qpid.jms.exceptions.jmsexceptionsupport.create(jmsexceptionsupport.java:66) @ org.apache.qpid.jms.exceptions.jmsexceptionsupport.create(jmsexceptionsupport.java:88) @ org.apache.qpid.jms.jmsconnection.createresource(jmsconnection.java:548) @ org.apache.qpid.jms.jmsconnection.createresource(jmsconnection.java:532) @ org.apache.qpid.jms.jmsconnection.connect(jmsconnection.java:447) @ org.apache.qpid.jms.jmsconnection.start(jmsconnection.java:301) @ com.test.sender.main(sender.java:36) caused by: java.io.ioexception: existing connection forcibly closed remote host @ sun.nio.ch.socketdispatcher.read0(native method) @ sun.nio.ch.socketdispatcher.read(socketdispatcher.java:43)
do have idea reason , and advise if there wrong code ???
thanks in advance!
Comments
Post a Comment