0

I am using spring integration,and I am using default correlation strategy, that is i am not explicitly writing code for correlation strategy,everything works fine till the splitter, after the splitter there is a service activator which does some processing and then puts the message into a channel from which the aggregator has to pick it,but the aggregator doesnt pick it, so i put an interceptor to find out what was going on and found out that before the message is put into the aggregator channel, aggregation related headers like correlation id etc are present,but once its put into the channel the headers are lost.Now i am not sure why the aggregator or the channel before that is losing the headers.Any help would be much appreciated.

UPDATE:- i using an spliier then activator then another splitter then an activator then an aggregator and then another aggregator... The code below is for inner splitter and aggregator combination

  • 1
    edit your post, and use code style – t-n-y Jul 17 '17 at 08:55
  • Edited, please let me know if it is ok – venkatesh ranganath Jul 17 '17 at 09:14
  • Also please note my aggregator method takes Message as a parameter – venkatesh ranganath Jul 17 '17 at 12:44
  • Don't put code/config in comments; it's unreadable; edit the question instead. You need to show the code from your service activator. `...but once its put into the channel the headers are lost...` smells like you are dealing with messages yourself and not propagating the headers. It's better to let the framework deal with messages (and headers) and just use POJOs for your business logic. – Gary Russell Jul 17 '17 at 12:47
  • Also see my edits to your question for correct formatting. – Gary Russell Jul 17 '17 at 12:49
  • Thanks for the reply and your edits Gary.Much appreciated.My first question here so excuse me. I have added code for the splitter aggregator and service activator – venkatesh ranganath Jul 17 '17 at 13:24
  • You don't show your `aggregator` configuration and it isn't clear to us what your `CustomChannelInterceptor` does. See Gary's comment: > smells like you are dealing with messages yourself and not propagating the headers That means that you should be sure that you propagate all the headers from the request to reply everywhere. Otherwise a default `correlationKey`, populated by the `splitter`, is lost. – Artem Bilan Jul 17 '17 at 13:46
  • I have added the aggregator configuration now to the original question.CustomChannelInterceptor does nothing except intercept and print the message in the channel from which the aggregator is supposed to read. Also after reading Gary's comments i changed my code to not to mess with messages directly, you can see the code doing that is commented out, but i still face the same issue. – venkatesh ranganath Jul 17 '17 at 13:56

1 Answers1

0

Thanks for your help. I was able to finally solve this. The problem was i was passing along org.json.JSONOBject from and to the spring integration components. Now the JSONObject is not serialized, and i guess splitter and aggregator components only work with serialized objects. The simplest way was to conver the JSONObjects to string by calling toString() method on them.It would have been so much easier if the stack trace told me that i was using a non-serialized object instead of telling me "Null correlation not allowed. Maybe the CorrelationStrategy is failing?"

I have removed my code that i had put here to be safe.