On 1/30/07, Nirav <[EMAIL PROTECTED]> wrote:

Hello,

In my project I added message content in normalize message as message
property but I think it is better to add as attachment,

So, Can you help me how can I add byte[] (byte array) as attachment in
Normalize message!

Now about the NormalizedMessage.addAttachment() method? Below is an
example of adding a byte[]:

// Grab the attachment from somewhere
byte[] attachment = getAttachment();

// Create a NormalizedMessage using the MessageExchange
NormalizedMessage msg = me.createMessage();
msg.setContent(new StringSource("<hello>Hello World! Message</hello>"));
msg.addAttachment("anAttachment", new DataHandler(new
StreamDataSource(new ByteArrayInputStream(attachment))));

// Set the message on the MessageExchange
me.setMessage(msg, "in");

Bruce
--
perl -e 'print unpack("u30","D0G)[EMAIL 
PROTECTED]&5R\"F)R=6-E+G-N>61E<D\!G;6%I;\"YC;VT*"
);'

Apache Geronimo - http://geronimo.apache.org/
Apache ActiveMQ - http://activemq.org/
Apache ServiceMix - http://servicemix.org/
Castor - http://castor.org/

Reply via email to