Hi!
How do I setup an effective way to consume messages from a topic in multiple threads.
With ejb3 you can do it like this:
Code:@MessageDriven(activationConfig={ @ActivationConfigProperty(propertyName="destinationType", propertyValue="javax.jms.Topic"), @ActivationConfigProperty(propertyName="destination", propertyValue="topic/testDistributedTopic"), @ActivationConfigProperty(propertyName="maxSession", propertyValue="5"), @ActivationConfigProperty(propertyName="SubscriptionDurability", propertyValue="Durable"), @ActivationConfigProperty(propertyName="acknowledgeMode", propertyValue="AUTO_ACKNOWLEDGE") })
With spring jms I seem to get the same setup with this configuration:
Is there a downside to do it like this?Code:<jms:listener-container connection-factory="connectionFactory" destination-type="durableTopic" acknowledge="auto" client-id="client1"> <jms:listener destination="testDistributedTopic" ref="messageListener"/> <jms:listener destination="testDistributedTopic" ref="messageListener"/> <jms:listener destination="testDistributedTopic" ref="messageListener"/> <jms:listener destination="testDistributedTopic" ref="messageListener"/> <jms:listener destination="testDistributedTopic" ref="messageListener"/> </jms:listener-container>
Even if the listener-container reads the messages in one thread I still want to process them in multiple threads. With the configuration above it seems to be working like I want but I have to repeat my self in the configuration.


Reply With Quote