Hi Freeman
From my understanding, BinaryFileMarshaler responsability is just to make File
BC to use NormalizedMessage attachment instead of content. This appears to me
that this marshaler has no direct link with cluster feature.
On the other hand, ClusterEngine serializes entire NormalizedMessage (including
content, attachments and properties) when sending NormalizedMessage to JMS
queue (ClusterEngine.processExchange send JMS ObjectMessage). I don't
understand how I can customize NormalizedMessage serialization from
ClusterEngine, as no marshaler or other extension point seems to be used here
:-(
For information, here is complete stack trace from ClusterEngine when using
attachment with BinaryFileMarshaler:
java.lang.RuntimeException: javax.activation.DataHandler
at
org.apache.activemq.command.ActiveMQObjectMessage.storeContent(ActiveMQObjectMessage.java:111)[46:org.apache.activemq.activemq-core:5.4.1.fuse-01-00]
at
org.apache.activemq.command.ActiveMQObjectMessage.setObject(ActiveMQObjectMessage.java:162)[46:org.apache.activemq.activemq-core:5.4.1.fuse-01-00]
at
org.apache.activemq.ActiveMQSession.createObjectMessage(ActiveMQSession.java:380)[46:org.apache.activemq.activemq-core:5.4.1.fuse-01-00]
at
org.apache.activemq.pool.PooledSession.createObjectMessage(PooledSession.java:153)[50:org.apache.activemq.activemq-pool:5.4.1.fuse-01-00]
at
org.apache.servicemix.jbi.cluster.engine.ClusterEngine.processExchange(ClusterEngine.java:739)[101:org.apache.servicemix.jbi.cluster.engine:1.3.0.fuse-02-00]
at
org.apache.servicemix.jbi.cluster.engine.ClusterEngine.process(ClusterEngine.java:570)[101:org.apache.servicemix.jbi.cluster.engine:1.3.0.fuse-02-00]
at
org.apache.servicemix.nmr.core.InternalEndpointWrapper.process(InternalEndpointWrapper.java:86)[84:org.apache.servicemix.nmr.core:1.3.0.fuse-02-00]
at
org.apache.servicemix.nmr.core.ChannelImpl.process(ChannelImpl.java:255)[84:org.apache.servicemix.nmr.core:1.3.0.fuse-02-00]
at
org.apache.servicemix.nmr.core.ChannelImpl$1.run(ChannelImpl.java:215)[84:org.apache.servicemix.nmr.core:1.3.0.fuse-02-00]
at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)[:1.6.0_24]
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)[:1.6.0_24]
at java.lang.Thread.run(Thread.java:662)[:1.6.0_24]
Caused by: java.io.NotSerializableException: javax.activation.DataHandler
at
java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1164)[:1.6.0_24]
at
java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:330)[:1.6.0_24]
at java.util.HashMap.writeObject(HashMap.java:1001)[:1.6.0_24]
at sun.reflect.GeneratedMethodAccessor58.invoke(Unknown Source)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)[:1.6.0_24]
at java.lang.reflect.Method.invoke(Method.java:597)[:1.6.0_24]
at
java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:945)[:1.6.0_24]
at
java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1469)[:1.6.0_24]
at
java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1400)[:1.6.0_24]
at
java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1158)[:1.6.0_24]
at
java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1518)[:1.6.0_24]
at
java.io.ObjectOutputStream.defaultWriteObject(ObjectOutputStream.java:422)[:1.6.0_24]
at
org.apache.servicemix.nmr.core.MessageImpl.writeObject(MessageImpl.java:362)[84:org.apache.servicemix.nmr.core:1.3.0.fuse-02-00]
at sun.reflect.GeneratedMethodAccessor61.invoke(Unknown Source)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)[:1.6.0_24]
at java.lang.reflect.Method.invoke(Method.java:597)[:1.6.0_24]
at
java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:945)[:1.6.0_24]
at
java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1469)[:1.6.0_24]
at
java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1400)[:1.6.0_24]
at
java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1158)[:1.6.0_24]
at
java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:330)[:1.6.0_24]
at
org.apache.activemq.command.ActiveMQObjectMessage.storeContent(ActiveMQObjectMessage.java:105)[46:org.apache.activemq.activemq-core:5.4.1.fuse-01-00]
... 11 more
________________________________________
De : Freeman Fang [[email protected]]
Date d'envoi : jeudi 10 mars 2011 03:00
À : [email protected]
Objet : Re: RE : Does the cluster engine support attachments?
Hi,
As cluster function is based on jms transport between nodes, so
everything should be "serializable".
For the attachment, I think you need write your Marshaler to make them
"serializable"(such as write to a Byte Array or something), as
Datahandler contain a Source which generally bind to a local resources
and it may be valid on the other node machine, you need ensure the
content of attachment is really sent to another node.
Freeman
On 2011-3-10, at 上午12:33, Pochat Jerome wrote:
> I tried to use release 4.3.0 with following configurations:
>
> Node 1
> ======
> <?xml version="1.0"?>
> <beans xmlns="http://www.springframework.org/schema/beans"
> xmlns:f="http://servicemix.apache.org/file/1.0"
> xmlns:t="urn:test"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xsi:schemaLocation="
> http://www.springframework.org/schema/beans
> http://www.springframework.org/schema/beans/spring-beans.xsd
> http://servicemix.apache.org/file/1.0
> http://servicemix.apache.org/file/1.0/servicemix-file.xsd
> ">
>
> <f:poller id="pollerEndpoint" service="t:File" endpoint="poller"
> targetService="t:File2" targetEndpoint="sender" file="file:inbox">
> <property name="marshaler">
> <bean
> class="org.apache.servicemix.components.util.BinaryFileMarshaler" />
> </property>
> </f:poller>
>
> <bean class="org.apache.servicemix.common.osgi.EndpointExporter" />
> <bean
> class
> =
> "org
> .apache.servicemix.jbi.cluster.engine.OsgiSimpleClusterRegistration">
> <property name="endpoint" ref="pollerEndpoint" />
> </bean>
> </beans>
>
>
> Node 2
> ======
> <?xml version="1.0"?>
> <beans xmlns="http://www.springframework.org/schema/beans"
> xmlns:f="http://servicemix.apache.org/file/1.0"
> xmlns:t="urn:test"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xsi:schemaLocation="
> http://www.springframework.org/schema/beans
> http://www.springframework.org/schema/beans/spring-beans.xsd
> http://servicemix.apache.org/file/1.0
> http://servicemix.apache.org/file/1.0/servicemix-file.xsd
> ">
>
> <f:sender id="senderEndpoint" service="t:File2" endpoint="sender"
> directory="file:outbox">
> <property name="marshaler">
> <bean
> class="org.apache.servicemix.components.util.BinaryFileMarshaler" />
> </property>
> </f:sender>
>
> <bean class="org.apache.servicemix.common.osgi.EndpointExporter" />
> <bean
> class
> =
> "org
> .apache.servicemix.jbi.cluster.engine.OsgiSimpleClusterRegistration">
> <property name="endpoint" ref="senderEndpoint" />
> </bean>
> </beans>
>
>
> Notice that I succeed to exchange XML payload with default marshalers.
>
> Thanks for help.
>
>
>
>
> ________________________________________
> De : Jean-Baptiste Onofré [[email protected]]
> Date d'envoi : mercredi 9 mars 2011 17:22
> À : [email protected]; Pochat Jerome
> Objet : Re: Does the cluster engine support attachments?
>
> Hi Jerome,
>
> Clustering has been completely rewritten in ServiceMix 4.
> I remember that we made some enhancements around the NMR to support
> different
> message payload (POJO, XML, etc) and attachments.
>
> On which version did you make a try ?
> Could you try on ServiceMix 4.3.0 ?
>
> Thanks
> Regards
> JB
>
> On Wed 09/03/11 16:12, "Pochat Jerome" [email protected] wrote:
>> Hi
>>
>> Is there a way to send NormalizedMessage with attachment between
>> ServiceMix nodes?
>>
>> "Out of the box" distribution produces
>> "java.io.NotSerializableException: javax.activation.DataHandler" when
>> trying to store NormalizedMessage into ActiveMQ queue. ServiceMix
>> users mailing list contains some old threads about this issue (3.x),
>> but about latest release (4.x)?
>>
>> Thanks in advance
>>
>>
>>
>
>
--
Freeman Fang
------------------------
FuseSource: http://fusesource.com
blog: http://freemanfang.blogspot.com
twitter: http://twitter.com/freemanfang
Apache Servicemix:http://servicemix.apache.org
Apache Cxf: http://cxf.apache.org
Apache Karaf: http://karaf.apache.org
Apache Felix: http://felix.apache.org