简体   繁体   English

如何将消息从Mule批量发送到ActiveMQ

[英]How to send messages from Mule to ActiveMQ in batches

In mule I have a flow that receive an InputStream with a 500mb xml file. 在m子中,我有一个流,它接收带有500mb xml文件的InputStream。

I want to split the xml file following certain rules. 我想按照某些规则拆分xml文件。

The result is 390000 messages that I need to send to an ActiveMQ queue. 结果是我需要发送到ActiveMQ队列的390000条消息。

ActiveMQ will give an outofmemory exception if I send all messages in one transaction. 如果我在一个事务中发送所有消息,ActiveMQ将给出内存不足的异常。

If I don't use transaction it will succeed but it will be much slower. 如果我不使用事务,它将成功,但是会慢得多。

What's the best way to send the messages in batches of 1000? 批量发送消息的最佳方法是什么?

Can I use standard components? 我可以使用标准组件吗?

I am using ActiveMQ 5.13 and Mule 3.7 我正在使用ActiveMQ 5.13和Mule 3.7

Thanks 谢谢

I think what you are looking for batch commits doc here . 我认为您在这里寻找批处理提交文档 This component will execute the internal flow components once he collected the specified numbers of records. 一旦他收集了指定数量的记录,此组件将执行内部流程组件。 Example: 例:

<batch:commit size="100" doc:name="Batch Commit">
    <!-- Put here all the message processor you want for example the active mq one -->
</batch:commit>

Please note that transaction are allowed only at step level and therefore also in the commit block that I think this is exactly what are you looking for. 请注意,仅在步骤级别才允许事务,因此在提交块中,我认为这正是您要查找的内容。

Footnote: Batch commit processor is allowed only inside a batch step. 脚注:批处理处理器只能在批处理步骤中使用。

Hope this helps 希望这可以帮助

Regards 问候

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

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