warning-explosive / Core

Framework for the core domain development
MIT License
1 stars 0 forks source link

Variance in messaging #192

Closed warning-explosive closed 1 year ago

warning-explosive commented 1 year ago

RabbitMQ transport: implement variance without sending the same binary multiple times for each message type in class hierarchy

warning-explosive commented 1 year ago

use CC and BCC headers for contravariance https://www.rabbitmq.com/sender-selected.html

warning-explosive commented 1 year ago

It isn't possible to determine routing path on the consumer side. Rabbit doesn't add any extra information about actually went route. On the consumer side we can see only publication exchange without any consequent transitions. In this case we have two options:

  1. send message several times with different reflected types accordingly to message type hierarchy
  2. send single message and process it in contravariant manner inside single endpoint instance.

These options force us to choose between an extra network expenses for sending same binary several times and weakly distributed processing when single endpoint instance handles contravariant message without ability to scale it.

P.S.: CC and BCC headers works only with direct exchange.