Results 1 to 5 of 5

Thread: Message Router and correlationID

  1. #1
    Join Date
    Mar 2008
    Posts
    8

    Default 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. #2
    Join Date
    May 2007
    Location
    Netherlands
    Posts
    614

    Default

    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?

  3. #3
    Join Date
    Mar 2008
    Posts
    8

    Default 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.

  4. #4
    Join Date
    Mar 2008
    Posts
    8

    Default 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

  5. #5
    Join Date
    May 2007
    Location
    Netherlands
    Posts
    614

    Default

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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •