Package org.apache.qpid.transport

Examples of org.apache.qpid.transport.Session$ResultFuture


        messageAcknowledge(ranges,accept,false);
    }

    void messageAcknowledge(final RangeSet ranges, final boolean accept, final boolean setSyncBit)
    {
        final Session ssn = getQpidSession();
        flushProcessed(ranges,accept);
        if (accept)
        {
            ssn.messageAccept(ranges, UNRELIABLE, setSyncBit ? SYNC : NONE);
        }
    }
View Full Code Here


     * @param ranges the range of command ids.
     * @param batch true if batched.
     */
    void flushProcessed(final RangeSet ranges, final boolean batch)
    {
        final Session ssn = getQpidSession();
        for (final Range range : ranges)
        {
            ssn.processed(range);
        }
        ssn.flushProcessed(batch ? BATCH : NONE);
    }
View Full Code Here

        messageAcknowledge(ranges,accept,false);
    }
   
    void messageAcknowledge(RangeSet ranges, boolean accept,boolean setSyncBit)
    {
        Session ssn = getQpidSession();
        for (Range range : ranges)
        {
            ssn.processed(range);
        }
        ssn.flushProcessed(accept ? BATCH : NONE);
        if (accept)
        {
            ssn.messageAccept(ranges, UNRELIABLE,setSyncBit? SYNC : NONE);
        }
    }
View Full Code Here

        messageAcknowledge(ranges,accept,false);
    }
   
    void messageAcknowledge(RangeSet ranges, boolean accept,boolean setSyncBit)
    {
        Session ssn = getQpidSession();
        for (Range range : ranges)
        {
            ssn.processed(range);
        }
        ssn.flushProcessed(accept ? BATCH : NONE);
        if (accept)
        {
            ssn.messageAccept(ranges, UNRELIABLE,setSyncBit? SYNC : NONE);
        }
    }
View Full Code Here

        // Create connection
        Connection con = new Connection();
        con.connect("localhost", 5672, "test", "guest", "guest",false);

        // Create session
        Session session = con.createSession(0);

        // Create an instance of the listener
        TopicListener listener = new TopicListener();
        session.setSessionListener(listener);

        listener.prepareQueue(session,"usa", "usa.#");
        listener.prepareQueue(session,"europe", "europe.#");
        listener.prepareQueue(session,"news", "#.news");
        listener.prepareQueue(session,"weather", "#.weather");

        // confirm completion
        session.sync();

        System.out.println("Waiting 100 seconds for messages");
        Thread.sleep(100*1000);

        System.out.println("Shutting down listeners");
        listener.cancelSubscription(session,"usa");
        listener.cancelSubscription(session,"europe");
        listener.cancelSubscription(session,"news");
        listener.cancelSubscription(session,"weather");

        //cleanup
        session.close();
        con.close();
    }
View Full Code Here

        // Create connection
        Connection con = new Connection();
        con.connect("localhost", 5672, "test", "guest", "guest",false);

        // Create session
        Session session = con.createSession(0);

        // declare and bind queues
        session.queueDeclare("headers_queue_any", null, null);
        session.queueDeclare("headers_queue_all", null, null);
        // we need to declare the header: name, type, alternate exchange
        session.exchangeDeclare("test.headers", "headers", "amq.direct", null);
        // The matching algorithm is controlled by 'x-match' property
        // 'x-match' can take one of two values,
        // (i) 'all' implies that all the other pairs must match the headers
        // property of a message for that message to be routed (i.e. an AND match)
        // (ii) 'any' implies that the message should be routed if any of the
        // fields in the headers property match one of the fields in the arguments table (i.e. an OR match)
        Map<String, Object> arguments = new HashMap<String, Object>();
        arguments.put("x-match", "any");
        arguments.put("h1", "v1");
        arguments.put("h2", "v2");
        session.exchangeBind("headers_queue_any", "test.headers", "useless", arguments);
        arguments = new HashMap<String, Object>();
        arguments.put("x-match", "all");
        arguments.put("h1", "v1");
        arguments.put("h2", "v2");
        session.exchangeBind("headers_queue_all", "test.headers", "useless", arguments);
        // confirm completion
        session.sync();
        //cleanup
        session.close();
        con.close();
    }
