Discussion:
Inbound message splitter with mulesource 2.0.1
Martin Mulder
2008-08-12 07:16:17 UTC
Permalink
Maybe a stupid question, but I'm new to Mule.

I need an service, which gets a file as input, split the content, and
forward every part to the same service.
After that, it need to assamble all the results together, and send the
response back.

I tried to split the incomming message with an messageSplitter but
can't get ik work.

<xm:message-splitter splitExpression="/objecten/object"
validateSchema="false">
<file:outbound-endpoint path="outbox"/>
</xm:message-splitter>

this results in:

org.mule.module.xml.routing.FilteringXmlMessageSplitter:
splitExpression is /objecten/object
org.mule.module.xml.routing.FilteringXmlMessageSplitter: Non-XML
message payload: class org.mule.transport.file.ReceiverFileInputStream
org.mule.module.xml.routing.FilteringXmlMessageSplitter: Error: nodes
are null

What am I doing wrong?

Needed message flow:

1) message comes in
<Objects>
<object>
<id>1</id>
<name>foo</name>
<object>
<object>
<id>2</id>
<name>bar</name>
</object>
</objects>

2) send a request per object to services 2.
2-1)
in:
<object>
<id>1</id>
<name>foo</name>
</object>
out:
<object>
<id>1</id>
<name>foo</name>
<data>foo data</data>
</object>

2-2)
in:
<object>
<id>2</id>
<name>bar</name>
</object>
out:
<object>
<id>2</id>
<name>bar</name>
<data>bar data</data>
</object>

3) Response
out:
<objects>
<object>
<id>1</id>
<name>foo</name>
<data>foo data</data>
</object>
<object>
<id>2</id>
<name>bar</name>
<data>bar data</data>
</object>
</object>

Met vriendelijke groet,

Martin Mulder

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email
David Dossot
2008-08-12 14:37:00 UTC
Permalink
Have you tried using "/Objects/object" instead of "/objecten/object"? Your
root element is named "Objects" and not "objecten".

D.



On Tue, Aug 12, 2008 at 12:16 AM, Martin Mulder <
Post by Martin Mulder
Maybe a stupid question, but I'm new to Mule.
I need an service, which gets a file as input, split the content, and
forward every part to the same service.
After that, it need to assamble all the results together, and send the
response back.
I tried to split the incomming message with an messageSplitter but
can't get ik work.
<xm:message-splitter splitExpression="/objecten/object"
validateSchema="false">
<file:outbound-endpoint path="outbox"/>
</xm:message-splitter>
splitExpression is /objecten/object
org.mule.module.xml.routing.FilteringXmlMessageSplitter: Non-XML
message payload: class org.mule.transport.file.ReceiverFileInputStream
org.mule.module.xml.routing.FilteringXmlMessageSplitter: Error: nodes
are null
What am I doing wrong?
1) message comes in
<Objects>
<object>
<id>1</id>
<name>foo</name>
<object>
<object>
<id>2</id>
<name>bar</name>
</object>
</objects>
2) send a request per object to services 2.
2-1)
<object>
<id>1</id>
<name>foo</name>
</object>
<object>
<id>1</id>
<name>foo</name>
<data>foo data</data>
</object>
2-2)
<object>
<id>2</id>
<name>bar</name>
</object>
<object>
<id>2</id>
<name>bar</name>
<data>bar data</data>
</object>
3) Response
<objects>
<object>
<id>1</id>
<name>foo</name>
<data>foo data</data>
</object>
<object>
<id>2</id>
<name>bar</name>
<data>bar data</data>
</object>
</object>
Met vriendelijke groet,
Martin Mulder
---------------------------------------------------------------------
http://xircles.codehaus.org/manage_email
Andrew Perepelytsya
2008-08-12 15:22:19 UTC
Permalink
ReceiverFileInputStream is being passed in. AFAIR filters didn't support
streaming. There was some recent work on this, though not sure if xml
splitter was touched.

Andrew
David Dossot
2008-08-12 15:38:23 UTC
Permalink
The FilteringXmlMessageSplitter (in 2.0.2) uses
XMLUtils.toDocument(payload), which accepts streams, to build the DOM on
which the split expression will be applied. It looks like there is
reasonable hope this can work (the devil being in the details).

Maybe Martin could run Mule at debug level and attach the log? It is always
a very instructive and entertaining reading ;-)

D.
Post by Andrew Perepelytsya
ReceiverFileInputStream is being passed in. AFAIR filters didn't support
streaming. There was some recent work on this, though not sure if xml
splitter was touched.
Andrew
Maurice Zeijen
2008-08-13 06:52:33 UTC
Permalink
Hey Martin,

Maybe the Smooks for Mule module could be a solution for you. It provides a
splitter router for which splitting small, large or huge XML documents is a
breeze. Take a look at http://www.mulesource.org/display/SMOOKS/Home. We
provide an example where a basic split and routing operation is shown.

Regards,

Maurice
Post by David Dossot
The FilteringXmlMessageSplitter (in 2.0.2) uses
XMLUtils.toDocument(payload), which accepts streams, to build the DOM on
which the split expression will be applied. It looks like there is
reasonable hope this can work (the devil being in the details).
Maybe Martin could run Mule at debug level and attach the log? It is always
a very instructive and entertaining reading ;-)
D.
Post by Andrew Perepelytsya
ReceiverFileInputStream is being passed in. AFAIR filters didn't support
streaming. There was some recent work on this, though not sure if xml
splitter was touched.
Andrew
Maurice Zeijen
2008-08-13 08:56:15 UTC
Permalink
Hey Martin,

I want to emphasize that with Smooks you can do multiple concurrent splits,
transforms to different formats (Java, XML, Other etc) and
conditional/content based routing of the splitted+transformed messages.

Maurice
Post by Maurice Zeijen
Hey Martin,
Maybe the Smooks for Mule module could be a solution for you. It provides a
splitter router for which splitting small, large or huge XML documents is a
breeze. Take a look at http://www.mulesource.org/display/SMOOKS/Home. We
provide an example where a basic split and routing operation is shown.
Regards,
Maurice
Post by David Dossot
The FilteringXmlMessageSplitter (in 2.0.2) uses
XMLUtils.toDocument(payload), which accepts streams, to build the DOM on
which the split expression will be applied. It looks like there is
reasonable hope this can work (the devil being in the details).
Maybe Martin could run Mule at debug level and attach the log? It is
always a very instructive and entertaining reading ;-)
D.
Post by Andrew Perepelytsya
ReceiverFileInputStream is being passed in. AFAIR filters didn't support
streaming. There was some recent work on this, though not sure if xml
splitter was touched.
Andrew
Loading...