@Override public ActiveMQDestination getActiveMQDestination() { return next.getActiveMQDestination(); }
/** * @return true if the destination is a Dead Letter Queue */ public boolean isDLQ() { return destination.getActiveMQDestination().isDLQ(); }
@Override public boolean isDLQ() { return destination.getActiveMQDestination().isDLQ(); }
@Override public void setDLQ(boolean val) { destination.getActiveMQDestination().setDLQ(val); }
@Override public void run() { try { if (exceptionAtomicReference.get() == null) { dest.send(context, copy(message, dest.getActiveMQDestination())); } } catch (ResourceAllocationException e) { if (!dropMessageOnResourceLimit) { exceptionAtomicReference.set(e); } } catch (Exception e) { exceptionAtomicReference.set(e); } finally { concurrent.countDown(); } } });
public void remove(Destination destination) { if (brokerService == null) { throw new IllegalArgumentException("No brokerService injected!"); } ActiveMQDestination topic = getMirrorTopic(destination.getActiveMQDestination()); if (topic != null) { try { brokerService.removeDestination(topic); } catch (Exception e) { LOG.error("Failed to remove mirror destination for {}", destination, 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); }
@Override public String getOptions() { Map<String, String> options = destination.getActiveMQDestination().getOptions(); String optionsString = ""; try { if (options != null) { optionsString = URISupport.createQueryString(options); } } catch (URISyntaxException ignored) {} return optionsString; }
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); } } }
@Override public String toString() { return super.toString() + ":" + regionDestination.getActiveMQDestination().getPhysicalName() + ",batchResetNeeded=" + batchResetNeeded + ",size=" + this.size + ",cacheEnabled=" + cacheEnabled + ",maxBatchSize:" + maxBatchSize + ",hasSpace:" + hasSpace() + ",pendingCachedIds.size:" + pendingCachedIds.size() + ",lastSyncCachedId:" + lastCachedIds[SYNC_ADD] + ",lastSyncCachedId-seq:" + (lastCachedIds[SYNC_ADD] != null ? lastCachedIds[SYNC_ADD].getFutureOrSequenceLong() : "null") + ",lastAsyncCachedId:" + lastCachedIds[ASYNC_ADD] + ",lastAsyncCachedId-seq:" + (lastCachedIds[ASYNC_ADD] != null ? lastCachedIds[ASYNC_ADD].getFutureOrSequenceLong() : "null"); }
@Override public Destination interceptMappedDestination(Destination destination) { // do a reverse map from destination to get actual virtual destination final String physicalName = destination.getActiveMQDestination().getPhysicalName(); final Pattern pattern = Pattern.compile(getRegex(prefix) + "(.*)" + getRegex(postfix)); final Matcher matcher = pattern.matcher(physicalName); if (matcher.matches()) { final String virtualName = matcher.group(1); return new MappedQueueFilter(new ActiveMQTopic(virtualName), destination); } return 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); } };
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); }
@Override public Destination interceptMappedDestination(Destination destination) { if (!isForwardOnly() && destination.getActiveMQDestination().isQueue()) { // recover retroactive messages in mapped Queue return new MappedQueueFilter(getVirtualDestination(), destination); } return destination; }
@Override public synchronized void removeAll(){ cache.clear(); if (destination != null) { for (Subscription s : destination.getConsumers()) { s.getConsumerInfo().clearAssignedGroupCount(destination.getActiveMQDestination()); } } }
@Override public void removeDestination(Destination dest) { ActiveMQDestination destination = dest.getActiveMQDestination(); if (!destination.isTemporary()) { if (destination.isQueue()) { persistenceAdapter.removeQueueMessageStore((ActiveMQQueue) destination); } else if (!AdvisorySupport.isAdvisoryTopic(destination)) { persistenceAdapter.removeTopicMessageStore((ActiveMQTopic) destination); } } }
@Override public void isFull(ConnectionContext context, Destination destination, Usage<?> usage) { super.isFull(context, destination, usage); if (AdvisorySupport.isAdvisoryTopic(destination.getActiveMQDestination()) == false) { try { ActiveMQTopic topic = AdvisorySupport.getFullAdvisoryTopic(destination.getActiveMQDestination()); ActiveMQMessage advisoryMessage = new ActiveMQMessage(); advisoryMessage.setStringProperty(AdvisorySupport.MSG_PROPERTY_USAGE_NAME, usage.getName()); advisoryMessage.setLongProperty(AdvisorySupport.MSG_PROPERTY_USAGE_COUNT, usage.getUsage()); fireAdvisory(context, topic, null, null, advisoryMessage); } catch (Exception e) { handleFireFailure("is full", e); } } }
@Override public boolean removeEldestEntry(final Map.Entry eldest) { boolean remove = super.removeEldestEntry(eldest); if (remove) { if (destination != null) { for (Subscription s : destination.getConsumers()) { if (s.getConsumerInfo().getConsumerId().equals(eldest.getValue())) { s.getConsumerInfo().decrementAssignedGroupCount(destination.getActiveMQDestination()); break; } } } } return remove; } };
@Override public void slowConsumer(ConnectionContext context, Destination destination, Subscription subs) { super.slowConsumer(context, destination, subs); try { if (!AdvisorySupport.isAdvisoryTopic(destination.getActiveMQDestination())) { ActiveMQTopic topic = AdvisorySupport.getSlowConsumerAdvisoryTopic(destination.getActiveMQDestination()); ActiveMQMessage advisoryMessage = new ActiveMQMessage(); advisoryMessage.setStringProperty(AdvisorySupport.MSG_PROPERTY_CONSUMER_ID, subs.getConsumerInfo().getConsumerId().toString()); fireAdvisory(context, topic, subs.getConsumerInfo(), null, advisoryMessage); } } catch (Exception e) { handleFireFailure("slow consumer", e); } }
@Override public boolean addRecoveredMessage(ConnectionContext context, MessageReference message) throws Exception { boolean result = false; MessageEvaluationContext msgContext = context.getMessageEvaluationContext(); try { Destination regionDestination = (Destination) message.getRegionDestination(); msgContext.setDestination(regionDestination.getActiveMQDestination()); msgContext.setMessageReference(message); result = matches(message, msgContext); if (result) { doAddRecoveredMessage(message); } } finally { msgContext.clear(); } return result; }