Camel ActiveMQ Artemis大消息

wvyml7n5  于 11个月前  发布在  Apache
关注(0)|答案(1)|浏览(103)

有没有办法在服务器端禁用或更改minLargeMessageSize?我有ActiveMQ Artemis 2.19和带有JMS组件(ActiveMQJMSConnectionFactory)的Camel客户端。设置属性minLargeMessageSize没有帮助。每一条消息都有一个大的消息标签。
我试过:
1.正在设置接受器minLargeMessageSize的属性。
1.从客户端设置JMS连接的minLargeMessageSize属性。
1.设置factory.setMinLargeMessageSize(1000000)也没有帮助。
1.使用ActiveMQConnectionFactory代替ActiveMQJMSConnectionFactory
我想发送一个10MB的文件,而不使用“大”消息。
这是我的测试路线:

<bean id="artemisConnectionFactory" class="org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory">
    <argument index="0" value="tcp://IP:61616"/>
    <argument index="1" value="login"/>
    <argument index="2" value="pass"/>
    <property name="minLargeMessageSize" value="99999999"/>
</bean>

<bean id="jms" class="org.apache.camel.component.jms.JmsComponent">
    <property name="connectionFactory" ref="artemisConnectionFactory"/>
</bean>

<camelContext id="test-broker" xmlns="http://camel.apache.org/schema/blueprint">
    <route>
        <from uri="file:///home/dev/files"/>
        <to uri="jms:test_queue"/>
    </route>

    <route>
    <from uri="jetty:http://0.0.0.0:8182/testbroker"/>
        <pollEnrich timeout="10">
            <simple>jms:test_queue</simple>
        </pollEnrich>
    </route>
</camelContext>

字符串
仅字节类型失败并出现错误。

polhcujo

polhcujo1#

我认为问题出在spring-jms(5.1.2.RELEASE)中,它在сamel-jms中使用
我能够在没有camel的情况下重现问题

JmsTemplate jmsTemplate = new JmsTemplate();
    ActiveMQConnectionFactory cf = new ActiveMQConnectionFactory("tcp://localhost:61616");
    jmsTemplate.setConnectionFactory(cf);
    Message message = jmsTemplate.receive("TEST_QUEUE");
    BytesMessage bytesMessage = (BytesMessage) message;
    int TEXT_LENGTH = new Long(bytesMessage.getBodyLength()).intValue();
    byte[] textBytes = new byte[TEXT_LENGTH];
    bytesMessage.readBytes(textBytes, TEXT_LENGTH);
    FileOutputStream fos = new FileOutputStream("src\\test.pdf");
    fos.write(textBytes);
    fos.close();

字符串
队列TEST_QUEUE包含类型为bytes的消息,当我尝试读取消息时:

Exception in thread "main" java.lang.RuntimeException: AMQ219023: The large message lost connection with its session, either because of a rollback or a closed session
    at org.apache.activemq.artemis.core.client.impl.ClientLargeMessageImpl.getBodyBuffer(ClientLargeMessageImpl.java:93)
    at org.apache.activemq.artemis.jms.client.ActiveMQBytesMessage.readBytes(ActiveMQBytesMessage.java:226)
    at org.apache.camel.learn.SpringJms.main(SpringJms.java:25)
Caused by: ActiveMQIllegalStateException[errorType=ILLEGAL_STATE message=AMQ219023: The large message lost connection with its session, either because of a rollback or a closed session]
    at org.apache.activemq.artemis.core.client.impl.LargeMessageControllerImpl.saveBuffer(LargeMessageControllerImpl.java:273)
    at org.apache.activemq.artemis.core.client.impl.ClientLargeMessageImpl.checkBuffer(ClientLargeMessageImpl.java:159)
    at org.apache.activemq.artemis.core.client.impl.ClientLargeMessageImpl.getBodyBuffer(ClientLargeMessageImpl.java:91)
    ... 2 more


artemis-jms-client-all/2.7.0
Artemis broker 2.7.0
我不认为它的版本依赖-我尝试了 Camel 3与经纪人2.20+和它是一样的
UPD:
@justin-bertram关于你的最后一条评论
https://github.com/tim08/camel_pollenrich_problem
如何用途:移动文件(我用了4 mb)到src/data文件夹,向localhost:8081/test发出get请求
第一个问题:参数MinLargeMessageSize x1c 0d1x无效
第二个问题:AMQ 219023:由于回滚或关闭的会话,大邮件失去了与其会话的连接-当pollenrich
我使用的是最新版本的Apache Camel和Artemis Broker
顺便说一句,当我使用https://camel.apache.org/components/2.x/sjms-component.html-时,它可以正常工作,没有错误

相关问题