java - How to assign a service to message-driven-adapter in Spring Integration? -


upon received message in receivechannel invoke service work. flow of messages be:

jms message -> receivechannel -- message-driven-adapter --> jmsinchannel -> queuechannel (here service should invoked) 

i achieve either 1) service invoked on queuechannel 2) or message-adapater.

in latter case not know how assign service message-driven-adapter in spring integration? service not invoked.

this configuration contains both approaches none of them working:

<int-jms:channel id="receivechannel"      queue-name="forward"     connection-factory="connectionfactory"      auto-startup="true"> </int-jms:channel>  <si:channel id="jmsinchannel"/> <int-jms:message-driven-channel-adapter id="messagedrivenadapter"     channel="receivechannel" destination-name="jmsinchannel"/> <si:bridge input-channel="jmsinchannel" output-channel="queuechannel"/>   <si:channel id="queuechannel">     <si:queue/> </si:channel>    <si:service-activator id ="activator" ref="messageservice"      method="processmessage"      input-channel="queuechannel"> </si:service-activator> 

and sender sends messages forward queue:

 <si:channel id="sendchannel"/> <int-jms:outbound-channel-adapter  connection-factory="connectionfactory"  destination-name="forward"  channel="sendchannel"/>  <si:gateway id="forwardgateway"      service-interface="com.ucware.ucpo.forward.jms.messagegateway"      default-request-channel="sendchannel"/> 

messages coming forward queue in activemq backend.

update: added listener , messages received. log file trace turned on:

18.07.2013 15:52:16.036 [directchannel] [abstractmessagechannel.java] [debug] [main] postsend (sent=true) on channel 'inputchannel', message: [payload={forward_all=3000, line=601}     [headers={timestamp=1374155536031, id=c2895e24-2260-4af8-9b23-a226ae95c31f,    source=presence_engine,userid=alice@tkb.local, type=forward}]  18.07.2013 15:52:16.036 [activemqmessageconsumer] [activemqmessageconsumer.java] [trace] [org.springframework.jms.listener.defaultmessagelistenercontainer#1-1] id:lmiroslaw-pc-59127-1374155535776-1:1:1:1 **received message: messagedispatch** {commandid = 0, responserequired = false, consumerid = id:lmiroslaw-pc-59127-1374155535776-1:1:1:1, destination = queue://forward, message = activemqobjectmessage {commandid = 11, responserequired = true, messageid = id:lmiroslaw-pc-59127-1374155535776-1:1:3:1:3, originaldestination = null, originaltransactionid = null, producerid = id:lmiroslaw-pc-59127-1374155535776-1:1:3:1, destination = queue://forward, transactionid = null, expiration = 0, timestamp = 1374155536032, arrival = 0, brokerintime = 1374155536013, brokerouttime = 1374155536013, correlationid = null, replyto = null, persistent = true, type = null, priority = 4, groupid = null, groupsequence = 0, targetconsumerid = null, compressed = false, userid = null, content = org.apache.activemq.util.bytesequence@1bc4ec8, marshalledproperties = org.apache.activemq.util.bytesequence@1d840d9, datastructure = null, redeliverycounter = 0, size = 0, properties = {timestamp=1374155536031, userid=alice@tkb.local, source=presence_engine, type=forward}, readonlyproperties = true, readonlybody = true, droppable = false}, redeliverycounter = 0}  18.07.2013 15:52:16.037 [defaultmessagelistenercontainer] [abstractpollingmessagelistenercontainer.java] [debug] [org.springframework.jms.listener.defaultmessagelistenercontainer#1-1] **received message of** type [class org.apache.activemq.command.activemqobjectmessage] consumer [cached jms messageconsumer: activemqmessageconsumer { value=id:lmiroslaw-pc-59127-1374155535776-1:1:1:1, started=true }] of session [cached jms session: activemqsession {id=id:lmiroslaw-pc-59127-1374155535776-1:1:1,started=true}] 

<int-jms:channel/> not used start flow - it's providing message persistence mid-flow.

you don't need first 2 elements; configure message-driven adapter destination-name="forward" , receive messages queue.

also, remove queuechannel; it's not needed; service invoked on listener thread.

message-driven-adapter->jmsinchannel->service-activator


Comments

Popular posts from this blog

php - Calling a template part from a post -

Firefox SVG shape not printing when it has stroke -

How to mention the localhost in android -