java - Spring Integration Messages sent but not received with activeMQ -
i create simple test when messages sent / received forward queue. upon received message service should invoked.
unfortunately, messages sent through message<?> message = messagebuilder.withpayload(params); forwardgateway.sendpremmessage(message); not received.
this config:
<!-- sender --> <si:gateway id="forwardgateway" service-interface="com.ucware.ucpo.forward.jms.messagegateway" default-request-channel="inputchannel"/> <si:channel id="inputchannel"/> <!-- subscriber channel --> <int-jms:outbound-channel-adapter channel="inputchannel" connection-factory="connectionfactory" destination-name="forward" /> <!-- receiver --> <int:channel id="jmsinchannel"/> <!-- subscriber jmsinchannel. used instead of inboud channel adapter --> <int-jms:message-driven-channel-adapter id="messagedrivenadapter" channel="jmsinchannel" destination-name="forward" connection-factory="connectionfactory" concurrent-consumers="1" auto-startup="true" acknowledge="auto"/> // service should invoked not <si:service-activator id ="activator" input-channel="jmsinchannel" ref="messageservice" method="process"/> the service defined :
@messageendpoint public class messageservice { public void process(message<?> message ) } , gateway :
public interface messagegateway { @gateway public void sendpremmessage(message<?> message); }
your configuration works fine me; suggest turn on trace level logging see message flow on both sides. (trace gives details of message listener container activity on receiving side).
if using in-memory activemq need careful timing - don't send message until container has started. alternatively sure use cachingconnectionfactory.
<bean id="connectionfactory" class="org.springframework.jms.connection.cachingconnectionfactory"> <property name="targetconnectionfactory"> <bean class="org.apache.activemq.activemqconnectionfactory"> <property name="brokerurl" value="vm://localhost"/> </bean> </property> </bean> that way, broker stay running after send, if container hasn't started yet.
Comments
Post a Comment