cancel
Showing results for 
Search instead for 
Did you mean: 

Principal Propogation, Event Mesh setup and User Context in CAP Nodejs application

nileshpuranik
Explorer
0 Kudos

Dear all,

We have a landscape with SAP S4 on premise system  -> Connected to a Event Mesh service on BTP -> and a CAP NodeJS based application which is the consumer of the event received from S4 .

There is a principal propagation in place between BTP and S4.

When an event is raised from S4 , it reaches to the Message client in Event Mesh service on BTP. The CAP Nodejs based application is subscribed to the queue/topic of the same. It immediately receives the event and starts handling it in an event handler.

Now, during the processing within CAPM, it makes oData calls to the backend S4 via Principle Propagation and fetch some more data.

When running locally ( BAS ), this works fine because we have a user context available and that helps in making the connection with S4 via Principle Propagation.

However, If the app is deployed on the space, then even though the event is received successfully, the application cannot make calls to the backend because there is no user context available.

How can we make this work? We can pass the User Id via the event payload but how can we create/get a context out of a simple user id and pass it in the header while making oData calls ?

Please advice.

Br

Nilesh

 

View Entire Topic
Ivan-Mirisola
Product and Topic Expert
Product and Topic Expert

Hi @nileshpuranik,

That topic on authentication is not related to your ERP backend authentication. It is rather the authentication that would happen when you call your service implemented with CAPM. 

Therefore, it will not make any difference whether you create a new instance of that object of not. It will simply not be used when you call your ERP end-point.

Best regards,
Ivan

CAPMDeveloper00
Explorer
0 Kudos

Hi @Ivan-Mirisola 

Very nice explanation. I am working on a cloud application (SAP Sales Cloud V2) where we can emit event notification using workflow.

I want to consume that event notification generated on creation of a ticket in the cloud SaaS system in my CAP application.

Which process would be the right way to achieve this out of below two:

1. SaaS cloud application --> Event generated --> Event Mesh --> Handling events on CAP application

2. SaaS cloud application --> Event generated --> Handling events directly on CAP application

 

Is there a way to directly handle events in cap application, raised by cloud SaaS application.

 

Regards,

CAPDeveloper