Spring JMS Message Listener Container


Spring JMS Message Listener Container



I'm new to JMS and I am working on setting up ActiveMQ with Tomcat 6 and Spring. I have most of the basic things configured however I'm a little bit confused with the Message Listener Containers that Spring provides. Reading the documentation it sounds like the Message Listener Container is used to "handle" subscribing (I'm working with Topics), unsubscribing and delivering the message to the listener. I not sure if I'm thinking about this correctly. If this is the case I don't see any documentation on how I would have multiple classes subscribe to the same topic using the Message Listener Container. I see that you can set the messageListener property but that would only allow one class to be able to subscribe to a topic. It doesn't seem right to create another instance of the same Message Listener Container just to have another subscriber (Message Driven POJO) listen to the same topic.

Can anyone shed some light on this for me? I think I may be a little confused.

Thanks in advance!




how do I configure autowire in spring

1:



Spring DI, Domain Model & best practices
If you're familiar with Message-Driven EJBs, then a Spring MessageListenerContainer is effectively replacement for an MDB.


Import Spring config file based on property in .properties file
It gets its name because it's wired up with the JMS topic/queue, as well as a single JMS MessageListener, and it pulls messages off that topic/queue and feeds them to your MessageListener..
using quartz in a web app with spring
You're quite right that only one MessageListener can be registered with each container at a time, but consider that while the MessageListenerContainer code can be quite complex, it's actually a very lightweight runtime component.


scope of a controller and a validator
Don't be afraid to create several instances of it..
How to load themes from a database in Spring MVC based on user-agent , etc
Also, make sure you pick the appropriate MessageListener implementation for your situation.


Accessing scoped proxy beans within Threads of
The Simple and Default implementation are really quite different, but neither is "better"..
JSPs not displaying objects from model in Spring


2:


Guys are correct that multiple Containers would help you, but it's look like wrong approach.

Since JMS goal is to integrate different application/services rather than internal application processes (several classes you talking about).

I would suggest push message to different classes yourself after receiving them by Message Listener.

Otherwise you take a look to frameworks like Apache Camel or Spring Integration..


3:


The container is a wrapper of sorts to "adapt" any POJO to receiving messages from a Queue or Topic.

If you desire multiple listeners, you will end up with multiple containers..



94 out of 100 based on 74 user ratings 574 reviews