简体   繁体   中英

Mule ESB: component and message source in one thing

I'd like to implement a flow in Mule that gets a message and returns multiple messages, not just one. However, I don't want to return a collection. I want the output messages to be sent out one-by-one. What I have in mind is something like a message source that is activated by receiving a message.

An example flow would be something like this:

message [a bunch of values for some SQL placeholders] -->

--> VM inbound-endpoint -->

--> Custom DB component/connector
(which executes an SQL query with the information from the inbound message)
"a new message is generated for each row returned by the SELECT query" -->

--> VM outbound-enpoint

The first thought I had was to write a component that implements both MessageSource and Callable interfaces. But that doesn't seem to work.

Any idea / suggestions ?

I would rather return a collection and then use Splitter or Foreach to send the items one-by-one. But if you really need a custom processor that takes in a single message and puts out multiple messages, a pretty simple approach would be extending AbstractMessageSequenceSplitter .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM