ARTEMIS-5483: New option - jmsMaxTextMessageSize #5689
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 creatingjavax.jms.TextMessage
jmsMaxTextMessageSize
is intended to prevent consumers ofjavax.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.