Reputation: 9697
I am new to spring integration and am in the process of getting a hold of the components. The requirement is as follows. Get an XML message , validate the data using a web service call and process the valid or invalid data accordingly. We currently use a router to validate the data and route the original payload as per the validation result. I have an alternate approach in mind to segregate this flow. I would like the router to perform only the routing job . For the web service validation , I am thinking of using a service activator . This in turn will pass the routing information to the router - could be by using a header enricher. I have some questions here . Is this the best practice? If so, how best can we pass the validation information received from the webservice to the router?.Also, will the addition of more components not negate the advantages we get by component segregation? Please help.
Regards, Aravind.
Upvotes: 1
Views: 384
Reputation: 2137
To help with a best practice approach consider a clear separation of responsibilities and what the validation is as a part of the flow. For instance, you may consider the validation to actually be a filter, where only valid messages pass through and invalid are directed to a rejection channel. The filter approach will work if you can distill the validation results toa boolean scenario.
(By the way, try to avoid extending Spring Integration classes/interfaces and instead create POJO services that you can reference. Makes it easier to test and maintain)
Upvotes: 2