/** * Get the BrokerDestinationView associated with destination * @param activeMQDestination * @return BrokerDestinationView * @throws Exception */ public BrokerDestinationView getDestinationView (ActiveMQDestination activeMQDestination) throws Exception { BrokerDestinationView view = null; synchronized(destinationViewMap){ view = destinationViewMap.get(activeMQDestination); if (view==null){ /** * If auto destinatons are allowed (on by default) - this will create a Broker Destination * if it doesn't exist. We could query the regionBroker first to check - but this affords more * flexibility - e.g. you might want to set up a query on destination statistics before any * messaging clients have started (and hence created the destination themselves */ Destination destination = brokerService.getDestination(activeMQDestination); view = new BrokerDestinationView(destination); destinationViewMap.put(activeMQDestination,view); } } return view; }
@Test public void testBrokerDestinationView() throws Exception { for (int i = 0; i < messageCount; i++){ Message message = producerSession.createTextMessage("test " + i); producer.send(message); } MessageBrokerView messageBrokerView = MessageBrokerViewRegistry.getInstance().lookup(""); BrokerDestinationView destinationView = messageBrokerView.getQueueDestinationView(getClass().getName()); assertEquals(destinationView.getQueueSize(),messageCount); } }
/** * Get the BrokerDestinationView associated with destination * @param activeMQDestination * @return BrokerDestinationView * @throws Exception */ public BrokerDestinationView getDestinationView (ActiveMQDestination activeMQDestination) throws Exception { BrokerDestinationView view = null; synchronized(destinationViewMap){ view = destinationViewMap.get(activeMQDestination); if (view==null){ /** * If auto destinatons are allowed (on by default) - this will create a Broker Destination * if it doesn't exist. We could query the regionBroker first to check - but this affords more * flexibility - e.g. you might want to set up a query on destination statistics before any * messaging clients have started (and hence created the destination themselves */ Destination destination = brokerService.getDestination(activeMQDestination); view = new BrokerDestinationView(destination); destinationViewMap.put(activeMQDestination,view); } } return view; }
/** * Get the BrokerDestinationView associated with destination * @param activeMQDestination * @return BrokerDestinationView * @throws Exception */ public BrokerDestinationView getDestinationView (ActiveMQDestination activeMQDestination) throws Exception { BrokerDestinationView view = null; synchronized(destinationViewMap){ view = destinationViewMap.get(activeMQDestination); if (view==null){ /** * If auto destinatons are allowed (on by default) - this will create a Broker Destination * if it doesn't exist. We could query the regionBroker first to check - but this affords more * flexibility - e.g. you might want to set up a query on destination statistics before any * messaging clients have started (and hence created the destination themselves */ Destination destination = brokerService.getDestination(activeMQDestination); view = new BrokerDestinationView(destination); destinationViewMap.put(activeMQDestination,view); } } return view; }
/** * Get the BrokerDestinationView associated with destination * @param activeMQDestination * @return BrokerDestinationView * @throws Exception */ public BrokerDestinationView getDestinationView (ActiveMQDestination activeMQDestination) throws Exception { BrokerDestinationView view = null; synchronized(destinationViewMap){ view = destinationViewMap.get(activeMQDestination); if (view==null){ /** * If auto destinatons are allowed (on by default) - this will create a Broker Destination * if it doesn't exist. We could query the regionBroker first to check - but this affords more * flexibility - e.g. you might want to set up a query on destination statistics before any * messaging clients have started (and hence created the destination themselves */ Destination destination = brokerService.getDestination(activeMQDestination); view = new BrokerDestinationView(destination); destinationViewMap.put(activeMQDestination,view); } } return view; }