Announcement Announcement Module
No announcement yet.
jms:outbound-channel-adaptor and message-converter Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • jms:outbound-channel-adaptor and message-converter

    I am attempting to use spring -integration with hornetq as a live-backup pair. In a failover scenario, messages are redelivered. Having ran some tests, i found a message was sent twice, reading: duplicate-detection, I wrote my own message converter that extended spring integrations HeaderMappingMessageConverter and uses some reflection to be able to set the appropriate message property (message.setStringProperty(org.hornetq.api.core.Me ssage.HDR_DUPLICATE_DETECTION_ID.toString(), getUniqueIdFromField(object))

    I then tried to wire this into my spring integration config:

        <beans:bean id="hqMsgConverter" class="" >
             <beans:property name="uniqueIdFieldName" value="id" />
             <beans:property name="className" value="" />
      <jms:outbound-channel-adapter destination="DeliveredQueue"
    When I attached the remote debugger my class was never called, only the HeaderMappingMessageConverter.

    I looked at the source of JmsOutboundChannelAdapterParser (I am using 2.0.0.M2 and i also checked in the svn repositiory, I can see no reference to any useage of the message-converter attribute (other than it being allowable by the schema). It does not appear to be an constant on the JmsAdapterParserUtils like the others.

    I was really hoping to be able to use the message-converter without having to wire it into a jms-template.

    Please let me know the correct intention of message-converter on the outbound-channel-adapter and if this is a bug or not.


  • #2
    OK I can see it being set in the code

    I will download and wire in the latest version of Spring Integration, and run the remote debugger over it to check that all is being initalised correctly.

    Comments still appreciated until i get to check (I am on Australian time, so it will be another 12 hours before i am back at my desk to check it properly)


    • #3
      I have been unable to get the messageConverter to kick in unless using a message template.

      I wanted to do this:

      <jms:outbound-channel-adapter destination=SendQueue"
      But instead, could only get it to work, when using a custom jmsTemplate, as follows:

       <beans:bean id="SendTemplate" class="org.springframework.jms.core.JmsTemplate">
              <beans:property name="connectionFactory"  ref="connectionFactoryHornetQ"/>
              <beans:property name="defaultDestination" ref="SendQueue" />
              <beans:property name="messageConverter"   ref="hqMsgConverter" />
        <jms:outbound-channel-adapter channel="dispatchDataItemInputChannel"
                                      jms-template="SendTemplate" />
      Whilst this provides me with a workaround, it is not fitting into spring integration in the way i hoped.

      Please advise if this is a bug and can be fixed?


      • #4
        Could you please open an issue in JIRA? If you can attach a simple, isolated, reproducible test case that would be ideal.

        Also, what version are you using currently (still M2)?


        • #5
          I upgraded to M4 and the latest spring, 3.0.3. So this issue is with the current version.

          I will produce the test case tomorrow and attach it to the jira.

          Thanks for listening.



          • #6

            I just created this issue:

            I was able to reproduce it... should be committing a fix soon.

            Thanks for discovering it!


            • #7
              I resolved the issue. Please try it out when you get a chance. We are hoping to release 2.0 M5 tomorrow.


              • #8
                Excellent news, I did not spot your message until after i built my test case. I attached it to the jira anyway. I wrote it as a standalone project since it has taken me over 6 hours to attempt to get the source from svn, not sure why, but its really slow.

                The test case tests it through spring config and uses mockrunner jms configuration.

                Thanks for fixing the issue, will try it once M5 is release.


                • #9
                  Thanks. Have taken M5 and confirmed it works now with the message-converter.

                  As a side note (and for others) I can see that using the jms-template causes it to break, with the following exception shown below:

                  Caused by: org.springframework.beans.NotWritablePropertyExcep tion: Invalid property 'jmsTemplate' of bean class [org.springframework.integration.jms.JmsSendingMess ageHandler]: Bean property 'jmsTemplate' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter?

                  at org.springframework.beans.BeanWrapperImpl.setPrope rtyValue(

                  The test case i attached to the jira covers the problem, but i will reopen the jira and recoment there too.

                  Thanks again for making the change, just need to fix the use of jms-template again :-)


                  • #10
                    Added comment to the jira but was unable to re-open it.