-
May 27th, 2008, 04:44 PM
#1
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
-
May 28th, 2008, 01:36 AM
#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?
-
May 28th, 2008, 07:18 AM
#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.
-
May 29th, 2008, 01:02 AM
#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
-
May 30th, 2008, 04:24 AM
#5
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
-
Forum Rules