1

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.

asked Jul 18, 2023 at 13:35
13
  • 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). Commented Jul 18, 2023 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 Commented Jul 18, 2023 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. Commented Jul 18, 2023 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? Commented Jul 18, 2023 at 16:32
  • Here is less than 100K and its Large message !screenshot. Commented Jul 18, 2023 at 16:36

2 Answers 2

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

answered Jul 19, 2023 at 16:54
Sign up to request clarification or add additional context in comments.

1 Comment

exactly my findings
0

I have a couple of workarounds for minLargeMessageSize to work correctly, tested on Camel 3.4.5 and Artemis 2.19.1.

  1. Use SjmsComponent or Sjms2Component (as @tim08 previously noted in his answer - https://stackoverflow.com/a/76723608/4169414)
  2. Use JmsComponent or AMQPComponent, but convert the message body to a string (.convertBodyTo(String.class)) before calling the producer. The message type in this case is text instead of bytes in the Artemis console. enter image description here
answered Jul 23, 2024 at 14:46

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.