Microservice Pipelines
Microservice Pipelines
A microservice pipeline is a pipeline that creates a fine-grained service to perform a specific task.
For example, you might use a microservice pipeline to validate changes to user accounts. You can have the pipeline check for matching accounts to validate account creation requests, account updates, and account deletions. The pipeline can tag requests as actionable or not and send all responses back to the originating system for next steps.
At this time, you can create REST-based microservice pipelines that use standalone execution mode. Other microservice types and platforms are planned for future releases.
A REST-based microservice pipeline uses a REST Service origin to listen for JSON-formatted requests at an HTTP endpoint. In the pipeline, you can use any available processor to transform and route the records as needed. Then, use one or more Send Response to Origin destinations to send records with user-defined status codes to the REST Service origin. The origin then transmits JSON-formatted responses back to the originating REST API client.
For more information and a descriptive video, see our blog post on microservice pipelines. For a full description of a sample microservice pipeline and a tutorial on creating one, see our GitHub tutorial, "Creating a CRUD Microservice Pipeline".
Stages for Microservice Pipelines
- REST Service origin - Listens on an HTTP endpoint, parses the contents of all authorized requests, and sends responses back to the originating REST API. Creates multiple threads to enable parallel processing in a multithreaded pipeline.
- Send Response to Origin destination - Sends records to the REST Service origin with the specified response.
Sample Pipeline
When you create a microservice pipeline, a sample microservice pipeline displays in the configuration canvas. You can edit the pipeline to suit your needs. Or, you can create a standalone pipeline and use the microservice stages in a clean canvas.
The sample pipeline shows how you might use the REST Service origin and several Send Response to Origin destinations in a microservice pipeline:
The sample pipeline uses a Stream Selector to route data to different streams based on the REST API request method, performs additional processing, and then passes the records to the Send Response to Origin destinations. The destinations pass the records back to the REST Service origin with the specified status codes, such as 200 for OK or 400 for bad requests. The pipeline error handling also passes records back to the origin, with the 500 status code representing an internal server error. The REST Service origin generates a response with the records it receives and sends it to the originating client.
The pipeline description contains instructions on interacting with it using the curl command line HTTP client. For a step-by-step explanation of the sample pipeline, see "Creating a Microservice Pipeline" in the Creating a CRUD Microservice Pipeline tutorial.