I like it..  But I wonder if we can do something to handle streams out
of band in general.  Here's a use case I'm thinking about...

A big file is being posted to a servlet and the servlet wants to pass
that input stream it's receiving to a JMS consumer somewhere in the
back end.  So there is no actual file or URL to identify that stream
but I want to 'pass' the stream to a consumer using JMS routing/load
balancing.  And ideally the contents of the stream would be sent out
band with respect to the JMS network.

It seems to me that if we can handle a case like that, transmitting
URL or File based resources is just a simple case of the above.

Regards,
Hiram

On 11/16/06, James Strachan <[EMAIL PROTECTED]> wrote:
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/



--
Regards,
Hiram

Blog: http://hiramchirino.com

Reply via email to