简体   繁体   English

Mule ESB:一件事中的组件和消息源

[英]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. 我想在Mule中实现一个流,该流获取一条消息并返回多条消息,而不仅仅是一条消息。 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. 我首先想到的是编写一个同时实现MessageSourceCallable接口的组件。 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. 我宁愿返回一个集合,然后使用Splitter或Foreach逐个发送项目。 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 . 但是,如果您确实需要一个接受一条消息并发出多条消息的自定义处理器,那么一种很简单的方法就是扩展AbstractMessageSequenceSplitter

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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