/** * Looks up and lazily creates if necessary the destination for the given * JMS name */ public Destination getDestination(ActiveMQDestination destination) throws Exception { return getBroker().addDestination(getAdminConnectionContext(), destination,false); }
public void removeDestination(ActiveMQDestination destination) throws Exception { getBroker().removeDestination(getAdminConnectionContext(), destination, 0); }
protected void importDestinations() throws Exception { BufferedReader reader = null; try { if (location.exists()) { reader = new BufferedReader(new FileReader(location)); String destination; Broker broker = getBrokerService().getBroker(); while ((destination = reader.readLine()) != null) { broker.addDestination(getBrokerService().getAdminConnectionContext(), ActiveMQDestination.createDestination(destination, ActiveMQDestination.QUEUE_TYPE), true); } } } catch (Exception e) { LOG.warn("Exception loading destinations", e); } finally { if (reader != null) { reader.close(); } } }
protected void startVirtualConsumerDestinations() throws Exception { checkStartException(); ConnectionContext adminConnectionContext = getAdminConnectionContext(); Set<ActiveMQDestination> destinations = destinationFactory.getDestinations(); DestinationFilter filter = getVirtualTopicConsumerDestinationFilter(); if (!destinations.isEmpty()) { for (ActiveMQDestination destination : destinations) { if (filter.matches(destination) == true) { broker.addDestination(adminConnectionContext, destination, false); } } } }
/** * Starts any configured destinations on startup */ protected void startDestinations() throws Exception { if (destinations != null) { ConnectionContext adminConnectionContext = getAdminConnectionContext(); for (int i = 0; i < destinations.length; i++) { ActiveMQDestination destination = destinations[i]; getBroker().addDestination(adminConnectionContext, destination,true); } } if (isUseVirtualTopics()) { startVirtualConsumerDestinations(); } }
private DestinationFilter getVirtualTopicConsumerDestinationFilter() { // created at startup, so no sync needed if (virtualConsumerDestinationFilter == null) { Set <ActiveMQQueue> consumerDestinations = new HashSet<>(); if (destinationInterceptors != null) { for (DestinationInterceptor interceptor : destinationInterceptors) { if (interceptor instanceof VirtualDestinationInterceptor) { VirtualDestinationInterceptor virtualDestinationInterceptor = (VirtualDestinationInterceptor) interceptor; for (VirtualDestination virtualDestination: virtualDestinationInterceptor.getVirtualDestinations()) { if (virtualDestination instanceof VirtualTopic) { consumerDestinations.add(new ActiveMQQueue(((VirtualTopic) virtualDestination).getPrefix() + DestinationFilter.ANY_DESCENDENT)); } if (isUseVirtualDestSubs()) { try { broker.virtualDestinationAdded(getAdminConnectionContext(), virtualDestination); LOG.debug("Adding virtual destination: {}", virtualDestination); } catch (Exception e) { LOG.warn("Could not fire virtual destination consumer advisory", e); } } } } } } ActiveMQQueue filter = new ActiveMQQueue(); filter.setCompositeDestinations(consumerDestinations.toArray(new ActiveMQDestination[]{})); virtualConsumerDestinationFilter = DestinationFilter.parseFilter(filter); } return virtualConsumerDestinationFilter; }
public void remove(SubscriptionView view, String messageId) throws Exception { ActiveMQDestination destination = getTopicDestination(view); if (destination != null) { final Destination topic = getTopicRegion().getDestinationMap().get(destination); final MessageAck messageAck = new MessageAck(); messageAck.setMessageID(new MessageId(messageId)); messageAck.setDestination(destination); topic.getMessageStore().removeMessage(brokerService.getAdminConnectionContext(), messageAck); // if sub is active, remove from cursor if (view.subscription instanceof DurableTopicSubscription) { final DurableTopicSubscription durableTopicSubscription = (DurableTopicSubscription) view.subscription; final MessageReference messageReference = new NullMessageReference(); messageReference.getMessage().setMessageId(messageAck.getFirstMessageId()); durableTopicSubscription.getPending().remove(messageReference); } } else { throw new IllegalStateException("can't determine topic for sub:" + view); } }
/** * Looks up and lazily creates if necessary the destination for the given * JMS name */ public Destination getDestination(ActiveMQDestination destination) throws Exception { return getBroker().addDestination(getAdminConnectionContext(), destination,false); }
/** * Looks up and lazily creates if necessary the destination for the given * JMS name */ public Destination getDestination(ActiveMQDestination destination) throws Exception { return getBroker().addDestination(getAdminConnectionContext(), destination,false); }
/** * Looks up and lazily creates if necessary the destination for the given * JMS name */ public Destination getDestination(ActiveMQDestination destination) throws Exception { return getBroker().addDestination(getAdminConnectionContext(), destination,false); }
/** * Looks up and lazily creates if necessary the destination for the given * JMS name */ public Destination getDestination(ActiveMQDestination destination) throws Exception { return getBroker().addDestination(getAdminConnectionContext(), destination,false); }
/** * Starts any configured destinations on startup */ protected void startDestinations() throws Exception { if (destinations != null) { ConnectionContext adminConnectionContext = getAdminConnectionContext(); for (int i = 0; i < destinations.length; i++) { ActiveMQDestination destination = destinations[i]; getBroker().addDestination(adminConnectionContext, destination,true); } } }
public void removeDestination(ActiveMQDestination destination) throws Exception { getBroker().removeDestination(getAdminConnectionContext(), destination, 0); }
protected void startVirtualConsumerDestinations() throws Exception { checkStartException(); ConnectionContext adminConnectionContext = getAdminConnectionContext(); Set<ActiveMQDestination> destinations = destinationFactory.getDestinations(); DestinationFilter filter = getVirtualTopicConsumerDestinationFilter(); if (!destinations.isEmpty()) { for (ActiveMQDestination destination : destinations) { if (filter.matches(destination) == true) { broker.addDestination(adminConnectionContext, destination, false); } } } }
protected void startVirtualConsumerDestinations() throws Exception { checkStartException(); ConnectionContext adminConnectionContext = getAdminConnectionContext(); Set<ActiveMQDestination> destinations = destinationFactory.getDestinations(); DestinationFilter filter = getVirtualTopicConsumerDestinationFilter(); if (!destinations.isEmpty()) { for (ActiveMQDestination destination : destinations) { if (filter.matches(destination) == true) { broker.addDestination(adminConnectionContext, destination, false); } } } }
protected void startVirtualConsumerDestinations() throws Exception { checkStartException(); ConnectionContext adminConnectionContext = getAdminConnectionContext(); Set<ActiveMQDestination> destinations = destinationFactory.getDestinations(); DestinationFilter filter = getVirtualTopicConsumerDestinationFilter(); if (!destinations.isEmpty()) { for (ActiveMQDestination destination : destinations) { if (filter.matches(destination) == true) { broker.addDestination(adminConnectionContext, destination, false); } } } }
public void addNewDestination(ActiveMQDestination destination) { try { this.addDestination(this.getBrokerService().getAdminConnectionContext(), destination, true); this.info("Added destination " + destination); } catch (Exception e) { this.info("Failed to add a new destination for: " + destination, e); } }
/** * Starts any configured destinations on startup */ protected void startDestinations() throws Exception { if (destinations != null) { ConnectionContext adminConnectionContext = getAdminConnectionContext(); for (int i = 0; i < destinations.length; i++) { ActiveMQDestination destination = destinations[i]; getBroker().addDestination(adminConnectionContext, destination,true); } } if (isUseVirtualTopics()) { startVirtualConsumerDestinations(); } }
@Override public void addNew(Object o) { try { ActiveMQDestination destination = createDestination(o); plugin.addDestination(plugin.getBrokerService().getAdminConnectionContext(), destination, true); plugin.info("Added destination " + destination); } catch (Exception e) { plugin.info("Failed to add a new destination for DTO: " + o, e); } }
public void setDestinations(final ActiveMQDestination[] destinations) { for (ActiveMQDestination destination : destinations) { try { if (!containsDestination(destination)) { this.addDestination(this.getBrokerService().getAdminConnectionContext(), destination, true); this.info("Added destination " + destination); } } catch (Exception e) { this.info("Failed to add a new destination for: " + destination, e); } } }