gstackoverflow
gstackoverflow

Reputation: 37034

Is it possible to consume by several consumers from the same queue in JMS?

I am learning JMS and I know that there 2 types of communication:
1. queues
2 topics

I understand topics but I could not understand is it possible to read from same queue by 2 different consumers.

I ask about it because I know it is possible in amqp.

lets we have queue like this

tail -> |5|4|3|2|1|-> head

and following action order:

  1. consumer_1 read and got 1
  2. consumer_2 read and got 2
  3. consumer_1 read and got 3
  4. consumer_2 read and got 4
  5. consumer_2 read and got 5

Is it possible or it is contradicts the point-to-point approach?

Upvotes: 0

Views: 111

Answers (1)

titou10
titou10

Reputation: 2977

It depends of the semantic you want to apply on your Q: strict FIFO or parallel processing..

Implementation of the semantic (Q + Consumers + parallel architecture etc.) is product/architecture dependent (ie cluster or not, multi threads etc.).

The semantic of a Q containing messages for updating an inventory is probably FIFO and must be processed in strict order, a queue with messages of mails to be send to customers is probably parallel and can be processed in any order with possibly many concurrent consumers

Upvotes: 1

Related Questions