wild_nothing
wild_nothing

Reputation: 3051

Spring's @JmsListener only receiving one message from Solace queue

I have just configured a listener using Spring's @JmsListener, yet when I use a single method parameter, I only receive one message from my queue.

@JmsListener(...)
public void onMessage(Message message)

It doesn't behave like a traditional listener in this case - only one messaged is ever received! Not an influx of single messages one at a time as I would expect.

However, if I change the method definition to become

@JmsListener(...)
public void onMessage(List<Message> messages)

I receive all of them as a list. This has never happened before, and the only unknown in this instance is how the Solace queue is configured. Are there batch settings on the queue I may not be aware of?

Upvotes: 1

Views: 1759

Answers (1)

wild_nothing
wild_nothing

Reputation: 3051

Turns out that the messages were actually being sent as a list!

As in:

jmsTemplate.convertAndSend(listOfMessages);

It seems Spring only allows the first in this list to be accessed if you define your listener as:

public void onMessage(Message message){}

Upvotes: 0

Related Questions