@Override public void start() throws Exception { if (isLogAll() || isLogInternalEvents()) { LOG.info("Starting {}", getBrokerName()); } super.start(); }
@Override public String toString() { StringBuffer buf = new StringBuffer(); buf.append("LoggingBrokerPlugin("); buf.append("logAll="); buf.append(isLogAll()); buf.append(", logConnectionEvents="); buf.append(isLogConnectionEvents()); buf.append(", logSessionEvents="); buf.append(isLogSessionEvents()); buf.append(", logConsumerEvents="); buf.append(isLogConsumerEvents()); buf.append(", logProducerEvents="); buf.append(isLogProducerEvents()); buf.append(", logTransactionEvents="); buf.append(isLogTransactionEvents()); buf.append(", logInternalEvents="); buf.append(isLogInternalEvents()); buf.append(")"); return buf.toString(); }
/** * @throws Exception * @org.apache.xbean.InitMethod */ public void afterPropertiesSet() throws Exception { LOG.info("Created LoggingBrokerPlugin: {}", this.toString()); }
@Override public void fastProducer(ConnectionContext context, ProducerInfo producerInfo,ActiveMQDestination destination) { if (isLogAll() || isLogProducerEvents() || isLogInternalEvents()) { LOG.info("Fast Producer: {}", producerInfo); } super.fastProducer(context, producerInfo, destination); }
@Override public void postProcessDispatch(MessageDispatch messageDispatch) { if (isLogAll() || isLogInternalEvents() || isLogConsumerEvents()) { LOG.info("postProcessDispatch: {}", messageDispatch); } super.postProcessDispatch(messageDispatch); }
@Override public String toString() { StringBuffer buf = new StringBuffer(); buf.append("LoggingBrokerPlugin("); buf.append("logAll="); buf.append(isLogAll()); buf.append(", logConnectionEvents="); buf.append(isLogConnectionEvents()); buf.append(", logConsumerEvents="); buf.append(isLogConsumerEvents()); buf.append(", logProducerEvents="); buf.append(isLogProducerEvents()); buf.append(", logMessageEvents="); buf.append(isLogMessageEvents()); buf.append(", logTransactionEvents="); buf.append(isLogTransactionEvents()); buf.append(", logInternalEvents="); buf.append(isLogInternalEvents()); buf.append(")"); return buf.toString(); } }
@Override public void rollbackTransaction(ConnectionContext context, TransactionId xid) throws Exception { if (isLogAll() || isLogTransactionEvents()) { LOG.info("Rolling back Transaction: {}", xid.getTransactionKey()); } super.rollbackTransaction(context, xid); }
@Override public void addConnection(ConnectionContext context, ConnectionInfo info) throws Exception { if (isLogAll() || isLogConnectionEvents()) { LOG.info("Adding Connection: {}", info); } super.addConnection(context, info); }
@Override public void removeSubscription(ConnectionContext context, RemoveSubscriptionInfo info) throws Exception { if (isLogAll() || isLogConsumerEvents()) { LOG.info("Removing subscription: {}", info); } super.removeSubscription(context, info); }
@Override public void removeSession(ConnectionContext context, SessionInfo info) throws Exception { if (isLogAll() || isLogSessionEvents()) { LOG.info("Removing Session: {}", info); } super.removeSession(context, info); }
@Override public void addDestinationInfo(ConnectionContext context, DestinationInfo info) throws Exception { if (isLogAll() || isLogInternalEvents()) { LOG.info("Adding destination info: {}", info); } super.addDestinationInfo(context, info); }
@Override public void send(ProducerBrokerExchange producerExchange, Message messageSend) throws Exception { if (isLogAll() || isLogProducerEvents()) { logSend(messageSend.copy()); } super.send(producerExchange, messageSend); }
@Override public void addProducer(ConnectionContext context, ProducerInfo info) throws Exception { if (isLogAll() || isLogProducerEvents()) { LOG.info("Adding Producer: {}", info); } super.addProducer(context, info); }
/** * JSR-250 callback wrapper; converts checked exceptions to runtime exceptions * * delegates to afterPropertiesSet, done to prevent backwards incompatible signature change */ @PostConstruct private void postConstruct() { try { afterPropertiesSet(); } catch (Exception ex) { throw new RuntimeException(ex); } }
@Override public void processDispatchNotification(MessageDispatchNotification messageDispatchNotification) throws Exception { if (isLogAll() || isLogInternalEvents() || isLogConsumerEvents()) { LOG.info("ProcessDispatchNotification: {}", messageDispatchNotification); } super.processDispatchNotification(messageDispatchNotification); }
@Override public void isFull(ConnectionContext context, Destination destination, Usage<?> usage) { if (isLogAll() || isLogProducerEvents() || isLogInternalEvents()) { LOG.info("Destination is full: {}", destination.getName()); } super.isFull(context, destination, usage); }
@Override public void beginTransaction(ConnectionContext context, TransactionId xid) throws Exception { if (isLogAll() || isLogTransactionEvents()) { LOG.info("Beginning transaction: {}", xid.getTransactionKey()); } super.beginTransaction(context, xid); }
@Override public void removeConnection(ConnectionContext context, ConnectionInfo info, Throwable error) throws Exception { if (isLogAll() || isLogConnectionEvents()) { LOG.info("Removing Connection: {}", info); } super.removeConnection(context, info, error); }
@Override public Subscription addConsumer(ConnectionContext context, ConsumerInfo info) throws Exception { if (isLogAll() || isLogConsumerEvents()) { LOG.info("Adding Consumer: {}", info); } return super.addConsumer(context, info); }
@Override public void addSession(ConnectionContext context, SessionInfo info) throws Exception { if (isLogAll() || isLogSessionEvents()) { LOG.info("Adding Session: {}", info); } super.addSession(context, info); }