0
votes

I have an application that consumes messages from a JMS topic. As part of the normal application flow it needs to periodically cease consumption of messages. While the application is in this state new messages are stored in the topic (note that my application is still running). Later the application resumes message consumption, also receiving those messages that were placed on the topic while the application wasn't listening.

This functionality is currently achieved by creating and disposing of connections from a ConnectionFactory. However, I now wish to migrate the application to Spring JMS. Although Spring rather neatly abstracts away much of the JMS boiler-plate - I no longer appear to have fine grained control over the underlying connection and hence cannot halt message consumption on demand.

Before I try to wade through Spring JMS internals, can anyone suggest a neat way of doing this?

1
I haven't used Spring JMS, but you probably shouldn't be stopping message consumption by killing connections. The way we usually did this was to stop and start MDBs (Message Driven Beans).aglassman

1 Answers

2
votes

Can you just avoid returning from onMessage()? How long do you want to stop consumption? Is your problem similar to https://stackoverflow.com/a/628337/20734