Thanks for the feedback!

The overall approach should be applicable for IPC (as well as any other way of communication, e.g. plain TCP sockets, or WebSocket, or any message queue, etc.). The only change is how you store and obtain (i.e. serialize and deserialize) the correlation id (the request id, in case of HTTP) in each of your node processes.

If you’re using child_process module, you can send messages between parent and child processes (see the doc). In this scenario, you can add a general purpose metadata field for each of messages, then read the correlation id from CLS each time when a message is being send and add it into the metadata field. On receival of messages you should read from the metadata field and store the correlation id into CLS. And, of course, it’s better to encapsulate this logic in a separate module.

Software engineer at Hazelcast. Node.js core collaborator. Architectural design and challenging problems are the things that I love in IT.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store