WS-Notification を使用した稼働を迅速に実現するためのスクリプトの使用

WebSphere® Application Server 内で WS-Notification を使用して稼働中である状態に 素早くできるよう、jython スクリプトを使用して必要なリソースを構成します。

始める前に

このトピックで 示されているスクリプトの例は、実稼働環境または Network Deployment 環境で 使用するのではなく、単一のサーバーのみでの開発で使用することを意図しています。

このタスクについて

スクリプトの 例を使用すると、開発の目的で WS-Notification アプリケーションに接続できる デフォルトのリソース・セットを構成することができます。 実行時に、スクリプトは以下のアクションを実行します。

  1. 構成で 既存のサービス統合バスを検索して、必要に応じてバスを作成します。
  2. 既存の バス・メンバーを検索しても見つからない場合は、バスに (スタンドアロン) サーバーを追加し、デフォルトのデータ・ソースを 使用します。
  3. 既存の サービス統合バス・トピック・スペース宛先を検索して、必要に応じて宛先を作成します。
  4. バージョン 6.1 またはバージョン 7.0 WS-Notification サービスを作成します。
  5. バージョン 6.1 またはバージョン 7.0 WS-Notification サービス・ポイントを、 SOAP over HTTP バインディング用にローカル・サーバー上に作成します。
  6. ステップ 3 で 見つかったか作成したサービス統合バス・トピック・スペースを参照する WS-Notification 永続トピック名前空間を作成します。
  7. 構成を保存して、公開した新規の通知ブローカー Web サービスの WSDL を検索する場所を 記述します。

スクリプトの 例を使用するには、以下のステップを実行します。

手順

  1. このスクリプトを、適当な名前を付けて (例えば wsnQuickStart.py) ファイル・システムに保存します。
  2. ローカル・サーバーの HTTP ポート (通常は 9080) を指すように、スクリプトの中で定義されている hostRoot 変数を変更します。
  3. (このステップが必要になるのは、バージョン 6.1 WS-Notification サービスの場合のみです) SDO リポジトリーをインストールして構成します
  4. サーバーを 始動してから、以下のコマンドを実行します。wsnQuickStart.py 以外の名前でスクリプトを保存した場合は、 代わりにその名前を使用してください。
    wsadmin -f wsnQuickStart.py

以下に スクリプトの例を示します。
#######################################################################################
# WS-Notification QuickStart script                                                   #
#                                                                                     #
# This Jython script will quickly create the basic resources required in order to     #
# start using WS-Notification in WebSphere Application Server Version 6.1 or later    #
#                                                                                     #
# Before executing it you must modify the variables defined below to match your       #
# configuration settings. #
#                                                                                     #
# Note:                                                                               #
#    - This script is not intended for production use, and is intended for use on     #
#      a stand-alone server (not network deployment) only. #
#    - The script will search the configuration for an existing bus, and if one is    #
#      not found then a new bus will be created                                       #
#    - It will then look for an existing Bus Member on the chosen bus. If one is not  #
#      found then one will be created using the default File Store                    #
#    - It will then look for an existing service integration bus topic space. If one  #
#      is not found then it will create one. #
#                                                                                     #
# Execute the script by typing;                                                       #
#   wsadmin -f wsnQuickStart.py                                                       #
#                                                                                     #
#######################################################################################

###########################################################
# Configuration variables                                 #
#                                                         #
# Set the following variables to match your configuration #
###########################################################
# The URL root of HTTP port on the local server
hostRoot = "http://xyz.ibm.com:9080"
# The type of WS-Notification service you want to create (Version 6.1 or Version 7.0)
wsnServiceType = "V7.0"

#######################################################################################
# Now create the configuration objects using the variables defined above              #
#######################################################################################

# These variables are arbitrary choices and need not be set unless required.
wsnServiceName = "myWSNService"+wsnServiceType
wsnServicePointName = "myWSNServicePoint"+wsnServiceType
eplName = "myNewEPL"
tnsNamespaceURI = "http://example.org/topicNamespace/example1"

# General environment variables
nodeName = AdminTask.listNodes().split("¥n")[0].rstrip()
server = AdminTask.listServers().split("¥n")[0].rstrip()

print "###########################################################"
print "# Check the pre-requisites before you begin               #"
print "###########################################################"
# Check for the existence of the bus
requiresRestart = "false"
myBuses = AdminTask.listSIBuses().split("¥n")
myBus = myBuses[0].rstrip()

