Docs icon indicating copy to clipboard operation
Docs copied to clipboard

Is there internal communication mechanism between application workers?

Open oleksandr-birch opened this issue 1 year ago • 0 comments

Scenario:

  • Application serves WebSocket protocol
  • Clients subscribe to the WebSockets room/channel via sending message to API using metacom message schema. The incoming request is handling by worker W1. The logic was taken from this example
  • At some moment, domain logic initiates application.scheduler.add() that should invoke some task in 1 minute.
  • The scheduler task execution is launching on worker W2 (default application behaviour). The task should broadcast WebSocket message to all subscribed clients connected to the application.
  • Because the Room Map object is initiated in W1 worker (application logic by default), the W2 worker doesn't contain the Room Map object, and this is logical.
  • How we can implement that internal communication between application workers? So we can broadcast some messages/events from all application workers to some master worker, and then broadcast messages to all connected WebSocket clients?

Thank you!

oleksandr-birch avatar Feb 17 '24 20:02 oleksandr-birch