Announcement Announcement Module
Collapse
No announcement yet.
MessageTransformingHandler not calling registered transformer Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • MessageTransformingHandler not calling registered transformer

    Hi all,

    I have a transformer configured in my spring integration job, sometimes when I start the service it gets to a configured MessageTransformingHandler which then calls the attached transformer, the message is transformed, and then replies correctly with the newly transformed message. However, with no changes whatsoever, sometimes when I start the program it gets to the MessageTransformingHandler which does NOT seem to call the transformer and immediately replies with a message with a payload of 'true' and not what the payload has been transformed to e.g. in a good case (shortened slightly for privacy reasons with the object values):

    10:22:12.167 [task-scheduler-1] DEBUG o.s.i.t.MessageTransformingHandler - org.springframework.integration.transformer.Messag eTransformingHandler@196fe6d6 received message: [Payload=record@2dd06f21...]
    10:22:12.168 [task-scheduler-1] INFO u.a.c.i.d.t.IdentityTransformerSims - Running identity transformer for input type ...
    10:22:12.192 [task-scheduler-1] DEBUG o.s.i.t.MessageTransformingHandler - handler 'org.springframework.integration.transformer.Messa geTransformingHandler@196fe6d6' sending reply Message: [Payload=record@2dd06f21....

    In the bad case:


    11:12:30.360 [task-scheduler-1] DEBUG o.s.i.t.MessageTransformingHandler - org.springframework.integration.transformer.Messag eTransformingHandler@6f0babe8 received message: [Payload=record@668dd96c...]Headers={timestamp=1347444750360, id=96ff404a-5257-48ad-9853-1f3133db2f24, correlationId=ac2e98b0-ef40-41ef-912f-110f988e0fca, sequenceSize=1, sequenceDetails=[[9d5773f1-814b-418a-83f2-d3d8358d289a, 1, 1]], sequenceNumber=1}]
    11:12:30.360 [task-scheduler-1] DEBUG o.s.i.t.MessageTransformingHandler - handler 'org.springframework.integration.transformer.Messa geTransformingHandler@6f0babe8' sending reply Message: [Payload=true][Headers={timestamp=1347444750360, id=96ff404a-5257-48ad-9853-1f3133db2f24, correlationId=ac2e98b0-ef40-41ef-912f-110f988e0fca, sequenceSize=1, sequenceDetails=[[9d5773f1-814b-418a-83f2-d3d8358d289a, 1, 1]], sequenceNumber=1}]

    It seems to 'skip' the transformer which is configured, and go straight to a reply with the payload of 'true' ( which I assume is added somewhere by default in the AbstractReplyProducingMessageHandler).

    Does anybody know why this behaviour is non-deterministic. I am using integration-core (2.1.3.RELEASE) and Spring (3.1.2.RELEASE).

  • #2
    Ah right, I may have found an answer. The customs transformer I was using did not implement the Transformer interface and I had not specified the method="" element in the XML definition, so I guess it did not really know what method to use in that class. Still very odd that even without this sometimes it would call the method in the class and sometimes it would not, of interest the method was called 'transform' with the same signature as the one from the interface. I would have assumed if you are using a custom transformer class that did not implement the Transformer interface you would *have* to supply the method element otherwise it would fail on initialisation or something.

    Comment


    • #3
      What is the signature of the method? Is there another method that returns a boolean? Do you have different payload types?

      If you have no method attribute, the framework will detect which method to call, based on the message payload type.

      Comment


      • #4
        Thanks for the response. The method is:

        public Message<IdmIdentity> transform(Message<SimsRecord> inputMessage);

        There are no methods that return a boolean. And the MessageTransformingHandler does have a SimsRecord each time as its received message e.g. (more expanded from the above):

        09:59:06.392 [task-scheduler-1] DEBUG o.s.i.t.MessageTransformingHandler - org.springframework.integration.transformer.Messag eTransformingHandler@4af364d4 received message: [Payload=uk.ac.cardiff.idman.model.SimsRecord@3b48a 380 ...

        So I guess it should call the transform method as the received message is a SimsRecord. However, for some reason about 70% of the time when I run the program it does not, and 30% of the time it does call that method. Each time, the MessageTransformingHandler instance receives a SimsRecord object.

        Comment


        • #5
          Hmmm... it's difficult to see what's going on; if you can reproduce with a small shareable test case, please attach.

          BTW, we generally recommend that user components use POJOs rather than being tied to messaging APIs.

          Code:
          public IdmIdentity transform(SimsRecord inputMessage);
          Unless you need access to the headers as well.

          Comment

          Working...
          X