Skip to content

ARTEMIS-5483: New option - jmsMaxTextMessageSize #5689

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

AlexejTimonin
Copy link

@AlexejTimonin AlexejTimonin commented May 18, 2025

Adds a new configuration option for Jakarta client consumers. When this configuration is set, the consumer will throw a javax.jms.JMSException on receiving large text(type 3) message that would exceed the specified size (in bytes) when creating javax.jms.TextMessage

jmsMaxTextMessageSize is intended to prevent consumers of javax.jms.TextMessage from crashing due to out-of-memory when receiving messages that are larger than consumers memory.

The configuration is provided as a URL property when establishing a connection to the broker.

Example:
Throw on large text messages exceeding 10MB in size: tcp://localhost:61616?jmsMaxTextMessageSize=10000000

Note:
This option relies on how core client consumer works. When message is above certain size threshold (default 100KB) it will be considered as a large message and be delivered in parts with headers first. With the help of headers we're able to determine the size of the incoming body and reject if it is above jmsMaxTextMessageSize.

If the message is below large message threshold then this option has no real defensive effect since the message will be read into memory anyway.

Adds a new configuration option for Jakarta client consumers. When this
configuration is set, the consumer will throw a javax.jms.JMSException
on receiving large text(type 3) message that would exceed the specified
size (in bytes) when creating javax.jms.TextMessage

jmsMaxTextMessageSize is intended to prevent consumers of
javax.jms.TextMessage from crashing due to out-of-memory when receiving
messages that are larger than consumers memory.

The configuration is provided as a URL property when establishing a
connection to the broker.

Example:
Throw on large text messages exceeding 10MB in size:
tcp://localhost:61616?jmsMaxTextMessageSize=10000000

Note:
This option relies on how core client consumer works. When message is
above certain size threshold (default 100KB) it will be considered as
a large message and be delivered in parts with headers first.
With the help of headers we're able to determine the size of the
incoming body and reject if it is above jmsMaxTextMessageSize.

If the message is below large message threshold then this option has
no real defensive effect since the message will be read into memory anyway.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant