Package javax.jms

Examples of javax.jms.Session.createTopic()


        prod.send(session.createMessage());
        prod.close();
        assertNotNull("The consumer on the queue bound to the alt-exchange should receive the message",cons.receive(1000));

        String addr2 = "ADDR:test-queue;{create:sender, delete: sender,node:{type:queue,x-declare:{alternate-exchange:'amq.fanout'}}}";
        prod = session.createProducer(session.createTopic(addr2));
        prod.send(session.createMessage());
        prod.close();
        assertNotNull("The consumer on the queue bound to the alt-exchange should receive the message",cons.receive(1000));
        cons.close();
    }
View Full Code Here


            Connection conn = getConnection("test", "client", "guest");
            Session sess = conn.createSession(true, Session.SESSION_TRANSACTED);
            conn.start();

            // create kipper
            Topic kipper = sess.createTopic("kipper");
            TopicSubscriber subscriber = sess.createDurableSubscriber(kipper, "kipper");

            subscriber.close();
            sess.unsubscribe("kipper");
View Full Code Here

            Connection conn = getConnection("test", "server", "guest");
            Session sess = conn.createSession(true, Session.SESSION_TRANSACTED);
            conn.start();

            // create kipper
            Topic kipper = sess.createTopic("kipper");
            TopicSubscriber subscriber = sess.createDurableSubscriber(kipper, "kipper");

            subscriber.close();
            sess.unsubscribe("kipper");
View Full Code Here

    {
        Connection con = getConnection("guest", "guest");
        Session ssn = (AMQSession) con.createSession(false, Session.CLIENT_ACKNOWLEDGE);
        con.start();

        Topic topic = ssn.createTopic("test");
        MessageConsumer consumer = ssn.createConsumer(topic);
        MessageProducer prod = ssn.createProducer(topic);
        Message m = ssn.createMessage();
        m.setObjectProperty("x-amqp-0-10.routing-key", "routing-key".getBytes());
        m.setObjectProperty("x-amqp-0-10.app-id", "my-app-id");
View Full Code Here

    public void testSelectorWithJMSDeliveryMode() throws Exception
    {
        Session session = _connection.createSession(false, Session.SESSION_TRANSACTED);

        Destination dest1 = session.createTopic("test1");
        Destination dest2 = session.createTopic("test2");

        MessageProducer prod1 = session.createProducer(dest1);
        MessageProducer prod2 = session.createProducer(dest2);
        MessageConsumer consumer1 = session.createConsumer(dest1,"JMSDeliveryMode = 'PERSISTENT'");
View Full Code Here

    public void testSelectorWithJMSDeliveryMode() throws Exception
    {
        Session session = _connection.createSession(false, Session.SESSION_TRANSACTED);

        Destination dest1 = session.createTopic("test1");
        Destination dest2 = session.createTopic("test2");

        MessageProducer prod1 = session.createProducer(dest1);
        MessageProducer prod2 = session.createProducer(dest2);
        MessageConsumer consumer1 = session.createConsumer(dest1,"JMSDeliveryMode = 'PERSISTENT'");
        MessageConsumer consumer2 = session.createConsumer(dest2,"JMSDeliveryMode = 'NON_PERSISTENT'");
View Full Code Here

    public void testSessionCreateTopic() throws Exception
    {
        Session ssn = _connection.createSession(false,Session.AUTO_ACKNOWLEDGE);
       
        // Using the BURL method
        Topic topic = ssn.createTopic("ACME");
        MessageProducer prod = ssn.createProducer(topic);
        MessageConsumer cons = ssn.createConsumer(topic);
       
        prod.send(ssn.createTextMessage("test"));
        assertNotNull("consumer should receive a message",cons.receive(1000));
View Full Code Here

        prod.send(ssn.createTextMessage("test"));
        assertNotNull("consumer should receive a message",cons.receive(1000));
        cons.close();
    
        // Using the ADDR method
        topic = ssn.createTopic("ADDR:ACME");
        prod = ssn.createProducer(topic);
        cons = ssn.createConsumer(topic);
       
        prod.send(ssn.createTextMessage("test"));
        assertNotNull("consumer should receive a message",cons.receive(1000));
View Full Code Here

                           "{exchange : 'vehicles', key : van}]" +
          "}" +
        "}";
       
        // Using the ADDR method to create a more complicated topic
        topic = ssn.createTopic(addr);
        prod = ssn.createProducer(topic);
        cons = ssn.createConsumer(topic);
       
        assertTrue("The queue was not bound to vehicle exchange using bus as the binding key",(
                (AMQSession_0_10)ssn).isQueueBound("vehicles",
View Full Code Here

        connection = connectionFactory.createConnection();
        connection.start();

        // lets create the consumers
        Session objectSession = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
        Destination destination = objectSession.createTopic(getClass().getName());
        MessageConsumer objectConsumer = objectSession.createConsumer(destination);

        Session textSession = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
        MessageConsumer textConsumer = textSession.createConsumer(destination);
        // lets clear the transformer on this consumer so we see the message as
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.