rabbitmq-java-client InputStream/OutputStream

223 views
Skip to first unread message

Arlo O'Keeffe

unread,
Nov 28, 2014, 12:09:00 AM11/28/14
to rabbitm...@googlegroups.com
Hello everyone,

is it possible to send a Message with an OutputStream instead of a byte[]?

If not, will it ever be possible?

The same goes for receiving messages via an InputStream.

I am using the Java client on Android devices and am running into OutOfMemoryError when trying to upload videos (anything longer than ~15 seconds).

Workarounds:
a) Split the message into chunks. I have to implement that :/
b) Use a HTTP endpoint in front of rabbitmq where I can use OutputStream. This has potential problems with e.g. message persistence that I don't have to worry about with rabbitmq.

Greetings,

Arlo

Michael Klishin

unread,
Nov 28, 2014, 4:00:13 AM11/28/14
to rabbitm...@googlegroups.com, Arlo O'Keeffe
On 28 November 2014 at 08:09:02, Arlo O'Keeffe (mailt...@gmail.com) wrote:
> is it possible to send a Message with an OutputStream instead
> of a byte[]?
>
> If not, will it ever be possible?

Publishing bodies that are streams is possible, although not trivial due to framing.

> The same goes for receiving messages via an InputStream.

The client would still need to parse protocol data, so even if we'd turn it into an InputStream,
we'd lose its lazy evaluation/memory efficiency.

Take a look at http://blog.travis-ci.com/2013-08-08-solving-the-puzzle-of-scalable-log-processing/,
you can apply a similar technique in the meantime. 
--
MK

Staff Software Engineer, Pivotal/RabbitMQ
Reply all
Reply to author
Forward
0 new messages