Websphere MQ のキュー深度にアクセスするためのコードをいくつか作成しましたが、SIB キューにアクセスするための API があるかどうか、または Websphere をセットアップしてアクセスできるようにすることができるかどうかがわかりません。
ヒントやアイデアを教えてもらえますか?
ありがとうジェフ・ポーター
その答えは、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);
}