@Test(timeout = 30000)
  public void testSessionUnsubscribePassthrough() throws Exception {
    JmsConnectionFactory factory = new JmsConnectionFactory("failover:(mock://localhost)");

    Connection connection = factory.createConnection();
    connection.start();
    Session session = connection.createSession(false, Session.CLIENT_ACKNOWLEDGE);
    session.unsubscribe("some-subscription");
    connection.close();

    assertEquals(1, mockPeer.getContextStats().getUnsubscribeCalls());
  }
예제 #2
0
  public void testDurableSubscriber() throws Exception {
    BridgeImpl bridge = null;

    try {
      final int NUM_MESSAGES = 10;

      bridge =
          new BridgeImpl(
              cff0,
              cff1,
              sourceTopicFactory,
              targetQueueFactory,
              null,
              null,
              null,
              null,
              null,
              5000,
              10,
              QualityOfServiceMode.AT_MOST_ONCE,
              1,
              -1,
              "subTest",
              "clientid123",
              false);

      bridge.start();

      sendMessages(cf0, sourceTopic, 0, NUM_MESSAGES, true);

      checkAllMessageReceivedInOrder(cf1, targetQueue, 0, NUM_MESSAGES);
    } finally {
      if (bridge != null) {
        bridge.stop();
      }

      // Now unsubscribe
      Connection conn = cf0.createConnection();
      conn.setClientID("clientid123");
      Session sess = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
      sess.unsubscribe("subTest");
      conn.close();
    }
  }