using System; ・・・・(中略)・・・ //usingディレクティブにC#ライブラリの名前空間を指定 using Appresso.DataSpider.Service; public class AppFabricTriggerTest { ・・・・(中略)・・・ public void ExecuteDataSpiderService () { // AppFabricTriggerServiceインスタンスの生成 AppFabricTriggerService service = new AppFabricTriggerService ( "serviceNamespace", // サービス名前空間(Service Namespace)の指定 "servicePath", // サービスパス(Service Path)の指定 "defaultIssuer", // 既定の発行者(Default Issuer)の指定 "defaultKey"); // 既定のキー(Default Key)の指定 // 文字列型のスクリプト入力変数「string_in」に渡すパラメータを設定 string string_in = "文字列入力"; service.PutParam("string_in", string_in); // 整数型のスクリプト入力変数「int_in」に渡すパラメータを設定 int int_in = 200; service.PutParam("int_in", int_in); // 真偽値型のスクリプト入力変数「boolean_in」に渡すパラメータを設定 bool boolean_in = True; service.PutParam("boolean_in", boolean_in); // Executeメソッドを呼び出してトリガーを発火させ、ExecutionResponseを取得する ExecutionResponse response = service.Execute(); // ExecutionResponseから終了ステータスを取得 int exitStatus = response.ExitStatus; // ExecutionResponseから処理に成功したかどうかを取得 bool succeeded = response.Succeeded; if (succeeded) { // 処理が成功した場合 // スクリプト出力変数の情報を持つDictionary型のインスタンスをExecutionResponseのResultsプロパティから取得 Dictionary<string, object> results = response.Results; // 文字列型のスクリプト出力変数「string_out」から値を取得 string string_out = (string )results["string_out"]; // 整数型のスクリプト出力変数「int_out」から値を取得 int int_out = (int)results["int_out"]; // 真偽値型のスクリプト出力変数「boolean_out」から値を取得 bool boolean_out = (bool)results["boolean_out"]; ・・・・(取得した値を使用した処理は中略)・・・ } else { // 処理が失敗した場合 // エラー情報を持つExecutionFailureインスタンスをExecutionResponseのFailureプロパティから取得 ExecutionFailure failure = response.Failure; // エラーのタイプを取得 string failureType = failure.Type; // エラーのメッセージを取得 string failureMessage = failure.Message; // エラーの詳細を取得 string failureMessage = failure.Message; ・・・・(取得したエラー情報を使用した処理は中略)・・・ } } ・・・・(中略)・・・ }
スクリプト入力変数の型 | 対応するC#の型 | 備考 |
---|---|---|
文字列型 | string | |
整数型 | int | |
10進数型 | decimal | |
日付/時間型 | System.DateTime | ![]() |
真偽値型 | bool | |
バイナリ型 | byte[] | |
XML型 | System.Xml.XmlDocument |
スクリプト出力変数の型 | 対応するC#の型 | 備考 |
---|---|---|
文字列型 | string | |
整数型 | int | |
10進数型 | decimal | |
日付/時間型 | System.DateTime | |
真偽値型 | bool | |
バイナリ型 | byte[] | |
XML型 | System.Xml.XmlDocument |
例外名 | 原因 | 対策 |
---|---|---|
System.IdentityModel.Tokens.SecurityTokenException
The token provider was unable to provide a security token. |
Azure Service Busサービスとの接続に失敗しました。 | AppFabricTriggerServiceに指定したサービス名前空間(Service Namespace)を確認してください。 |
System.ServiceModel.EndpointNotFoundException
Message could not be created: NotFound, No service is hosted at the specified address. |
Azure Service Busサービスが見つかりませんでした。 | 以下のことを確認してください。
|
System.IdentityModel.Tokens.SecurityTokenException
The token provider was unable to provide a security token. Error:Code:401:SubCode:T2001:Detail:The issuer does not exist, or the secret or signature is invalid. |
Azure Service Busサービスの認証に失敗しました。 | AppFabricTriggerServiceに指定した既定の発行者(Default Issuer)および既定のキー(Default Key)を確認してください。 |
System.TimeoutException
Message could not be retrieved: NoContent, No message available within the specified timeout. |
Azure Service Busトリガーからのメッセージ受信に失敗しました。 | 以下のことを確認してください。
|