walk-through
The code for this microservice is a simple textbook REST service. This is a simple blocking service so that we can explore a simpler paradigm. Later we'll build a Webflux service when we build the Event Activity service. Here's the basic outline of the solution:

The client request
The client request is the input to the microservice REST API. It's a simplified json record with the basic requirements for sending emails. Any additional information required to build a SendGrid request are stored as configurations
The Controller
The controller is a simple rest service that our client calls. It handles the client request by passing it on to the main program and returning the final result back to the client.
The Handler
The handler function is just a pass-through - it's only function is to convert from a json string to a SendgridRequest Object and to provide a final catch for any errant runtime exceptions. The design paradigm is that everything returning to the caller is in the form of a valid Response object.
The Mailer
The SendGridMailer send() method takes the user's request and:
SendGrid Response
SendGrid will respond with an httpStatus code and any message in the body. It will aslo include a list of headers
Last updated
Was this helpful?