[no jira] add identity option to consumer bean to aid logging/debugging

This commit is contained in:
gtully 2017-03-29 22:19:15 +01:00
parent 8e00c6c2bc
commit 770a73e9ba
1 changed files with 6 additions and 1 deletions

View File

@ -30,6 +30,7 @@ public class ConsumerBean extends Assert implements MessageListener {
private static final Logger LOG = LoggerFactory.getLogger(ConsumerBean.class); private static final Logger LOG = LoggerFactory.getLogger(ConsumerBean.class);
private final List<Message> messages = new ArrayList<Message>(); private final List<Message> messages = new ArrayList<Message>();
private boolean verbose; private boolean verbose;
private String id = null;
/** /**
* Constructor. * Constructor.
@ -37,6 +38,10 @@ public class ConsumerBean extends Assert implements MessageListener {
public ConsumerBean() { public ConsumerBean() {
} }
public ConsumerBean(String id) {
this.id = id;
}
/** /**
* @return all the messages on the list so far, clearing the buffer * @return all the messages on the list so far, clearing the buffer
*/ */
@ -59,7 +64,7 @@ public class ConsumerBean extends Assert implements MessageListener {
synchronized (messages) { synchronized (messages) {
messages.add(message); messages.add(message);
if (verbose) { if (verbose) {
LOG.info("Received: " + message); LOG.info("" + id + "Received: " + message);
} }
messages.notifyAll(); messages.notifyAll();
} }