我如何获取带有远程Websphere应用程序服务器中所有队列名称的列表?

胜利者

我使用AdminClient连接到远程服务器,并使用一些代码获取队列列表:

...
AdminClient client = new AdminClientFactory.createAdminClient(props);
Set<ObjectName> s = client.queryNames(new ObjectName("WebSphere:*"),null);
if (!s.isEmpty()){
     Iterator i = s.iterator();
     while (i.hasNext){
          ObjectName on = i.next();
          String type = on.getKeyProperty("type");
          if ("SIBQueuePoint".eqquals(type)){
               System.out.println(on.getKeyProperty("name");)
          }
     }
}

此列表列出了我与JMS提供程序“默认消息提供程序”的队列。而且,我还有一些“ Websphere MQ消息传递提供程序”队列,在此列表中不存在。

我如何从所有JMS提供程序获取所有队列的列表?

adimoise91

抱歉,迟到了。我保证,这是python语言的脚本。

您所要做的就是替换您的范围和您的资源文件。

import sys, java, java.io, java.lang

lineSeparator = java.lang.System.getProperty('line.separator')

def listMQQCF(scope):
    scopeID = AdminConfig.getid(scope)
    scopeName = scope[scope.rfind(":")+1:scope.rfind("/")]
    wmqQCFList = AdminConfig.list('MQQueueConnectionFactory', scopeID).split(lineSeparator)
    MQQCFListHeader = "\n#==== MQQueueConnectionFactoryList " + scopeName + " ===="
    MQQCFListHeader = MQQCFListHeader + "\n#[name, jndiName, ,description, queueManager, transportType, host, port, channel, ConmaxConn, ConminCon, SessionmaxConn, SessionminConn]\n"  
    MQQCFList = "MQQueueConnectionFactoryList = [\\\n"
    if (len(wmqQCFList) > 0):
        for wmqQCF in wmqQCFList:
            wmqQCFName = wmqQCF[wmqQCF.rfind("/")+1:wmqQCF.find("|")]
            if (scopeName == wmqQCFName):
                name = AdminConfig.showAttribute(wmqQCF, 'name')
                jndiName = AdminConfig.showAttribute(wmqQCF, 'jndiName')
                description = AdminConfig.showAttribute(wmqQCF, 'description')
                if (description == None): description = ""
                queueManager = AdminConfig.showAttribute(wmqQCF, 'queueManager')                
                transportType = AdminConfig.showAttribute(wmqQCF, 'transportType')
                host = AdminConfig.showAttribute(wmqQCF, 'host')
                port = AdminConfig.showAttribute(wmqQCF, 'port')
                channel = AdminConfig.showAttribute(wmqQCF, 'channel')
                connPool = AdminConfig.showAttribute(wmqQCF, 'connectionPool')
                sessionPool = AdminConfig.showAttribute(wmqQCF, 'sessionPool')
                connTimeout = AdminConfig.showAttribute(connPool, "connectionTimeout")
                maxConn = AdminConfig.showAttribute(connPool, "maxConnections")
                minConn = AdminConfig.showAttribute(connPool, "minConnections")
                reapTime = AdminConfig.showAttribute(connPool, "reapTime")
                unusedTimeout =  AdminConfig.showAttribute(connPool, "unusedTimeout")
                agedTimeout = AdminConfig.showAttribute(connPool, "agedTimeout")
                sesconnTimeout = AdminConfig.showAttribute(sessionPool, "connectionTimeout")
                sesmaxConn = AdminConfig.showAttribute(sessionPool, "maxConnections")
                sesminConn = AdminConfig.showAttribute(sessionPool, "minConnections")
                sesreapTime = AdminConfig.showAttribute(sessionPool, "reapTime")
                sesunusedTimeout =  AdminConfig.showAttribute(sessionPool, "unusedTimeout")
                sesagedTimeout = AdminConfig.showAttribute(sessionPool, "agedTimeout")
                MQQCFList = MQQCFList + "['" + name + "','" + jndiName + "','" + description + "','" +  queueManager + "','" + transportType + "','" + host + "','" + port + "','" + channel + "','" + maxConn + "','" + minConn + "','" + sesmaxConn + "','" + sesminConn + "'],\\\n"
    if (MQQCFList[len(MQQCFList)-3] == ","):
        MQQCFList = MQQCFList[0:len(MQQCFList)-3] + "]\n"
    else:
        MQQCFList = MQQCFList[0:len(MQQCFList)-2] + "]\n"
    return MQQCFListHeader + MQQCFList

