<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Eyal Ringort</title>
    <description>The latest articles on DEV Community by Eyal Ringort (@eyalrin).</description>
    <link>https://dev.to/eyalrin</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F579469%2F751600ab-6332-48e6-9c52-9c8bd1109070.jpg</url>
      <title>DEV Community: Eyal Ringort</title>
      <link>https://dev.to/eyalrin</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/eyalrin"/>
    <language>en</language>
    <item>
      <title>Building a scalable webhook delivery system using Kafka, SQS &amp; S3</title>
      <dc:creator>Eyal Ringort</dc:creator>
      <pubDate>Thu, 26 May 2022 15:03:20 +0000</pubDate>
      <link>https://dev.to/eyalrin/building-a-scalable-webhook-delivery-system-using-kafka-sqs-s3-2569</link>
      <guid>https://dev.to/eyalrin/building-a-scalable-webhook-delivery-system-using-kafka-sqs-s3-2569</guid>
      <description>&lt;p&gt;As the world gets more and more connected, software applications are of course no exception. Apps need a way to have 2 or more completely separated systems share information.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Webhooks&lt;/strong&gt; are automated messages sent from apps when something happens. They have a message (or payload), and are sent to a unique URL. Webhooks are almost always faster than polling, which makes them an ideal solution for pushing events from a system to the outside world.&lt;/p&gt;

&lt;p&gt;They are widely used in industry giants like Shopify, Stripe, Twitter &amp;amp; Twilio. If you look at PayPal, webhooks are how PayPal tells your eCommerce app that your clients paid you.&lt;/p&gt;

&lt;p&gt;In this post I'll introduce a webhook delivery system solution using Apache Kafka, AWS SQS and S3. In the past, my company had different implementations for sending out events via webhooks in different products. We decided to consolidate them into a single unified solution.&lt;/p&gt;

&lt;p&gt;So, if you're considering building your own webhook delivery system, this blog is for you!&lt;/p&gt;




&lt;h2&gt;
  
  
  Defining the requirements
&lt;/h2&gt;

&lt;p&gt;Let's look at what we wanted to get from the new webhook delivery system, and why:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Scalability&lt;/strong&gt; - system needs to be able to adapt to changes and different loads using horizontal scalability&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Retry Support&lt;/strong&gt; - sending webhooks can sometimes fail, due to a problem on the receiving end (bug, system is down, etc.). We could just discard the failed messages, but this would result in data loss for the receiver. We need a mechanism to retry the operation with exponential backoff and within up to 24h&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Large Payload Support&lt;/strong&gt; - webhook events might have a large payload of a few MB&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Payload Agnostic&lt;/strong&gt; - no knowledge of the meaning of the message's content is needed (nor even possible). Message’s payload is delivered as-is. This is crucial for having one solution to handle many different business use cases&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Deduplication of Delivery&lt;/strong&gt; - all webhook events will get to their destination, but perhaps more than once. We’ll have a unique event id for deduplication purposes&lt;br&gt;
Public REST API - necessary for registering webhooks&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  We did allow ourselves some leniency:
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;No Order Guarantee&lt;/strong&gt; - we do not guarantee any order for webhook events&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Handle HTTP/S communication only&lt;/strong&gt; - sending webhooks in any other type of communication manner (e.g., Apache Kafka, TCP, etc.) will not be supported&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Building the functionality
&lt;/h2&gt;

&lt;p&gt;Right off the bat it was clear to us that our system would have 2 main tiers: The &lt;strong&gt;API&lt;/strong&gt; (used for configurations) and the &lt;strong&gt;Brain&lt;/strong&gt; (actual sending of webhook events). Let’s look at each of them separately…&lt;/p&gt;

&lt;h3&gt;
  
  
  The API Tier
&lt;/h3&gt;

&lt;p&gt;Used for registering and configuring webhooks. We decided to go for the most straightforward solution and have a REST API. The API can be used by an end user (the webhook subscriber) or by another application.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fp2t8wl6ydtvv6x27fh2u.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fp2t8wl6ydtvv6x27fh2u.png" alt="diagram 1 - The API" width="800" height="583"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The endpoints URL is structured as &lt;code&gt;[base-path]/webhooks/&amp;lt;entity&amp;gt;&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Defined 3 object types:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Webhook Target - an entity that encapsulates the target URL of the webhook&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"id"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;111111111&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"url"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"http://www.dummy.com"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"createdAt"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"2021-10-03T17:14:23Z"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"updatedAt"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"2021-10-03T17:14:23Z"&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Webhook Filter - an entity containing a list of event types a user wants to listen on (essentially an event group)&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"id"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;222222222&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"events"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="s2"&gt;"core.orders.created.v1"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="s2"&gt;"core.orders.updated.v2"&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"createdAt"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"2021-10-03T17:14:23Z"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"updatedAt"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"2021-10-03T17:14:23Z"&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Webhook Subscription - an entity that holds a combination of webhook target and webhook filter. Webhooks events will only be sent to active subscriptions&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"id"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;123456789&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"targetId"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;111111111&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"filterId"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;222222222&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"active"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"createdAt"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"2021-10-03T17:14:23Z"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"updatedAt"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"2021-10-03T17:14:23Z"&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Each entity has support for the following operations:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;GET BY ID&lt;/strong&gt; (&lt;em&gt;GET&lt;/em&gt; &lt;code&gt;/webhooks/&amp;lt;entity&amp;gt;/&amp;lt;entity_id&amp;gt;&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;GET ALL&lt;/strong&gt; (&lt;em&gt;GET&lt;/em&gt; &lt;code&gt;/webhooks/&amp;lt;entity&amp;gt;&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;CREATE&lt;/strong&gt; (&lt;em&gt;POST&lt;/em&gt; &lt;code&gt;/webhooks/&amp;lt;entity&amp;gt;&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;UPDATE&lt;/strong&gt; (&lt;em&gt;PATCH&lt;/em&gt; &lt;code&gt;/webhooks/&amp;lt;entity&amp;gt;/&amp;lt;entity_id&amp;gt;&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;DELETE&lt;/strong&gt; (&lt;em&gt;DELETE&lt;/em&gt; &lt;code&gt;/webhooks/&amp;lt;entity&amp;gt;/&amp;lt;entity_id&amp;gt;&lt;/code&gt;)&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;To create a webhook there is a 3 step process:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Create a &lt;strong&gt;Webhook Target&lt;/strong&gt; that will point to the location you want the webhook message to be sent to.&lt;/li&gt;
&lt;li&gt;Create a &lt;strong&gt;Webhook Filter&lt;/strong&gt; that will tell which events are to be sent as webhook messages.&lt;/li&gt;
&lt;li&gt;Create a &lt;strong&gt;Webhook Subscription&lt;/strong&gt; to bind a target and a filter. &lt;strong&gt;Only when this step is completed, will actual webhook messages be sent&lt;/strong&gt;.&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  The Brain Tier
&lt;/h3&gt;

&lt;p&gt;The tier that will be responsible for the actual sending of webhooks. It is sensible to break it down to even smaller pieces, allowing us to scale different areas of the system independently from other areas that do not need the same scaling.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fchokw0ofbd9w9hbzdzr8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fchokw0ofbd9w9hbzdzr8.png" alt="diagram 2 - The Brain" width="800" height="468"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;First, let’s define some simple terminology:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Webhook Event&lt;/strong&gt; - the event received from other applications&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Webhook Delivery&lt;/strong&gt; - a combination of a Webhook Target and a Webhook Event. Since each event might interest multiple targets, it is duplicated per target&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Webhook Message&lt;/strong&gt; - the actual data sent to the target URL&lt;/li&gt;
&lt;/ol&gt;

&lt;h4&gt;
  
  
  The Consumer
&lt;/h4&gt;

&lt;p&gt;The consumer handles webhook events from Kafka and decides (based on the subscription data) what Webhook Targets are applicable. Once deciding that, it generates a Webhook Delivery for each target that needs to get the event, and publishes it to an AWS SQS queue.&lt;/p&gt;

