cancel
Showing results for 
Search instead for 
Did you mean: 

Sync Async scenario with a twist... Possible?

0 Kudos
309

Hello experts,

I have a requirement - Depending on the message processing status of the incoming message, SAP PO needs to send back a technical acknowledgement back to the sender.

REST <-> SAP PO <-> SAP [Proxy]

1. A request comes in Synchronously via REST sender channel.

2. The data is sent to the back-end SAP system via Proxy

3. If Step 2 was successful - send 200 in the XML body back to the sender, if Step 2 failed - send 500 in the XML body back to the sender.

I need to achieve this without a BPM or Custom Modules.

Any ideas?

Thanks!

Accepted Solutions (1)

Accepted Solutions (1)

alex_bundschuh
Product and Topic Expert
Product and Topic Expert

Hi Thomas,

this can be achieved using standard modules, see a similar setup with JMS as receiver at https://help.sap.com/viewer/2462a9a468b1491b91fda1923d23f667/7.31.25/en-US/4520d2b4c20a0732e10000000...

Other than in the JMS adapter where we can use JMS correlation to write the message id of the request message into the correlation id, you need to fetch the message id in the proxy method and pass it to the outbound proxy that sends the async response, actually I'm not sure if you can already set the correlation id when calling the outbound proxy, if not you may store the message id into a dynamic header and use the DynamicConfigurationBean module in the XI sender channel of the async response to read the message id from the dynamic header and to write the same into the correlation id, see https://help.sap.com/viewer/2462a9a468b1491b91fda1923d23f667/7.31.25/en-US/45da2239feb22e98e10000000...

See also a couple of sync-async scenarios at https://blogs.sap.com/2014/04/14/bridges-construction-site-23-synchronous-asynchronous-bridge/

Alex

0 Kudos

alexander.bundschuh - Thanks for this. I have a SYNC ASYNC bridge setup (REST to SFTP) [SFTP for easier testing] using the same instructions as the referenced blogs and it works well, the caller gets STATUS CODE as 200 and a response with message ID in the payload. Only issue is... Say I keep the SFTP receiver channel down (to simulate an error scenario), the caller still gets an HTTP 200 [and the new message ID in the response payload] when posting a message and the message to the SFTP receiver will be stuck in Waiting status.

However, I would want it to return an HTTP 500/throw some error/timeout so that the calling system can make out that something went wrong.

alex_bundschuh
Product and Topic Expert
Product and Topic Expert

Hi Thomas,

this behaviour is not as expected, if the response message is not sent from the sftp adapter it should go into a timeout depending on your client, if you get an http 200 in any case, maybe the order of the modules is wrong, the response should only be sent to the client once the async response message is picked up from the sftp server.

If you need an http 500, custom error handling in the REST adapter may help, see https://blogs.sap.com/2015/04/10/pi-rest-adapter-custom-error-handling/

Alex

Answers (0)