# the event listener

## What are we building

The (SendGrid) Event Activity service is a REST microservice that

* [x] accepts information from SendGrid's webhook service (SendGrid Webhooks)
* [x] publishes that information to a Kafka queue
* [x] performs minimal formatting of data or the payload

## Background

When we submit a request to SendGrid we get an immediate response that the request was received. We can also get asynchronous `event activity` messages from Sendgrid about the delivery progress and how the recipient interacted with the email.

In order to get these we need to set up a REST 'endpoint' that listens for the messages, and we need to tell Sendgrid to send the messages to our endpoint.

## The basic flow

* [x] SendGrid completes processing of the request
* [x] The email makes it to the recipient (or not)
* [x] The recipient opens the email (or not)
* [x] The recipient clicks on any link that we've embedded in the email (or not)

![](https://835605371-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MirRN1Vsv3GcZ0OdXtu%2Fsync%2F3737fba93657e218ddd801e82be4114ff040a9c3.png?generation=1630870450464035\&alt=media)

## The event activity service

The `Event Activity` service will listen for these messages and store the raw data in Kafka for further processing. Unlike the Sendgrid mailer service, we replace the controller with a reactive router so that we can explore testing that sort of service. In the next few sections we'll

* [x] Do a brief walk-through of the code
* [x] Explore testng the reactive router&#x20;
* [x] Explore testing a message service client
