Gary Sharpe
Gary Sharpe

Reputation: 2431

Can you use a Mule ESB Collection Splitter to on a HashMap?

Can you use a Collection Splitter to split a HashMap resulting in messages identified by the key and containing the value in the payload? For example, I have a Map<String, List<Object>>, and I would like to process each list differently based on the key. If this is possible, I'm assuming the list would be mapped to the payload, but how would the key be mapped to the resulting message? As a message header?

Upvotes: 1

Views: 625

Answers (1)

You could split on the entry set of the hash map. I.E use the following as split expression

#[mayMap.entrySet()]

Please see the javadoc for that method to understand how to get the key and the value from each entry.

Upvotes: 4

Related Questions