Reputation: 7335
I have some non-critical clean up operation that I want to perform inside my web-app. I'm hoping to hand it off to an asynchronous process, but I don't have any JMS provider available to me ( and I'm not likely to get one approved in the timescales ).
I like the idea of the Spring MDP, but all the examples that I have seen explicitly tie it in to a JMS implementation of some sort. Is it possible to tie it to a Queue implementation based on the java.util.Queue interface? I'm thinking that I could just push messages on to a queue and use a Spring MDP to process them.
Am I barking up the wrong tree?
Upvotes: 0
Views: 1180
Reputation: 136122
You can embed an ApacheMQ BrokerService in your application
<bean id="broker" class="org.apache.activemq.broker.BrokerService" init-method="start">
<property name="transportConnectorURIs">
<list>
<value>tcp://localhost:61616</value>
</list>
</property>
</bean>
Now you can use it just as a regular ApacheMQ.
Upvotes: 0
Reputation: 3599
Maybe you could use asynchronous tasks to do the clean up. You could have a CleanUp
component that offers @Asnyc annotated methods. The TaskExecutors implicitly use a Queue for pending tasks (like plain Java's ExecutorService). There would also be the option to collect submitted clean up requests in a Queue and let them be processed by a scheduled task.
Another alternative may be Guava's EventBus. Setting one up wth spring should be straight forward and there is an AsynchronousEventBus available.
Upvotes: 2