protected Destination getMirrorDestination(Destination destination) throws Exception { if (brokerService == null) { throw new IllegalArgumentException("No brokerService injected!"); } ActiveMQDestination topic = getMirrorTopic(destination.getActiveMQDestination()); return brokerService.getDestination(topic); }
/** * 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; }
public void removeQueue(String queueName) { try { ActiveMQQueue destination = new ActiveMQQueue(queueName); ConnectionContext connectionContext = BrokerSupport.getConnectionContext(broker.getBroker()); Destination brokerDestination = broker.getDestination(destination); List<Subscription> consumers = brokerDestination.getConsumers(); for (Subscription consumer : consumers) { consumer.remove(connectionContext, brokerDestination); brokerDestination.removeSubscription(connectionContext, consumer, 0); } broker.getBroker().removeDestination(connectionContext, destination, 1000); broker.removeDestination(destination); } catch (Exception e) { throw bomb(e); } }
protected Destination getMirrorDestination(Destination destination) throws Exception { if (brokerService == null) { throw new IllegalArgumentException("No brokerService injected!"); } ActiveMQDestination topic = getMirrorTopic(destination.getActiveMQDestination()); return brokerService.getDestination(topic); }
/** * 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; }
protected Destination getMirrorDestination(Destination destination) throws Exception { if (brokerService == null) { throw new IllegalArgumentException("No brokerService injected!"); } ActiveMQDestination topic = getMirrorTopic(destination.getActiveMQDestination()); return brokerService.getDestination(topic); }
protected Destination getMirrorDestination(Destination destination) throws Exception { if (brokerService == null) { throw new IllegalArgumentException("No brokerService injected!"); } ActiveMQDestination topic = getMirrorTopic(destination.getActiveMQDestination()); return brokerService.getDestination(topic); }
/** * 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; }
protected Destination getMirrorDestination(Destination destination) throws Exception { if (brokerService == null) { throw new IllegalArgumentException("No brokerService injected!"); } ActiveMQDestination topic = getMirrorTopic(destination.getActiveMQDestination()); return brokerService.getDestination(topic); }
/** * Get the ActiveMQ destination * * The full name of the JMS destination including the prefix should be provided - i.e. queue://myQueue * or topic://myTopic. If the destination type prefix is not included in the destination name, a prefix * of "queue://" is assumed. * * @param destinationName the full name of the JMS Destination * * @return the {@link org.apache.activemq.broker.region.Destination}, null if not found * * @throws EmbeddedActiveMQBrokerException if some exception occurs retrieving the {@link org.apache.activemq.broker.region.Destination} * from the {@link org.apache.activemq.broker.BrokerService} * IllegalStateException if the {@link org.apache.activemq.broker.BrokerService} * hasn't been created */ public Destination getDestination(String destinationName) { if (null == brokerService) { throw new IllegalStateException("BrokerService has not yet been created - was before() called?"); } Destination answer; try { ActiveMQDestination tmpDestination = createDestination(destinationName); answer = brokerService.getDestination(tmpDestination); } catch (Exception unexpectedEx) { throw new EmbeddedActiveMQBrokerException("Unexpected exception getting destination from broker", unexpectedEx); } return answer; }
/** * Get the next {@link javax.jms.Message} from the specified destination without consuming the message. * * @param destinationName the JMS destination name * * @return the next {@link javax.jms.Message} */ public Message peekMessage(String destinationName) { if (null == brokerService) { throw new NullPointerException("peekMessage failure - BrokerService is null"); } if (destinationName == null) { throw new IllegalArgumentException("peekMessage failure - destination name is required"); } ActiveMQDestination destination = createDestination(destinationName); Destination brokerDestination = null; try { brokerDestination = brokerService.getDestination(destination); } catch (Exception ex) { throw new EmbeddedActiveMQBrokerException("peekMessage failure - unexpected exception getting destination from BrokerService", ex); } if (brokerDestination == null) { throw new IllegalStateException(String.format("peekMessage failure - destination %s not found in broker %s", destination.toString(), brokerService.getBrokerName())); } org.apache.activemq.command.Message[] messages = brokerDestination.browse(); if (messages != null && messages.length > 0) { return (Message) messages[0]; } return null; }