Examples of AMQDestination


Examples of org.apache.qpid.client.AMQDestination

            return;
        }
       
        Session jmsSession = _connection.createSession(false,Session.CLIENT_ACKNOWLEDGE);
       
        AMQDestination dest = new AMQAnyDestination(address);
        MessageConsumer cons = jmsSession.createConsumer(dest);
        MessageProducer prod = jmsSession.createProducer(dest);
       
        for (int i=0; i< 15; i++)
        {
View Full Code Here

Examples of org.apache.qpid.client.AMQDestination

        map.put("destination.myQueue3", "BURL:direct://amq.direct/my-queue3?routingkey='test'");
       
        PropertiesFileInitialContextFactory props = new PropertiesFileInitialContextFactory();
        Context ctx = props.getInitialContext(map);
       
        AMQDestination dest1 = (AMQDestination)ctx.lookup("myQueue1");     
        AMQDestination dest2 = (AMQDestination)ctx.lookup("myQueue2");
        AMQDestination dest3 = (AMQDestination)ctx.lookup("myQueue3");
       
        Session jmsSession = _connection.createSession(false,Session.CLIENT_ACKNOWLEDGE);
        MessageConsumer cons1 = jmsSession.createConsumer(dest1);
        MessageConsumer cons2 = jmsSession.createConsumer(dest2);
        MessageConsumer cons3 = jmsSession.createConsumer(dest3);
View Full Code Here

Examples of org.apache.qpid.client.AMQDestination

     */
    public void testOverridingSubject() throws Exception
    {
        Session jmsSession = _connection.createSession(false,Session.CLIENT_ACKNOWLEDGE);
       
        AMQDestination topic1 = new AMQAnyDestination("ADDR:amq.topic/topic1; {link:{name: queue1}}");
       
        MessageProducer prod = jmsSession.createProducer(topic1);
       
        Message m = jmsSession.createTextMessage("Hello");
        m.setStringProperty("qpid.subject", "topic2");
View Full Code Here

Examples of org.apache.qpid.client.AMQDestination

        MessageConsumer cons;
       
        // default (create never, assert never) -------------------
        // create never --------------------------------------------
        String addr1 = "ADDR:testQueue1;{create: always, delete: always}";
        AMQDestination  dest = new AMQAnyDestination(addr1);
        try
        {
            cons = jmsSession.createConsumer(dest);
            cons.close();
        }
        catch(JMSException e)
        {
            fail("Exception should not be thrown. Exception thrown is : " + e);
        }
       
        assertFalse("Queue not deleted as expected",(
                (AMQSession_0_10)jmsSession).isQueueExist(dest,(QueueNode)dest.getSourceNode(), true))
       
       
        String addr2 = "ADDR:testQueue2;{create: always, delete: receiver}";
        dest = new AMQAnyDestination(addr2);
        try
        {
            cons = jmsSession.createConsumer(dest);
            cons.close();
        }
        catch(JMSException e)
        {
            fail("Exception should not be thrown. Exception thrown is : " + e);
        }
       
        assertFalse("Queue not deleted as expected",(
                (AMQSession_0_10)jmsSession).isQueueExist(dest,(QueueNode)dest.getSourceNode(), true))

       
        String addr3 = "ADDR:testQueue3;{create: always, delete: sender}";
        dest = new AMQAnyDestination(addr3);
        try
        {
            cons = jmsSession.createConsumer(dest);
            MessageProducer prod = jmsSession.createProducer(dest);
            prod.close();
        }
        catch(JMSException e)
        {
            fail("Exception should not be thrown. Exception thrown is : " + e);
        }
       
        assertFalse("Queue not deleted as expected",(
                (AMQSession_0_10)jmsSession).isQueueExist(dest,(QueueNode)dest.getSourceNode(), true))

       
    }
View Full Code Here

Examples of org.apache.qpid.client.AMQDestination

    {
        Session ssn = _connection.createSession(false,Session.CLIENT_ACKNOWLEDGE);
        MessageConsumer cons;
        MessageProducer prod;
       
        AMQDestination  dest = new AMQAnyDestination(address);
        cons = ssn.createConsumer(dest);
        prod = ssn.createProducer(dest);
       
        for (int i=0; i < expectedQueueDepth; i++)
        {
View Full Code Here

Examples of org.apache.qpid.client.AMQDestination

    private void createQueue(AMQSession<?, ?> session, QueueConfig queueConfig)
    {
        try
        {
            AMQDestination destination = (AMQDestination) session.createQueue(queueConfig.getName());
            boolean autoDelete = false;
            boolean exclusive = false;
            session.createQueue(destination.getAMQQueueName(), autoDelete,
                    queueConfig.isDurable(), exclusive, queueConfig.getAttributes());
            session.bindQueue(destination.getAMQQueueName(), destination.getRoutingKey(),
                    EMPTY_QUEUE_BIND_ARGUMENTS, destination.getExchangeName(),
                    destination, autoDelete);

            LOGGER.debug("Created queue " + queueConfig);
        }
        catch (Exception e)
View Full Code Here

Examples of org.apache.qpid.client.AMQDestination

        try
        {
            // The Qpid AMQSession API currently makes the #deleteQueue method protected and the
            // raw protocol method public.  This should be changed then we should switch the below to
            // use #deleteQueue.
            AMQDestination destination = (AMQDestination) session.createQueue(queueConfig.getName());
            session.sendQueueDelete(destination.getAMQQueueName());
            LOGGER.debug("Deleted queue " + queueConfig.getName());
        }
        catch (Exception e)
        {
            throw new DistributedTestException("Failed to delete queue:" + queueConfig.getName(), e);
View Full Code Here

Examples of org.apache.qpid.client.AMQDestination

        super(deliveryTag);
        _messageProps = messageProps;
        _deliveryProps = deliveryProps;
        _readableProperties = (_messageProps != null);

        AMQDestination dest;

        if (AMQDestination.getDefaultDestSyntax() == AMQDestination.DestSyntax.BURL)
        {
            dest = generateDestination(new AMQShortString(_deliveryProps.getExchange()),
                                   new AMQShortString(_deliveryProps.getRoutingKey()));
View Full Code Here

Examples of org.apache.qpid.client.AMQDestination

            isQueue = false;
        }
       
        try
        {
            AMQDestination dest = (AMQDestination)AMQDestination.createDestination("ADDR:" + addr);
            if (isQueue)
            {
                dest.setQueueName(new AMQShortString(routingKey));
                dest.setRoutingKey(new AMQShortString(routingKey));
                dest.setExchangeName(new AMQShortString(""));
            }
            else
            {
                dest.setRoutingKey(new AMQShortString(routingKey));
                dest.setExchangeName(new AMQShortString(exchange));
            }
            return dest;
        }
        catch(Exception e)
        {
View Full Code Here

Examples of org.apache.qpid.client.AMQDestination

        {
            throw new IllegalArgumentException(
                "ReplyTo destination may only be an AMQDestination - passed argument was type " + destination.getClass());
        }

        final AMQDestination amqd = (AMQDestination) destination;

        if (amqd.getDestSyntax() == AMQDestination.DestSyntax.ADDR)
        {
           try
           {
               int type = ((AMQSession_0_10)getAMQSession()).resolveAddressType(amqd);
               if (type == AMQDestination.QUEUE_TYPE)
               {
                   ((AMQSession_0_10)getAMQSession()).setLegacyFiledsForQueueType(amqd);
               }
               else
               {
                   ((AMQSession_0_10)getAMQSession()).setLegacyFiledsForTopicType(amqd);
               }
           }
           catch(AMQException ex)
           {
               JMSException e = new JMSException("Error occured while figuring out the node type");
               e.initCause(ex);
               e.setLinkedException(ex);
               throw e;
           }
           catch (TransportException e)
           {
               JMSException jmse = new JMSException("Exception occured while figuring out the node type:" + e.getMessage());
               jmse.initCause(e);
               jmse.setLinkedException(e);
               throw jmse;
           }
        }

        final ReplyTo replyTo = new ReplyTo(amqd.getExchangeName().toString(), amqd.getRoutingKey().toString());
        _destinationCache.put(replyTo, destination);
        _messageProps.setReplyTo(replyTo);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.