Event-driven messaging

An integration mechanism for asynchronous communication in a microservices orientated architecture is the use of an event stream. The event stream is a separate on-premised or cloud-bound workload managing the receipt of messages published from microservices and their propagation to one or more subscribing consumer services. Depending on the tool, each Neptune DXP microservice must be furnished with a corresponding client library to allow Neptune DXP server scripts to publish and consume messages. There are multiple implementation approaches for this integration model, utilising either a traditional queue manager, such as IBM MQ, or distributed data streaming services, such as Kafka or AWS Kinesis. With Neptune DXP’s direct integration with NPM, it can be flexibly enhanced to deliver a mixed microservice interface composed of one of the following:

  • a combined synchronous REST API driven interface to enable client communications

  • a combined asynchronous event driven interface for inter-service communications

eventdrivenmessaging

In the simplified example above, a series of REST API request and events is combined to produce an interaction to enable customer order management. Let’s look at the sequence of events:

  1. Order Create an application posts, invoking a REST API, a new order with the Neptune DXP Order microservice

  2. Order Create the Neptune DXP Order microservices publishes an event to a Kafka event stream (to make this happen a Kafka node client has been installed and a script composes the message)

  3. Order Acknowledgment via SMS is issued by the Neptune DXP Notification microservice which has onboarded an external API such as Twilio SMS API. Whilst it would be possible to issue Twilio SMS messages programmatically, using the corresponding Twilio SMS library is an unnecessary complication since Neptune DXP’s REST API designer handles the integration.

  4. Order Shipped message is issued by the Fulfilment service after the goods are dispatched and the Notification service issue another SMS to the customer to that effect.

  5. Payment is processed in parallel, triggered by the Order Shipped message

Both the Fulfilment and the Payment microservices orchestrate complex integration with carrier and payment processor services, having onboarded their respective REST APIs.