mirror of https://github.com/apache/activemq.git
Added a handy processingDelay option to the MessageIdList so that a test case and simulate a slow consumer
git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@560294 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
d56ebd842d
commit
9d2e5418fe
|
@ -51,6 +51,7 @@ public class MessageIdList extends Assert implements MessageListener {
|
||||||
private boolean verbose;
|
private boolean verbose;
|
||||||
private MessageListener parent;
|
private MessageListener parent;
|
||||||
private long maximumDuration = 15000L;
|
private long maximumDuration = 15000L;
|
||||||
|
private long processingDelay=0;
|
||||||
|
|
||||||
private CountDownLatch countDownLatch;
|
private CountDownLatch countDownLatch;
|
||||||
|
|
||||||
|
@ -119,6 +120,12 @@ public class MessageIdList extends Assert implements MessageListener {
|
||||||
if (parent != null) {
|
if (parent != null) {
|
||||||
parent.onMessage(message);
|
parent.onMessage(message);
|
||||||
}
|
}
|
||||||
|
if( processingDelay > 0 ) {
|
||||||
|
try {
|
||||||
|
Thread.sleep(processingDelay);
|
||||||
|
} catch (InterruptedException e) {
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getMessageCount() {
|
public int getMessageCount() {
|
||||||
|
@ -241,4 +248,24 @@ public class MessageIdList extends Assert implements MessageListener {
|
||||||
this.countDownLatch = countDownLatch;
|
this.countDownLatch = countDownLatch;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the amount of time the message listener will spend sleeping to
|
||||||
|
* simulate a processing delay.
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public long getProcessingDelay() {
|
||||||
|
return processingDelay;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the amount of time the message listener will spend sleeping to
|
||||||
|
* simulate a processing delay.
|
||||||
|
*
|
||||||
|
* @param processingDelay
|
||||||
|
*/
|
||||||
|
public void setProcessingDelay(long processingDelay) {
|
||||||
|
this.processingDelay = processingDelay;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue