6

Async /Non Blocking Mode - SAP CAP

 1 year ago
source link: https://answers.sap.com/questions/13720830/async-non-blocking-mode-sap-cap.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
Sep 21 at 12:39 PM

Async /Non Blocking Mode - SAP CAP

347 Views Last edit Sep 21 at 12:41 PM 2 rev

Hello Everyone,

Kindly let me know the best way to handle task in background/non-blocking format which actually get triggers on the HTTP POST request instead of a scheduled job.

I have created a action named as publishNotification in SAP CAP.

Here are the details of the logic

In ‘On’ Event handler of an action , I am inserting entries in staging table.

And in ‘After’ Event I am calling async function named as triggerNotification which is wrapped in method setTimeout .I wrapped so that HTTO POST request ( for a action -- publishNotification ) is not blocked and implicit database commit happens . In this way I will have data in staging table

The logic of triggerNotification is to loop on staging table and triggers EMAIL and SMS and update the staging table with sent status.

I found that when no of recipient is more than 100, program failed to trigger EMAIL and SMS . It happens randomly . Even when I trigger multiple HTTP request simultaneously using multiple browser session , notification didn’t triggered for few users.

Kindly let me know , if there any better approach in SAP CAP to handle such situation.

Thanks

Sandeep


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK