Tabnine Logo
Destination
Code IndexAdd Tabnine to your IDE (free)

How to use
Destination
in
org.apache.activemq.broker.region

Best Java code snippets using org.apache.activemq.broker.region.Destination (Showing top 20 results out of 315)

Refine searchRefine arrow

  • CountStatisticImpl
  • BrokerService
  • ActiveMQDestination
  • Broker
  • ConsumerInfo
  • ConnectionContext
  • Session
  • MessageProducer
  • ActiveMQQueue
origin: gocd/gocd

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);
  }
}
origin: apache/activemq

@Override
protected void acknowledge(ConnectionContext context, MessageAck ack, MessageReference node) throws IOException {
  this.setTimeOfLastMessageAck(System.currentTimeMillis());
  Destination regionDestination = (Destination) node.getRegionDestination();
  regionDestination.acknowledge(context, this, ack, node);
  redeliveredMessages.remove(node.getMessageId());
  node.decrementReferenceCount();
  ((Destination)node.getRegionDestination()).getDestinationStatistics().getDequeues().increment();
  if (info.isNetworkSubscription()) {
    ((Destination)node.getRegionDestination()).getDestinationStatistics().getForwards().add(ack.getMessageCount());
  }
}
origin: apache/activemq

public boolean checkQueueSize(String queueName) {
  long count = 0;
  long queueSize = 0;
  Map<ActiveMQDestination, Destination> destinationMap = regionBroker.getDestinationMap();
  for (Map.Entry<ActiveMQDestination, Destination> entry : destinationMap.entrySet()) {
    if (entry.getKey().isQueue()) {
      if (entry.getValue().getName().matches(queueName)) {
        queueSize = entry.getValue().getDestinationStatistics().getMessages().getCount();
        count += queueSize;
        if (queueSize > 0) {
          LOG.info("Queue has pending message: {} queueSize is: {}", entry.getValue().getName(), queueSize);
        }
      }
    }
  }
  return count == 0;
}
origin: apache/activemq

private void doDispose(Destination dest) {
  ConnectionContext context = new ConnectionContext();
  try {
    dest.dispose(context);
    dest.stop();
  } catch (Exception e) {
    LOG.warn("Failed to dispose of {}", dest, e);
  }
}
origin: apache/activemq

protected void dispose(ConnectionContext context, Destination dest) throws Exception {
  dest.dispose(context);
  dest.stop();
  destinationFactory.removeDestination(dest);
}
origin: apache/activemq

protected final synchronized void dispose(ConnectionContext context,
    Destination dest) throws Exception {
  // add to cache
  if (this.doCacheTempDestinations) {
    cachedDestinations.put(new CachedDestination(dest
        .getActiveMQDestination()), dest);
  }else {
    try {
      dest.dispose(context);
      dest.stop();
    } catch (Exception e) {
      LOG.warn("Failed to dispose of {}", dest, e);
    }
  }
}
origin: apache/activemq

ActiveMQDestination queryDestination = ActiveMQDestination.createDestination(destinationQuery,msgDest.getDestinationType());
Set<Destination> destinations = getDestinations(queryDestination);
  DestinationStatistics stats = dest.getDestinationStatistics();
  if (stats != null) {
    ActiveMQMapMessage statsMessage = new ActiveMQMapMessage();
    statsMessage.setString("brokerName", regionBroker.getBrokerName());
    statsMessage.setString("brokerId", regionBroker.getBrokerId().toString());
    statsMessage.setString("destinationName", dest.getActiveMQDestination().toString());
    statsMessage.setLong("size", stats.getMessages().getCount());
    statsMessage.setLong("enqueueCount", stats.getEnqueues().getCount());
    statsMessage.setLong("dequeueCount", stats.getDequeues().getCount());
    statsMessage.setInt("memoryPercentUsage", dest.getMemoryUsage().getPercentUsage());
    statsMessage.setLong("memoryUsage", dest.getMemoryUsage().getUsage());
    statsMessage.setLong("memoryLimit", dest.getMemoryUsage().getLimit());
    statsMessage.setDouble("averageEnqueueTime", stats.getProcessTime().getAverageTime());
    statsMessage.setDouble("maxEnqueueTime", stats.getProcessTime().getMaxTime());
SystemUsage systemUsage = brokerService.getSystemUsage();
DestinationStatistics stats = regionBroker.getDestinationStatistics();
statsMessage.setString("brokerName", regionBroker.getBrokerName());
String answer = brokerService.getTransportConnectorURIsAsMap().get("tcp");
answer = answer != null ? answer : "";
statsMessage.setString("openwire", answer);
origin: apache/activemq

@Override
@SuppressWarnings("unchecked")
public Subscription addConsumer(ConnectionContext context, ConsumerInfo info) throws Exception {
  LOG.debug("{} adding consumer: {} for destination: {}", new Object[]{ broker.getBrokerName(), info.getConsumerId(), info.getDestination() });
  ActiveMQDestination destination = info.getDestination();
  if (destination != null && !destination.isPattern() && !destination.isComposite()) {
    for (Destination dest : addList) {
      try {
        dest.addSubscription(context, sub);
        removeList.add(dest);
      } catch (SecurityException e){
        if (sub.isWildcard()) {
          LOG.debug("Subscription denied for " + sub + " to destination " +
            dest.getActiveMQDestination() + ": " + e.getMessage());
        } else {
              remove.removeSubscription(context, sub, info.getLastDeliveredSequenceId());
            } catch (Exception ex) {
              LOG.error("Error unsubscribing " + sub + " from " + remove + ": " + ex.getMessage(), ex);
origin: powertac/powertac-server

 private void deleteDestination (Broker broker,
                 ActiveMQDestination amqDestination,
                 Destination destination) throws Exception
 {
  List<Subscription> subscriptions = destination.getConsumers();
  for (Subscription subscription: subscriptions) {
   ConsumerInfo info = new ConsumerInfo();
   info.setDestination(amqDestination);
   info.setConsumerId(subscription.getConsumerInfo().getConsumerId());
   broker.removeConsumer(subscription.getContext(), info);
  }
  ConnectionContext context = new ConnectionContext();
  context.setBroker(broker);
  broker.removeDestination(context, amqDestination, 0);
  log.info("processQueues - successfully remove queue " + destination.getName());
 }
}
origin: org.apache.activemq/activemq-all

@Override
protected void onRecovered(Tx tx) {
  for (RemoveMessageCommand removeMessageCommand: tx.acks) {
    if (removeMessageCommand instanceof LastAckCommand) {
      LastAckCommand lastAckCommand = (LastAckCommand) removeMessageCommand;
      JDBCTopicMessageStore jdbcTopicMessageStore = (JDBCTopicMessageStore) topicStores.get(lastAckCommand.getMessageAck().getDestination());
      jdbcTopicMessageStore.pendingCompletion(lastAckCommand.getClientId(), lastAckCommand.getSubName(), lastAckCommand.getSequence(), lastAckCommand.getPriority());
      lastAckCommand.setMessageStore(jdbcTopicMessageStore);
    } else {
      // when reading the store we ignore messages with non null XIDs but should include those with XIDS starting in - (pending acks in an xa transaction),
      // but the sql is non portable to match BLOB with LIKE etc
      // so we make up for it when we recover the ack
      ((JDBCPersistenceAdapter)persistenceAdapter).getBrokerService().getRegionBroker().getDestinationMap().get(removeMessageCommand.getMessageAck().getDestination()).getDestinationStatistics().getMessages().increment();
    }
  }
  for (AddMessageCommand addMessageCommand : tx.messages) {
    ActiveMQDestination destination = addMessageCommand.getMessage().getDestination();
    addMessageCommand.setMessageStore(destination.isQueue() ? queueStores.get(destination) : topicStores.get(destination));
  }
}
origin: apache/activemq

int match = sub.getActiveMQDestination().compareTo(next.getActiveMQDestination());
if (match == 0 || (!next.getActiveMQDestination().isPattern() && match == 1)) {
  super.addSubscription(context, sub);
  final RegionBroker regionBroker = (RegionBroker) context.getBroker().getAdaptor(RegionBroker.class);
  final Set<Destination> virtualDests = regionBroker.getDestinations(virtualDestination);
    if (virtualDest.getActiveMQDestination().isTopic() &&
        (virtualDest.isAlwaysRetroactive() || sub.getConsumerInfo().isRetroactive())) {
origin: apache/activemq

Set<Subscription> dupChecker = new HashSet<Subscription>(rc);
TopicMessageStore store = (TopicMessageStore)dest.getMessageStore();
    ConsumerInfo consumerInfo = createInactiveConsumerInfo(info);
    if (sub == null) {
      ConnectionContext c = new ConnectionContext();
      c.setBroker(context.getBroker());
      c.setClientId(key.getClientId());
      c.setConnectionId(consumerInfo.getConsumerId().getParentId().getParentId());
      sub = (DurableTopicSubscription)createSubscription(c, consumerInfo);
      sub.setOfflineTimestamp(System.currentTimeMillis());
    dest.addSubscription(context, sub);
    if (sub.matches(dest.getActiveMQDestination())) {
      rc.add(sub);
      dest.addSubscription(context, sub);
origin: apache/activemq

protected void onDispatch(final MessageReference node, final Message message) {
  Destination nodeDest = (Destination) node.getRegionDestination();
  if (nodeDest != null) {
    if (node != QueueMessageReference.NULL_MESSAGE) {
      nodeDest.getDestinationStatistics().getDispatched().increment();
      nodeDest.getDestinationStatistics().getInflight().increment();
      LOG.trace("{} dispatched: {} - {}, dispatched: {}, inflight: {}", new Object[]{ info.getConsumerId(), message.getMessageId(), message.getDestination(), getSubscriptionStatistics().getDispatched().getCount(), dispatched.size() });
    }
  }
  if (info.isDispatchAsync()) {
    try {
      dispatchPending();
    } catch (IOException e) {
      context.getConnection().serviceExceptionAsync(e);
    }
  }
}
origin: apache/activemq

md.setConsumerId(info.getConsumerId());
if (node != null) {
  md.setDestination(((Destination)node.getRegionDestination()).getActiveMQDestination());
  synchronized(dispatchLock) {
    getSubscriptionStatistics().getDispatched().increment();
    if (isUseTopicSubscriptionInflightStats()) {
      dispatched.add(new DispatchedNode(node));
if (info.isDispatchAsync()) {
  if (node != null) {
    md.setTransmitCallback(new TransmitCallback() {
  context.getConnection().dispatchAsync(md);
} else {
  context.getConnection().dispatchSync(md);
  if (node != null) {
    Destination regionDestination = (Destination) node.getRegionDestination();
    regionDestination.getDestinationStatistics().getDispatched().increment();
    regionDestination.getDestinationStatistics().getInflight().increment();
    node.decrementReferenceCount();
origin: apache/activemq

  map.putAll(tempTopicRegion.getDestinationMap());
long maxPurgedDests = this.brokerService.getMaxPurgedDestinationsPerSweep();
long timeStamp = System.currentTimeMillis();
for (Destination d : map.values()) {
  d.markForGC(timeStamp);
  if (d.canGC()) {
    list.add(d);
    if (maxPurgedDests > 0 && list.size() == maxPurgedDests) {
  context.setBroker(this);
      log = ((BaseDestination) dest).getLog();
    log.info("{} Inactive for longer than {} ms - removing ...", dest.getName(), dest.getInactiveTimeoutBeforeGC());
    try {
      getRoot().removeDestination(context, dest.getActiveMQDestination(), isAllowTempAutoCreationOnSend() ? 1 : 0);
    } catch (Throwable e) {
      LOG.error("Failed to remove inactive destination {}", dest, e);
origin: apache/activemq

@Override
@SuppressWarnings("unchecked")
public void removeConsumer(ConnectionContext context, ConsumerInfo info) throws Exception {
  LOG.debug("{} removing consumer: {} for destination: {}", new Object[]{ broker.getBrokerName(), info.getConsumerId(), info.getDestination() });
  Subscription sub = subscriptions.remove(info.getConsumerId());
  // The sub could be removed elsewhere - see ConnectionSplitBroker
  if (sub != null) {
    // remove the subscription from all the matching queues.
    List<Destination> removeList = new ArrayList<Destination>();
    destinationsLock.readLock().lock();
    try {
      for (Destination dest : (Set<Destination>) destinationMap.unsynchronizedGet(info.getDestination())) {
        removeList.add(dest);
      }
    } finally {
      destinationsLock.readLock().unlock();
    }
    for (Destination dest : removeList) {
      dest.removeSubscription(context, sub, info.getLastDeliveredSequenceId());
    }
    destroySubscription(sub);
  }
  synchronized (consumerChangeMutexMap) {
    consumerChangeMutexMap.remove(info.getConsumerId());
  }
}
origin: apache/activemq

private void discard(MessageReference message) {
  discarding = true;
  try {
    message.decrementReferenceCount();
    matched.remove(message);
    discarded++;
    if (destination != null) {
      destination.getDestinationStatistics().getDequeues().increment();
    }
    LOG.debug("{}, discarding message {}", this, message);
    Destination dest = (Destination) message.getRegionDestination();
    if (dest != null) {
      dest.messageDiscarded(getContext(), this, message);
    }
    broker.getRoot().sendToDeadLetterQueue(getContext(), message, this, new Throwable("TopicSubDiscard. ID:" + info.getConsumerId()));
  } finally {
    discarding = false;
  }
}
origin: apache/activemq

public Destination intercept(final Destination destination) {
  if (destination.getActiveMQDestination().isQueue()) {
    if (!destination.getActiveMQDestination().isTemporary() || brokerService.isUseTempMirroredQueues()) {
      try {
        final Destination mirrorDestination = getMirrorDestination(destination);
        if (mirrorDestination != null) {
          return new DestinationFilter(destination) {
            public void send(ProducerBrokerExchange context, Message message) throws Exception {
              message.setDestination(mirrorDestination.getActiveMQDestination());
              mirrorDestination.send(context, message);

              if (isCopyMessage()) {
                message = message.copy();
              }
              message.setDestination(destination.getActiveMQDestination());
              message.setMemoryUsage(null); // set this to null so that it will use the queue memoryUsage instance instead of the topic.
              super.send(context, message);
            }
          };
        }
      }
      catch (Exception e) {
        LOG.error("Failed to lookup the mirror destination for: {}", destination, e);
      }
    }
  }
  return destination;
}

origin: apache/activemq

  @Override
  public void onFailure() {
    Destination nodeDest = (Destination) node.getRegionDestination();
    if (nodeDest != null) {
      if (node != QueueMessageReference.NULL_MESSAGE) {
        nodeDest.getDestinationStatistics().getDispatched().increment();
        nodeDest.getDestinationStatistics().getInflight().increment();
        LOG.trace("{} failed to dispatch: {} - {}, dispatched: {}, inflight: {}", new Object[]{ info.getConsumerId(), message.getMessageId(), message.getDestination(), getSubscriptionStatistics().getDispatched().getCount(), dispatched.size() });
      }
    }
    if (node instanceof QueueMessageReference) {
      ((QueueMessageReference) node).unlock();
    }
  }
});
origin: apache/activemq

public synchronized void purge() throws Exception {
  final long originalMessageCount = destination.getDestinationStatistics().getMessages().getCount();
  ((Queue)destination).purge();
  LOG.info("{} purge of {} messages", destination.getActiveMQDestination().getQualifiedName(), originalMessageCount);
}
org.apache.activemq.broker.regionDestination

Most used methods

  • getConsumers
  • getDestinationStatistics
  • getName
  • getActiveMQDestination
  • browse
  • removeSubscription
  • acknowledge
  • addProducer
  • addSubscription
  • dispose
  • fastProducer
    Called to notify a producer is too fast
  • gc
  • fastProducer,
  • gc,
  • getBlockedProducerWarningInterval,
  • getCursorMemoryHighWaterMark,
  • getDeadLetterStrategy,
  • getMaxAuditDepth,
  • getMaxBrowsePageSize,
  • getMaxPageSize,
  • getMaxProducersToAudit,
  • getMemoryUsage

Popular in Java

  • Creating JSON documents from java classes using gson
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • getSystemService (Context)
  • scheduleAtFixedRate (ScheduledExecutorService)
  • Font (java.awt)
    The Font class represents fonts, which are used to render text in a visible way. A font provides the
  • FileReader (java.io)
    A specialized Reader that reads from a file in the file system. All read requests made by calling me
  • String (java.lang)
  • GregorianCalendar (java.util)
    GregorianCalendar is a concrete subclass of Calendarand provides the standard calendar used by most
  • Reference (javax.naming)
  • Servlet (javax.servlet)
    Defines methods that all servlets must implement. A servlet is a small Java program that runs within
  • Github Copilot alternatives
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now