You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-user@james.apache.org by Ataul Wadood Ahmad <ma...@ahmadsoft.de> on 2007/03/23 09:31:41 UTC

Sending emails to JMS (Java Messaging Service)

Hello,

has somebody experience in sending emails from JAMES to JMS.
The problem is that JavaMail API is in general not serialized and can't be
send to a Messaging Service as an Object. Since I want to establish
asynchronous communication streaming is no option.

I appreciate any help. Thanks.

Ataul


-- 
Ataul W. Ahmad
-Certified Project Management Associate (GPM, IPMA)-
-Sun Certified Java Developer-

email: mail@ahmadsoft.de
Fon: +49 177 829 87 39
Fax: +49 571 398 13 77



---------------------------------------------------------------------
To unsubscribe, e-mail: server-user-unsubscribe@james.apache.org
For additional commands, e-mail: server-user-help@james.apache.org


Re: Sending emails to JMS (Java Messaging Service)

Posted by Ataul Wadood Ahmad <ma...@ahmadsoft.de>.
Hi Stefano,

thank you for your hint. By the way MimeMessage is either not serialized.

I used the workaround to send to a JMS Que (as you proposed):

ByteArrayOutputStream os = new ByteArrayOutputStream();
mimeMessage.writeTo(os);
String content = os.toString();
ObjectMessage mesg = jmsSession.createObjectMessage(content);
jmsSender.send(mesg);

And to read from a JMS Que:

String content = (String)jmsMsg.getObject();
byte[] bytes = content.getBytes();
ByteArrayInputStream bis = new ByteArrayInputStream(bytes);
MimeMessage emailMessage = new MimeMessage(null, bis);

This helps. Thanks.
Ataul

> Well, mimemessages are intended to be serialized. In fact in pop3 and
> smtp service we do that all of the time. Hint:
> MimeMessage.writeTo(OutputStream out) and MimeMessage(InputStream source).
>
> Stefano
>
> Ataul Wadood Ahmad ha scritto:
>> Hello,
>>
>> has somebody experience in sending emails from JAMES to JMS.
>> The problem is that JavaMail API is in general not serialized and can't
>> be
>> send to a Messaging Service as an Object. Since I want to establish
>> asynchronous communication streaming is no option.
>>
>> I appreciate any help. Thanks.
>>
>> Ataul
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: server-user-unsubscribe@james.apache.org
> For additional commands, e-mail: server-user-help@james.apache.org
>
>


-- 
Ataul W. Ahmad
-Certified Project Management Associate (GPM, IPMA)-
-Sun Certified Java Developer-

email: mail@ahmadsoft.de
Fon: +49 177 829 87 39
Fax: +49 571 398 13 77



---------------------------------------------------------------------
To unsubscribe, e-mail: server-user-unsubscribe@james.apache.org
For additional commands, e-mail: server-user-help@james.apache.org


Re: Sending emails to JMS (Java Messaging Service)

Posted by Stefano Bagnara <ap...@bago.org>.
Well, mimemessages are intended to be serialized. In fact in pop3 and 
smtp service we do that all of the time. Hint: 
MimeMessage.writeTo(OutputStream out) and MimeMessage(InputStream source).

Stefano

Ataul Wadood Ahmad ha scritto:
> Hello,
> 
> has somebody experience in sending emails from JAMES to JMS.
> The problem is that JavaMail API is in general not serialized and can't be
> send to a Messaging Service as an Object. Since I want to establish
> asynchronous communication streaming is no option.
> 
> I appreciate any help. Thanks.
> 
> Ataul



---------------------------------------------------------------------
To unsubscribe, e-mail: server-user-unsubscribe@james.apache.org
For additional commands, e-mail: server-user-help@james.apache.org