Package org.apache.qpid.client

Examples of org.apache.qpid.client.AMQConnection.createSession()


        AMQConnection con = new AMQConnection("vm://:1", "guest", "guest", "test", "test");
        AMQTopic topic = new AMQTopic(con, "MyTopic");
        Session session1 = con.createSession(false, ackMode);
        MessageConsumer consumer1 = session1.createConsumer(topic);

        Session sessionProd = con.createSession(false, ackMode);
        MessageProducer producer = sessionProd.createProducer(topic);

        Session session2 = con.createSession(false, ackMode);
        TopicSubscriber consumer2 = session2.createDurableSubscriber(topic, "MySubscription");
View Full Code Here


        MessageConsumer consumer1 = session1.createConsumer(topic);

        Session sessionProd = con.createSession(false, ackMode);
        MessageProducer producer = sessionProd.createProducer(topic);

        Session session2 = con.createSession(false, ackMode);
        TopicSubscriber consumer2 = session2.createDurableSubscriber(topic, "MySubscription");

        con.start();

        producer.send(session1.createTextMessage("A"));
View Full Code Here

        msg = consumer2.receive(500);
        assertNull("There should be no more messages for consumption on consumer2.", msg);

        consumer2.close();

        Session session3 = con.createSession(false, ackMode);
        MessageConsumer consumer3 = session3.createDurableSubscriber(topic, "MySubscription");

        producer.send(session1.createTextMessage("B"));

        _logger.info("Receive message on consumer 1 :expecting B");
View Full Code Here

    }

    public void testJMSDestination() throws Exception
    {
        AMQConnection con = new AMQConnection("vm://:1", "guest", "guest", "consumer1", "test");
        AMQSession consumerSession = (AMQSession) con.createSession(false, Session.CLIENT_ACKNOWLEDGE);
        Queue queue =
            new AMQQueue(con.getDefaultQueueExchangeName(), new AMQShortString("someQ"), new AMQShortString("someQ"), false,
                true);
        MessageConsumer consumer = consumerSession.createConsumer(queue);
View Full Code Here

            new AMQQueue(con.getDefaultQueueExchangeName(), new AMQShortString("someQ"), new AMQShortString("someQ"), false,
                true);
        MessageConsumer consumer = consumerSession.createConsumer(queue);

        Connection con2 = new AMQConnection("vm://:1", "guest", "guest", "producer1", "test");
        Session producerSession = con2.createSession(false, Session.CLIENT_ACKNOWLEDGE);
        MessageProducer producer = producerSession.createProducer(queue);

        TextMessage sentMsg = producerSession.createTextMessage("hello");
        assertNull(sentMsg.getJMSDestination());
View Full Code Here

public class SimpleClusterTest extends TestCase
{
    public void testDeclareExchange() throws AMQException, JMSException, URLSyntaxException
    {
        AMQConnection con = new AMQConnection("localhost:9000", "guest", "guest", "test", "/test");
        AMQSession session = (AMQSession) con.createSession(false, AMQSession.NO_ACKNOWLEDGE);
        System.out.println("Session created");
        session.declareExchange(new AMQShortString("my_exchange"), new AMQShortString("direct"), true);
        System.out.println("Exchange declared");
        con.close();
        System.out.println("Connection closed");
View Full Code Here

                // Test queue is still there.
                AMQConnection connection =
                    new AMQConnection(_brokerDetails, _username, _password, "DifferentClientID", _virtualpath);

                AMQSession session = (AMQSession) connection.createSession(false, Session.AUTO_ACKNOWLEDGE);

                try
                {
                    session.createConsumer(session.createQueue(QUEUE));
                    _logger.error("Create consumer succeeded."
View Full Code Here

    public void test() throws Exception
    {

        AMQConnection connection = (AMQConnection) getConnection();

        AMQSession session = (AMQSession) connection.createSession(false, Session.AUTO_ACKNOWLEDGE);

        // Set no wait true so that we block the connection
        // Also set a different exchange class string so the attempt to declare
        // the exchange causes an exchange.
        ExchangeDeclareBody body = session.getMethodRegistry().createExchangeDeclareBody(session.getTicket(), new AMQShortString(EXCHANGE_NAME), null,
View Full Code Here

            AMQConnection pubCon = (AMQConnection) getConnection("guest", "guest");

            AMQQueue queue = new AMQQueue(pubCon,"ConnectionStartTest");

            Session pubSess = pubCon.createSession(false, AMQSession.AUTO_ACKNOWLEDGE);

            MessageProducer pub = pubSess.createProducer(queue);

            _connection = (AMQConnection) getConnection("guest", "guest");
View Full Code Here

    public void testAcknowledgePerConsumer() throws Exception
    {
        AMQConnection con = (AMQConnection) getConnection();

        Session consumerSession = con.createSession(false, Session.CLIENT_ACKNOWLEDGE);
        Queue queue =
                new AMQQueue(consumerSession.getDefaultQueueExchangeName(), new AMQShortString("Q1"), new AMQShortString("Q1"),
                             false, true);
        Queue queue2 =
                new AMQQueue(consumerSession.getDefaultQueueExchangeName(), new AMQShortString("Q2"), new AMQShortString("Q2"),
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.