activemq-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "James Strachan" <james.strac...@gmail.com>
Subject support for FileMessage?
Date Thu, 16 Nov 2006 09:01:50 GMT
Saw an interesting blog post today...

http://weblogs.java.net/blog/guruwons/archive/2006/11/sending_large_f.html

As I mentioned on the comments, I'd like to extend this a little to
support both out-of-band transfer (e.g. its basically a message with a
URL in it to that the user can download the file from some remote
destination) or the file is actually sent over the JMS network, so it
can act as a facade to the existing JMS Streams feature...

http://incubator.apache.org/activemq/jms-streams.html

So am thinking from a client API perspective they do one of the following...

// send a message out of band...
FileMessage message = session.createRemoteFileMessage(new
URL("http:///foo.com/bar.jpg"));

// send a local file over the JMS network
FileMessage message = session.createLocalFileMessage(new
File("~/myfiles/bar.jpg"));

then for consumers...

if (message instanceof FileMessage) {
  FileMessage fileMessage = (FileMessage) message;
  InputStream in = fileMessage.getInputStream();
  // lets read the file...

  // or lets force the file to be manifested as a local file so we can
work directly on the file instead

  URL url = fileMessage.getURL();
  // we can now open the file as many times as we like...
}

Thoughts?

-- 

James
-------
http://radio.weblogs.com/0112098/

Mime
View raw message