Announcement Announcement Module
No announcement yet.
SimpleMessageConverter and default conversion of JMSMessage and SpringIntMessage Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • SimpleMessageConverter and default conversion of JMSMessage and SpringIntMessage

    Here is piece of XML config:
    <splitter id="fileToStringsSplitter" input-channel="inboundFileChannel" output-channel="inboundStringChannel" ref="inboundFileToStringsSplitter" />
    	<jms:outbound-channel-adapter id="outboundOscarRowsJmsAdapter" destination="oscarRowsQueue" channel="inboundStringChannel" />
    	<jms:message-driven-channel-adapter id="inboundOscarRowChannelAdapter" destination="oscarRowsQueue" channel="inboundStringProcessingChannel" />
    	<transformer id="stringToOscarSaleDataTransformer" input-channel="inboundStringProcessingChannel" output-channel="inboundOscarSaleDataChannel" ref="inboundStringToOscarSaleDataTransformer" />
    Application reads file, splits it to strings, posts Strings to ActiveMQ, then reads them, converts to my custom objects with transformer.
    My guess was, that in the channel "inboundStringProcessingChannel" i'll get usual spring message (SimpleMessageConverter supposed to convert it to text/object).
    But actually, headers still contain JMS related information.

    Because of that, transformer does NOT post message to "inboundOscarSaleDataChannel" and flow simply stucks.

    Could you please explain where I'm missunderstanding the conversion flow ?
    Thanks !

  • #2
    What do you mean by "flow simply stucks" ?

    Turn on DEBUG logging and follow the messages through the flow.

    Yes, the headers will contain JMS related information (by default), but that has no bearing on the message conversion.


    • #3
      What do you mean by "flow simply stucks" ?
      Oh sorry, right after transformer, i have the following outbound jms adapter:
      		Transformed oscar data processing flow
      	<jms:outbound-channel-adapter id="outboundOscarDataJmsAdapter" destination="oscarDataQueue" channel="inboundOscarSaleDataChannel" />
      So the transformer SHOULD be posting in that channel: "inboundOscarSaleDataChannel", but it does NOT (I've looked in ActiveMQ administration queue panel, 0 messages)
      And here what is debug log says:
      2013-04-18 16:31:54,875 INFO nsformer.transformStringToOscarSaleData(InboundStr
      - Transforming line "000002002000003379216934913730812401466188871 310 0000059000000000000000001302110757806333700001515E UR01000077704000" to OscarSaleData object
      2013-04-18 16:31:54,875 DEBUG org.springframework.integration.handler.AbstractMe ssageHandler.handleMessage(AbstractMessageHandler. java:67)
      - org.springframework.integration.handler.LoggingHan dler#0 received message: [[email protected]][Headers={timestamp=1366291914875, id=4e446941-d98e-4f49-bc8c-7be64cd8782b, FILE_NAME=1Ships, jms_timestamp=1366291914843, jms_redelivered=false, FILE_PROCESSING_TIMESTAMP=_t1366291914750, sequenceSize=1, FILE_LINE=0000020020000033792169349137308124014661 88871310 0000059000000000000000001302110757806333700001515E UR01000077704000, sequenceNumber=1, jms_messageId=ID:xdjpc-db571977e-4505-1366291914390-1:1:10:1:1}]
      2013-04-18 16:31:54,875 DEBUG org.springframework.integration.handler.LoggingHan dler.handleMessageInternal( )
      - [email protected]
      Here is stucks, no futher processing is performed.


      • #4
        As I said, turn on DEBUG logging; most likely the transformer is returning null.


        • #5
          Originally posted by Gary Russell View Post
          As I said, turn on DEBUG logging; most likely the transformer is returning null.
          Thanks Gary.
          It is really strange, because i had log4j logger for spring set to:
 = error

          But somewhy it has omitted error message about conversion failed of my object.

          And in the end that was my mistake - i forgot to implement Serializible for my object.
          Problem solved now.