com.rabbitmq.client.Channel.consumerCount()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(2.5k)|赞(0)|评价(0)|浏览(134)

本文整理了Java中com.rabbitmq.client.Channel.consumerCount()方法的一些代码示例,展示了Channel.consumerCount()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Channel.consumerCount()方法的具体详情如下:
包路径:com.rabbitmq.client.Channel
类名称:Channel
方法名:consumerCount

Channel.consumerCount介绍

暂无

代码示例

代码示例来源:origin: spring-projects/spring-amqp

@Override
public long consumerCount(String queue) throws IOException {
  return this.delegate.consumerCount(queue);
}

代码示例来源:origin: org.springframework.amqp/spring-rabbit

@Override
public long consumerCount(String queue) throws IOException {
  return this.delegate.consumerCount(queue);
}

代码示例来源:origin: wmr513/reactive

public static void main(String[] args) {

    try {
      Channel channel = AMQPCommon.connect();            
      while (true) {
        long consumers = channel.consumerCount("trade.eq.q");
        long queueDepth = channel.messageCount("trade.eq.q");
        System.out.println("consumers: " + consumers + ", pending messages:" + queueDepth);
        Thread.sleep(1000);
      }

//            DeclareOk queue = channel.queueDeclare("trade.eq.q", true, false, false, null);
//            long consumers = queue.getConsumerCount();
//            long queueDepth = queue.getMessageCount();

    } catch (Exception e) {
      e.printStackTrace();
    }
  }
}

代码示例来源:origin: wmr513/reactive

public static void main(String[] args) {

    try {
      Channel channel = AMQPCommon.connect();            
      while (true) {
        long consumers = channel.consumerCount(args[0]);
        long queueDepth = channel.messageCount(args[0]);
        System.out.println("consumers: " + consumers + ", pending messages:" + queueDepth);
        Thread.sleep(1000);
      }

//            DeclareOk queue = channel.queueDeclare("trade.eq.q", true, false, false, null);
//            long consumers = queue.getConsumerCount();
//            long queueDepth = queue.getMessageCount();

    } catch (Exception e) {
      e.printStackTrace();
    }
  }
}

代码示例来源:origin: spring-projects/spring-amqp

@Test
public void test36Methods() throws Exception {
  this.templateWithConfirmsEnabled.convertAndSend(ROUTE, "foo");
  this.templateWithConfirmsEnabled.convertAndSend(ROUTE, "foo");
  assertMessageCountEquals(2L);
  assertEquals(Long.valueOf(1), this.templateWithConfirmsEnabled.execute(channel -> {
    final CountDownLatch latch = new CountDownLatch(2);
    String consumerTag = channel.basicConsume(ROUTE, new DefaultConsumer(channel) {
      @Override
      public void handleDelivery(String consumerTag, Envelope envelope, BasicProperties properties,
          byte[] body) throws IOException {
        latch.countDown();
      }
    });
    long consumerCount = channel.consumerCount(ROUTE);
    assertTrue(latch.await(10, TimeUnit.SECONDS));
    channel.basicCancel(consumerTag);
    return consumerCount;
  }));
  assertMessageCountEquals(0L);
}

相关文章

微信公众号

最新文章

更多