I have a requirement when I need to write asynchronously to a queue in activemq. I am using Spring Jms to do it. This is the wiring in my spring context file
<bean id="amqProducerConnectionFactory" class="org.apache.activemq.ActiveMQConnectionFactory">
<property name="brokerURL" value="${activemq.broker}"/>
</bean>
<bean id="pooledProducerConnectionFactory" class="org.apache.activemq.pool.PooledConnectionFactory" destroy-method="stop" lazy-init="true">
<property name="connectionFactory" ref="amqProducerConnectionFactory" />
</bean>
<bean id="jmsTemplate" class="org.springframework.jms.core.JmsTemplate">
<property name="connectionFactory" ref="pooledProducerConnectionFactory" />
</bean>
And in my code...i do..
void sendMessage(JmsTemplate jmsTemplate, String message, String requestQueue) {
def messageCreator = { session ->
session.createTextMessage(message)
} as MessageCreator
jmsTemplate.send(requestQueue, messageCreator)
}
But the above seems to be working synchronously, not asynchrously. Is there anything that I need to add here that makes the process asynchronous(I mean, App 'A' writes to a queue. It should write to the queue and forget, not wait until App 'B' picks it up from the queue and processes it.)