If the message was sent as a "large" message or converted into a large
message by the broker (e.g. if it exceeded the journal-buffer-size) then it
can be streamed from the broker in chunks via JMS as noted in the
documentation [1]. However, if the message is not "large" then the entire
message will be transferred to the client.


Justin

[1]
https://activemq.apache.org/components/artemis/documentation/latest/large-messages.html#streaming-over-jms

On Tue, Apr 22, 2025 at 4:14 PM Alexej Timonin <alexejtimo...@gmail.com>
wrote:

> Hi!
>
> I'm building a consumer which will be listening on text messages (I've no
> control over producers). I want to protect my consumer such that it does
> not read messages larger than 256KB to avoid crashing due to memory
> limitations. Is there any way in artemis jms client implementation to see
> if a text message is larger than given size without having to load it into
> memory?
>
> My understanding is that it's not possible when reading code of
> ActiveMQTextMessage, specifically doBeforeReceive method, looks like it
> loads the entire message into memory -
>
> https://github.com/apache/activemq-artemis/blob/6f68668c867b23c7468f85c91c96a74136a561ad/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQTextMessage.java#L104
> Is my understanding correct?
>
> Thank you in advance!
>

Reply via email to