JMS message redelivery on exception in JMS listener

后端 未结 1 777
傲寒
傲寒 2021-01-13 15:45

Javadoc for org.springframework.jms.listener.AbstractMessageListenerContainer states, that if

\"sessionAcknowledgeMode\" set to \"CLIENT_

1条回答
  •  北荒
    北荒 (楼主)
    2021-01-13 16:15

    It depends on which listener container you use; when using AUTO ack mode, the SimpleMessageListenerContainer acks after the listener returns (i.e. a traditional JMS MessageListener). The DefaultMessageListenerContainer acks before the listener is invoked, so you need acknowledgeMode="transacted" to prevent message loss.

    The javadocs in this area were a bit misleading and have been improved recently.

    With CLIENT_ACKNOWLEDGE, you're on your own to do the acks. That doc just means you are at the whim of the broker. According to the JMS message javadoc:

    Messages that have been received but not acknowledged may be redelivered

    In my experience it is best to use auto ack with an SMLC and transactions with DMLC.

    0 讨论(0)
提交回复
热议问题