Event Driven webapi
Attempt to make a basic event driven api that uses a RESTful http interface, ensuring it still conforms to REST.
- the user make a request of the server.
- the server passes the request to a handler.
- the handler generates a correlation id.
- the handler pushes the request data (message) onto a request message queue with the correlation id as metadata.
- the handler then responds with a 202 accepted and the correlation id.
- the request message queue then pushes the message to any relevant subscribed worker service.
- the worker service does work on the message, and pushes a response message with the correlation id as metadata, onto a response message queue.
- the user, at some point, makes another request to the server with the correlation id.
- the server passes the request to a handler.
- the handler asks the response message queue, if it has any messages with the correct correlation id.
- if it does, the handler takes the message, processes it, and responds accordingly.
- if it doesn't, the handler response with a suitable error code (404, 409...etc).