Mule esb How to use Collection Splitter in 5 minutes
1. Mule ESB
How to use Collection Splitter in 5 minutes
Gennaro Spagnoli - 2016
2. In this tutorial we will be using the collection splitter, which is a component thet splits a
message into separate fragments, then sends these fragments one at a time to the next
message processor in the flow.
As usual, let’s begin creating the http inbound component to trigger the flow
We will be using this component to split the xml provided in input into smallest parts.
The input provided will be the following xml:
Gennaro Spagnoli - 2016
3. Gennaro Spagnoli - 2016
<root>
<actors>
<actor id="1">Robert De Niro</actor>
<actor id="2">Roberto Benigni</actor>
<actor id="3">Al Pacino</actor>
</actors>
<singers>
<singer id="4">Freddie Mercury</singer>
<singer id="5">Gigione</singer>
</singers>
</root>
We want to get the actors splitted in output of the component. To do this, we will confgure
the splitter component in this way:
4. Gennaro Spagnoli - 2016
As always, we will put the Logger component to show the results on the console
Let’s start the server, do the request with postman and get the results
INFO 2016-06-01 12:32:19,735 [[db_test].HTTP_Listener_Configuration.worker.01]
org.mule.api.processor.LoggerMessageProcessor: Robert De Niro
INFO 2016-06-01 12:32:19,735 [[db_test].HTTP_Listener_Configuration.worker.01]
org.mule.api.processor.LoggerMessageProcessor: Roberto Benigni
INFO 2016-06-01 12:32:19,735 [[db_test].HTTP_Listener_Configuration.worker.01]
org.mule.api.processor.LoggerMessageProcessor: Al Pacino
Fantastic!