-
Notifications
You must be signed in to change notification settings - Fork 37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Should message contains headers? #10
Comments
See #5 for a lot more discussion about this. |
Except of the reactive call minute about this topic:
To summarise the questions that need to be answered:
The header structure needs to look like an immutable typed map, keys are case-insensitive. |
I don't think we can say that keys are case-insensitive, that will be up to the underlying transport. For example, Kafka header keys are case sensitive. I'm not sure of this, but I think AMQP headers are also case sensitive. HTTP of course is case insensitive. Any attempt to make them case insensitive will introduce bugs and incompatibilities with transports that have case sensitive headers. I think we should make this something that the user has to be aware of with their selected transport, and write their code accordingly. The same goes for duplicate headers, I think we should allow them, as this ensures compatibility with transports that use and even require duplicate headers (eg, imagine an SMTP transport, it makes heavy use of duplicate headers), but leave it up to the transport to decide how to handle duplicates. For the structure to model headers, I think we should be unopinionated about this, offer an API that offers methods to get, set, remove and enumerate headers, but don't provide an implementation. Transports will provide their own implementation, and whether that's a map (as AMQP uses) or a list (as Kafka uses) is up to the transport. For copying headers - I think we should specify that header values be immutable, at least effectively. This solves all the problems, this way there's no need to copy anything, you can just propagate object references directly. |
Here's my suggestion re propagation - don't propagate any headers. Most headers should not be propagated, a content type or encoding header for example should not be. Security headers should be explicitly propagated by user code, it is dangerous to assume that because a principal is attached to an incoming message, that an outgoing message will have the same principal attached. The only headers that potentially should be propagated are correlation headers for tracing, and in that case, I think we should leave it up to implementations if they support any trace headers, and how to propagate them. But what I think we should do is allow messages themselves to be correlated. What if |
I also think metadata would be very useful for other context related things as touched on here: |
…containers-testcontainers-1.10.1 Bump testcontainers from 1.10.0 to 1.10.1
This is how it's done in Smallrye: smallrye/smallrye-reactive-messaging#347 |
We had a set of discussions where we mentioned headers attached to messages.
Right now, the
Message
interface does not have headers. However, we give the possibility to useEvent
which can have headers.Looking at the current set of message-oriented middleware, most of them (if not all) support headers as a first-class citizen. So, I think we can add headers to the
Message
class. These headers would be represented as aMap<String, Object>
. Whether or not the Object should be serializable, I don't have a strong opinion. It might be a limitation when we want to pass container-related objects (but should we?).Would that reduce the interest of Event? I don't think so as typically the Events that have been studied so far (Cloud Event) are more about defining the header key and how the payload and header are encoded.
The text was updated successfully, but these errors were encountered: