Package org.apache.activemq.broker.region

Examples of org.apache.activemq.broker.region.Destination


            }
        }

        connection.close();
        Thread.sleep(1000);
        Destination dest = backEnd.getRegionBroker().getDestinationMap().get(topic);
        assertNotNull(dest);
        assertTrue(dest.getConsumers().isEmpty());
    }
View Full Code Here


                if (!msg.isPersistent()) {
                    nonPersistent.addMessageLast(node);
                }
            }
            if (msg.isPersistent()) {
                Destination dest = (Destination) msg.getRegionDestination();
                TopicStorePrefetch tsp = topics.get(dest);
                if (tsp != null) {
                    tsp.addMessageLast(node);
                    if (prioritizedMessages && immediatePriorityDispatch && tsp.isPaging()) {
                        if (msg.getPriority() > tsp.getLastRecoveredPriority()) {
View Full Code Here

        if (node != null) {
            Message msg = node.getMessage();
            if (!msg.isPersistent()) {
                nonPersistent.addMessageFirst(node);
            } else {
                Destination dest = (Destination) msg.getRegionDestination();
                TopicStorePrefetch tsp = topics.get(dest);
                if (tsp != null) {
                    tsp.addMessageFirst(node);
                }
            }
View Full Code Here

  }

    public void purgeQueue(ActiveMQDestination destination) throws Exception {
        Set destinations = getManagedBroker().getQueueRegion().getDestinations(destination);
        for (Iterator i = destinations.iterator(); i.hasNext();) {
            Destination dest = (Destination) i.next();
            if (dest instanceof Queue) {
                Queue regionQueue = (Queue) dest;
                regionQueue.purge();
            }
        }
View Full Code Here

        }
    }

    @Override
    public Destination addDestination(ConnectionContext context, ActiveMQDestination destination,boolean create) throws Exception {
        Destination answer = super.addDestination(context, destination,create);
        if (!AdvisorySupport.isAdvisoryTopic(destination)) {
            DestinationInfo info = new DestinationInfo(context.getConnectionId(), DestinationInfo.ADD_OPERATION_TYPE, destination);
            DestinationInfo previous = destinations.putIfAbsent(destination, info);
            if( previous==null ) {
                ActiveMQTopic topic = AdvisorySupport.getDestinationAdvisoryTopic(destination);
View Full Code Here

                                                    String suffix,
                                                    boolean useQueue,
                                                    Subscription subscription ) {
        String name = null;

        Destination regionDestination = (Destination) message.getRegionDestination();
        if (regionDestination != null
                && regionDestination.getActiveMQDestination() != null
                && regionDestination.getActiveMQDestination().getPhysicalName() != null
                && !regionDestination.getActiveMQDestination().getPhysicalName().isEmpty()){
            name = prefix + regionDestination.getActiveMQDestination().getPhysicalName();
        } else {
            name = prefix + message.getDestination().getPhysicalName();
        }

        if (destinationPerDurableSubscriber && subscription instanceof DurableTopicSubscription) {
View Full Code Here

        if (messageReference.isExpired()) {
            // there are two uses of  sendToDeadLetterQueue, we are only interested in valid messages
            super.sendToDeadLetterQueue(context, messageReference, subscription);
        } else {
            try {
                Destination regionDestination = (Destination) messageReference.getRegionDestination();
                final RedeliveryPolicy redeliveryPolicy = redeliveryPolicyMap.getEntryFor(regionDestination.getActiveMQDestination());
                if (redeliveryPolicy != null) {
                    int redeliveryCount = messageReference.getRedeliveryCounter();
                    if (redeliveryCount < redeliveryPolicy.getMaximumRedeliveries()) {

                        long delay = ( redeliveryCount == 0 ?
                                redeliveryPolicy.getInitialRedeliveryDelay() :
                                redeliveryPolicy.getNextRedeliveryDelay(getExistingDelay(messageReference)));

                        scheduleRedelivery(context, messageReference, delay, ++redeliveryCount);
                    } else if (isSendToDlqIfMaxRetriesExceeded()) {
                        super.sendToDeadLetterQueue(context, messageReference, subscription);
                    } else {
                        LOG.debug("Discarding message that exceeds max redelivery count, " + messageReference.getMessageId());
                    }
                } else if (isFallbackToDeadLetter()) {
                    super.sendToDeadLetterQueue(context, messageReference, subscription);
                } else {
                    LOG.debug("Ignoring dlq request for:" + messageReference.getMessageId() + ", RedeliveryPolicy not found (and no fallback) for: " + regionDestination.getActiveMQDestination());
                }
            } catch (Exception exception) {
                // abort the ack, will be effective if client use transactions or individual ack with sync send
                RuntimeException toThrow =  new RuntimeException("Failed to schedule redelivery for: " + messageReference.getMessageId(), exception);
                LOG.error(toThrow.toString(), exception);
View Full Code Here

        }
    }

    private void scheduleRedelivery(ConnectionContext context, MessageReference messageReference, long delay, int redeliveryCount) throws Exception {
        if (LOG.isTraceEnabled()) {
            Destination regionDestination = (Destination) messageReference.getRegionDestination();
            LOG.trace("redelivery #" + redeliveryCount + " of: " + messageReference.getMessageId() + " with delay: "
                    + delay + ", dest: " + regionDestination.getActiveMQDestination());
        }
        final Message old = messageReference.getMessage();
        Message message = old.copy();

        message.setTransactionId(null);
View Full Code Here

        }
    }

    private void forceDestinationWakeupOnCompletion(ConnectionContext context, Transaction transaction,
                                                    ActiveMQDestination amqDestination, BaseCommand ack) throws Exception {
        Destination destination =  addDestination(context, amqDestination, false);
        registerSync(destination, transaction, ack);
    }
View Full Code Here

    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());
View Full Code Here

TOP

Related Classes of org.apache.activemq.broker.region.Destination

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.