在rabbitmq中队列长度始终为零

时间:2014-09-03 05:55:49

标签: scala rabbitmq

val sslsf: SSLConnectionSocketFactory = Utility.getTrustAllSSLFactory
    val credsProvider: CredentialsProvider = new BasicCredentialsProvider()
    credsProvider.setCredentials(
      new AuthScope(rmqHost1, 15672),
      new UsernamePasswordCredentials("guest", "guest"))
val httpclient: CloseableHttpClient = HttpClients.custom()
    .setSSLSocketFactory(sslsf)
    .setDefaultCredentialsProvider(credsProvider)
    .build()

val getRequest: HttpGet = new HttpGet(rmqHost1 + "api/queues")
val response: CloseableHttpResponse = httpclient.execute(getRequest) 
for (qName <- queueNameList) {
     channel.queueDeclare(qName, true, false, false, policies)
     queueMap += (qName -> channel.queueDeclarePassive(qName).getMessageCount)
 }

我正在尝试建立一个关于RMQ队列健康状况的警报系统。为此,我需要队列中的消息数量。但是

channel.queueDeclarePassive(qName).getMessageCount)
即使队列中有可用消息,

也始终返回0。我只需要准备好的消息。并不担心未加密的消息。

我知道一种方法是对api \ queues进行API调用,然后从那里提取所需的信息,但是如果有人可以解决这个问题中的bug,那将会更有帮助

提前致谢!干杯:)

0 个答案:

没有答案