Thank you very much christopher.l.shannon. Your reply helped me to solve the problem. This is the new code (the modifications are in bold) for any one who may be interested. Your critics are welcomed of course.
Regards, public class MyBroker extends BrokerFilter { public MyBroker(Broker next) { super(next); } public void addConnection(ConnectionContext context, ConnectionInfo info) throws Exception { *sendNotification(context,"addConnection",info.getConnectionId().toString(),info.getClientId(),info.getClientIp());* super.addConnection(context, info); } *public void sendNotification (ConnectionContext context,String notificationType,String id,String clientId,String clientIp) throws Exception { ActiveMQDestination destination = ActiveMQDestination.createDestination("monitoring.notifications",ActiveMQDestination.QUEUE_TYPE); ActiveMQMapMessage msg = new ActiveMQMapMessage(); msg.setString("notificationType",notificationType); msg.setString("id",id); msg.setString("clientId",clientId); msg.setString("clientIp",clientIp); msg.setPersistent(false); msg.setTimestamp(System.currentTimeMillis()); msg.setPriority((byte) javax.jms.Message.DEFAULT_PRIORITY); msg.setType(AdvisorySupport.ADIVSORY_MESSAGE_TYPE); msg.setDestination(destination); msg.setResponseRequired(false); ProducerId producerId = new ProducerId("monitorNotifier"); msg.setProducerId(producerId); msg.setMessageId(new MessageId(producerId, this.messageIdGenerator.getNextSequenceId())); boolean originalFlowControl = context.isProducerFlowControl(); final ProducerBrokerExchange producerExchange = new ProducerBrokerExchange(); producerExchange.setConnectionContext(context); producerExchange.setMutable(true); producerExchange.setProducerState(new ProducerState(new ProducerInfo())); try { context.setProducerFlowControl(false); this.next.send(producerExchange, msg); } finally { context.setProducerFlowControl(originalFlowControl); } }* } -- View this message in context: http://activemq.2283324.n4.nabble.com/put-a-message-in-queue-using-org-apache-activemq-broker-Broker-tp4697413p4697470.html Sent from the ActiveMQ - User mailing list archive at Nabble.com.