Pergunta

I have two questions about JMS:

1) What happens when the queue is down and the publisher is trying to send a message. What error I am going to get?

2) What happends when message is avaiable but the consumer is not? Will the message wait indefinitely until it is consumed?

Foi útil?

Solução

1) Generally, you can expect some form of (runtime) connection exception as your code (assume Java) is trying to connect to your JMS broker. The exact exception will depend largely on any frameworks you use (i.e. Spring). You'd need to decide what to do in this scenario (i.e. throw exception back to client). One option could be to cache the message to be published and attempt it a certain time intervals, if the client is not concerned with the actual moment the message is published.

2) Nothing, your message will just sit in the queue until something deletes it. This could be a consumer after a successful listen and process, or it could be the broker (I think there is a JMS property called time-to-live which can be set when publishing so that the message would disappear after that time if not consumed).

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top