Package org.codehaus.activemq.message

Examples of org.codehaus.activemq.message.ActiveMQDestination


     * @param client
     * @param info
     * @throws JMSException
     */
    public synchronized void addMessageConsumer(BrokerClient client, ConsumerInfo info) throws JMSException {
        ActiveMQDestination destination = info.getDestination();
        if (destination.isTopic()) {
            TransientTopicBoundedMessageContainer container = (TransientTopicBoundedMessageContainer) containers
                    .get(client);
            if (container == null) {
                MemoryBoundedQueue queue = queueManager.getMemoryBoundedQueue(client.toString());
                container = new TransientTopicBoundedMessageContainer(this, client, queue);
                containers.put(client, container);
                if (started.get()) {
                    container.start();
                }
            }
            if (log.isDebugEnabled()) {
                log.debug("Adding consumer: " + info);
            }

            TransientTopicSubscription ts = container.addConsumer(createFilter(info), info);
            if (ts != null) {
                subscriptions.put(info.getConsumerId(), ts);
            }

            destinationMap.put(destination,container);
            String name = destination.getPhysicalName();
            //As the destinations are used for generating
            //subscriptions for NetworkConnectors etc.,
            //we should not generate duplicates by adding in
            //durable topic subscribers
            if (!info.isDurableTopic() && !destinations.containsKey(name)) {
View Full Code Here


        if (message == null) {
            return;
        }

        boolean consumed = browser ? false : messageRead;
        ActiveMQDestination destination = message.getJMSActiveMQDestination();
        boolean topic = destination != null && destination.isTopic();
        message.setTransientConsumed((!isDurableSubscriber() || !message.isPersistent()) && topic);
        this.session.afterMessageDelivered((isDurableSubscriber() || this.destination.isQueue()), message, consumed, messageExpired, beforeCalled);
        if (messageRead) {
            stats.onMessage(message);
        }
View Full Code Here

                tempDestinationMap.put(dest, event);
                ActiveMQObjectMessage msg = new ActiveMQObjectMessage();
                msg.setObject(event);
                msg.setJMSDeliveryMode(DeliveryMode.NON_PERSISTENT);
                String destName = ActiveMQDestination.TEMP_DESTINATION_ADVISORY_PREFIX + dest.getPhysicalName();
                ActiveMQDestination target = ActiveMQDestination.createDestination(dest.getDestinationType(), destName);
                msg.setJMSDestination(target);
                this.asyncSendPacket(msg);
            }
        }
    }
View Full Code Here

                event.setStarted(false);
                ActiveMQObjectMessage msg = new ActiveMQObjectMessage();
                msg.setObject(event);
                msg.setJMSDeliveryMode(DeliveryMode.NON_PERSISTENT);
                String destName = ActiveMQDestination.TEMP_DESTINATION_ADVISORY_PREFIX + dest.getPhysicalName();
                ActiveMQDestination target = ActiveMQDestination.createDestination(dest.getDestinationType(), destName);
                msg.setJMSDestination(target);
                this.asyncSendPacket(msg);
            }
        }
    }
View Full Code Here

        }
    }
   
    protected void closeTemporaryDestinations() throws JMSException{
        for (Iterator i = tempDestinationMap.keySet().iterator();i.hasNext();){
            ActiveMQDestination dest = (ActiveMQDestination)i.next();
            stopTemporaryDestination(dest);
        }
    }
View Full Code Here

     * @param client
     * @param info
     * @throws JMSException
     */
    public synchronized void addMessageConsumer(BrokerClient client, ConsumerInfo info) throws JMSException {
        ActiveMQDestination destination = info.getDestination();
        if (destination.isQueue()) {
            TransientQueueBoundedMessageContainer container = (TransientQueueBoundedMessageContainer) containers
                    .get(destination);
            if (container == null) {
                MemoryBoundedQueue queue = queueManager.getMemoryBoundedQueue(client.toString());
                container = new TransientQueueBoundedMessageContainer(threadPool, queueManager, destination,
                        redeliveryPolicy, deadLetterPolicy);
                addContainer(container);
                if (started.get()) {
                    container.start();
                }
            }
            if (log.isDebugEnabled()) {
                log.debug("Adding consumer: " + info);
            }
           
            TransientQueueSubscription ts = container.addConsumer(createFilter(info), info, client);
            if (ts != null) {
                subscriptions.put(info.getConsumerId(), ts);
            }
            String name = destination.getPhysicalName();
            if (!destinations.containsKey(name)) {
                destinations.put(name, destination);
            }
        }
    }
View Full Code Here

     * @param client
     * @param info
     * @throws JMSException
     */
    public synchronized void removeMessageConsumer(BrokerClient client, ConsumerInfo info) throws JMSException {
        ActiveMQDestination destination = info.getDestination();
        if (destination.isQueue()) {
            for (Iterator i = containers.values().iterator();i.hasNext();) {
                TransientQueueBoundedMessageContainer container = (TransientQueueBoundedMessageContainer) i.next();
                if (container != null) {
                    container.removeConsumer(info);
                }
View Full Code Here

     * @param client
     * @param message
     * @throws JMSException
     */
    public void sendMessage(final BrokerClient client, final ActiveMQMessage message) throws JMSException {
        ActiveMQDestination destination = message.getJMSActiveMQDestination();
        if ( !destination.isQueue() || !message.isTemporary() )
            return;

            // If there is no transaction.. then this executes directly.
        TransactionManager.getContexTransaction().addPostCommitTask(new TransactionTask(){
            public void execute() throws Throwable {
View Full Code Here

     * @param message
     * @throws JMSException
     */
    private void doSendMessage(BrokerClient client, ActiveMQMessage message) throws JMSException {

        ActiveMQDestination destination = message.getJMSActiveMQDestination();
        if (queueManager.getCurrentCapacity() <= garbageCoolectionCapacityLimit) {
            doGarbageCollection();
        }
        TransientQueueBoundedMessageContainer container = (TransientQueueBoundedMessageContainer) containers
                .get(destination);
View Full Code Here

    public Map getLocalDestinations() {
        Map localDestinations = new HashMap();
        for (Iterator iter = subscriptions.values().iterator(); iter.hasNext();) {
            TransientSubscription sub = (TransientSubscription) iter.next();
            if (sub.isLocalSubscription()) {
                final ActiveMQDestination dest = sub.getDestination();
                localDestinations.put(dest.getPhysicalName(), dest);
            }
        }
        return Collections.unmodifiableMap(localDestinations);
    }
View Full Code Here

TOP

Related Classes of org.codehaus.activemq.message.ActiveMQDestination

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.