I have a situation where I need to read a(on going) messages from a topic and put them on another Queue . I have doubts do I need jms Queue or I can be satisfied with an in memory java Queue . I will do the reading from the Queue by other thread(s) in same jvm and will do client acknowledge of the message to the topic after reading the message from the (in memory) queue and process it as necessary (send it to remote IBM MQ) .So if my client crash the messages that were exist in the in memory queue will be lost but will still exist on topic and will be redeliver to me . Am I right ?
答案 0 :(得分:1)
Some of this depends on how you have set up the queue/topic and the connection string you are using to read from IBM's MQ but if you are using the defaults you WILL lose messages if you're reading it to an in-memory queue.
I'd use ActiveMQ, either in the same JVM as a library so you have it taking care of receipt, delivery and persistence.
Also if you are listening to a topic you're not going to be sent missed messages after a crash even if you reconnect afterwards unless you've
The ActiveMQ library is not large and worth using if ensure delivery of every message is important, especially in an asynchronous environment.
答案 1 :(得分:0)
主要区别在于内存在应用程序出现故障时丢失数据;如果主题/队列不持久,JMS队列在服务器发生故障时丢失数据。前者比后者更有可能,所以我也说与JMS一起去。