Package org.apache.activemq.command

Examples of org.apache.activemq.command.DestinationInfo


                    SERVICELOG.warn("Failed to remove session " + sessionId, e);
                }
            }
            // Cascade the connection stop to temp destinations.
            for (Iterator iter = cs.getTempDestinations().iterator(); iter.hasNext();) {
                DestinationInfo di = (DestinationInfo) iter.next();
                try {
                    broker.removeDestination(cs.getContext(), di.getDestination(), 0);
                } catch (Throwable e) {
                    SERVICELOG.warn("Failed to remove tmp destination " + di.getDestination(), e);
                }
                iter.remove();
            }
            try {
                broker.removeConnection(cs.getContext(), cs.getInfo(), null);
View Full Code Here


        info.setDispatchAsync(false);
        return info;
    }
   
    protected DestinationInfo createTempDestinationInfo(ConnectionInfo connectionInfo, byte destinationType) {
        DestinationInfo info = new DestinationInfo();
        info.setConnectionId(connectionInfo.getConnectionId());
        info.setOperationType(DestinationInfo.ADD_OPERATION_TYPE);
        info.setDestination(ActiveMQDestination.createDestination(info.getConnectionId() + ":" + (++tempDestGenerator), destinationType));
        return info;
    }
View Full Code Here

        return info;
    }
   
    protected ActiveMQDestination createDestinationInfo(StubConnection connection, ConnectionInfo connectionInfo1, byte destinationType) throws Exception {
        if ((destinationType & ActiveMQDestination.TEMP_MASK) != 0) {
            DestinationInfo info = createTempDestinationInfo(connectionInfo1, destinationType);
            connection.send(info);
            return info.getDestination();
        } else {
            return ActiveMQDestination.createDestination(queueName, destinationType);
        }
    }
View Full Code Here

                    SERVICELOG.warn("Failed to remove session " + sessionId, e);
                }
            }
            // Cascade the connection stop to temp destinations.
            for (Iterator iter = cs.getTempDesinations().iterator(); iter.hasNext();) {
                DestinationInfo di = (DestinationInfo) iter.next();
                try {
                    broker.removeDestination(cs.getContext(), di.getDestination(), 0);
                } catch (Throwable e) {
                    SERVICELOG.warn("Failed to remove tmp destination " + di.getDestination(), e);
                }
                iter.remove();
            }
            try {
                broker.removeConnection(cs.getContext(), cs.getInfo(), null);
View Full Code Here

                }
            }
        } else if (data.getClass() == DestinationInfo.class) {
            // It's a destination info - we want to pass up
            // information about temporary destinations
            DestinationInfo destInfo = (DestinationInfo) data;
            BrokerId[] path = destInfo.getBrokerPath();
            if (path != null && path.length >= networkTTL) {
                if (LOG.isDebugEnabled()) {
                    LOG.debug(configuration.getBrokerName() + " Ignoring destination " + destInfo + " restricted to " + networkTTL + " network hops only");
                }
                return;
            }
            if (contains(destInfo.getBrokerPath(), localBrokerPath[0])) {
                // Ignore this consumer as it's a consumer we locally sent to
                // the broker.
                if (LOG.isDebugEnabled()) {
                    LOG.debug(configuration.getBrokerName() + " Ignoring destination " + destInfo + " already routed through this broker once");
                }
                return;
            }
            destInfo.setConnectionId(localConnectionInfo.getConnectionId());
            if (destInfo.getDestination() instanceof ActiveMQTempDestination) {
                // re-set connection id so comes from here
                ActiveMQTempDestination tempDest = (ActiveMQTempDestination) destInfo.getDestination();
                tempDest.setConnectionId(localSessionInfo.getSessionId().getConnectionId());
            }
            destInfo.setBrokerPath(appendToBrokerPath(destInfo.getBrokerPath(), getRemoteBrokerPath()));
            if (LOG.isTraceEnabled()) {
                LOG.trace("bridging destination control command: " + destInfo);
            }
            localBroker.oneway(destInfo);
        } else if (data.getClass() == RemoveInfo.class) {
View Full Code Here

            // We need to replay all the previously collected destination objects
            // for this newly added consumer.           
            if( AdvisorySupport.isDestinationAdvisoryTopic(info.getDestination()) ) {
                // Replay the destinations.
                for (Iterator iter = destinations.values().iterator(); iter.hasNext();) {
                    DestinationInfo value = (DestinationInfo) iter.next();
                    ActiveMQTopic topic = AdvisorySupport.getDestinationAdvisoryTopic(value.getDestination());
                    fireAdvisory(context, topic, value, info.getConsumerId());
                }
            }

            // Replay the producers.
            if( AdvisorySupport.isProducerAdvisoryTopic(info.getDestination()) ) {
                for (Iterator iter = producers.values().iterator(); iter.hasNext();) {
                    ProducerInfo value = (ProducerInfo) iter.next();
                    ActiveMQTopic topic = AdvisorySupport.getProducerAdvisoryTopic(value.getDestination());
                    fireProducerAdvisory(context, topic, value, info.getConsumerId());
                }
            }
           
            // Replay the consumers.
            if( AdvisorySupport.isConsumerAdvisoryTopic(info.getDestination()) ) {
                for (Iterator iter = consumers.values().iterator(); iter.hasNext();) {
                    ConsumerInfo value = (ConsumerInfo) iter.next();
                    ActiveMQTopic topic = AdvisorySupport.getConsumerAdvisoryTopic(value.getDestination());
                    fireConsumerAdvisory(context, topic, value, info.getConsumerId());
                }
            }
        }
        return answer;
