matryer / vice

Go channels at horizontal scale (powered by message queues)
https://medium.com/@matryer/introducing-vice-go-channels-across-many-machines-bcac1147d7e2
Apache License 2.0
1.55k stars 79 forks source link

Using io.Reader for Transport interface instead of []byte #40

Closed karthikmuralidharan closed 6 years ago

karthikmuralidharan commented 7 years ago

Hi,

I love the idea of this package and want to use it for a new service I'm working on with SQS integration.

I was wondering if it made sense to use io.Reader as the message type instead of directly using []byte for this package?

So that we could directly pass the messages along to different decoders as necessary.

https://medium.com/@matryer/golang-advent-calendar-day-seventeen-io-reader-in-depth-6f744bb4320b

matryer commented 7 years ago

We did explore this in the early design, and just felt that []byte more accurately represented what was really going on. I think we'd end up reading everything into a buffer anyway, so the io.Reader would just be sugar, rather than being useful as a streaming protocol. And I was worried people would deliver gigantic payloads through the queue, which isn't recommended. Messages should be small and discrete.

matryer commented 7 years ago

@dahernan What do you think?