Mavlarn
Mavlarn

Reputation: 3883

Redelivery of JMS message in microserices

I want to know the redelivery of JMS in a microservices.

For example, if I have a microservices system. And I have 2 instances of User service. And have a listener on a destination in user service. It means I have 2 listeners. The listener is like this:

@JmsListener(destination = "order:new", containerFactory = "orderFactory")
@Transactional
public void create(OrderDTO orderDTO) {
    Order order = new Order(orderDTO);
    orderRepository.save(order);
    jmsTemplate.convertAndSend("order:need_to_pay", order);
}

So my question is, how many times a message will be delivered. And if there is some error in this function, and the message will be re-delivered. But I have 2 instances of the service. And on which this message will be delivered?

Upvotes: 0

Views: 61

Answers (1)

Gary Russell
Gary Russell

Reputation: 174759

It's not part of the spec; it depends on the broker configuration how many times it will be delivered; many brokers can be configured to send the message to a dead-letter queue after some number of attempts.

There is no guarantee the redelivery will go to the same instance.

Upvotes: 1

Related Questions