You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Stefan Burkard <sb...@gmail.com> on 2012/03/26 13:19:23 UTC

How to handle attachments in JMS message

Hi all

Camels DefaultMessage has an attachment map and CXFs message also
knows attachments. But a JMS message does not know about attachments.

I have an mtom-enabled SOAP service that sends an object along with
file attachments (mtom to serialize attachments as binary data instead
of base64). I consume these messages with CXF to get a Camel Exchange
for further processing. But how would I handle the attachments to put
the messages on a plain JMS-queue?

Is there any standard way or a recommendation how to handle file
attachments in JMS messages?

I can of course marshal and unmarshal the messages with JAXB, but then
the attachments are serialized as base64.

Thanks
Stefan

Re: How to handle attachments in JMS message

Posted by Stefan Burkard <sb...@gmail.com>.
Thanks for your answers!

I consume the SOAP-mtom-messages with CXF endpoint and then marshal
the message with JAXB (to work without CXF for further processing and
queueing). The attachments are then embedded as base64 in the message
body, I guess due to the Annotation
@XmlMimeType("application/octet-stream") on the DataHandler fields
that is needed for SOAP-mtom. Since the attachments are quite small
this is not a big deal. I am new to all this stuff and I was wondering
if there is a best practice way to do attachments in JMS.

Perhaps I could "register" an AttachmentMarshaller for JAXB to have
them embedded as binary data... need to check this out later.

@Carl: it didn't found a maximum size for property values in the spec,
but ActiveMQ seems to allow 65k for String values.

Thanks
Stefan



On Mon, Mar 26, 2012 at 18:07, Christian Schneider
<ch...@die-schneider.net> wrote:
> I guess you can use SOAP and MTOM with JMS (have not tried it though). The
> question is how big your attachment is and if it would be better to
> transport it outside JMS
>
> Christian
>
> Am 26.03.2012 16:11, schrieb David Karlsen:
>
>> Doesn't the ws-spec cover this in some way? As JMS is one possible
>> transport?
>>
>> 2012/3/26 Claus Ibsen<cl...@gmail.com>:
>>>
>>> Hi
>>>
>>> The JMS data model is
>>> - body
>>> - headers / properties
>>>
>>> You can read how Camel maps to this from the Camel JMS wiki page
>>> http://camel.apache.org/jms
>>>
>>> And JMS have limitations what data type you can send, especially for
>>> its properties.
>>>
>>> So for attachments, you must transfer that in a way that is supported by
>>> JMS.
>>> Either in the body itself as a bytes message.
>>> Or somehow encode it and attach as a property. I can't recall if there
>>> is some limitations on the length of JMS properties. But I would
>>> assume.
>>> Check the JMS spec and/or JMS javadoc.
>>> http://docs.oracle.com/javaee/6/api/javax/jms/Message.html
>>>
>>>
>>> Some message brokers have special support for large payloads (out of
>>> bands), and allow to transfer the big data using other means
>>> such as over HTTP / FTP / SCP etc. So that could be an alternative for
>>> very large data. But I do not think its so very commonly used.
>>>
>>>
>>> On Mon, Mar 26, 2012 at 1:19 PM, Stefan Burkard<sb...@gmail.com>
>>>  wrote:
>>>>
>>>> Hi all
>>>>
>>>> Camels DefaultMessage has an attachment map and CXFs message also
>>>> knows attachments. But a JMS message does not know about attachments.
>>>>
>>>> I have an mtom-enabled SOAP service that sends an object along with
>>>> file attachments (mtom to serialize attachments as binary data instead
>>>> of base64). I consume these messages with CXF to get a Camel Exchange
>>>> for further processing. But how would I handle the attachments to put
>>>> the messages on a plain JMS-queue?
>>>>
>>>> Is there any standard way or a recommendation how to handle file
>>>> attachments in JMS messages?
>>>>
>>>> I can of course marshal and unmarshal the messages with JAXB, but then
>>>> the attachments are serialized as base64.
>>>>
>>>> Thanks
>>>> Stefan
>>>
>>>
>>>
>>> --
>>> Claus Ibsen
>>> -----------------
>>> CamelOne 2012 Conference, May 15-16, 2012: http://camelone.com
>>> FuseSource
>>> Email: cibsen@fusesource.com
>>> Web: http://fusesource.com
>>> Twitter: davsclaus, fusenews
>>> Blog: http://davsclaus.blogspot.com/
>>> Author of Camel in Action: http://www.manning.com/ibsen/
>>
>>
>>
>
>
> --
> Christian Schneider
> http://www.liquid-reality.de
>
> Open Source Architect
> Talend Application Integration Division http://www.talend.com
>

Re: How to handle attachments in JMS message

Posted by Christian Schneider <ch...@die-schneider.net>.
I guess you can use SOAP and MTOM with JMS (have not tried it though). 
The question is how big your attachment is and if it would be better to 
transport it outside JMS

Christian

