Aug 7th, 2012, 03:47 AM
How can I a Message send out of SI, and then update the OK/KO status of the sending?
I'm doing my best with EAI, but now I'm facing a challenge that I can't solve.
How can I send a Message out of the Integration flow (outbound adapter: JMS, File, HTTP...) and then either update the Message if there is no error, or inform of any thrown Exception?
The Message flow must go on, due to pending process (backing up the message, report of the sending and so on)
Some context here:
I have an integration process for some kind of deliver. I have to create messages (selecting pending products to deliver), try to send them (formerly a simple HTTP POST, soon a JMS queue, for the time being write to a file for testing purposes), and then update (mark as delivered) the products of the messages successfully delivered.
In an asynchronous way, we expect a confirmation response, in order to register the processing from the receiver or trying to resend the items not confirmed.
I don't expect a synchronous response. In the former program, the update was done if a 200 HTTP response was received from the HTTP connection (the actual confirmation is based on the response message)
Maybe it sounds weird, but I will update the message if there is no JMS Exception. And even weirdest, I want to simulate the queue with a file writing in a first attempt.
Thank you very much.
Aug 7th, 2012, 06:55 AM
If I understand you correctly you want send message out to the external system and if you have a way of knowing that the external system succeeded than you can update/continue etc. If not you want to go to error channel.
So basically you need to get a response of some type from the remote system and outbound gateways with reply-channel are the type of components that will give you that (JMS, HTTP). Once the reply is received you can continue with whatever else you need otherwise the exception will be generated by such gateway essentially resulting in the ErrorMessage being sent to the error-channel by your flow starting component (e.g., <gateway> or any other inbound adapter/gateway)
But something tells me you already knew that, so may be you can clarify what I am missing.
Aug 7th, 2012, 07:38 AM
Thank you very much, Oleg.
You've understood very well.
The main issue is me. I donīt change the mind to adapt to EAI patterns. Furthermore, I'm trying to maintain a former weird logic.
Actually, waiting for a reply is not the expected behaviour for the program (the processing process at the other side could take a long time) I'm following a current program logic that only expects an HTTP 200 for updating the sending (that only means the other side's webserver is alive)
So, there are two integration flows: sending (from gateway to outbound) and response (from input to service activator).
I apreciate a lot your help and your quick response. You've clarified the concepts to me.
My best option is to create a pure asynchronous sending process (create the sending, update the records, and send the Message out using an outbound adapter at the end of the flow. The rest of the process will be achieved with the help of a "recipient-list-router")
Aug 7th, 2012, 07:41 AM
Sure, just have an outbound-adapter to send a Message to the remote system. The successful send is equivalent of your 200 OK.
And then have an inbound-adapter for the 'reply' flow.
Aug 7th, 2012, 08:19 AM
Thanks a lot.
The only issue is that I have to perform some business process (not very important: backups, notification, the update itself) BEFORE the sending (it's like to assume that the sending will be OK)
That it's not a problem, because with no sending there won't be a response and the products will be still pending. In the next execution, the products will be ready for sending again (until receive a successful response)