Skip to Content
Technical Articles
Author's profile photo Showkath Ali Naseem

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

What is Webhook ?

A webhook is a technique used to send HTTP POST notifications to a URL. When an event occurs in a source application, a webhook request is triggered to one of the API endpoints.

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

Why should I use Webhook ?

Webhooks does not require the administrator to manually trigger event & submit a request

Instead, a webhook automatically broadcasts information to third-party systems which can then be used to make event-driven decisions

 

What is difference between Pub/Sub vs 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.

 

In a pub/sub scenario  , providers (message sources) are decoupled from message consumers while in webhooks, the producer via Event mesh is fully aware of the location of the consumer through the webhook URL.

Webhooks are a very useful method to communicate events,

However The communication model in a webhook is one-to-one, i.e. one producer to one consumer, while in a pub/sub system you can have many producers sending messages to multiple consumers.

 

Use a pub/sub techniques for asynchronously commination  & Webhooks for  synchronous commination

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 to 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

 

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

Webhooks are used for one-way communication from a source application to a destination application(rest API)

 

How to create Webhook in Event Mesh ?

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

Assigned Tags

      2 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Sandesh Kurumella
      Sandesh Kurumella

      Hello Showkath,

       

      Great insight about  Webhook vs Pub-Sub. Now the question is, is there a documentation on how a client application can subscribe to queues/topics using AMQP and MQTT protocols?

      I was able to find documentation on how a client can consume events from the queue using HTTP protocol but not using AMQP or MQTT.

      Regards,
      Sandesh

      Author's profile photo Showkath Ali Naseem
      Showkath Ali Naseem
      Blog Post Author

      Thanks Sandesh Kurumella

      Here are few useful resources for your reference

      SAP CAP --> https://cap.cloud.sap/docs/guides/messaging/event-mesh

      The enterprise-messaging-shared messaging variant is for single-tenant usage and uses AMQP by default

      Samples

      Tutorials