Package javax.jms

Examples of javax.jms.Session.commit()


        // is terminated when there are no outstanding delivered but unacknowledged messages.  In contrast, with a
        // standard message grouping queue the assignment will be retained until the subscription is no longer
        // registered
        if(sharedGroups)
        {
            cs2.commit();
            received = consumer2.receive(1000);

            assertNotNull("Consumer 2 should have received its second message", received);
            assertEquals("incorrect message received", 4, received.getIntProperty("msg"));
View Full Code Here


            received = consumer2.receive(1000);

            assertNotNull("Consumer 2 should have received its second message", received);
            assertEquals("incorrect message received", 4, received.getIntProperty("msg"));

            cs2.commit();
        }
        else
        {
            cs2.commit();
            received = consumer2.receive(1000);
View Full Code Here

            cs2.commit();
        }
        else
        {
            cs2.commit();
            received = consumer2.receive(1000);

            assertNull("Consumer 2 should not have received a second message", received);

            cs1.commit();
View Full Code Here

        MessageProducer sender = sess.createProducer(queue);

        sender.send(sess.createTextMessage("test"));

        //Send the message using a transaction as this will allow us to retrieve any errors that occur on the broker.
        sess.commit();

        conn.close();
    }

    public void setUpRequestResponseSuccess() throws Exception
View Full Code Here

        // Client
        Message request = clientSession.createTextMessage("Request");
        request.setJMSReplyTo(responseQueue);

        clientSession.createProducer(requestQueue).send(request);
        clientSession.commit();

        // Server
        Message msg = server.receive(2000);
        assertNotNull("Server should have received client's request", msg);
        assertNotNull("Received msg should have Reply-To", msg.getJMSReplyTo());
View Full Code Here

        sender.send(serverSession.createTextMessage("Response"));
        serverSession.commit();

        // Client
        Message clientResponseMsg = clientResponse.receive(2000);
        clientSession.commit();
        assertNotNull("Client did not receive response message,", clientResponseMsg);
        assertEquals("Incorrect message received", "Response", ((TextMessage) clientResponseMsg).getText());
    }

    public void setUpClientDeleteQueueSuccessWithOnlyAllPermissions() throws Exception
View Full Code Here

        // Publish 5 persistent messages, 256k chars to ensure they are multi-frame
        sendMessages(session, messageProducer, queue, DeliveryMode.PERSISTENT, 256*1024, 5);
        // Publish 5 persistent messages, 1k chars to ensure they are single-frame
        sendMessages(session, messageProducer, queue, DeliveryMode.PERSISTENT, 1*1024, 5);

        session.commit();

        // Publish 5 persistent messages which will NOT be committed and so should be 'lost'
        sendMessages(session, messageProducer, queue, DeliveryMode.PERSISTENT, 1*1024, 5);
        messageProducer.close();
        session.close();
View Full Code Here

        // Send message to the DLQ
        Queue dlq = session.createQueue("fanout://" + QUEUE_WITH_DLQ_NAME + "_DLE//does-not-matter");
        MessageProducer dlqMessageProducer = session.createProducer(dlq);
        sendMessages(session, dlqMessageProducer, dlq, DeliveryMode.PERSISTENT, 1*1024, 1);
        session.commit();

        // Create a queue with JMX specifying an owner, so it can later be moved into description
        createAndBindQueueOnBrokerWithJMX(NONEXCLUSIVE_WITH_ERRONEOUS_OWNER, MISUSED_OWNER, priorityQueueArguments);
        session.close();
        connection.close();
View Full Code Here

    for(String event : events) {
      TextMessage message = session.createTextMessage();
      message.setText(event);
      producer.send(message);
    }
    session.commit();
    session.close();
    connection.close();
  }

  private void putTopic(List<String> events) throws Exception {
View Full Code Here

    for(String event : events) {
      TextMessage message = session.createTextMessage();
      message.setText(event);
      producer.send(message);
    }
    session.commit();
    session.close();
    connection.close();
  }

  @Test
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.