Announcement Announcement Module
Collapse
No announcement yet.
Message Router and correlationID Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Message Router and correlationID

    I'm trying to combine a router with an aggregator, where alle the messages go through the router first and some of theme are aggregated in the next step. It seems that the correlationId used by the aggregator is being reset by the router. Is this correct, or am I missing something?

    Thanks, Levente

  • #2
    I had similar problems pre M3. Back then it was confirmed that the correlation id got lost if you put endpoints in between the source of the correlationId and the aggregator.

    In my specific example, the fact that a barista takes a Drink as an argument instead of a Message was the reason for the loss. Your result could be a related. Do you have some sample code?

    Comment


    • #3
      Code

      As you can see I'm using a GenericMessage<T> type as argument.
      Hereby my code/configuration:

      My router method:

      @MessageEndpoint(input="splittedinput" )
      public class SearchDataRouter {
      @Router
      public String route(@HeaderProperty("service") String service){
      if (service.startsWith("book"))
      return "searchBookChannel";
      else
      return "searchAddressChannel";
      }
      }


      My spring config for a custom handler endpoint that uses the searchBookChannel as input:

      <handler-endpoint input-channel="searchBookChannel"
      handler="contentEnricher"
      method="generateBookWSCall"
      output-channel="searchBookWSChannel"/>

      respectievely the code of the handler endpoint:

      public GenericMessage<String> generateBookWSCall(GenericMessage<InputData> gmID) {
      GenericMessage<String> gm = new GenericMessage<String>(
      String.format(AMESSAGE, gmID.getPayload().getTitel()));
      gm.getHeader().setCorrelationId(gmID.getHeader().g etCorrelationId());
      gm.getHeader().setReturnAddress(bookChannel);
      return gm;
      }

      But the gmID.getHeader().getCorrelationId() is different from the one before the router.

      Comment


      • #4
        Issue solved

        Iwein,

        I realized that my ws-target caused the "resetting" of the correlationId. Actualy I had a ws-target between the router and the aggregator and I forget to set the messageID before the ws-target was called.

        BR, Levente

        Comment


        • #5
          Glad you got that sorted, any open questions remaining on this?

          Comment

          Working...
          X