コード例 #1
0
  @Test
  public void testListConsumers() throws Exception {

    HashMap<String, Object> map = new HashMap<String, Object>();
    map.put("host", TestSuiteEnvironment.getServerAddress());
    TransportConfiguration transportConfiguration =
        new TransportConfiguration(NettyConnectorFactory.class.getName(), map);
    HornetQConnectionFactory cf =
        HornetQJMSClient.createConnectionFactoryWithoutHA(
            JMSFactoryType.CF, transportConfiguration);
    cf.setClientID("consumer");
    consumerConn = cf.createQueueConnection("guest", "guest");
    consumerConn.start();
    consumerSession = consumerConn.createQueueSession(false, TopicSession.AUTO_ACKNOWLEDGE);

    ModelNode result = execute(getQueueOperation("list-consumers-as-json"), true);
    Assert.assertTrue(result.isDefined());
    Assert.assertEquals(ModelType.STRING, result.getType());
  }
コード例 #2
0
  @Before
  public void addTopic() throws Exception {

    count++;
    adminSupport.createJmsQueue(getQueueName(), getQueueJndiName());
    adminSupport.createJmsQueue(getOtherQueueName(), getOtherQueueJndiName());
    HashMap<String, Object> map = new HashMap<String, Object>();
    map.put("host", TestSuiteEnvironment.getServerAddress());
    TransportConfiguration transportConfiguration =
        new TransportConfiguration(NettyConnectorFactory.class.getName(), map);
    HornetQConnectionFactory cf =
        HornetQJMSClient.createConnectionFactoryWithoutHA(
            JMSFactoryType.CF, transportConfiguration);
    cf.setClientID("sender");
    conn = cf.createQueueConnection("guest", "guest");
    conn.start();
    queue = HornetQJMSClient.createQueue(getQueueName());
    otherQueue = HornetQJMSClient.createQueue(getOtherQueueName());
    session = conn.createQueueSession(false, TopicSession.AUTO_ACKNOWLEDGE);
  }