0

Is there any way to disable or change minLargeMessageSize on server side? I have ActiveMQ Artemis 2.19 and Camel client with JMS component (ActiveMQJMSConnectionFactory). Setting property minLargeMessageSize does not help. Every message is sent has large message tag.

I tried:

  1. Setting property for acceptor minLargeMessageSize.
  2. Setting minLargeMessageSize property for JMS connection from the client side.
  3. Setting factory.setMinLargeMessageSize(1000000) also does not help.
  4. Using ActiveMQConnectionFactory instead of ActiveMQJMSConnectionFactory.

I want to send a 10MB file without using a "large" message.

This is my test route:

<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>

Only bytes type fails with error.

Thaideval
  • 1
  • 1
  • What happens if you set the `minLargeMessageSize` to something really large like `9999999`? You should be able to set this on the URL of the JMS connection (e.g. `tcp://host:61616?minLargeMessageSize=9999999`). – Justin Bertram Jul 18 '23 at 14:07
  • If i set it to realy large on client side - i have an error telling that i have to increase minLargeMessageSize on server side. I will post text later – Thaideval Jul 18 '23 at 15:09
  • BTW, why do you want to avoid sending the message as "large"? Large message support is designed, at least in part, to conserve memory on the broker so it doesn't run out. A "large" message is sent in chunks and streamed to disk rather than stored completely in memory. – Justin Bertram Jul 18 '23 at 15:21
  • addressing the why - because i have a problem with pollEnrich - "AMQ119023: The large message lost connection with its session, either because of a rollback or a closed session". BTW. It seems that some types of data - like Bytes always uses large message. Is that true? – Thaideval Jul 18 '23 at 16:32
  • Here is less than 100K and its Large message ![screenshot](https://skr.sh/sKsFTHDUsx4). – Thaideval Jul 18 '23 at 16:36
  • The code `119023` hasn't been used for that message since ActiveMQ Artemis 2.6.3 which was released in September 2018 almost 5 years ago now. I **strongly** recommend you upgrade. Your problem sounds very similar to https://stackoverflow.com/questions/59651341/polling-byte-large-messages-from-activemq-artemis-using-apache-camel-consumert which I was never able to get to the bottom of. I wonder if upgrading would help. Please try it out and let me know. – Justin Bertram Jul 18 '23 at 19:17
  • Technically speaking, all messages are ultimately just an array of bytes. There is no kind of message that is always treated as "large." The only time a message should be treated as large is if it exceeds the `minLargeMessageSize` configured on the client. – Justin Bertram Jul 18 '23 at 19:19
  • hmm.. i am pretty sure i have 2.19. i will double check. followng old topic - https://stackoverflow.com/questions/59651341/polling-byte-large-messages-from-activemq-artemis-using-apache-camel-consumert - i saw it and fow now - i was not able to use Byte[]. – Thaideval Jul 19 '23 at 07:10
  • This is my versions now: Artemis 2.26.0 Hawtio 2.15.0 Hawtio Core 4.16.1 Hawtio Integration 5.0.1 Hawtio OAuth 4.13.8 – Thaideval Jul 19 '23 at 07:33
  • Two messages in queue. first - test with 6MB. Second bytes with 3.5MB https://skr.sh/sKt7xvVUost Only bytes type falls with error. Added my route from client to the question – Thaideval Jul 19 '23 at 07:37
  • Are you using 2.26.0 on the server or the client or both? The error message you shared indicates you're using at most 2.6.3 on the client. – Justin Bertram Jul 19 '23 at 14:53
  • Can you provide a [minimal, reproducible example](https://stackoverflow.com/help/minimal-reproducible-example)? For example, a small project on GitHub that I can pull down and execute to reproduce this problem. – Justin Bertram Jul 19 '23 at 16:50
  • I tried artemis-jms-client 2.26.0+ camel 3.21.0 / artemis-jms-client 2.7.0 + camel 2.23.2 – Thaideval Jul 20 '23 at 07:36

1 Answers1

0

i think the problem is in spring-jms(5.1.2.RELEASE) which is used in сamel-jms

I was able to reproduce the issue without 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();

queue TEST_QUEUE contains a message with the type bytes and when i try to read the message:

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

I don't think it's version dependent - i tried on camel 3 with broker 2.20+ and it was the same

UPD:

@justin-bertram about your last comment

https://github.com/tim08/camel_pollenrich_problem

how to use: move the file (I used 4mb) to src/data folder, make a get request to localhost:8081/test

first problem: not working parameter MinLargeMessageSize enter image description here

second problem: AMQ219023: The large message lost connection with its session, either because of a rollback or a closed session - when pollenrich

I used the latest versions apache camel and artemis broker

by the way when I used https://camel.apache.org/components/2.x/sjms-component.html- it worked without errors

tim08
  • 25
  • 5