activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "James Strachan" <james.strac...@gmail.com>
Subject Re: MimeBodyPart attachment
Date Tue, 22 Jan 2008 10:37:55 GMT
On 16/01/2008, LeeZ01 <lee.zhou@us.usana.com> wrote:
>
> I need to send email with attachment from producer server to a consumer
> server.  On the producer server, a file (PDF, MS Doc, etc.) is loaded as
> attachment, together with addressTo, addressFrom, subject, etc. are sent to
> ActiveMQ.  The consumer server needs to grab all those contents, forms a
> javax.mail.Message object, and transport that mail message to its
> destinations.
>
> On the producer server side, I have MyMessage like:
>
> public class MyMessage implements Serializable {
>     static final long serialVersionUID = 4916853063597487545L;
>     private String addressTo;
>     private String addressFrom;
>     private String text;
>     private byte[] attachment;
>     private String subject;
>     private Vector cc;
>     //Bean methods follows.
> }
> Is it okey to load the file into the byte[] array attachment and send the
> object to ActiveMQ?

You could yes. Given its Serializable, you could use an ObjectMessage ?

> If okey, could someone show me code snipet on the consumer server side to
> form a MultiPart java mail message using MyMessage bean?

MyMessage message = (MyMessage) objectMessage.getObject();

-- 
James
-------
http://macstrac.blogspot.com/

Open Source Integration
http://open.iona.com

Mime
View raw message