ARTEMIS-596 JMS Bridge messages should be identified.

In cases where there are many JMS bridges defined on a broker it should
be possible to identify any error message by a bridge name.
This commit is contained in:
Tom Ross 2016-06-24 14:38:05 +01:00
parent 5c4fab3fcc
commit 5bca681c1a
6 changed files with 95 additions and 88 deletions

View File

@ -48,58 +48,58 @@ public interface ActiveMQJMSBridgeLogger extends BasicLogger {
ActiveMQJMSBridgeLogger LOGGER = Logger.getMessageLogger(ActiveMQJMSBridgeLogger.class, ActiveMQJMSBridgeLogger.class.getPackage().getName()); ActiveMQJMSBridgeLogger LOGGER = Logger.getMessageLogger(ActiveMQJMSBridgeLogger.class, ActiveMQJMSBridgeLogger.class.getPackage().getName());
@LogMessage(level = Logger.Level.INFO) @LogMessage(level = Logger.Level.INFO)
@Message(id = 341000, value = "Failed to set up JMS bridge connections. Most probably the source or target servers are unavailable." + " Will retry after a pause of {0} ms", format = Message.Format.MESSAGE_FORMAT) @Message(id = 341000, value = "Failed to set up JMS bridge {1} connections. Most probably the source or target servers are unavailable." + " Will retry after a pause of {0} ms", format = Message.Format.MESSAGE_FORMAT)
void failedToSetUpBridge(long failureRetryInterval); void failedToSetUpBridge(long failureRetryInterval,String bridgeName);
@LogMessage(level = Logger.Level.INFO) @LogMessage(level = Logger.Level.INFO)
@Message(id = 341001, value = "JMS Bridge Succeeded in reconnecting to servers", format = Message.Format.MESSAGE_FORMAT) @Message(id = 341001, value = "JMS Bridge {0} succeeded in reconnecting to servers", format = Message.Format.MESSAGE_FORMAT)
void bridgeReconnected(); void bridgeReconnected(String bridgeName);
@LogMessage(level = Logger.Level.INFO) @LogMessage(level = Logger.Level.INFO)
@Message(id = 341002, value = "Succeeded in connecting to servers", format = Message.Format.MESSAGE_FORMAT) @Message(id = 341002, value = "JMSBridge {0} succeeded in connecting to servers", format = Message.Format.MESSAGE_FORMAT)
void bridgeConnected(); void bridgeConnected(String bridgeName);
@LogMessage(level = Logger.Level.WARN) @LogMessage(level = Logger.Level.WARN)
@Message(id = 342000, value = "Attempt to start JMS Bridge, but is already started", format = Message.Format.MESSAGE_FORMAT) @Message(id = 342000, value = "Attempt to start JMS Bridge {0}, but is already started", format = Message.Format.MESSAGE_FORMAT)
void errorBridgeAlreadyStarted(); void errorBridgeAlreadyStarted(String bridgeName);
@LogMessage(level = Logger.Level.WARN) @LogMessage(level = Logger.Level.WARN)
@Message(id = 342001, value = "Failed to start JMS Bridge", format = Message.Format.MESSAGE_FORMAT) @Message(id = 342001, value = "Failed to start JMS Bridge {0}", format = Message.Format.MESSAGE_FORMAT)
void errorStartingBridge(); void errorStartingBridge(String bridgeName);
@LogMessage(level = Logger.Level.WARN) @LogMessage(level = Logger.Level.WARN)
@Message(id = 342002, value = "Failed to unregisted JMS Bridge {0}", format = Message.Format.MESSAGE_FORMAT) @Message(id = 342002, value = "Failed to unregisted JMS Bridge {0} - {1}", format = Message.Format.MESSAGE_FORMAT)
void errorUnregisteringBridge(ObjectName objectName); void errorUnregisteringBridge(ObjectName objectName,String bridgeName);
@LogMessage(level = Logger.Level.WARN) @LogMessage(level = Logger.Level.WARN)
@Message(id = 342003, value = "JMS Bridge unable to set up connections, bridge will be stopped", format = Message.Format.MESSAGE_FORMAT) @Message(id = 342003, value = "JMS Bridge {0} unable to set up connections, bridge will be stopped", format = Message.Format.MESSAGE_FORMAT)
void errorConnectingBridge(); void errorConnectingBridge(String bridgeName);
@LogMessage(level = Logger.Level.WARN) @LogMessage(level = Logger.Level.WARN)
@Message(id = 342004, value = "JMS Bridge Will retry after a pause of {0} ms", format = Message.Format.MESSAGE_FORMAT) @Message(id = 342004, value = "JMS Bridge {1}, will retry after a pause of {0} ms", format = Message.Format.MESSAGE_FORMAT)
void bridgeRetry(long failureRetryInterval); void bridgeRetry(long failureRetryInterval,String bridgeName);
@LogMessage(level = Logger.Level.WARN) @LogMessage(level = Logger.Level.WARN)
@Message(id = 342005, value = "JMS Bridge unable to set up connections, bridge will not be started", format = Message.Format.MESSAGE_FORMAT) @Message(id = 342005, value = "JMS Bridge {0} unable to set up connections, bridge will not be started", format = Message.Format.MESSAGE_FORMAT)
void bridgeNotStarted(); void bridgeNotStarted(String bridgeName);
@LogMessage(level = Logger.Level.WARN) @LogMessage(level = Logger.Level.WARN)
@Message(id = 342006, value = "Detected failure on bridge connection", format = Message.Format.MESSAGE_FORMAT) @Message(id = 342006, value = "JMS Bridge {0}, detected failure on bridge connection", format = Message.Format.MESSAGE_FORMAT)
void bridgeFailure(@Cause Exception e); void bridgeFailure(@Cause Exception e,String bridgeName);
@LogMessage(level = Logger.Level.WARN) @LogMessage(level = Logger.Level.WARN)
@Message(id = 342009, value = "JMS Bridge failed to send + acknowledge batch, closing JMS objects", format = Message.Format.MESSAGE_FORMAT) @Message(id = 342009, value = "JMS Bridge {0} failed to send + acknowledge batch, closing JMS objects", format = Message.Format.MESSAGE_FORMAT)
void bridgeAckError(@Cause Exception e); void bridgeAckError(@Cause Exception e,String bridgeName);
@LogMessage(level = Logger.Level.WARN) @LogMessage(level = Logger.Level.WARN)
@Message(id = 342010, value = "Failed to connect JMS Bridge", format = Message.Format.MESSAGE_FORMAT) @Message(id = 342010, value = "Failed to connect JMS Bridge {0}", format = Message.Format.MESSAGE_FORMAT)
void bridgeConnectError(@Cause Exception e); void bridgeConnectError(@Cause Exception e,String bridgeName);
@LogMessage(level = Logger.Level.ERROR) @LogMessage(level = Logger.Level.ERROR)
@Message(id = 344001, value = "Failed to start source connection", format = Message.Format.MESSAGE_FORMAT) @Message(id = 344001, value = "JMS Bridge {0}, failed to start source connection", format = Message.Format.MESSAGE_FORMAT)
void jmsBridgeSrcConnectError(@Cause Exception e); void jmsBridgeSrcConnectError(@Cause Exception e,String bridgeName);
@LogMessage(level = Logger.Level.ERROR) @LogMessage(level = Logger.Level.ERROR)
@Message(id = 344002, value = "Failed to start JMS Bridge. QoS Mode: {0} requires a Transaction Manager, none found", format = Message.Format.MESSAGE_FORMAT) @Message(id = 344002, value = "Failed to start JMS Bridge {1}. QoS Mode: {0} requires a Transaction Manager, none found", format = Message.Format.MESSAGE_FORMAT)
void jmsBridgeTransactionManagerMissing(QualityOfServiceMode qosMode); void jmsBridgeTransactionManagerMissing(QualityOfServiceMode qosMode,String bridgeName);
} }