Am 26.03.2012 16:11, schrieb David Karlsen:
> Doesn't the ws-spec cover this in some way? As JMS is one possible transport?
>
> 2012/3/26 Claus Ibsen<cl...@gmail.com>:
>> Hi
>>
>> The JMS data model is
>> - body
>> - headers / properties
>>
>> You can read how Camel maps to this from the Camel JMS wiki page
>> http://camel.apache.org/jms
>>
>> And JMS have limitations what data type you can send, especially for
>> its properties.
>>
>> So for attachments, you must transfer that in a way that is supported by JMS.
>> Either in the body itself as a bytes message.
>> Or somehow encode it and attach as a property. I can't recall if there
>> is some limitations on the length of JMS properties. But I would
>> assume.
>> Check the JMS spec and/or JMS javadoc.
>> http://docs.oracle.com/javaee/6/api/javax/jms/Message.html
>>
>>
>> Some message brokers have special support for large payloads (out of
>> bands), and allow to transfer the big data using other means
>> such as over HTTP / FTP / SCP etc. So that could be an alternative for
>> very large data. But I do not think its so very commonly used.
>>
>>
>> On Mon, Mar 26, 2012 at 1:19 PM, Stefan Burkard<sb...@gmail.com>  wrote:
>>> Hi all
>>>
>>> Camels DefaultMessage has an attachment map and CXFs message also
>>> knows attachments. But a JMS message does not know about attachments.
>>>
>>> I have an mtom-enabled SOAP service that sends an object along with
>>> file attachments (mtom to serialize attachments as binary data instead
>>> of base64). I consume these messages with CXF to get a Camel Exchange
>>> for further processing. But how would I handle the attachments to put
>>> the messages on a plain JMS-queue?
>>>
>>> Is there any standard way or a recommendation how to handle file
>>> attachments in JMS messages?
>>>
>>> I can of course marshal and unmarshal the messages with JAXB, but then
>>> the attachments are serialized as base64.
>>>
>>> Thanks
>>> Stefan
>>
>>
>> --
>> Claus Ibsen
>> -----------------
>> CamelOne 2012 Conference, May 15-16, 2012: http://camelone.com
>> FuseSource
>> Email: cibsen@fusesource.com
>> Web: http://fusesource.com
>> Twitter: davsclaus, fusenews
>> Blog: http://davsclaus.blogspot.com/
>> Author of Camel in Action: http://www.manning.com/ibsen/
>
>


-- 
Christian Schneider
http://www.liquid-reality.de

Open Source Architect
Talend Application Integration Division http://www.talend.com


Re: How to handle attachments in JMS message

Posted by David Karlsen <da...@gmail.com>.
Doesn't the ws-spec cover this in some way? As JMS is one possible transport?

2012/3/26 Claus Ibsen <cl...@gmail.com>:
> Hi
>
> The JMS data model is
> - body
> - headers / properties
>
> You can read how Camel maps to this from the Camel JMS wiki page
> http://camel.apache.org/jms
>
> And JMS have limitations what data type you can send, especially for
> its properties.
>
> So for attachments, you must transfer that in a way that is supported by JMS.
> Either in the body itself as a bytes message.
> Or somehow encode it and attach as a property. I can't recall if there
> is some limitations on the length of JMS properties. But I would
> assume.
> Check the JMS spec and/or JMS javadoc.
> http://docs.oracle.com/javaee/6/api/javax/jms/Message.html
>
>
> Some message brokers have special support for large payloads (out of
> bands), and allow to transfer the big data using other means
> such as over HTTP / FTP / SCP etc. So that could be an alternative for
> very large data. But I do not think its so very commonly used.
>
>
> On Mon, Mar 26, 2012 at 1:19 PM, Stefan Burkard <sb...@gmail.com> wrote:
>> Hi all
>>
>> Camels DefaultMessage has an attachment map and CXFs message also
>> knows attachments. But a JMS message does not know about attachments.
>>
>> I have an mtom-enabled SOAP service that sends an object along with
>> file attachments (mtom to serialize attachments as binary data instead
>> of base64). I consume these messages with CXF to get a Camel Exchange
>> for further processing. But how would I handle the attachments to put
>> the messages on a plain JMS-queue?
>>
>> Is there any standard way or a recommendation how to handle file
>> attachments in JMS messages?
>>
>> I can of course marshal and unmarshal the messages with JAXB, but then
>> the attachments are serialized as base64.
>>
>> Thanks
>> Stefan
>
>
>
> --
> Claus Ibsen
> -----------------
> CamelOne 2012 Conference, May 15-16, 2012: http://camelone.com
> FuseSource
> Email: cibsen@fusesource.com
> Web: http://fusesource.com
> Twitter: davsclaus, fusenews
> Blog: http://davsclaus.blogspot.com/
> Author of Camel in Action: http://www.manning.com/ibsen/



-- 
--
David J. M. Karlsen - http://www.linkedin.com/in/davidkarlsen

Re: How to handle attachments in JMS message

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

The JMS data model is
- body
- headers / properties

You can read how Camel maps to this from the Camel JMS wiki page
http://camel.apache.org/jms

And JMS have limitations what data type you can send, especially for
its properties.

So for attachments, you must transfer that in a way that is supported by JMS.
Either in the body itself as a bytes message.
Or somehow encode it and attach as a property. I can't recall if there
is some limitations on the length of JMS properties. But I would
assume.
Check the JMS spec and/or JMS javadoc.
http://docs.oracle.com/javaee/6/api/javax/jms/Message.html


Some message brokers have special support for large payloads (out of
bands), and allow to transfer the big data using other means
such as over HTTP / FTP / SCP etc. So that could be an alternative for
very large data. But I do not think its so very commonly used.


On Mon, Mar 26, 2012 at 1:19 PM, Stefan Burkard <sb...@gmail.com> wrote:
> Hi all
>
> Camels DefaultMessage has an attachment map and CXFs message also
> knows attachments. But a JMS message does not know about attachments.
>
> I have an mtom-enabled SOAP service that sends an object along with
> file attachments (mtom to serialize attachments as binary data instead
> of base64). I consume these messages with CXF to get a Camel Exchange
> for further processing. But how would I handle the attachments to put
> the messages on a plain JMS-queue?
>
> Is there any standard way or a recommendation how to handle file
> attachments in JMS messages?
>
> I can of course marshal and unmarshal the messages with JAXB, but then
> the attachments are serialized as base64.
>
> Thanks
> Stefan



-- 
Claus Ibsen
-----------------
CamelOne 2012 Conference, May 15-16, 2012: http://camelone.com
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/