WebSphere Message Broker バージョン 8.0.0.5 オペレーティング・システム: AIX、HP-Itanium、Linux、Solaris、Windows、z/OS

製品の最新バージョンについては、IBM Integration Bus バージョン 9.0 をご覧ください。

.NETCompute ノードを使用するメッセージのコピー

.NETCompute ノードを使用して既存のメッセージをコピーします。

変換ノード (.NETCompute ノードなど) は、ある 1 つのノードから次のノードにメッセージ・フローを経由して渡される論理ツリー構造を変更することができます。 このツリー構造、つまりメッセージ・アセンブリー には 4 つのツリーが含まれています。 それらはそれぞれ、メッセージ、環境、ローカル環境、および例外リストを表します。 .NETCompute ノードの入力端末から出力端末にデータを送信するには、入力メッセージ・アセンブリーを伝搬するか出力メッセージ・アセンブリーを作成する Evaluate メソッドがノードと関連付けられているクラスに含まれている必要があります。 入力端末から出力端末にメッセージをコピーするには、入力メッセージ・アセンブリー全体を伝搬します。 メッセージは、C# で FilterNode クラスを作成する際に提供されるテンプレート・コードによって伝搬されます。 以下のコードから分かるように、inputAssembly が Propagate メソッドに渡されます。

        public override void Evaluate(NBMessageAssembly inputAssembly)
        {
            NBOutputTerminal outTerminal = OutputTerminal("Out");

            NBMessage inputMessage = inputAssembly.Message;
            NBElement root = inputMessage.RootElement;

            #region UserCode
            // Add user code in this region to filter the message
            #endregion UserCode

            // Change the following if not propagating message to the 'Out' terminal
            outTerminal.Propagate(inputAssembly);
        }

メッセージをコピーし、.NETCompute ノードでその更新も行う計画の場合は、CreateNode テンプレートを使用することをお勧めします。 このテンプレートは、出力アセンブリーを作成します。 UserCode 領域に 1 行のコードだけ追加して、入力アセンブリーをこの出力アセンブリーにコピーします。

        public override void Evaluate(NBMessageAssembly inputAssembly)
        {
            NBOutputTerminal outTerminal = OutputTerminal("out");

            NBMessage inputMessage = inputAssembly.Message;

            // Create a new empty message, ensuring it is disposed after use
            using (NBMessage outputMessage = new NBMessage())
            {
                NBMessageAssembly outAssembly = new NBMessageAssembly(inputAssembly, outputMessage);
                NBElement inputRoot = inputMessage.RootElement;
                NBElement outputRoot = outputMessage.RootElement;

                // Optionally copy message headers, remove if not needed
                CopyMessageHeaders(inputRoot, outputRoot);

                #region UserCode
                // Add user code in this region to create a new output message
                outputRoot.AddLastChild(inputRoot.LastChild);
                #endregion UserCode

                // Change the following if not propagating message to the 'Out' terminal
                outTerminal.Propagate(outAssembly);
            }
        }
特記事項 | 商標 | ダウンロード | ライブラリー | サポート | フィードバック

Copyright IBM Corporation 1999, 2014Copyright IBM Corporation 1999, 2014.

        
        最終更新:
        
        最終更新: 2015-02-28 17:48:48


タスク・トピックタスク・トピック | バージョン 8.0.0.5 | bc34208_