View Full Code Here

        // Create connection
        Connection con = new Connection();
        con.connect("localhost", 5672, "test", "guest", "guest",false);

        // Create session
        Session session = con.createSession(0);

        // declare and bind queue
        Map<String, Object> arguments = new HashMap<String, Object>();
        // We use a lvq
        arguments.put("qpid.last_value_queue", true);
        // We want this queue to use the key test
        arguments.put("qpid.LVQ_key", "test");
        session.queueDeclare("message_queue", null, arguments);
        session.exchangeBind("message_queue", "amq.direct", "routing_key", null);

        // confirm completion
        session.sync();

        //cleanup
        session.close();
        con.close();
    }
View Full Code Here

        // Create connection
        Connection con = new Connection();
        con.connect("localhost", 5672, "test", "guest", "guest",false);

        // Create session
        Session session = con.createSession(0);

        // Create an instance of the listener
        Listener listener = new Listener();
        session.setSessionListener(listener);

        // create a subscription
        session.messageSubscribe("message_queue",
                                 "listener_destination",
                                 MessageAcceptMode.NONE,
                                 MessageAcquireMode.PRE_ACQUIRED,
                                 null, 0, null);


        // issue credits
        // XXX
        session.messageFlow("listener_destination", MessageCreditUnit.BYTE, Session.UNLIMITED_CREDIT);
        session.messageFlow("listener_destination", MessageCreditUnit.MESSAGE, 11);

        // confirm completion
        session.sync();

        // check to see if we have received all the messages
        System.out.println("Waiting 100 seconds for messages from listener_destination");
        Thread.sleep(100*1000);
        System.out.println("Shutting down listener for listener_destination");
        session.messageCancel("listener_destination");

        //cleanup
        session.close();
        con.close();
    }
View Full Code Here

        // Create connection
        Connection con = new Connection();
        con.connect("localhost", 5672, "test", "guest", "guest",false);

        // Create session
        Session session = con.createSession(0);

        // Create an instance of the listener
        Listener listener = new Listener();
        session.setSessionListener(listener);

        // create a subscription
        session.messageSubscribe("message_queue",
                                 "listener_destination",
                                 MessageAcceptMode.NONE,
                                 MessageAcquireMode.PRE_ACQUIRED,
                                 null, 0, null);


        // issue credits
        // XXX
        session.messageFlow("listener_destination", MessageCreditUnit.BYTE, Session.UNLIMITED_CREDIT);
        session.messageFlow("listener_destination", MessageCreditUnit.MESSAGE, 11);

        // confirm completion
        session.sync();

        // wait to receive all the messages
        System.out.println("Waiting 100 seconds for messages from listener_destination");
        Thread.sleep(100*1000);
        System.out.println("Shutting down listener for listener_destination");
        session.messageCancel("listener_destination");

        //cleanup
        session.close();
        con.close();
    }
View Full Code Here

        // Create connection
        Connection con = new Connection();
        con.connect("localhost", 5672, "test", "guest", "guest",false);

        // Create session
        Session session = con.createSession(0);

        // Create an instance of the listener
        Listener listener = new Listener();
        session.setSessionListener(listener);

        // create a subscription
        session.messageSubscribe("message_queue",
                                 "listener_destination",
                                 MessageAcceptMode.NONE,
                                 MessageAcquireMode.PRE_ACQUIRED,
                                 null, 0, null);


        // issue credits
        // XXX
        session.messageFlow("listener_destination", MessageCreditUnit.BYTE, Session.UNLIMITED_CREDIT);
        session.messageFlow("listener_destination", MessageCreditUnit.MESSAGE, 11);

        // confirm completion
        session.sync();

        // wait to receive all the messages
        System.out.println("Waiting 100 seconds for messages from listener_destination");

        _countDownLatch.await(30, TimeUnit.SECONDS);
        System.out.println("Shutting down listener for listener_destination");
        session.messageCancel("listener_destination");

        //cleanup
        session.close();
        con.close();
    }
View Full Code Here

TOP

Related Classes of org.apache.qpid.transport.Session$ResultFuture

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.