Hi! I have ran into a situation which I feel is a quite common case but I can't figure out how to implement elegantly using SEI. Fortunately it's not very complicated so I'll try describe it here, and would be very grateful for help from people with more experience with the framework.
I have a Dossier domain entity that has an Application representing a loan application to a bank. The Application has several Applicants. I want to do the following: grab the Dossier from the DossierService, and run a BRE check on each applicant checking if they are older the 18 (keep in mind that this is just an exercise, it's of course too simple a task to really use a BRE for), then submit the Dossier back to the DossierService. I already implemented this by implementing the iteration over all Applicants in the BRE adapter.
Now I want to modify the implementation to use a Splitter for splitting the Applicants into multiple messages so the BRE adapter will only handle one Applicant. My message chain looks the following now (this is not working yet, so please don't mind errors in there, I mainly put it here to summarize what I'm trying to do):
The problem I ran into is that the aggregator will produce a List<Applicant> in the end but I what I need is an updated Dossier object. As I see it my Dossier object was lost when the Splitter transformed my message which had a Dossier payload into a set of messages with Applicant payloads. Is there a way to "save" my original message, so I can use the Dossier in the end. I definetaly want to output the whole (updated) Dossier from the chain.Code:<int:chain input-channel="businessRuleChannel" output-channel="dossierServiceChannel"> <int:transformer expression="payload.getApplication().getApplicants().getApplicantList()"/> <int:splitter apply-sequence="true"/> <int:service-activator method="checkAgeOfApplicant"> <bean class="nl.vwpfs.pos.esb.BusinessRuleEngine"/> </int:service-activator> <int:aggregator> <bean class="nl.vwpfs.pos.esb.ApplicantAggregator"/> </int:aggregator> </int:chain>
One more note: In this simple case where everything is an in-memory object the Dossier will actually be updated because it still holds reference to the Applicant objects. But If I would convert this to a more realistic scenario then this would not be the case, so I want to simulate that update operation.


Reply With Quote