def listMQQueue(scope):
    scopeID = AdminConfig.getid(scope)
    scopeName = scope[scope.rfind(":")+1:scope.rfind("/")]
    objdmgr = AdminControl.queryNames('WebSphere:type=Server,name=dmgr,*')
    version = objdmgr[objdmgr.find("version")+8:]
    wmqQueueList = AdminConfig.list('MQQueue', scopeID).split(lineSeparator)
    MQQueueListHeader = "\n#==== MQQueueList " + scopeName + "  ====\n#[name, jndiName, description, baseQueueName, baseQMgrName, persistence, priority, targetClient, messageBody]\n"
    MQQueueList = "MQQueueList = [\\\n"
    if (len(wmqQueueList) > 0) :
        for wmqQueue in wmqQueueList:
            wmqQueueName = wmqQueue[wmqQueue.rfind("/")+1:wmqQueue.find("|")]
            if (scopeName == wmqQueueName):
                name = AdminConfig.showAttribute(wmqQueue, 'name')
                jndiName = AdminConfig.showAttribute(wmqQueue, 'jndiName')
                description = AdminConfig.showAttribute(wmqQueue, 'description')
                if (description == None):   description = ""
                baseQueueName = AdminConfig.showAttribute(wmqQueue, 'baseQueueName')
                baseQMgrName = AdminConfig.showAttribute(wmqQueue, 'baseQueueManagerName')
                if (baseQMgrName == None):  baseQMgrName = ""
                persistence = AdminConfig.showAttribute(wmqQueue, 'persistence')    
                priority = AdminConfig.showAttribute(wmqQueue, 'priority')
                targetClient = AdminConfig.showAttribute(wmqQueue, 'targetClient')
                if (version =='8'):
                    messageBody = AdminConfig.showAttribute(wmqQueue, 'messageBody')
                else:
                    messageBody = ""                
                MQQueueList = MQQueueList + "['" + name + "','" + jndiName + "','" + description + "','" + baseQueueName + "','" + baseQMgrName + "','" + persistence + "','" + priority + "','" + targetClient + "','" + messageBody + "'],\\\n"               
            #endif
    if (MQQueueList[len(MQQueueList)-3] == ","):
        MQQueueList = MQQueueList[0:len(MQQueueList)-3] + "]\n"
    else:
        MQQueueList = MQQueueList[0:len(MQQueueList)-2] + "]\n"
    return MQQueueListHeader + MQQueueList


#===============================================
#MAIN
#===============================================    

filename='resources.txt'
scope='/Cell:CellName/ServerCluster:ClusterName/'


objItemFileOutputStream = java.io.FileOutputStream(fileName, 1)
scopeID = AdminConfig.getid(scope)
if ( scopeID <> ""):
    list = listRes(objType, scope)
    objItemFileOutputStream.write(list)
else:
    print "\n" + scope + "\t Failed: Incorrect scopes!\n"
objItemFileOutputStream.close()

祝你好运!

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章

来自分类Dev

如何在tomcat服务器中获取所有已部署的应用程序

来自分类Dev

如何在tomcat服务器中获取所有已部署的应用程序

来自分类Dev

如何获取Openfire服务器中所有房间的列表

来自分类Dev

如何获取Openfire服务器中所有房间的列表

来自分类Dev

Android:如何获取应用程序中所有缓存文件的列表?

来自分类Dev

如何获取MVC5 Web应用程序中所有管理员的列表?

来自分类Dev

Android:如何获取应用程序中所有缓存文件的列表?

来自分类Dev

在应用程序中获取带有服务器路径的文件,而不是通过 http?

来自分类Dev

带有Parse的Android应用程序-如何响应服务器端的事件

来自分类Dev

如何从另一台服务器远程获取Biztalk应用程序列表

来自分类Dev

如何从另一台服务器远程获取Biztalk应用程序列表

来自分类Dev

参数存储中所有Windows服务器名称的列表

来自分类Dev

X服务器关闭之前如何关闭所有应用程序?

来自分类Dev

无法从远程服务器列表中获取应用程序池。循环无效

来自分类Dev

Powershell获取OU中所有服务器的lastlogonDate

来自分类Dev

获取ios 8中所有已安装应用程序的列表

来自分类Dev

ServiceStack:获取当前应用程序中所有受支持路由的列表

来自分类Dev

如何在iOS中从我的应用程序获取所有消息传递应用程序列表

来自分类Dev

Android Facebook SDK如何获取安装我的应用程序的所有朋友列表

来自分类Dev

如何获得PHP中所有预安装的服务器模块的列表?

来自分类Dev

如何使Websphere应用程序服务器中的应用程序通过LAN可用

来自分类Dev

我有一个服务器应用程序可以准确地获取数据的一半时间。为什么/如何发生以及如何解决?

来自分类Dev

如何从iOS中的应用程序获取所有消息传递应用程序列表

来自分类Dev

如何使用 sunspot gem 在带有 Rails 应用程序的生产服务器中独立配置 Solr?

来自分类Dev

如何获取Play商店中所有热门应用的列表

来自分类Dev

从带有应用程序引擎的FTP服务器正确解析CSV文件

来自分类Dev

带有URI的Apache服务器上的两个应用程序

来自分类Dev

带有VB.NET的客户端/服务器应用程序

来自分类Dev

带有Json服务器的Extjs应用程序无法正常工作

Related 相关文章

  1. 1

    如何在tomcat服务器中获取所有已部署的应用程序

  2. 2

    如何在tomcat服务器中获取所有已部署的应用程序

  3. 3

    如何获取Openfire服务器中所有房间的列表

  4. 4

    如何获取Openfire服务器中所有房间的列表

  5. 5

    Android:如何获取应用程序中所有缓存文件的列表?

  6. 6

    如何获取MVC5 Web应用程序中所有管理员的列表?

  7. 7

    Android:如何获取应用程序中所有缓存文件的列表?

  8. 8

    在应用程序中获取带有服务器路径的文件,而不是通过 http?

  9. 9

    带有Parse的Android应用程序-如何响应服务器端的事件

  10. 10

    如何从另一台服务器远程获取Biztalk应用程序列表

  11. 11

    如何从另一台服务器远程获取Biztalk应用程序列表

  12. 12

    参数存储中所有Windows服务器名称的列表

  13. 13

    X服务器关闭之前如何关闭所有应用程序?

  14. 14

    无法从远程服务器列表中获取应用程序池。循环无效

  15. 15

    Powershell获取OU中所有服务器的lastlogonDate

  16. 16

    获取ios 8中所有已安装应用程序的列表

  17. 17

    ServiceStack:获取当前应用程序中所有受支持路由的列表

  18. 18

    如何在iOS中从我的应用程序获取所有消息传递应用程序列表

  19. 19

    Android Facebook SDK如何获取安装我的应用程序的所有朋友列表

  20. 20

    如何获得PHP中所有预安装的服务器模块的列表?

  21. 21

    如何使Websphere应用程序服务器中的应用程序通过LAN可用

  22. 22

    我有一个服务器应用程序可以准确地获取数据的一半时间。为什么/如何发生以及如何解决?

  23. 23

    如何从iOS中的应用程序获取所有消息传递应用程序列表

  24. 24

    如何使用 sunspot gem 在带有 Rails 应用程序的生产服务器中独立配置 Solr?

  25. 25

    如何获取Play商店中所有热门应用的列表

  26. 26

    从带有应用程序引擎的FTP服务器正确解析CSV文件

  27. 27

    带有URI的Apache服务器上的两个应用程序

  28. 28

    带有VB.NET的客户端/服务器应用程序

  29. 29

    带有Json服务器的Extjs应用程序无法正常工作

热门标签

归档