if (myBus == ""):
        print "  *** Creating new bus "
        myBus = AdminTask.createSIBus("-bus MySampleBus -busSecurity false 
                                       -scriptCompatibility 6.1")
        requiresRestart = "true"
#endIf
siBusName = AdminConfig.showAttribute(myBus, "name" )
print "  service integration bus name: "+siBusName+" "

# Check for the existence of the bus member
busMembers = AdminTask.listSIBusMembers(" -bus "+siBusName).split("¥n")
myBusMember = busMembers[0].rstrip()

if (myBusMember == ""):
        print ""
        print "  *** Creating new Bus Member "
        busMemberName = AdminConfig.showAttribute(server, "name")
        myBusMember = AdminTask.addSIBusMember(" -bus "+siBusName+" 
                        -node "+nodeName+" -server "+busMemberName)
        print ""
        requiresRestart = "true"
else:
        nodeName = AdminConfig.showAttribute(myBusMember, "node")
        busMemberName = AdminConfig.showAttribute(myBusMember, "server")
#endElse
print "  service integration bus Member on node: "+nodeName+" "
print "                               on server: "+busMemberName+" "

# Find a topic space to use
topicSpaces = AdminTask.listSIBDestinations(" -bus "+siBusName+" 
                                  -type TopicSpace ").split("¥n")
tSpace = topicSpaces[0].rstrip()

if (tSpace == ""):
        print "  *** Creating a Topic Space "
        tSpace = AdminTask.createSIBDestination(" -bus "+siBusName+" 
                        -node "+nodeName+" -server "+myBusMember+" 
                        -name MyTopicSpace -type TopicSpace")
        print ""

#endIf
siBusTopicSpaceName = AdminConfig.showAttribute(tSpace, "identifier" )
print "     service integration bus topic space: "+siBusTopicSpaceName+" "

print ""
print "###########################################################"
print "# Create the WS-Notification service                      #"
print "###########################################################"
newService = AdminTask.listWSNServices(" -name "+wsnServiceName+" 
                            -bus "+siBusName).split("¥n")[0].rstrip()

if (newService == ""):
        newService = AdminTask.createWSNService(" -name "+wsnServiceName+" 
                            -bus "+siBusName+" "+" -type "+wsnServiceType)
        print "WS-Notification service created: "+wsnServiceName+" "
        print "                         on bus: "+siBusName+" "
else:
        print "WS-Notification service '"+wsnServiceName+"' "
        print "  already exists on bus '"+siBusName+"' "
#endElse

print ""
print "###########################################################"
print "# Create the WS-Notification service point                #"
print "###########################################################"
eplURLRoot = hostRoot+"/wsn"
wsdlURLRoot = hostRoot+"/SIBWS/wsdl"

newServicePoint = AdminTask.listWSNServicePoints(newService, "
                -name "+wsnServicePointName+" " ).split("¥n")[0].rstrip()

if (newServicePoint == ""):
        if (wsnServiceType == "V7.0"):
            newServicePoint = AdminTask.createWSNServicePoint(newService, "
            -name "+wsnServicePointName+" -node "+nodeName+" -server "+busMemberName)
        else:
            newServicePoint = AdminTask.createWSNServicePoint(newService, "
            -name "+wsnServicePointName+" 
            -node "+nodeName+" -server "+busMemberName+" -eplName "+eplName+" 
            -eplURLRoot "+eplURLRoot+" -eplWSDLServingURLRoot "+wsdlURLRoot+" " )
        print "WS-Notification service point created: "+wsnServicePointName+" "
        print "                        on bus member: "+busMemberName+" "
        print "                              on node: "+nodeName+" "
else:
        print "WS-Notification service point '"+wsnServicePointName+"' "
        print "already exists on WS-Notification service '"+wsnServiceName+"' "
#endElse

print ""
print "###########################################################"
print "# Create the WS-Notification permanent topic namespace    #"
print "###########################################################"
newTopicNamespace = AdminTask.listWSNTopicNamespaces(newService, "
                    -namespace "+tnsNamespaceURI+" ").split("¥n")[0].rstrip()

if (newTopicNamespace == ""):
    newTopicNamespace = AdminTask.createWSNTopicNamespace(newService, "
      -namespace "+tnsNamespaceURI+" -busTopicSpace "+siBusTopicSpaceName+" 
      -reliability RELIABLE_PERSISTENT")
  print "WS-Notification topic namespace created: "+tnsNamespaceURI+" "
  print "                        bus topic space: "+siBusTopicSpaceName+" "
else:
  print "WS-Notification permanent topic namespace already exists: "
        +tnsNamespaceURI+" "
#endElse

#######################################################################################
# All the objects have been created - inform the user where to proceed next           #
#######################################################################################

print ""
print "###########################################################"
print "# Summary                                                 #"
print "###########################################################"

# Calculate where you would find the WSDL for the new service.
if (wsnServiceType == "V7.0"):
  print "IMPORTANT: Because you've created a Version 7.0 service" 
  print "you need to start the newly installed application;"
  print "           WSN_"+wsnServiceName+"_"+wsnServicePointName 
  print ""

  wsdlLocation = hostRoot+"/"+wsnServiceName+wsnServicePointName
                         +"NB/Service?wsdl"
else:
  print "IMPORTANT: Because you've created a Version 6.1 service" 
  print "you need to start 2 newly installed applications;"
  serverName = AdminConfig.showAttribute(server, "name")
  print "           "+eplName+"."+nodeName+"."+serverName
  print "           sibws."+nodeName+"."+serverName
  print ""
  wsdlLocation = hostRoot+"/wsn/soaphttpengine/"+siBusName+"/"
                 +wsnServiceName+"NotificationBroker/"
                 +wsnServicePointName+"NotificationBrokerPort?wsdl"
print " The WSDL for the new service can be viewed at the following location; "
print "   "+wsdlLocation+" "
print ""
print " Your web service applications can publish and subscribe to any topics in the namespace; "
print "   "+tnsNamespaceURI+" "
print ""
if (requiresRestart == "true"):
  print " You must now restart the server for the changes to take effect. "
  print ""
#endIf

print ""
print "###########################################################"
print "# Save the configuration and exit                         #"
print "###########################################################"
AdminConfig.save()
sys.exit()

トピックのタイプを示すアイコン タスク・トピック



タイム・スタンプ・アイコン 最終更新: last_date
http://www14.software.ibm.com/webapp/wsbroker/redirect?version=cord&product=was-nd-mp&topic=tjwsn_task_sysa0
ファイル名:tjwsn_task_sysa0.html