Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Practical examples of how correlation id is used in messaging?

Can anyone give me examples of how in production a correlation id can be used?

I have read it is used in request/response type messages but I don't understand where I would use it?

One example (which maybe wrong) I can think off is in a publish subscribe scenario where I could have 5 subscribers and if I get 5 replies with the same correlation id then I could say all my subscribers have received it. Not sure if this would the be correct usage of it.

Or if I send a simple message, the I can use the correlation to guarantee that the client received it.

Any other examples?

like image 334
JD. Avatar asked Nov 25 '13 04:11

JD.


People also ask

What is message correlation?

The service processes the message received from the sender and sends a response message back to the sender. The sender correlates the response it received to the request it sent originally. The MessageID and CorrelationID properties of the message are used to correlate the request and response messages.

How do you use correlation ID in microservices?

Using a Correlation ID In a microservice architecture, the initial Correlation ID is passed to your sub-processes. If a sub-system also makes sub-requests, it will also pass the Correlation ID to those systems. How you pass the Correlation ID to other systems depends on your architecture.

What is correlation ID used for?

A Correlation ID, also known as a Transit ID, is a unique identifier value that is attached to requests and messages that allow reference to a particular transaction or event chain.

What is request ID and correlation ID?

When the caller processes the reply, it uses the request identifier to correlate the request with the reply. This is called a correlation identifier because of the way the caller uses the identifier to correlate each reply with the request. A correlation ID is usually put in the header of a message.


1 Answers

A web application that is providing HTTP API for outsiders for performing a processing task and you want to give the results for the caller as a response to the HTTP request they made.

A request comes in, message describing the task is pushed to queue by the frontend server. After that the frontend server blocks to wait for response message with the same correlation id. A pool of worker machines are listening on queue and one of them picks up the task, performs it and returns the result as message. Once a message with right correlation id comes in, frontend server continues to return the response to the caller.

like image 163
Juha Palomäki Avatar answered Nov 11 '22 21:11

Juha Palomäki