on MessageConsumer<T> (that extends ReadStream<Message<T>> indeed) you have bodyStream() that gives you a ReadStream<T>, so you can chain and write : consumer(“foo”).bodyStream() .
On 14 Nov 2014 at 22:29:37, Jordan Halterman (
jordan.h...@gmail.com) wrote:
> I think the benefits of exposing the event bus as a ReadStream and WriteStream are pretty
> obvious and a great decision, but:
> - Types seem inconsistent: consumer() returns a MessageConsumer which extends ReadStream
> and sender() and publisher() return a WriteStream. I realize this is probably just because
> there was no need for additional methods on the WriteStream, but neither can you add event
> bus specific WriteStream methods later if you want/need to
> - Methods exposed by the interface seem inconsistent: I can send() or publish() messages
> by calling those methods directly on the EventBus API *or* I can create a sender() or publisher(),
> but to receive messages I can only create a consumer() and use that to consume messages.
> Does the event bus provide an interface that allows you to send/receive messages, or
> does it provide addressed streams that allow you to send/receive messages, or does it
> do both? Right now it does both for sending but one for receiving.
>
> I think the thing that felt awkward or more complex to me was having to hang on to a MessageConsumer
> in order to unregister it later, but I think that's fine. And maybe producer/consumer
> behaviors differ enough to warrant the asymmetric API that I mentioned above. Just thought
> I'd give some thoughts from my symmetric thinking mind.
>
> Jordan Halterman
>