/** * Returns the broker's administration connection context used for * configuring the broker at startup */ public ConnectionContext getAdminConnectionContext() throws Exception { return BrokerSupport.getConnectionContext(getBroker()); }
public synchronized int retryMessages() throws Exception { ConnectionContext context = BrokerSupport.getConnectionContext(broker.getContextBroker()); return ((Queue)destination).retryMessages(context, Integer.MAX_VALUE); }
public int copyMatchingMessagesTo(String selector, String destinationName) throws Exception { ConnectionContext context = BrokerSupport.getConnectionContext(broker.getContextBroker()); ActiveMQDestination toDestination = ActiveMQDestination.createDestination(destinationName, ActiveMQDestination.QUEUE_TYPE); return ((Queue)destination).copyMatchingMessagesTo(context, selector, toDestination); }
public int copyMatchingMessagesTo(String selector, String destinationName, int maximumMessages) throws Exception { ConnectionContext context = BrokerSupport.getConnectionContext(broker.getContextBroker()); ActiveMQDestination toDestination = ActiveMQDestination.createDestination(destinationName, ActiveMQDestination.QUEUE_TYPE); return ((Queue)destination).copyMatchingMessagesTo(context, selector, toDestination, maximumMessages); }
public boolean moveMessageTo(String messageId, String destinationName) throws Exception { ConnectionContext context = BrokerSupport.getConnectionContext(broker.getContextBroker()); ActiveMQDestination toDestination = ActiveMQDestination.createDestination(destinationName, ActiveMQDestination.QUEUE_TYPE); return ((Queue)destination).moveMessageTo(context, messageId, toDestination); }
public synchronized int moveMatchingMessagesTo(String selector, String destinationName) throws Exception { ConnectionContext context = BrokerSupport.getConnectionContext(broker.getContextBroker()); ActiveMQDestination toDestination = ActiveMQDestination.createDestination(destinationName, ActiveMQDestination.QUEUE_TYPE); return ((Queue)destination).moveMatchingMessagesTo(context, selector, toDestination); }
public synchronized int moveMatchingMessagesTo(String selector, String destinationName, int maximumMessages) throws Exception { ConnectionContext context = BrokerSupport.getConnectionContext(broker.getContextBroker()); ActiveMQDestination toDestination = ActiveMQDestination.createDestination(destinationName, ActiveMQDestination.QUEUE_TYPE); return ((Queue)destination).moveMatchingMessagesTo(context, selector, toDestination, maximumMessages); }
public boolean copyMessageTo(String messageId, String destinationName) throws Exception { ConnectionContext context = BrokerSupport.getConnectionContext(broker.getContextBroker()); ActiveMQDestination toDestination = ActiveMQDestination.createDestination(destinationName, ActiveMQDestination.QUEUE_TYPE); return ((Queue)destination).copyMessageTo(context, messageId, toDestination); }
private ConnectionContext getConnectionContext() { ConnectionContext context; if (broker == null) { context = new ConnectionContext(); } else { ConnectionContext sharedContext = BrokerSupport.getConnectionContext(broker.getContextBroker()); // Make a local copy of the sharedContext. We do this because we do // not want to set a clientId on the // global sharedContext. Taking a copy of the sharedContext is a // good way to make sure that we are not // messing up the shared context context = sharedContext.copy(); } return context; } }
ConnectionContext context = BrokerSupport.getConnectionContext(this); context.setBroker(this);
@Override public void addQueue(String name) throws Exception { safeGetBroker().getContextBroker() .addDestination(BrokerSupport.getConnectionContext(safeGetBroker().getContextBroker()), new ActiveMQQueue(name), true); }
@Override public void addTopic(String name) throws Exception { safeGetBroker().getContextBroker() .addDestination(BrokerSupport.getConnectionContext(safeGetBroker().getContextBroker()), new ActiveMQTopic(name), true); }
@Override public void removeTopic(String name) throws Exception { safeGetBroker().getContextBroker().removeDestination(BrokerSupport.getConnectionContext(safeGetBroker().getContextBroker()), new ActiveMQTopic(name), 1000); }
@Override public void removeQueue(String name) throws Exception { safeGetBroker().getContextBroker().removeDestination(BrokerSupport.getConnectionContext(safeGetBroker().getContextBroker()), new ActiveMQQueue(name), 1000); }
/** * Moves a message back to its original destination */ public boolean retryMessage(String messageId) throws Exception { Queue queue = (Queue) destination; QueueMessageReference ref = queue.getMessage(messageId); Message rc = ref.getMessage(); if (rc != null) { ActiveMQDestination originalDestination = rc.getOriginalDestination(); if (originalDestination != null) { ConnectionContext context = BrokerSupport.getConnectionContext(broker.getContextBroker()); return queue.moveMessageTo(context, ref, originalDestination); } else { throw new JMSException("No original destination for message: "+ messageId); } } else { throw new JMSException("Could not find message: "+ messageId); } }
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); } }
adminContext = BrokerSupport.getConnectionContext(this);
/** * Returns the broker's administration connection context used for * configuring the broker at startup */ public ConnectionContext getAdminConnectionContext() throws Exception { return BrokerSupport.getConnectionContext(getBroker()); }
public synchronized int moveMatchingMessagesTo(String selector, String destinationName) throws Exception { ConnectionContext context = BrokerSupport.getConnectionContext(broker.getContextBroker()); ActiveMQDestination toDestination = ActiveMQDestination.createDestination(destinationName, ActiveMQDestination.QUEUE_TYPE); return ((Queue)destination).moveMatchingMessagesTo(context, selector, toDestination); }
public synchronized int moveMatchingMessagesTo(String selector, String destinationName, int maximumMessages) throws Exception { ConnectionContext context = BrokerSupport.getConnectionContext(broker.getContextBroker()); ActiveMQDestination toDestination = ActiveMQDestination.createDestination(destinationName, ActiveMQDestination.QUEUE_TYPE); return ((Queue)destination).moveMatchingMessagesTo(context, selector, toDestination, maximumMessages); }