When to use Event Mesh Webhook
In this blog post I would like to share my knowledge on “When to use Webhook”
According to my knowledge you simply should not configure Webhook in Event Mesh
When you should not use (Not recommended) Event Mesh Webhook
If consumer application supports AMQP, MQTT protocols then go for AMQP, MQTT communication .
For example SAP Cloud Integration iflows supports AMQP Adapter ,
BTP CAP Supports AMQP communication protocol
JAVA also supports AMQP connection so in these cases you should not create Webhook
If consumer does not supports AMQP then go for Webhook
For example you have scenario of Third party integration then go for Webhook
When you should use (recommended) Event Mesh Webhook
Scenario:
The webhooks are used if the consumer application is not supporting any native messaging protocol like AMQP or MQTT. As such the consumer can’t act as a client and subscribe to EM.
As a solution the consumer can provide a REST endpoint to which you can POST events. This is the endpoint you need to provide for the webhook configuration. EM itself takes the role of the consumer and pushes any incoming message to the configured REST endpoint.
if your API work with Postman, they should also work with EM webhook
Why should I use Webhook
In Pub-Sub scenario : Event mesh don’t know its clients. For example consumer apps like CI Iflow , BTP CAP APP in charge of the flow control… these consumers responsible to creates the connection and subscribes to event mesh. Client Listing to Event Mesh.
When application does not supports AMQP , MQTT protocols & your third party app has requirement to receive message form Event Mesh Queue I,e your APP wants data sent to a certain URL when something event happens in provider .
In Web hook scenario Event Mesh needs to know its consumer & invoke third part Rest API with consumer provided credentials
I would suggest you can also refer blog post : https://blogs.sap.com/2020/05/06/cloud-foundry-enterprise-messaging-webhooks-%F0%9F%93%A8/ by Dries Van Vaerenbergh
If you have access to Event Mesh Dashboard cockpit ,
Go to your desired Message Client -> under the “Webhook” tab click on “Create webhook
to create a new configuration
How webhook sends message to consumer Application
The Event Mesh webhook does an HTTP POST (mor or less) in real time when an event arrives in the queue
A webhook subscription notifies the receiving application when an event is triggered. The data is sent through HTTP using a POST request to the receiving application that handles the data. The exchange of data is done through a webhook URL. A webhook URL is configured by the receiving application. The data sent to the webhook URL is known as payload. When an event is triggered, an HTTP POST payload is sent to the webhook URL.
See : https://help.sap.com/doc/95ffc07cb5064bc5aaedf3b3172c28b8/Cloud/en-US/enterprise_messaging_en_US.pdf
How consumer APP knows Event Mesh Triggered Webhook & sends message
It depends on logic inside your REST API i.e as soon as REST API triggered by BTP Event Mesh WebHook.Your API logic logs/business process is evidence 😊
What are Authentication option supported by Webhook
Webhooks supports basic authentication, OAuth 2.0 authentication, and no authentication are supported. I,e your third Party Rest API should provide credentials with supported auth types (Basic, oAuth )
The authentication applies to both handshake and message delivery calls. For OAuth 2.0 client credentials protected webhooks, the token URL is called with an HTTP POST method and client credentials are sent in a basic authentication header
Is there any option to Edit Web hook ?
As of now not possible to Edit Webhook configuration , rather you can delete & re-create.
What are trigger handshake, pause, resume options
Trigger : This will trigger handshake
Pause : Pause the webhook i.e active
Resume : Resume the webhook that was paused before
Can I see History of Handshake
Event Mesh Dashboard provide an option to view History details