log.debug(this + " has started running client version " + info.getClientVersion() + " , wire format = " + info.getWireFormatVersion());
this.brokerConnector.registerClient(this, info);
//go through consumers and producers - setting their clientId (which might not have been set)
for (Iterator i = consumers.iterator();i.hasNext();) {
ConsumerInfo ci = (ConsumerInfo) i.next();
ci.setClientId(info.getClientId());
}
for (Iterator i = producers.iterator();i.hasNext();) {
ProducerInfo pi = (ProducerInfo) i.next();
pi.setClientId(info.getClientId());
}
}
if (info.isStarted()) {
//register any consumers
for (Iterator i = consumers.iterator();i.hasNext();) {
ConsumerInfo ci = (ConsumerInfo) i.next();
if (activeConsumers.add(ci)) {
this.brokerConnector.registerMessageConsumer(this, ci);
}
}
}
else {
log.debug(this + " has stopped");
//de-register any consumers
for (Iterator i = consumers.iterator();i.hasNext();) {
ConsumerInfo ci = (ConsumerInfo) i.next();
if (activeConsumers.remove(ci)) {
this.brokerConnector.deregisterMessageConsumer(this, ci);
}
}
}