IBM Integration API を使用したワークロード管理ポリシーの構成

IBM® Integration API によって、ワークロード管理ポリシーを作成、取得、更新、および削除する方法が提供されます。

サンプル・コード・スニペットは、以下のタスクで提供されます。

ワークロード管理ポリシーの作成

public static void PolicyCreate(String hostname, int port, String qmgr) {
  BrokerProxy b = null;
  try {      
    System.out.println("Connecting to the Integration Node (Broker).");
    System.out.println("Hostname="+hostname+", Port="+port+", QueueManager="+qmgr);
    BrokerConnectionParameters bcp = new MQBrokerConnectionParameters(hostname, port, qmgr);
    b = BrokerProxy.getInstance(bcp);     
    String policyName = "ExamplePolicy";
    String policyType = "WorkloadManagement";
    String policyContent = "<wsp:Policy xmlns:wsp=\"http://www.w3.org/ns/ws-policy\">
                           <iwlm:workloadManagement xmlns:iwlm=\"http://www.ibm.com/xmlns/prod/websphere/iib/9.0.0/policy/wlm\">
                           <iwlm:notificationThresholdMsgsPerSec>75</iwlm:notificationThresholdMsgsPerSec>
                           <iwlm:maximumRateMsgsPerSec>100</iwlm:maximumRateMsgsPerSec>
                           <iwlm:processingTimeoutMsgsPerSec></iwlm:processingTimeoutMsgsPerSec>
                           <iwlm:processingTimeoutAction></iwlm:processingTimeoutAction>
                           <iwlm:additionalInstances>0</iwlm:additionalInstances>
                           <iwlm:startInstancesWhenFlowStarts>false</iwlm:startInstancesWhenFlowStarts>
                           <iwlm:commitCount>0</iwlm:commitCount>
                           <iwlm:commitInterval></iwlm:commitInterval>
                           <iwlm:startMode>maintained</iwlm:startMode>
                           </iwlm:workloadManagement>
                           </wsp:Policy>";	   			 
                           System.out.println("About to create a policy.");
    b.createPolicy(policyType, policyName, policyContent);    
    System.out.println("Disconnecting from the Integration Node (Broker).");
    b.disconnect();
  } catch (ConfigManagerProxyException ex) {
    ex.printStackTrace();
  }
}

ワークロード管理ポリシーの取得

public static void PolicyRetrieve(String hostname, int port, String qmgr) {
	BrokerProxy b = null;
	try {			 
		 System.out.println("Connecting to the Integration Node (Broker).");
		 System.out.println("Hostname="+hostname+", Port="+port+", QueueManager="+qmgr);
		 BrokerConnectionParameters bcp = new MQBrokerConnectionParameters(hostname, port, qmgr);
		 b = BrokerProxy.getInstance(bcp);			 
		 String policyName = "ExamplePolicy";
		 String policyType = "WorkloadManagement";			 	   		
		 System.out.println("About to retrieve a policy.");
		 PolicyProxy p = b.getPolicy(policyType, policyName);
		 System.out.println("Policy contents of retrieved policy:");
		 System.out.println(p.getPolicyContent());
		 System.out.println("Disconnecting from the Integration Node (Broker).");
		 b.disconnect();
	} catch (ConfigManagerProxyException ex) {
		 ex.printStackTrace();
	}
}	

ワークロード管理ポリシーの更新

public static void PolicyUpdate(String hostname, int port, String qmgr) {
  BrokerProxy b = null;
  try {      
    System.out.println("Connecting to the Integration Node (Broker).");
    System.out.println("Hostname="+hostname+", Port="+port+", QueueManager="+qmgr);
    BrokerConnectionParameters bcp = new MQBrokerConnectionParameters(hostname, port, qmgr);
    b = BrokerProxy.getInstance(bcp);     
    String policyName = "ExamplePolicy";
    String policyType = "WorkloadManagement";
    String policyContent = "<wsp:Policy xmlns:wsp=\"http://www.w3.org/ns/ws-policy\">
                           <iwlm:workloadManagement xmlns:iwlm=\"http://www.ibm.com/xmlns/prod/websphere/iib/9.0.0/policy/wlm\">
                           <iwlm:notificationThresholdMsgsPerSec>75</iwlm:notificationThresholdMsgsPerSec>
                           <iwlm:maximumRateMsgsPerSec>100</iwlm:maximumRateMsgsPerSec>
                           <iwlm:processingTimeoutMsgsPerSec></iwlm:processingTimeoutMsgsPerSec>
                           <iwlm:processingTimeoutAction></iwlm:processingTimeoutAction>
                           <iwlm:additionalInstances>0</iwlm:additionalInstances>
                           <iwlm:startInstancesWhenFlowStarts>false</iwlm:startInstancesWhenFlowStarts>
                           <iwlm:commitCount>0</iwlm:commitCount>
                           <iwlm:commitInterval></iwlm:commitInterval>
                           <iwlm:startMode>maintained</iwlm:startMode></iwlm:workloadManagement>
                           </wsp:Policy>";          
                           System.out.println("About to update a policy.");
    b.updatePolicy(policyType, policyName, policyContent);
    System.out.println("Disconnecting from the Integration Node (Broker).");
    b.disconnect();
  } catch (ConfigManagerProxyException ex) {
    ex.printStackTrace();
  }
} 

ワークロード管理ポリシーの削除

public static void PolicyDelete(String hostname, int port, String qmgr) {
	BrokerProxy b = null;
	try {			 
		 System.out.println("Connecting to the Integration Node (Broker).");
		 System.out.println("Hostname="+hostname+", Port="+port+", QueueManager="+qmgr);
		 BrokerConnectionParameters bcp = new MQBrokerConnectionParameters(hostname, port, qmgr);
		 b = BrokerProxy.getInstance(bcp);	   
		 String policyName = "ExamplePolicy";
		 String policyType = "WorkloadManagement";			 	   		 
		 System.out.println("About to delete a policy.");
		 b.deletePolicy(policyType, policyName);
		 System.out.println("Disconnecting from the Integration Node (Broker).");
		 b.disconnect();
	} catch (ConfigManagerProxyException ex) {
		 ex.printStackTrace();
	}
}	
特記事項 | 商標 | ダウンロード | ライブラリー | サポート | フィードバック

Copyright IBM Corporation 1999, 2013Copyright IBM Corporation 1999, 2013.

        
        最終更新:
        
        最終更新: 2013-07-17 15:21:55


タスク・トピックタスク・トピック | IBM Integration Bus バージョン 9.0.0.0 | bn34264_