Websphere 7 SIB 队列:如何从 Java 访问队列深度?

发布于 2024-12-16 13:28:49 字数 132 浏览 1 评论 0原文

我已经创建了一些代码来访问 Websphere MQ 的队列深度,但我无法确定是否有用于访问 SIB 队列的 API,或者我是否可以设置 websphere 以允许我访问它。

谁能给我一些提示/想法?

谢谢 杰夫·波特

I've created some code to access queue depths for a Websphere MQ, but I can't work out if there is an API for accessing a SIB queue, or if I can setup websphere to allow me to access it.

Can anyone give me some hints/ideas?

Thanks
Jeff Porter

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

北陌 2024-12-23 13:28:49

对于那些关心的人来说,答案是 SOAP。

好吧,我还没有设法让 WSADMIN 使用的 API 正常工作,但我已经使用 SOAP 直接进入 websphere 来询问有关队列的信息。

注意:默认端口为8880

import java.util.Iterator;
import java.util.Map;
import java.util.Properties;
import java.util.Set;
import java.util.TreeMap;

import javax.management.ObjectName;

import org.apache.log4j.Logger;

import com.ibm.websphere.management.AdminClient;
import com.ibm.websphere.management.AdminClientFactory;

 <SNIP>
 Properties connectProps = new Properties();
 connectProps.setProperty(AdminClient.CONNECTOR_TYPE, AdminClient.CONNECTOR_TYPE_SOAP);
 connectProps.setProperty(AdminClient.CONNECTOR_HOST, "127.0.0.1");
 connectProps.setProperty(AdminClient.CONNECTOR_PORT, "8880"); 

 AdminClient adminClient = null;
    try
    {
      adminClient = AdminClientFactory.createAdminClient(connectProps);

      Set<ObjectName> s2 = adminClient.queryNames(new ObjectName("WebSphere:*"), null);
      if (!s2.isEmpty())
      {
        Iterator<ObjectName> i = s2.iterator();
        while (i.hasNext())
        {
          ObjectName on = i.next();
          String type = on.getKeyProperty("type");
          if ("SIBQueuePoint".equals(type))
          {
            String queueName = on.getKeyProperty("name") ;
            int currentDepth =  ((Integer) adminClient.getAttribute(on, "depth")).intValue();
            int maxSize =  ((Integer) adminClient.getAttribute(on, "highMessageThreshold")).intValue();

            LOG.info("Queried SIB queue: Queue: [" + queueName + "] Size =[" + currentDepth + "] highMessageThreshold:["+maxSize+"]");
          }
        }
      }
      else {
        System.out.println("MBean was not found");
      }
    }
    catch (Exception e)
    {
      LOG.error("Error finding SIB queue details, message:" + e.getMessage(), e); 
    }  

The answer, for those that care is SOAP.

Ok, so I've not managed to get the API used by WSADMIN to work, but I've used SOAP direct into websphere to ask it about the queues.

Note: Default port is 8880

import java.util.Iterator;
import java.util.Map;
import java.util.Properties;
import java.util.Set;
import java.util.TreeMap;

import javax.management.ObjectName;

import org.apache.log4j.Logger;

import com.ibm.websphere.management.AdminClient;
import com.ibm.websphere.management.AdminClientFactory;

 <SNIP>
 Properties connectProps = new Properties();
 connectProps.setProperty(AdminClient.CONNECTOR_TYPE, AdminClient.CONNECTOR_TYPE_SOAP);
 connectProps.setProperty(AdminClient.CONNECTOR_HOST, "127.0.0.1");
 connectProps.setProperty(AdminClient.CONNECTOR_PORT, "8880"); 

 AdminClient adminClient = null;
    try
    {
      adminClient = AdminClientFactory.createAdminClient(connectProps);

      Set<ObjectName> s2 = adminClient.queryNames(new ObjectName("WebSphere:*"), null);
      if (!s2.isEmpty())
      {
        Iterator<ObjectName> i = s2.iterator();
        while (i.hasNext())
        {
          ObjectName on = i.next();
          String type = on.getKeyProperty("type");
          if ("SIBQueuePoint".equals(type))
          {
            String queueName = on.getKeyProperty("name") ;
            int currentDepth =  ((Integer) adminClient.getAttribute(on, "depth")).intValue();
            int maxSize =  ((Integer) adminClient.getAttribute(on, "highMessageThreshold")).intValue();

            LOG.info("Queried SIB queue: Queue: [" + queueName + "] Size =[" + currentDepth + "] highMessageThreshold:["+maxSize+"]");
          }
        }
      }
      else {
        System.out.println("MBean was not found");
      }
    }
    catch (Exception e)
    {
      LOG.error("Error finding SIB queue details, message:" + e.getMessage(), e); 
    }  
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文