Java Code Examples for org.apache.qpid.jms.JmsConnection#setCloseTimeout()
The following examples show how to use
org.apache.qpid.jms.JmsConnection#setCloseTimeout() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SessionIntegrationTest.java From qpid-jms with Apache License 2.0 | 6 votes |
@Test(timeout = 20000) public void testCloseSessionTimesOut() throws Exception { try (TestAmqpPeer testPeer = new TestAmqpPeer();) { JmsConnection connection = (JmsConnection) testFixture.establishConnecton(testPeer); connection.setCloseTimeout(500); testPeer.expectBegin(); testPeer.expectEnd(false); testPeer.expectClose(); Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); assertNotNull("Session should not be null", session); try { session.close(); fail("Should have thrown an timed out exception"); } catch (JmsOperationTimedOutException jmsEx) { LOG.info("Caught exception: {}", jmsEx.getMessage()); } connection.close(); testPeer.waitForAllHandlersToComplete(1000); } }
Example 2
Source File: ConnectionIntegrationTest.java From qpid-jms with Apache License 2.0 | 5 votes |
@Test(timeout = 20000) public void testCloseConnectionTimesOut() throws Exception { try (TestAmqpPeer testPeer = new TestAmqpPeer();) { JmsConnection connection = (JmsConnection) testFixture.establishConnecton(testPeer); connection.setCloseTimeout(500); testPeer.expectClose(false); connection.start(); assertNotNull("Connection should not be null", connection); connection.close(); testPeer.waitForAllHandlersToComplete(1000); } }
Example 3
Source File: ProducerIntegrationTest.java From qpid-jms with Apache License 2.0 | 5 votes |
@Test(timeout = 20000) public void testCloseSenderTimesOut() throws Exception { try (TestAmqpPeer testPeer = new TestAmqpPeer();) { JmsConnection connection = (JmsConnection) testFixture.establishConnecton(testPeer); connection.setCloseTimeout(500); testPeer.expectBegin(); testPeer.expectSenderAttach(); testPeer.expectDetach(true, false, true); testPeer.expectClose(); Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); Queue queue = session.createQueue("myQueue"); MessageProducer producer = session.createProducer(queue); try { producer.close(); fail("Should have thrown a timed out exception"); } catch (JmsOperationTimedOutException jmsEx) { LOG.info("Caught excpected exception", jmsEx); } connection.close(); testPeer.waitForAllHandlersToComplete(1000); } }
Example 4
Source File: SessionIntegrationTest.java From qpid-jms with Apache License 2.0 | 5 votes |
@Test(timeout = 20000) public void testDeleteTemporaryQueueTimesOut() throws Exception { try (TestAmqpPeer testPeer = new TestAmqpPeer();) { JmsConnection connection = (JmsConnection) testFixture.establishConnecton(testPeer); connection.setCloseTimeout(500); connection.start(); testPeer.expectBegin(); Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); String dynamicAddress = "myTempQueueAddress"; testPeer.expectTempQueueCreationAttach(dynamicAddress); TemporaryQueue tempQueue = session.createTemporaryQueue(); // Deleting the TemporaryQueue will be achieved by closing its creating link. testPeer.expectDetach(true, false, true); try { tempQueue.delete(); fail("Should have timed out waiting to delete."); } catch (JmsOperationTimedOutException jmsEx) { LOG.info("Caught expected exception: {}", jmsEx.getMessage()); } testPeer.expectClose(); connection.close(); testPeer.waitForAllHandlersToComplete(1000); } }
Example 5
Source File: SessionIntegrationTest.java From qpid-jms with Apache License 2.0 | 5 votes |
@Test(timeout = 20000) public void testDeleteTemporaryTopicTimesOut() throws Exception { try (TestAmqpPeer testPeer = new TestAmqpPeer();) { JmsConnection connection = (JmsConnection) testFixture.establishConnecton(testPeer); connection.setCloseTimeout(500); connection.start(); testPeer.expectBegin(); Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); String dynamicAddress = "myTempTopicAddress"; testPeer.expectTempTopicCreationAttach(dynamicAddress); TemporaryTopic tempTopic = session.createTemporaryTopic(); // Deleting the TemporaryTopic will be achieved by closing its creating link. testPeer.expectDetach(true, false, true); try { tempTopic.delete(); fail("Should have timed out waiting to delete."); } catch (JmsOperationTimedOutException jmsEx) { LOG.info("Caught expected exception: {}", jmsEx.getMessage()); } testPeer.expectClose(); connection.close(); testPeer.waitForAllHandlersToComplete(1000); } }
Example 6
Source File: ConsumerIntegrationTest.java From qpid-jms with Apache License 2.0 | 5 votes |
@Test(timeout = 20000) public void testCloseConsumerTimesOut() throws Exception { try (TestAmqpPeer testPeer = new TestAmqpPeer();) { JmsConnection connection = (JmsConnection) testFixture.establishConnecton(testPeer); connection.setCloseTimeout(500); testPeer.expectBegin(); testPeer.expectReceiverAttach(); testPeer.expectLinkFlow(); testPeer.expectDetach(true, false, true); testPeer.expectClose(); Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); Queue queue = session.createQueue("myQueue"); MessageConsumer consumer = session.createConsumer(queue); try { consumer.close(); fail("Should have thrown a timed out exception"); } catch (JmsOperationTimedOutException jmsEx) { LOG.info("Caught excpected exception", jmsEx); } connection.close(); testPeer.waitForAllHandlersToComplete(1000); } }