Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does JMS have a concept of a queue peek?

Tags:

java

queue

jms

peek

From a general Computer Science perspective - when we think of a Queue in a logical sense - we think of being able to 'peek' the first item in the queue.

When I look at the JMS API - it has a MessageListener - which has an OnMessage() method. This feels a little bit like "don't call us- we'll call you."

Does JMS have a concept of a queue peek?

like image 845
hawkeye Avatar asked Mar 09 '13 23:03

hawkeye


People also ask

What is queue in JMS?

Queue is JMS managed object used for holding messages waiting for subscribers to consume. When all subscribers consumed the message , message will be removed from queue. Topic is that all subscribers to a topic receive the same message when the message is published.

Is JMS point-to-point?

In point-to-point messaging, JMS producers and consumers exchange messages by using a destination which is called a queue. Point-to-point messaging is available for JMS applications only. JMS producers send messages to the queue, and JMS consumers receive messages from that queue.

Which of the following options can be created by using JMS sessions?

You use sessions to create the following: Message producers. Message consumers. Messages.


1 Answers

1) If you want to receive messages synchroneously use MessageConsumer.receive

2) Basically, 'peek' in queues means to return, but do not remove, the head of the queue. For this you can use QueueBrowser to look at messages on a queue without removing them.

like image 177
Evgeniy Dorofeev Avatar answered Sep 23 '22 03:09

Evgeniy Dorofeev