Domenico is right. Using JmsTemplate will create a connection, session, &
producer for *every* message sent. This is a significant anti-pattern
discussed here [1] and here [2].


Justin

[1]
http://activemq.apache.org/components/artemis/documentation/latest/perf-tuning.html#avoiding-anti-patterns
[2] https://activemq.apache.org/jmstemplate-gotchas

On Wed, Mar 25, 2020 at 8:43 PM brusdev <bruscin...@gmail.com> wrote:

> Hi,
>
> the JmsTemplate creates a new session for each message to send, according
> to
> its source[1].
> So in the broker log you can find the lines relative the session creating
> and the message sending for each of the 5 messages sent by
> `sender.sendmessages`.
>
> [1]
>
> https://github.com/spring-projects/spring-framework/blob/v5.1.7.RELEASE/spring-jms/src/main/java/org/springframework/jms/core/JmsTemplate.java#L495
>
> Regards,
> Domenico
>
>
>
> --
> Sent from:
> http://activemq.2283324.n4.nabble.com/ActiveMQ-User-f2341805.html
>
>

Reply via email to