&lt;p&gt;Since SQS has a limit of 256KB per message, and we have larger messages than that, we store the message payload in S3 for future retrieval.&lt;/p&gt;

&lt;h4&gt;
  
  
  The Cache
&lt;/h4&gt;

&lt;p&gt;Events are very frequent in the system, and for each of them we need to match all relevant subscriptions defined in the subscriptions data DB. To not put strain on the DB, we hold in memory a local cache with the subscription configuration.&lt;/p&gt;

&lt;h4&gt;
  
  
  The Dispatcher
&lt;/h4&gt;

&lt;p&gt;The dispatcher is the part of the system that performs the actual sending of the event payload as a Webhook Message to the relevant URL. It gets the delivery created by the consumer from the AWS SQS queue, and performs an &lt;code&gt;HTTP POST&lt;/code&gt; call to the desired URL with the delivery payload. It is a separate module in order to allow dealing with performance interference issues, but more on that later.&lt;/p&gt;

&lt;h4&gt;
  
  
  The Retry Manager
&lt;/h4&gt;

&lt;p&gt;As mentioned in the requirements, sending webhooks can fail, so we must have a mechanism to retry the operation (exponential backoff within up to 24h). After failing to find an existing solution that meets our requirements, we decided to implement it ourselves, using the power of SQS delayed messages and S3 for payload storage. For an in-depth dive into this topic, please refer to my upcoming blog post (link at the end of this post).&lt;/p&gt;




&lt;h2&gt;
  
  
  Putting it all together
&lt;/h2&gt;

&lt;h2&gt;
  
  
  System flow
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Using the &lt;strong&gt;API&lt;/strong&gt;, a new webhook is defined (target, filter &amp;amp; subscription) and saved to the subscription data DB. This is done once, and from that point forward relevant events will be sent as webhook messages.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Once something happens in a system that uses the webhooks delivery system (marked as App1 in diagram 2), it should send a message to a dedicated &lt;strong&gt;Kafka topic&lt;/strong&gt; with the payload of the event and the type of the event. Here is the schema for such a message:&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"type"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"record"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"name"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"WebhookEvent"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"namespace"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"com.yotpo.platform.webhookdelivery.messages"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"fields"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"name"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"event_type"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"type"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"string"&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"name"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"payload"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"type"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"string"&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The &lt;strong&gt;consumer&lt;/strong&gt; polls the message from the &lt;strong&gt;Kafka topic&lt;/strong&gt;, and uses the definitions that were made before in the &lt;strong&gt;API&lt;/strong&gt; and stored in the local cache. It then decides whether there exists a subscription that uses a filter in which the current type of event is defined. If so, it gathers all of the subscriptions that got matched, and creates a delivery message for all of the targets defined in them. The deliveries that were created are sent to an &lt;strong&gt;SQS queue&lt;/strong&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The dispatcher polls the webhook deliveries from the SQS queue and sends it to the target. If the dispatcher gets a link to S3 for the payload, it fetches it before sending the delivery to the URL.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;In case the send is unsuccessful, the delivery is returned to the retry manager that is responsible for pushing it to the dispatcher again. This will continue until the delivery is successful, or until the number of attempts is exhausted.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;




&lt;h2&gt;
  
  
  Final thoughts
&lt;/h2&gt;

&lt;p&gt;This article only touches on subjects like how we solved problems relating to real life (such as retry management) or performance (Caching and I/O operations).&lt;br&gt;
Also, very interesting and challenging topics that should be addressed are the usage in a multi-tenant SaaS system. There are more issues to consider when integrating it with such a system. Issues like starvation and performance interference, security (CRC, Signature Header Validation), data separation, and much more.&lt;br&gt;
For all these issues, I invite you to check out my upcoming post - &lt;em&gt;&lt;strong&gt;Addressing the challenges of a webhook delivery system in a multi-tenant SaaS system&lt;/strong&gt;&lt;/em&gt;.&lt;/p&gt;

</description>
      <category>webhooks</category>
      <category>kafka</category>
      <category>sqs</category>
      <category>s3</category>
    </item>
  </channel>
</rss>