View File

@ -84,6 +84,8 @@ public final class JMSBridgeImpl implements JMSBridge {
private final Object lock = new Object(); private final Object lock = new Object();
private String bridgeName;
private String sourceUsername; private String sourceUsername;
private String sourcePassword; private String sourcePassword;
@ -193,7 +195,8 @@ public final class JMSBridgeImpl implements JMSBridge {
executor = createExecutor(); executor = createExecutor();
} }
public JMSBridgeImpl(final ConnectionFactoryFactory sourceCff, public JMSBridgeImpl(final String bridgeName,
final ConnectionFactoryFactory sourceCff,
final ConnectionFactoryFactory targetCff, final ConnectionFactoryFactory targetCff,
final DestinationFactory sourceDestinationFactory, final DestinationFactory sourceDestinationFactory,
final DestinationFactory targetDestinationFactory, final DestinationFactory targetDestinationFactory,
@ -211,10 +214,11 @@ public final class JMSBridgeImpl implements JMSBridge {
final String clientID, final String clientID,
final boolean addMessageIDInHeader) { final boolean addMessageIDInHeader) {
this(sourceCff, targetCff, sourceDestinationFactory, targetDestinationFactory, sourceUsername, sourcePassword, targetUsername, targetPassword, selector, failureRetryInterval, maxRetries, qosMode, maxBatchSize, maxBatchTime, subName, clientID, addMessageIDInHeader, null, null); this(bridgeName,sourceCff, targetCff, sourceDestinationFactory, targetDestinationFactory, sourceUsername, sourcePassword, targetUsername, targetPassword, selector, failureRetryInterval, maxRetries, qosMode, maxBatchSize, maxBatchTime, subName, clientID, addMessageIDInHeader, null, null);
} }
public JMSBridgeImpl(final ConnectionFactoryFactory sourceCff, public JMSBridgeImpl(final String bridgeName,
final ConnectionFactoryFactory sourceCff,
final ConnectionFactoryFactory targetCff, final ConnectionFactoryFactory targetCff,
final DestinationFactory sourceDestinationFactory, final DestinationFactory sourceDestinationFactory,
final DestinationFactory targetDestinationFactory, final DestinationFactory targetDestinationFactory,
@ -233,10 +237,11 @@ public final class JMSBridgeImpl implements JMSBridge {
final boolean addMessageIDInHeader, final boolean addMessageIDInHeader,
final MBeanServer mbeanServer, final MBeanServer mbeanServer,
final String objectName) { final String objectName) {
this(sourceCff, targetCff, sourceDestinationFactory, targetDestinationFactory, sourceUsername, sourcePassword, targetUsername, targetPassword, selector, failureRetryInterval, maxRetries, qosMode, maxBatchSize, maxBatchTime, subName, clientID, addMessageIDInHeader, mbeanServer, objectName, DEFAULT_FAILOVER_TIMEOUT); this(bridgeName,sourceCff, targetCff, sourceDestinationFactory, targetDestinationFactory, sourceUsername, sourcePassword, targetUsername, targetPassword, selector, failureRetryInterval, maxRetries, qosMode, maxBatchSize, maxBatchTime, subName, clientID, addMessageIDInHeader, mbeanServer, objectName, DEFAULT_FAILOVER_TIMEOUT);
} }
public JMSBridgeImpl(final ConnectionFactoryFactory sourceCff, public JMSBridgeImpl(final String bridgeName,
final ConnectionFactoryFactory sourceCff,
final ConnectionFactoryFactory targetCff, final ConnectionFactoryFactory targetCff,
final DestinationFactory sourceDestinationFactory, final DestinationFactory sourceDestinationFactory,
final DestinationFactory targetDestinationFactory, final DestinationFactory targetDestinationFactory,
@ -294,6 +299,8 @@ public final class JMSBridgeImpl implements JMSBridge {
this.failoverTimeout = failoverTimeout; this.failoverTimeout = failoverTimeout;
this.bridgeName = bridgeName;
checkParams(); checkParams();
if (mbeanServer != null) { if (mbeanServer != null) {
@ -339,7 +346,7 @@ public final class JMSBridgeImpl implements JMSBridge {
locateRecoveryRegistry(); locateRecoveryRegistry();
if (started) { if (started) {
ActiveMQJMSBridgeLogger.LOGGER.errorBridgeAlreadyStarted(); ActiveMQJMSBridgeLogger.LOGGER.errorBridgeAlreadyStarted(bridgeName);
return; return;
} }
@ -367,7 +374,7 @@ public final class JMSBridgeImpl implements JMSBridge {
} }
if (tm == null) { if (tm == null) {
ActiveMQJMSBridgeLogger.LOGGER.jmsBridgeTransactionManagerMissing(qualityOfServiceMode); ActiveMQJMSBridgeLogger.LOGGER.jmsBridgeTransactionManagerMissing(qualityOfServiceMode,bridgeName);
throw new RuntimeException(); throw new RuntimeException();
} }
@ -395,7 +402,7 @@ public final class JMSBridgeImpl implements JMSBridge {
startSource(); startSource();
} }
else { else {
ActiveMQJMSBridgeLogger.LOGGER.errorStartingBridge(); ActiveMQJMSBridgeLogger.LOGGER.errorStartingBridge(bridgeName);
handleFailureOnStartup(); handleFailureOnStartup();
} }
@ -542,7 +549,7 @@ public final class JMSBridgeImpl implements JMSBridge {
mbeanServer.unregisterMBean(objectName); mbeanServer.unregisterMBean(objectName);
} }
catch (Exception e) { catch (Exception e) {
ActiveMQJMSBridgeLogger.LOGGER.errorUnregisteringBridge(objectName); ActiveMQJMSBridgeLogger.LOGGER.errorUnregisteringBridge(objectName,bridgeName);
} }
} }
} }
@ -1183,7 +1190,7 @@ public final class JMSBridgeImpl implements JMSBridge {
// If this fails we should attempt to cleanup or we might end up in some weird state // If this fails we should attempt to cleanup or we might end up in some weird state
// Adding a log.warn, so the use may see the cause of the failure and take actions // Adding a log.warn, so the use may see the cause of the failure and take actions
ActiveMQJMSBridgeLogger.LOGGER.bridgeConnectError(e); ActiveMQJMSBridgeLogger.LOGGER.bridgeConnectError(e,bridgeName);
cleanup(); cleanup();
@ -1275,7 +1282,7 @@ public final class JMSBridgeImpl implements JMSBridge {
break; break;
} }
ActiveMQJMSBridgeLogger.LOGGER.failedToSetUpBridge(failureRetryInterval); ActiveMQJMSBridgeLogger.LOGGER.failedToSetUpBridge(failureRetryInterval,bridgeName);
pause(failureRetryInterval); pause(failureRetryInterval);
} }
@ -1371,7 +1378,7 @@ public final class JMSBridgeImpl implements JMSBridge {
} }
catch (Exception e) { catch (Exception e) {
if (!stopping) { if (!stopping) {
ActiveMQJMSBridgeLogger.LOGGER.bridgeAckError(e); ActiveMQJMSBridgeLogger.LOGGER.bridgeAckError(e,bridgeName);
} }
// We don't call failure otherwise failover would be broken with ActiveMQ // We don't call failure otherwise failover would be broken with ActiveMQ
@ -1419,7 +1426,7 @@ public final class JMSBridgeImpl implements JMSBridge {
catch (Throwable ignored) { catch (Throwable ignored) {
} }
ActiveMQJMSBridgeLogger.LOGGER.bridgeAckError(e); ActiveMQJMSBridgeLogger.LOGGER.bridgeAckError(e,bridgeName);
//we don't do handle failure here because the tx //we don't do handle failure here because the tx
//may be rolledback due to failover. All failure handling //may be rolledback due to failover. All failure handling
@ -1437,7 +1444,7 @@ public final class JMSBridgeImpl implements JMSBridge {
} }
catch (Exception e) { catch (Exception e) {
ActiveMQJMSBridgeLogger.LOGGER.bridgeAckError(e); ActiveMQJMSBridgeLogger.LOGGER.bridgeAckError(e,bridgeName);
handleFailureOnSend(); handleFailureOnSend();
} }
@ -1460,7 +1467,7 @@ public final class JMSBridgeImpl implements JMSBridge {
} }
catch (Exception e) { catch (Exception e) {
ActiveMQJMSBridgeLogger.LOGGER.bridgeAckError(e); ActiveMQJMSBridgeLogger.LOGGER.bridgeAckError(e,bridgeName);
try { try {
sourceSession.rollback(); sourceSession.rollback();
@ -1743,12 +1750,12 @@ public final class JMSBridgeImpl implements JMSBridge {
sourceConn.start(); sourceConn.start();
} }
catch (JMSException e) { catch (JMSException e) {
ActiveMQJMSBridgeLogger.LOGGER.jmsBridgeSrcConnectError(e); ActiveMQJMSBridgeLogger.LOGGER.jmsBridgeSrcConnectError(e,bridgeName);
} }
} }
protected void succeeded() { protected void succeeded() {
ActiveMQJMSBridgeLogger.LOGGER.bridgeReconnected(); ActiveMQJMSBridgeLogger.LOGGER.bridgeReconnected(bridgeName);
connectedSource = true; connectedSource = true;
connectedTarget = true; connectedTarget = true;
synchronized (lock) { synchronized (lock) {
@ -1760,7 +1767,7 @@ public final class JMSBridgeImpl implements JMSBridge {
protected void failed() { protected void failed() {
// We haven't managed to recreate connections or maxRetries = 0 // We haven't managed to recreate connections or maxRetries = 0
ActiveMQJMSBridgeLogger.LOGGER.errorConnectingBridge(); ActiveMQJMSBridgeLogger.LOGGER.errorConnectingBridge(bridgeName);
try { try {
stop(); stop();
@ -1783,7 +1790,7 @@ public final class JMSBridgeImpl implements JMSBridge {
boolean ok = false; boolean ok = false;
if (maxRetries > 0 || maxRetries == -1) { if (maxRetries > 0 || maxRetries == -1) {
ActiveMQJMSBridgeLogger.LOGGER.bridgeRetry(failureRetryInterval); ActiveMQJMSBridgeLogger.LOGGER.bridgeRetry(failureRetryInterval,bridgeName);
pause(failureRetryInterval); pause(failureRetryInterval);
@ -1805,13 +1812,13 @@ public final class JMSBridgeImpl implements JMSBridge {
@Override @Override
protected void failed() { protected void failed() {
// Don't call super // Don't call super
ActiveMQJMSBridgeLogger.LOGGER.bridgeNotStarted(); ActiveMQJMSBridgeLogger.LOGGER.bridgeNotStarted(bridgeName);
} }
@Override @Override
protected void succeeded() { protected void succeeded() {
// Don't call super - a bit ugly in this case but better than taking the lock twice. // Don't call super - a bit ugly in this case but better than taking the lock twice.
ActiveMQJMSBridgeLogger.LOGGER.bridgeConnected(); ActiveMQJMSBridgeLogger.LOGGER.bridgeConnected(bridgeName);
synchronized (lock) { synchronized (lock) {
@ -1827,7 +1834,7 @@ public final class JMSBridgeImpl implements JMSBridge {
startSource(); startSource();
} }
catch (JMSException e) { catch (JMSException e) {
ActiveMQJMSBridgeLogger.LOGGER.jmsBridgeSrcConnectError(e); ActiveMQJMSBridgeLogger.LOGGER.jmsBridgeSrcConnectError(e,bridgeName);
} }
} }
} }
@ -1911,7 +1918,7 @@ public final class JMSBridgeImpl implements JMSBridge {
if (stopping) { if (stopping) {
return; return;
} }
ActiveMQJMSBridgeLogger.LOGGER.bridgeFailure(e); ActiveMQJMSBridgeLogger.LOGGER.bridgeFailure(e,bridgeName);
if (isSource) { if (isSource) {
connectedSource = false; connectedSource = false;
} }

View File

@ -55,7 +55,7 @@ public class JMSBridgeReconnectionTest extends BridgeTestBase {
activeMQServer = jmsServer1; activeMQServer = jmsServer1;
ConnectionFactoryFactory factInUse0 = cff0; ConnectionFactoryFactory factInUse0 = cff0;
ConnectionFactoryFactory factInUse1 = cff1; ConnectionFactoryFactory factInUse1 = cff1;
final JMSBridgeImpl bridge = new JMSBridgeImpl(factInUse0, factInUse1, sourceQueueFactory, targetQueueFactory, null, null, null, null, null, 1000, -1, QualityOfServiceMode.DUPLICATES_OK, 10, -1, null, null, false); final JMSBridgeImpl bridge = new JMSBridgeImpl("test-bridge",factInUse0, factInUse1, sourceQueueFactory, targetQueueFactory, null, null, null, null, null, 1000, -1, QualityOfServiceMode.DUPLICATES_OK, 10, -1, null, null, false);
addActiveMQComponent(bridge); addActiveMQComponent(bridge);
bridge.setTransactionManager(newTransactionManager()); bridge.setTransactionManager(newTransactionManager());

View File

@ -95,7 +95,7 @@ public class JMSBridgeClusteredTest extends ClusteredBridgeTestBase {
//even number //even number
final int batchSize = 4; final int batchSize = 4;
bridge = new JMSBridgeImpl(sourceCFF, targetCFF, sourceQueueFactory, targetQueueFactory, null, null, null, null, null, 1000, -1, mode, batchSize, -1, null, null, false); bridge = new JMSBridgeImpl("test-bridge",sourceCFF, targetCFF, sourceQueueFactory, targetQueueFactory, null, null, null, null, null, 1000, -1, mode, batchSize, -1, null, null, false);
txMgr = newTransactionManager(); txMgr = newTransactionManager();
bridge.setTransactionManager(txMgr); bridge.setTransactionManager(txMgr);
@ -154,7 +154,7 @@ public class JMSBridgeClusteredTest extends ClusteredBridgeTestBase {
DestinationFactory sourceQueueFactory = sourceServer.getDestinationFactory(sourceQueueName); DestinationFactory sourceQueueFactory = sourceServer.getDestinationFactory(sourceQueueName);
DestinationFactory targetQueueFactory = targetServer.getDestinationFactory(targetQueueName); DestinationFactory targetQueueFactory = targetServer.getDestinationFactory(targetQueueName);
bridge = new JMSBridgeImpl(sourceCFF, targetCFF, sourceQueueFactory, targetQueueFactory, null, null, null, null, null, 1000, -1, mode, 10, 1000, null, null, false); bridge = new JMSBridgeImpl("test-bridge",sourceCFF, targetCFF, sourceQueueFactory, targetQueueFactory, null, null, null, null, null, 1000, -1, mode, 10, 1000, null, null, false);
txMgr = newTransactionManager(); txMgr = newTransactionManager();
bridge.setTransactionManager(txMgr); bridge.setTransactionManager(txMgr);

View File

@ -107,7 +107,7 @@ public class JMSBridgeReconnectionTest extends BridgeTestBase {
public void testRetryConnectionOnStartup() throws Exception { public void testRetryConnectionOnStartup() throws Exception {
jmsServer1.stop(); jmsServer1.stop();
JMSBridgeImpl bridge = new JMSBridgeImpl(cff0, cff1, sourceQueueFactory, targetQueueFactory, null, null, null, null, null, 1000, -1, QualityOfServiceMode.DUPLICATES_OK, 10, -1, null, null, false); JMSBridgeImpl bridge = new JMSBridgeImpl("test-bridge",cff0, cff1, sourceQueueFactory, targetQueueFactory, null, null, null, null, null, 1000, -1, QualityOfServiceMode.DUPLICATES_OK, 10, -1, null, null, false);
bridge.setTransactionManager(newTransactionManager()); bridge.setTransactionManager(newTransactionManager());
addActiveMQComponent(bridge); addActiveMQComponent(bridge);
bridge.start(); bridge.start();
@ -133,7 +133,7 @@ public class JMSBridgeReconnectionTest extends BridgeTestBase {
public void testStopBridgeWithFailureWhenStarted() throws Exception { public void testStopBridgeWithFailureWhenStarted() throws Exception {
jmsServer1.stop(); jmsServer1.stop();
JMSBridgeImpl bridge = new JMSBridgeImpl(cff0, cff1, sourceQueueFactory, targetQueueFactory, null, null, null, null, null, 500, -1, QualityOfServiceMode.DUPLICATES_OK, 10, -1, null, null, false); JMSBridgeImpl bridge = new JMSBridgeImpl("test-bridge",cff0, cff1, sourceQueueFactory, targetQueueFactory, null, null, null, null, null, 500, -1, QualityOfServiceMode.DUPLICATES_OK, 10, -1, null, null, false);
bridge.setTransactionManager(newTransactionManager()); bridge.setTransactionManager(newTransactionManager());
bridge.start(); bridge.start();
@ -168,7 +168,7 @@ public class JMSBridgeReconnectionTest extends BridgeTestBase {
factInUse1 = cff1xa; factInUse1 = cff1xa;
} }
bridge = new JMSBridgeImpl(factInUse0, factInUse1, sourceQueueFactory, targetQueueFactory, null, null, null, null, null, 1000, -1, qosMode, 10, -1, null, null, false); bridge = new JMSBridgeImpl("test-bridge",factInUse0, factInUse1, sourceQueueFactory, targetQueueFactory, null, null, null, null, null, 1000, -1, qosMode, 10, -1, null, null, false);
addActiveMQComponent(bridge); addActiveMQComponent(bridge);
bridge.setTransactionManager(newTransactionManager()); bridge.setTransactionManager(newTransactionManager());
bridge.start(); bridge.start();
@ -223,7 +223,7 @@ public class JMSBridgeReconnectionTest extends BridgeTestBase {
public void performCrashDestinationStopBridge() throws Exception { public void performCrashDestinationStopBridge() throws Exception {
ConnectionFactoryFactory factInUse0 = cff0; ConnectionFactoryFactory factInUse0 = cff0;
ConnectionFactoryFactory factInUse1 = cff1; ConnectionFactoryFactory factInUse1 = cff1;
final JMSBridgeImpl bridge = new JMSBridgeImpl(factInUse0, factInUse1, sourceQueueFactory, targetQueueFactory, null, null, null, null, null, 1000, -1, QualityOfServiceMode.DUPLICATES_OK, 10, -1, null, null, false); final JMSBridgeImpl bridge = new JMSBridgeImpl("test-bridge",factInUse0, factInUse1, sourceQueueFactory, targetQueueFactory, null, null, null, null, null, 1000, -1, QualityOfServiceMode.DUPLICATES_OK, 10, -1, null, null, false);
addActiveMQComponent(bridge); addActiveMQComponent(bridge);
bridge.setTransactionManager(newTransactionManager()); bridge.setTransactionManager(newTransactionManager());
@ -294,7 +294,7 @@ public class JMSBridgeReconnectionTest extends BridgeTestBase {
DummyTransaction tx = new DummyTransaction(); DummyTransaction tx = new DummyTransaction();
tm.tx = tx; tm.tx = tx;
JMSBridgeImpl bridge = new JMSBridgeImpl(cff0xa, cff1xa, sourceQueueFactory, targetQueueFactory, null, null, null, null, null, 1000, -1, QualityOfServiceMode.ONCE_AND_ONLY_ONCE, 10, 5000, null, null, false); JMSBridgeImpl bridge = new JMSBridgeImpl("test-bridge",cff0xa, cff1xa, sourceQueueFactory, targetQueueFactory, null, null, null, null, null, 1000, -1, QualityOfServiceMode.ONCE_AND_ONLY_ONCE, 10, 5000, null, null, false);
addActiveMQComponent(bridge); addActiveMQComponent(bridge);
bridge.setTransactionManager(tm); bridge.setTransactionManager(tm);
@ -379,7 +379,7 @@ public class JMSBridgeReconnectionTest extends BridgeTestBase {
* Verify all messages are received * Verify all messages are received
*/ */
private void performCrashAndReconnectDestCrashBeforePrepare(final boolean persistent) throws Exception { private void performCrashAndReconnectDestCrashBeforePrepare(final boolean persistent) throws Exception {
JMSBridgeImpl bridge = new JMSBridgeImpl(cff0xa, cff1xa, sourceQueueFactory, targetQueueFactory, null, null, null, null, null, 1000, -1, QualityOfServiceMode.ONCE_AND_ONLY_ONCE, 10, 5000, null, null, false); JMSBridgeImpl bridge = new JMSBridgeImpl("test-bridge",cff0xa, cff1xa, sourceQueueFactory, targetQueueFactory, null, null, null, null, null, 1000, -1, QualityOfServiceMode.ONCE_AND_ONLY_ONCE, 10, 5000, null, null, false);
addActiveMQComponent(bridge); addActiveMQComponent(bridge);
bridge.setTransactionManager(newTransactionManager()); bridge.setTransactionManager(newTransactionManager());

View File

@ -335,7 +335,7 @@ public class JMSBridgeTest extends BridgeTestBase {
try { try {
final int NUM_MESSAGES = 10; final int NUM_MESSAGES = 10;
bridge = new JMSBridgeImpl(factInUse0, factInUse1, sourceQueueFactory, targetQueueFactory, null, null, null, null, null, 5000, 10, QualityOfServiceMode.AT_MOST_ONCE, NUM_MESSAGES, -1, null, null, false); bridge = new JMSBridgeImpl("test-bridge",factInUse0, factInUse1, sourceQueueFactory, targetQueueFactory, null, null, null, null, null, 5000, 10, QualityOfServiceMode.AT_MOST_ONCE, NUM_MESSAGES, -1, null, null, false);
bridge.start(); bridge.start();
@ -414,7 +414,7 @@ public class JMSBridgeTest extends BridgeTestBase {
String clientID = null; String clientID = null;
try { try {
bridge = new JMSBridgeImpl(null, cff1, sourceQueueFactory, targetQueueFactory, sourceUsername, sourcePassword, destUsername, destPassword, selector, failureRetryInterval, maxRetries, qosMode, batchSize, maxBatchTime, subName, clientID, false); bridge = new JMSBridgeImpl("test-bridge",null, cff1, sourceQueueFactory, targetQueueFactory, sourceUsername, sourcePassword, destUsername, destPassword, selector, failureRetryInterval, maxRetries, qosMode, batchSize, maxBatchTime, subName, clientID, false);
fail("expected exception"); fail("expected exception");
} }
catch (IllegalArgumentException e) { catch (IllegalArgumentException e) {
@ -425,7 +425,7 @@ public class JMSBridgeTest extends BridgeTestBase {
} }
try { try {
bridge = new JMSBridgeImpl(cff0, null, sourceQueueFactory, targetQueueFactory, sourceUsername, sourcePassword, destUsername, destPassword, selector, failureRetryInterval, maxRetries, qosMode, batchSize, maxBatchTime, subName, clientID, false); bridge = new JMSBridgeImpl("test-bridge",cff0, null, sourceQueueFactory, targetQueueFactory, sourceUsername, sourcePassword, destUsername, destPassword, selector, failureRetryInterval, maxRetries, qosMode, batchSize, maxBatchTime, subName, clientID, false);
fail("expected exception"); fail("expected exception");
} }
catch (IllegalArgumentException e) { catch (IllegalArgumentException e) {
@ -436,7 +436,7 @@ public class JMSBridgeTest extends BridgeTestBase {
} }
try { try {
bridge = new JMSBridgeImpl(cff0, cff1, null, targetQueueFactory, sourceUsername, sourcePassword, destUsername, destPassword, selector, failureRetryInterval, maxRetries, qosMode, batchSize, maxBatchTime, subName, clientID, false); bridge = new JMSBridgeImpl("test-bridge",cff0, cff1, null, targetQueueFactory, sourceUsername, sourcePassword, destUsername, destPassword, selector, failureRetryInterval, maxRetries, qosMode, batchSize, maxBatchTime, subName, clientID, false);
fail("expected exception"); fail("expected exception");
} }
catch (IllegalArgumentException e) { catch (IllegalArgumentException e) {
@ -447,7 +447,7 @@ public class JMSBridgeTest extends BridgeTestBase {
} }
try { try {
bridge = new JMSBridgeImpl(cff0, cff1, sourceQueueFactory, null, sourceUsername, sourcePassword, destUsername, destPassword, selector, failureRetryInterval, maxRetries, qosMode, batchSize, maxBatchTime, subName, clientID, false); bridge = new JMSBridgeImpl("test-bridge",cff0, cff1, sourceQueueFactory, null, sourceUsername, sourcePassword, destUsername, destPassword, selector, failureRetryInterval, maxRetries, qosMode, batchSize, maxBatchTime, subName, clientID, false);
fail("expected exception"); fail("expected exception");
} }
catch (IllegalArgumentException e) { catch (IllegalArgumentException e) {
@ -458,7 +458,7 @@ public class JMSBridgeTest extends BridgeTestBase {
} }
try { try {
bridge = new JMSBridgeImpl(cff0, cff1, sourceQueueFactory, targetQueueFactory, sourceUsername, sourcePassword, destUsername, destPassword, selector, -2, maxRetries, qosMode, batchSize, maxBatchTime, subName, clientID, false); bridge = new JMSBridgeImpl("test-bridge",cff0, cff1, sourceQueueFactory, targetQueueFactory, sourceUsername, sourcePassword, destUsername, destPassword, selector, -2, maxRetries, qosMode, batchSize, maxBatchTime, subName, clientID, false);
fail("expected exception"); fail("expected exception");
} }
catch (IllegalArgumentException e) { catch (IllegalArgumentException e) {
@ -469,7 +469,7 @@ public class JMSBridgeTest extends BridgeTestBase {
} }
try { try {
bridge = new JMSBridgeImpl(cff0, cff1, sourceQueueFactory, targetQueueFactory, sourceUsername, sourcePassword, destUsername, destPassword, selector, -1, 10, qosMode, batchSize, maxBatchTime, subName, clientID, false); bridge = new JMSBridgeImpl("test-bridge",cff0, cff1, sourceQueueFactory, targetQueueFactory, sourceUsername, sourcePassword, destUsername, destPassword, selector, -1, 10, qosMode, batchSize, maxBatchTime, subName, clientID, false);
fail("expected exception"); fail("expected exception");
} }
catch (IllegalArgumentException e) { catch (IllegalArgumentException e) {
@ -480,7 +480,7 @@ public class JMSBridgeTest extends BridgeTestBase {
} }
try { try {
bridge = new JMSBridgeImpl(cff0, cff1, sourceQueueFactory, null, sourceUsername, sourcePassword, destUsername, destPassword, selector, failureRetryInterval, maxRetries, qosMode, 0, maxBatchTime, subName, clientID, false); bridge = new JMSBridgeImpl("test-bridge",cff0, cff1, sourceQueueFactory, null, sourceUsername, sourcePassword, destUsername, destPassword, selector, failureRetryInterval, maxRetries, qosMode, 0, maxBatchTime, subName, clientID, false);
fail("expected exception"); fail("expected exception");
} }
catch (IllegalArgumentException e) { catch (IllegalArgumentException e) {
@ -491,7 +491,7 @@ public class JMSBridgeTest extends BridgeTestBase {
} }
try { try {
bridge = new JMSBridgeImpl(cff0, cff1, sourceQueueFactory, null, sourceUsername, sourcePassword, destUsername, destPassword, selector, failureRetryInterval, maxRetries, qosMode, batchSize, -2, subName, clientID, false); bridge = new JMSBridgeImpl("test-bridge",cff0, cff1, sourceQueueFactory, null, sourceUsername, sourcePassword, destUsername, destPassword, selector, failureRetryInterval, maxRetries, qosMode, batchSize, -2, subName, clientID, false);
fail("expected exception"); fail("expected exception");
} }
catch (IllegalArgumentException e) { catch (IllegalArgumentException e) {
@ -513,7 +513,7 @@ public class JMSBridgeTest extends BridgeTestBase {
try { try {
final int NUM_MESSAGES = 10; final int NUM_MESSAGES = 10;
bridge = new JMSBridgeImpl(cff0, cff1, sourceQueueFactory, targetQueueFactory, null, null, null, null, null, 5000, 10, QualityOfServiceMode.AT_MOST_ONCE, 1, -1, null, null, false); bridge = new JMSBridgeImpl("test-bridge",cff0, cff1, sourceQueueFactory, targetQueueFactory, null, null, null, null, null, 5000, 10, QualityOfServiceMode.AT_MOST_ONCE, 1, -1, null, null, false);
bridge.start(); bridge.start();
@ -577,7 +577,7 @@ public class JMSBridgeTest extends BridgeTestBase {
String selector = "vegetable='radish'"; String selector = "vegetable='radish'";
bridge = new JMSBridgeImpl(cff0, cff1, sourceQueueFactory, targetQueueFactory, null, null, null, null, selector, 5000, 10, QualityOfServiceMode.AT_MOST_ONCE, 1, -1, null, null, false); bridge = new JMSBridgeImpl("test-bridge",cff0, cff1, sourceQueueFactory, targetQueueFactory, null, null, null, null, selector, 5000, 10, QualityOfServiceMode.AT_MOST_ONCE, 1, -1, null, null, false);
bridge.start(); bridge.start();
@ -652,7 +652,7 @@ public class JMSBridgeTest extends BridgeTestBase {
try { try {
final int NUM_MESSAGES = 10; final int NUM_MESSAGES = 10;
bridge = new JMSBridgeImpl(cff0, cff1, sourceQueueFactory, targetQueueFactory, "guest", mask, "guest", mask, null, 5000, 10, QualityOfServiceMode.AT_MOST_ONCE, 1, -1, null, null, false); bridge = new JMSBridgeImpl("test-bridge",cff0, cff1, sourceQueueFactory, targetQueueFactory, "guest", mask, "guest", mask, null, 5000, 10, QualityOfServiceMode.AT_MOST_ONCE, 1, -1, null, null, false);
bridge.setUseMaskedPassword(true); bridge.setUseMaskedPassword(true);
@ -726,7 +726,7 @@ public class JMSBridgeTest extends BridgeTestBase {
try { try {
final int NUM_MESSAGES = 10; final int NUM_MESSAGES = 10;
bridge = new JMSBridgeImpl(cff0, cff1, sourceQueueFactory, targetQueueFactory, "guest", mask, "guest", mask, null, 5000, 10, QualityOfServiceMode.AT_MOST_ONCE, 1, -1, null, null, false); bridge = new JMSBridgeImpl("test-bridge",cff0, cff1, sourceQueueFactory, targetQueueFactory, "guest", mask, "guest", mask, null, 5000, 10, QualityOfServiceMode.AT_MOST_ONCE, 1, -1, null, null, false);
bridge.setUseMaskedPassword(true); bridge.setUseMaskedPassword(true);
bridge.setPasswordCodec(codec.getClass().getName() + ";key=bridgekey"); bridge.setPasswordCodec(codec.getClass().getName() + ";key=bridgekey");
@ -812,7 +812,7 @@ public class JMSBridgeTest extends BridgeTestBase {
final int NUM_MESSAGES = 10; final int NUM_MESSAGES = 10;
bridge = new JMSBridgeImpl(cff0, cff1, sourceTopicFactory, targetQueueFactory, null, null, null, null, null, 5000, 10, QualityOfServiceMode.AT_MOST_ONCE, 1, -1, null, null, false); bridge = new JMSBridgeImpl("test-bridge",cff0, cff1, sourceTopicFactory, targetQueueFactory, null, null, null, null, null, 5000, 10, QualityOfServiceMode.AT_MOST_ONCE, 1, -1, null, null, false);
bridge.start(); bridge.start();
sendMessages(cf0, sourceTopic, 0, NUM_MESSAGES, false, largeMessage); sendMessages(cf0, sourceTopic, 0, NUM_MESSAGES, false, largeMessage);
@ -859,7 +859,7 @@ public class JMSBridgeTest extends BridgeTestBase {
try { try {
final int NUM_MESSAGES = 10; final int NUM_MESSAGES = 10;
bridge = new JMSBridgeImpl(cff0, cff1, sourceTopicFactory, targetQueueFactory, null, null, null, null, null, 5000, 10, QualityOfServiceMode.AT_MOST_ONCE, batchSize, -1, null, null, false); bridge = new JMSBridgeImpl("test-bridge",cff0, cff1, sourceTopicFactory, targetQueueFactory, null, null, null, null, null, 5000, 10, QualityOfServiceMode.AT_MOST_ONCE, batchSize, -1, null, null, false);
bridge.start(); bridge.start();
@ -890,7 +890,7 @@ public class JMSBridgeTest extends BridgeTestBase {
try { try {
final int NUM_MESSAGES = 10; final int NUM_MESSAGES = 10;
bridge = new JMSBridgeImpl(cff0, cff1, sourceTopicFactory, targetQueueFactory, null, null, null, null, null, 5000, 10, QualityOfServiceMode.AT_MOST_ONCE, batchSize, -1, "subTest", "clientid123", false); bridge = new JMSBridgeImpl("test-bridge",cff0, cff1, sourceTopicFactory, targetQueueFactory, null, null, null, null, null, 5000, 10, QualityOfServiceMode.AT_MOST_ONCE, batchSize, -1, "subTest", "clientid123", false);
bridge.start(); bridge.start();
@ -932,7 +932,7 @@ public class JMSBridgeTest extends BridgeTestBase {
try { try {
final int NUM_MESSAGES = 10; final int NUM_MESSAGES = 10;
bridge = new JMSBridgeImpl(cff0, cff1, sourceQueueFactory, targetQueueFactory, null, null, null, null, null, 5000, 10, QualityOfServiceMode.AT_MOST_ONCE, 1, -1, null, null, on); bridge = new JMSBridgeImpl("test-bridge",cff0, cff1, sourceQueueFactory, targetQueueFactory, null, null, null, null, null, 5000, 10, QualityOfServiceMode.AT_MOST_ONCE, 1, -1, null, null, on);
bridge.start(); bridge.start();
@ -1107,7 +1107,7 @@ public class JMSBridgeTest extends BridgeTestBase {
try { try {
final int NUM_MESSAGES = 10; final int NUM_MESSAGES = 10;
bridge = new JMSBridgeImpl(cff0, cff1, sourceQueueFactory, targetQueueFactory, null, null, null, null, null, 5000, 10, QualityOfServiceMode.AT_MOST_ONCE, 1, -1, null, null, messageIDInHeader); bridge = new JMSBridgeImpl("test-bridge",cff0, cff1, sourceQueueFactory, targetQueueFactory, null, null, null, null, null, 5000, 10, QualityOfServiceMode.AT_MOST_ONCE, 1, -1, null, null, messageIDInHeader);
bridge.start(); bridge.start();
@ -1255,7 +1255,7 @@ public class JMSBridgeTest extends BridgeTestBase {
try { try {
final int NUM_MESSAGES = 10; final int NUM_MESSAGES = 10;
bridge = new JMSBridgeImpl(cff0, cff1, sourceQueueFactory, targetQueueFactory, null, null, null, null, null, 5000, 10, QualityOfServiceMode.AT_MOST_ONCE, 1, -1, null, null, false); bridge = new JMSBridgeImpl("test-bridge",cff0, cff1, sourceQueueFactory, targetQueueFactory, null, null, null, null, null, 5000, 10, QualityOfServiceMode.AT_MOST_ONCE, 1, -1, null, null, false);
bridge.start(); bridge.start();
@ -1339,7 +1339,7 @@ public class JMSBridgeTest extends BridgeTestBase {
} }
try { try {
bridge = new JMSBridgeImpl(factInUse0, factInUse1, sourceQueueFactory, targetQueueFactory, null, null, null, null, null, 5000, 10, qosMode, batchSize, -1, null, null, false); bridge = new JMSBridgeImpl("test-bridge",factInUse0, factInUse1, sourceQueueFactory, targetQueueFactory, null, null, null, null, null, 5000, 10, qosMode, batchSize, -1, null, null, false);
bridge.start(); bridge.start();
@ -1409,7 +1409,7 @@ public class JMSBridgeTest extends BridgeTestBase {
} }
try { try {
bridge = new JMSBridgeImpl(factInUse0, factInUse1, sourceQueueFactory, targetQueueFactory, null, null, null, null, null, 5000, 10, qosMode, 2, maxBatchTime, null, null, false); bridge = new JMSBridgeImpl("test-bridge",factInUse0, factInUse1, sourceQueueFactory, targetQueueFactory, null, null, null, null, null, 5000, 10, qosMode, 2, maxBatchTime, null, null, false);
bridge.start(); bridge.start();
@ -1477,7 +1477,7 @@ public class JMSBridgeTest extends BridgeTestBase {
} }
try { try {
bridge = new JMSBridgeImpl(factInUse0, factInUse0, sourceQueueFactory, localTargetQueueFactory, null, null, null, null, null, 5000, 10, qosMode, batchSize, -1, null, null, false); bridge = new JMSBridgeImpl("test-bridge",factInUse0, factInUse0, sourceQueueFactory, localTargetQueueFactory, null, null, null, null, null, 5000, 10, qosMode, batchSize, -1, null, null, false);
bridge.start(); bridge.start();
@ -1542,7 +1542,7 @@ public class JMSBridgeTest extends BridgeTestBase {
try { try {
final int NUM_MESSAGES = 10; final int NUM_MESSAGES = 10;
bridge = new JMSBridgeImpl(factInUse0, factInUse1, sourceQueueFactory, targetQueueFactory, null, null, null, null, null, 5000, 10, qosMode, NUM_MESSAGES, -1, null, null, false); bridge = new JMSBridgeImpl("test-bridge",factInUse0, factInUse1, sourceQueueFactory, targetQueueFactory, null, null, null, null, null, 5000, 10, qosMode, NUM_MESSAGES, -1, null, null, false);
bridge.start(); bridge.start();
@ -1599,7 +1599,7 @@ public class JMSBridgeTest extends BridgeTestBase {
try { try {
final int NUM_MESSAGES = 10; final int NUM_MESSAGES = 10;
bridge = new JMSBridgeImpl(factInUse0, factInUse0, sourceQueueFactory, localTargetQueueFactory, null, null, null, null, null, 5000, 10, qosMode, NUM_MESSAGES, -1, null, null, false); bridge = new JMSBridgeImpl("test-bridge",factInUse0, factInUse0, sourceQueueFactory, localTargetQueueFactory, null, null, null, null, null, 5000, 10, qosMode, NUM_MESSAGES, -1, null, null, false);
bridge.start(); bridge.start();
@ -1658,7 +1658,7 @@ public class JMSBridgeTest extends BridgeTestBase {
final int MAX_BATCH_SIZE = 100000; // something big so it won't reach it final int MAX_BATCH_SIZE = 100000; // something big so it won't reach it
bridge = new JMSBridgeImpl(factInUse0, factInUse1, sourceQueueFactory, targetQueueFactory, null, null, null, null, null, 3000, 10, qosMode, MAX_BATCH_SIZE, MAX_BATCH_TIME, null, null, false); bridge = new JMSBridgeImpl("test-bridge",factInUse0, factInUse1, sourceQueueFactory, targetQueueFactory, null, null, null, null, null, 3000, 10, qosMode, MAX_BATCH_SIZE, MAX_BATCH_TIME, null, null, false);
bridge.start(); bridge.start();
@ -1698,7 +1698,7 @@ public class JMSBridgeTest extends BridgeTestBase {
final int MAX_BATCH_SIZE = 100000; // something big so it won't reach it final int MAX_BATCH_SIZE = 100000; // something big so it won't reach it
bridge = new JMSBridgeImpl(factInUse0, factInUse0, sourceQueueFactory, localTargetQueueFactory, null, null, null, null, null, 3000, 10, qosMode, MAX_BATCH_SIZE, MAX_BATCH_TIME, null, null, false); bridge = new JMSBridgeImpl("test-bridge",factInUse0, factInUse0, sourceQueueFactory, localTargetQueueFactory, null, null, null, null, null, 3000, 10, qosMode, MAX_BATCH_SIZE, MAX_BATCH_TIME, null, null, false);
bridge.start(); bridge.start();
@ -1731,7 +1731,7 @@ public class JMSBridgeTest extends BridgeTestBase {
JMSBridgeImpl bridge = null; JMSBridgeImpl bridge = null;
try { try {
bridge = new JMSBridgeImpl(cff0, cff0, sourceQueueFactory, localTargetQueueFactory, null, null, null, null, null, 3000, 10, QualityOfServiceMode.ONCE_AND_ONLY_ONCE, 10000, 3000, null, null, false); bridge = new JMSBridgeImpl("test-bridge",cff0, cff0, sourceQueueFactory, localTargetQueueFactory, null, null, null, null, null, 3000, 10, QualityOfServiceMode.ONCE_AND_ONLY_ONCE, 10000, 3000, null, null, false);
bridge.start(); bridge.start();
} }
finally { finally {
@ -1747,7 +1747,7 @@ public class JMSBridgeTest extends BridgeTestBase {
MBeanServer mbeanServer = ManagementFactory.getPlatformMBeanServer(); MBeanServer mbeanServer = ManagementFactory.getPlatformMBeanServer();
ObjectName objectName = new ObjectName("example.jmsbridge:service=JMSBridge"); ObjectName objectName = new ObjectName("example.jmsbridge:service=JMSBridge");
JMSBridgeImpl bridge = new JMSBridgeImpl(cff0, cff0, sourceQueueFactory, localTargetQueueFactory, null, null, null, null, null, 5000, 10, QualityOfServiceMode.AT_MOST_ONCE, 1, -1, null, null, false, mbeanServer, objectName.getCanonicalName()); JMSBridgeImpl bridge = new JMSBridgeImpl("test-bridge",cff0, cff0, sourceQueueFactory, localTargetQueueFactory, null, null, null, null, null, 5000, 10, QualityOfServiceMode.AT_MOST_ONCE, 1, -1, null, null, false, mbeanServer, objectName.getCanonicalName());
Assert.assertTrue(mbeanServer.isRegistered(objectName)); Assert.assertTrue(mbeanServer.isRegistered(objectName));