Uploaded image for project: 'Spring Integration'
  1. Spring Integration
  2. INT-3285

JsonType of request overrides response type when using amqp inbound gateway in combination with json converters (jackson2)

    Details

      Description

      Okay, I'm still note sure if I get this right.

      The scenario: If have two components communication via Spring Integration, via RabbitMQ (AMQP), via AMAP Inbound and Outbound Gateways, via a Jackson2 Message Converter.

      (No conversion service is involved, it's a standard setup without spring wev)

      Component 1: Sends a message via an AMQP Outbound Gateway with a configured Jackson2 message converter. Requesting type is *A, returning type is **B*. Works fine, internally toJSON() like we would expected.

      Component 2: Receives messages via an AMQP Inbound Gateway with a configured Jackson2 message converter. Requesting type is *A* and returning type *BB*. Internal fromJson() works fine, and the actual processing works without problems.

      Well.. however, until the reply message is processed. The reply message will be created containing the (correct JSON) of the payload (an object of type *B) but with a type hint header (_TypeId_) of the requesting type **A*.

      So far I can tell you: Actually, the reply message was correctly transformed via toJSON by the configured Jackson2 converter (I could verify the jackson2 converter was a) used and b) processed the payload correctly including adding a message header). However, in AmqpInboundGateway.java:100 headerMapper.fromHeadersToReply() will be invoked. Called with a correct value of headers._TypeId_ representing the type *B, it will be in this call be overridden in AbstractHeaderMapper.java:141-149 with the corresponding value of the request type **AA* (made by the message converter I think).


      Coming from the old approach with two more or less simple directives from-json/to-json, this is now very confusing. Is this a bug or a miss configuration of myself?

        Attachments

          Activity

            People

            • Assignee:
              abilan Artem Bilan
              Reporter:
              knalli Jan Philipp
            • Votes:
              1 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: