AMQ-5949 Treat maxSendRetries of -1 as infinite.

This commit is contained in:
Timothy Bish 2015-09-02 16:37:13 -04:00
parent 5b2aec5472
commit 505916b927
1 changed files with 4 additions and 1 deletions

View File

@ -82,6 +82,7 @@ public abstract class DestinationBridge implements Service, MessageListener {
return jmsConnector.createReplyToBridge(destination, getConnnectionForConsumer(), getConnectionForProducer());
}
@Override
public void start() throws Exception {
if (started.compareAndSet(false, true)) {
createConsumer();
@ -89,16 +90,18 @@ public abstract class DestinationBridge implements Service, MessageListener {
}
}
@Override
public void stop() throws Exception {
started.set(false);
}
@Override
public void onMessage(Message message) {
int attempt = 0;
final int maxRetries = jmsConnector.getReconnectionPolicy().getMaxSendRetries();
while (started.get() && message != null && attempt <= maxRetries) {
while (started.get() && message != null && (maxRetries == ReconnectionPolicy.INFINITE || attempt <= maxRetries)) {
try {