I have a small requirement. I am going to read the data from some input files and load them into the jms queue, and let some consumers read the packets from the queue and processes them.
Is there any way to signal the consumers that the Input Data is finished, and they can safely shutthem down after processing the data they hold currently?

I am using Apache Active MQ.

Thanks,

没有正确的解决方案

其他提示

JMS implementers have a message grouping feature that allows messages to be grouped together and process messages in an order in that group. All the messages in a group are received by the same consumer. The messages in a group are ordered using a sequence number. JMS defines JMSXGroupdID and JMSXGroupSeq properties for this purpose.

You can use the JMSXGroupID property to group all the messages read from files and use a unique JMSXGroupSeq property for each message in the group. Consumers must look for messages with group id and start picking up messages until the JMSXGroupSeq property value is -1. That signals the end of the group.

Sample and more details are here

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top