NO-JIRA Adding consumer timing on CLI consumer

This commit is contained in:
Clebert Suconic 2019-04-25 15:41:27 -04:00
parent 881143252c
commit a1b3fb3d41
1 changed files with 9 additions and 0 deletions

View File

@ -177,6 +177,7 @@ public class ConsumerThread extends Thread {
consumer = session.createConsumer(destination);
}
}
long tStart = System.currentTimeMillis();
int count = 0;
while (running && received < messageCount) {
Message msg = consumer.receive(receiveTimeOut);
@ -217,6 +218,14 @@ public class ConsumerThread extends Thread {
session.commit();
} catch (Throwable ignored) {
}
System.out.println(threadName + " Consumed: " + this.getMessageCount() + " messages");
long tEnd = System.currentTimeMillis();
long elapsed = (tEnd - tStart) / 1000;
System.out.println(threadName + " Elapsed time in second : " + elapsed + " s");
System.out.println(threadName + " Elapsed time in milli second : " + (tEnd - tStart) + " milli seconds");
} catch (Exception e) {
e.printStackTrace();
} finally {