使用骆驼JMS流式传输

使用骆驼JMS流式传输

本文介绍了使用骆驼JMS流式传输的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个将消息放入JMS队列的应用程序.消息大小最大为150 mb. JMS消息包含带有附加元数据作为xml的字节数组数据,一旦将消息放入队列中,骆驼路由应用程序选择了该消息,并使用该消息调用外部Java api.我想使用骆驼jms从JMS队列中流式传输消息零件.你能告诉我我能不能用骆驼来实现.目前,我面临堆错误问题.

I have a application which places message in JMS Queue.The message size can be upto 150 mb. JMS message contains byte array data with additional metadata as xml,once the message is placed in queue the camel route application picks the message and calls the external java api with the message.i would like to stream the message from the JMS Queue using camel jms component.Can you please tell me if i can acheive it using camel.Currently i am facing heap error issue.

示例JMS消息如下.

<request>
    <esb-metadata>
        <source-transaction-id>1234567890</source-transaction-id>
        <environment>Dev</environment>
        <message-type>REQ</message-type>
        <source-id>12345678</source-id>
        <master-id>mst-id1234</master-id>
    </esb-metadata>
    <message-body>
        <parameters>
            <info>
                <document-class>Document</document-class>

                <document-guid>idd_C0A5DF59-0000-C51C-BCDA-E76E9476D5C2</document-guid>
            </info>
        </parameters>
        <document>
            <document-mime-type>std/text</document-mime-type>
            <document-content>SGVhZGluZzEgQ2hhbmdlZCB0b2RheSBKYW4gMTEgc2FtcGxlIHRleHQgYmVsb3csDQpPbmNlIEkg
cmVjZWl2ZSB0aGlzIGluZm9ybWF0aW9uLCBJIHdpbGwgdGhlbiBjb250YWN0IHlvdSBpbW1lZGlh
dGVseSB0byBkaXNjdXNzIHRoZSByZXNvbHV0aW9uIG9mIHlvdXIgY2xhaW0uDQoNCg0KSGVhZGlu
ZzIgc2FtcGxlIHRleHQsDQpJZiBwb3NzaWJsZSwgSSBuZWVkIHRvIHJlY2VpdmUgdGhpcyBpbmZv
cm1hdGlvbiBmcm9tIHlvdSB3aXRoaW4gMzAgRGF5cy4NCg0KMQkxCTENCjIJMgkyDQozCTMJMw0K
NAk0CTQNCg0KSGVhZGluZzMgc2FtcGxlIHRleHQsDQpJIHdpbGwgYXNzdW1lIHlvdSBkbyBub3Qg
d2lzaCB0byBwdXJzdWUgdGhpcyBjbGFpbSBhbmQgSSB3aWxsIGNsb3NlIG15IGZpbGUuDQpBRERF
RCBUSElTIE5FVyBMSU5FIFRPIFNFRSBJRiBJVCBJUyBWSVNJQkxFDQoNCnRhYmxlIHN0YXJ0cyBo
ZXJlDQpwb2xpY3kgbnVtYmVyCWNsYWltIG51bWJlcglpbnN1cmVkDQpwMTIzCWMxMjMJYm9zY2gN
CnAzMjEJYzMyMQlibXcNCnRhYmxlIGVuZHMgaGVyZQ0KDQomIzk2Nzk7CUJ1bGxldCBwb2ludCAx
DQomIzk2Nzk7CUJ1bGxldCBwb2ludCAyDQomIzk2Nzk7CUJ1bGxldCBwb2ludCAzDQoNCjEuCU51
bWJlcmVkIHBvaW50IDENCjIuCU51bWJlcmVkIHBvaW50IDINCjMuCU51bWJlcmVkIHBvaW50IDMN
Cg==        </document-content>
        </document>
    </message-body>
</request>

推荐答案

HornetQ支持流大消息,因此客户端不必担心达到内存限制.这种支持在HornetQ JMS实现中有效,但是JMS API不直接支持流式传输大消息,因此标准JMS组件(例如Camel提供的组件)可能不适用于此用例.您需要使用专门为支持HornetQ实现而编写的组件.您可以在文档.

HornetQ has support for streaming large messages so that clients don't have to worry about hitting memory limits. This support works in the HornetQ JMS implementation, but the JMS API doesn't directly support streaming large messages so a standard JMS component (e.g. one that Camel provides) likely won't work for this use-case. You'd need to use a component written to support the HornetQ implementation specifically. You can read about how HornetQ JMS clients can stream large messages in the documentation.

这篇关于使用骆驼JMS流式传输的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-24 22:42