activemq-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rob Davies <rajdav...@gmail.com>
Subject Re: support for FileMessage?
Date Thu, 16 Nov 2006 10:03:44 GMT
like it! I guess it's already implemented by now :)

On 16 Nov 2006, at 09:01, James Strachan 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/


Mime
View raw message