문제

I am new to Qpid and JMS and I'm trying to make a very simple Java application using Qpid Java broker.

I am implementing this example that simply sends and receives a predefined message.
http://qpid.apache.org/releases/qpid-0.24/qpid-jms/examples/Hello.java.html

I divided the application in 2 parts, consumer and producer.

If I start the consumer part of the example first, and then I start the producer one, everything is ok and the message is consumed.

But if I start the producer first and then the consumer, the message is lost.

In other words, how can I store the messages sent by a producer in order to retrieve them later with the consumer application?

Thanks in advance!

도움이 되었습니까?

해결책

You are emitting/listening to/from an EXCHANGE, to get the behaviour you're describing you should create a QUEUE and use it as your message destination for the emitter.

If you are using the Apache QPID broker Java implementation, you can create a new QUEUE following this steps at the broker web administration site:

enter image description here enter image description here enter image description here

At you code side you should change the EXCHANGE name you were using to the new QUEUE's name.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top