View Full Code Here

   
    public Destination addDestination(ConnectionContext context, ActiveMQDestination destination) throws Exception {
        Destination answer = next.addDestination(context, destination)
     
        ActiveMQTopic topic = AdvisorySupport.getDestinationAdvisoryTopic(destination);
        DestinationInfo info = new DestinationInfo(context.getConnectionId(), DestinationInfo.ADD_OPERATION_TYPE, destination);
        fireAdvisory(context, topic, info);       
        destinations.put(destination, info);
        return answer;
    }
View Full Code Here

        destinations.put(destination, info);   
    }

    public void removeDestination(ConnectionContext context, ActiveMQDestination destination, long timeout) throws Exception {
        next.removeDestination(context, destination, timeout);
        DestinationInfo info = (DestinationInfo) destinations.remove(destination);
        if( info !=null ) {
            info.setDestination(destination);
            info.setOperationType(DestinationInfo.REMOVE_OPERATION_TYPE);
            ActiveMQTopic topic = AdvisorySupport.getDestinationAdvisoryTopic(destination);
            fireAdvisory(context, topic, info);

            if (!AdvisorySupport.isAdvisoryTopic(destination)) {
                try {
                    context.getBroker().removeDestination(context, AdvisorySupport.getConsumerAdvisoryTopic(info.getDestination()), -1);
                } catch (Exception expectedIfDestinationDidNotExistYet) {
                }
                try {
                    context.getBroker().removeDestination(context, AdvisorySupport.getProducerAdvisoryTopic(info.getDestination()), -1);
                } catch (Exception expectedIfDestinationDidNotExistYet) {
                }
             }
        }
      
View Full Code Here

      
    }
   
    public void removeDestinationInfo(ConnectionContext context, DestinationInfo destInfo) throws Exception{
        next.removeDestinationInfo(context, destInfo);
        DestinationInfo info = (DestinationInfo) destinations.remove(destInfo.getDestination());

        if( info !=null ) {
            info.setDestination(destInfo.getDestination());
            info.setOperationType(DestinationInfo.REMOVE_OPERATION_TYPE);
            ActiveMQTopic topic = AdvisorySupport.getDestinationAdvisoryTopic(destInfo.getDestination());
            fireAdvisory(context, topic, info);

            if (!AdvisorySupport.isAdvisoryTopic(destInfo.getDestination())) {
                try {
                    context.getBroker().removeDestination(context, AdvisorySupport.getConsumerAdvisoryTopic(info.getDestination()), -1);
                } catch (Exception expectedIfDestinationDidNotExistYet) {
                }
                try {
                    context.getBroker().removeDestination(context, AdvisorySupport.getProducerAdvisoryTopic(info.getDestination()), -1);
                } catch (Exception expectedIfDestinationDidNotExistYet) {
                }
             }
        }
View Full Code Here

            }
        }
        else if (data.getClass()==DestinationInfo.class){
//          It's a destination info - we want to pass up
            //infomation about temporary destinations
            DestinationInfo destInfo = (DestinationInfo) data;
            BrokerId[] path=destInfo.getBrokerPath();
            if((path!=null&&path.length>= networkTTL)){
                if(log.isDebugEnabled())
                    log.debug("Ignoring Subscription " + destInfo + " restricted to " + networkTTL + " network hops only");
                return;
            }
            if(contains(destInfo.getBrokerPath(),localBrokerPath[0])){
                // Ignore this consumer as it's a consumer we locally sent to the broker.
                if(log.isDebugEnabled())
                    log.debug("Ignoring sub " + destInfo + " already routed through this broker once");
                return;
            }
           
            destInfo.setConnectionId(localConnectionInfo.getConnectionId());
            if (destInfo.getDestination() instanceof ActiveMQTempDestination){
                //re-set connection id so comes from here
                ActiveMQTempDestination tempDest = (ActiveMQTempDestination) destInfo.getDestination();
                tempDest.setConnectionId(localSessionInfo.getSessionId().getConnectionId());
            }
                       
            destInfo.setBrokerPath(appendToBrokerPath(destInfo.getBrokerPath(),getRemoteBrokerPath()));
           
            log.debug("Replying destination control command: "+destInfo);           
            localBroker.oneway(destInfo);
           
        }
View Full Code Here

TOP

Related Classes of org.apache.activemq.command.DestinationInfo

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.