Package org.apache.qpid.client

Examples of org.apache.qpid.client.AMQAnyDestination


     */
    public void testDefaultSubjects() throws Exception
    {
        Session ssn = _connection.createSession(false,Session.AUTO_ACKNOWLEDGE);
       
        MessageConsumer queueCons = ssn.createConsumer(new AMQAnyDestination("ADDR:amq.direct"));
        MessageConsumer topicCons = ssn.createConsumer(new AMQAnyDestination("ADDR:amq.topic"));
       
        MessageProducer queueProducer = ssn.createProducer(new AMQAnyDestination("ADDR:amq.direct"));
        MessageProducer topicProducer1 = ssn.createProducer(new AMQAnyDestination("ADDR:amq.topic/usa.weather"));
        MessageProducer topicProducer2 = ssn.createProducer(new AMQAnyDestination("ADDR:amq.topic/sales"));
       
        queueProducer.send(ssn.createBytesMessage());
        assertNotNull("The consumer subscribed to amq.direct " +
            "with empty binding key should have received the message ",queueCons.receive(1000));
       
View Full Code Here


                     "x-bindings:[{key:'NYSE.#'},{key:'NASDAQ.#'},{key:'CNTL.#'}]" +
                     "}" +
            "}";
       
        // Using the ADDR method to create a more complicated topic
        MessageConsumer  cons = ssn.createConsumer(new AMQAnyDestination(addr));
       
        assertTrue("The queue was not bound to MRKT exchange using NYSE.# as the binding key",(
                (AMQSession_0_10)ssn).isQueueBound("MRKT",
                    "my-topic","NYSE.#", null));
       
View Full Code Here

        }
    }
   
    public void testQueueReceiversAndTopicSubscriber() throws Exception
    {
        Queue queue = new AMQAnyDestination("ADDR:my-queue; {create: always}");
        Topic topic = new AMQAnyDestination("ADDR:amq.topic/test");
       
        QueueSession qSession = ((AMQConnection)_connection).createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
        QueueReceiver receiver = qSession.createReceiver(queue);
       
        TopicSession tSession = ((AMQConnection)_connection).createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
View Full Code Here

        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

        acceptModeTest("ADDR:testQueue1;{create: always}",2);
              
        String addr3 = "ADDR:testQueue2;{create: always, delete : receiver, link : {reliability : exactly-once}}";       
        try
        {
            AMQAnyDestination dest = new AMQAnyDestination(addr3);
            fail("An exception should be thrown indicating it's an unsupported type");
        }
        catch(Exception e)
        {
            assertTrue(e.getCause().getMessage().contains("The reliability mode 'exactly-once' is not yet supported"));
        }
       
        String addr4 = "ADDR:amq.topic/test;{link : {reliability : at-least-once}}";       
        try
        {
            AMQAnyDestination dest = new AMQAnyDestination(addr4);
            Session ssn = _connection.createSession(false,Session.CLIENT_ACKNOWLEDGE);
            MessageConsumer cons = ssn.createConsumer(dest);
            fail("An exception should be thrown indicating it's an unsupported combination");
        }
        catch(Exception e)
View Full Code Here

    {
        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

        {
            dest = new AMQQueue(exchange, routingKey, routingKey);
        }
        else
        {
            dest = new AMQAnyDestination(exchange,
                                         new AMQShortString(exchangeInfo.exchangeType),
                                         routingKey,
                                         false,
                                         false,
                                         routingKey,
View Full Code Here

     * @throws Exception
     */
    public void testGetDestinationWithCustomExchange() throws Exception
    {

        AMQDestination dest = new AMQAnyDestination(new AMQShortString("my-exchange"),
                                                    new AMQShortString("direct"),
                                                    new AMQShortString("test"),
                                                    false,
                                                    false,
                                                    new AMQShortString("test"),
                                                    false,
                                                    new AMQShortString[]{new AMQShortString("test")});
       
        // to force the creation of my-exchange.
        sendMessage(_session, dest, 1);
       
        MessageProducer prod = _session.createProducer(dest);
       
        MessageConsumer consumer = _session.createConsumer(dest);
       
        _connection.start();

        sendMessage(_session, dest, 1);
       
        Message message = consumer.receive(10000);

        assertNotNull("Message should not be null", message);

        Destination destination = message.getJMSDestination();

        assertNotNull("JMSDestination should not be null", destination);

        assertEquals("Incorrect Destination name", "my-exchange", dest.getExchangeName().asString());
        assertEquals("Incorrect Destination type", "direct", dest.getExchangeClass().asString());
        assertEquals("Incorrect Routing Key", "test", dest.getRoutingKey().asString());
    }
View Full Code Here

   
    public Receiver(Connection con,String addr) throws Exception
    {
      super(con);
      setSsn(con.createSession(isTransacted(), getAck_mode()));
      consumer = getSsn().createConsumer(new AMQAnyDestination(addr));
      if (!syncRcv)
      {
        consumer.setMessageListener(this);
      }
     
View Full Code Here

        super(args, usage, desc);       
       
        Connection con = createConnection();
        con.start();
        Session ssn = con.createSession(false,Session.AUTO_ACKNOWLEDGE);    
        Destination dest = new AMQAnyDestination(getAddress());
        MessageConsumer consumer = ssn.createConsumer(dest);
        Message msg;
       
        long timeout = -1;       
        int count = 0;
View Full Code Here

TOP

Related Classes of org.apache.qpid.client.AMQAnyDestination

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.