Destination サブツリーを使用して、出力ノード、HTTPRequest ノード、SOAPRequest ノード、SOAPAsyncRequest ノード、および RouteToLabel ノードで使用されるターゲット宛先をセットアップします。 以下の例は、ESQL プロシージャーを作成およびそれを使用して、それぞれの使用における値のセットアップというタスクを実行する方法を示しています。
これらのプロシージャーをコピーし、示されているとおりに使用するか、あるいはそれらを変更または拡張して同様のタスクを実行できます。
Compute ノード用にこの ESQL コードを作成しようとしている場合は、「計算モード」プロパティーを設定してこのノードを構成し、出力メッセージ内のローカル環境ツリーにアクセスできるようにしなければなりません。 「LocalEnvironment」、「LocalEnvironment とメッセージ」、または「すべて」の 3 つの値のうち 1 つを選択しなければなりません。
CREATE PROCEDURE addToMQDestinationList(IN LocalEnvironment REFERENCE, IN newQueue char) BEGIN
/*******************************************************************************
* A procedure that adds a queue name to the MQ destination list in the local environment.
* This list is used by an MQOutput node that has its mode set to Destination list.
*
* IN LocalEnvironment: the LocalEnvironment to be modified.
* IN queue: the queue to be added to the list
*
*******************************************************************************/
DECLARE I INTEGER CARDINALITY(LocalEnvironment.Destination.MQ.DestinationData[]);
IF I = 0 THEN
SET OutputLocalEnvironment.Destination.MQ.DestinationData[1].queueName = newQueue;
ELSE
SET OutputLocalEnvironment.Destination.MQ.DestinationData[I+1].queueName = newQueue;
END IF;
END;
これらのエレメントの詳細については、MQ DestinationData サブツリー内のエレメントのデータ・タイプを参照してください。CREATE PROCEDURE overrideDefaultSOAPRequestURL(IN LocalEnvironment REFERENCE, IN newUrl char) BEGIN
/*******************************************************************************
* A procedure that changes the URL to which the SOAPRequest node or
* SOAPAsyncRequest node sends the request.
*
* IN LocalEnvironment: the LocalEnvironment to be modified.
* IN queue: the URL to which to send the request.
*
*******************************************************************************/
SET OutputLocalEnvironment.Destination.SOAP.Request.Transport.HTTP.WebServiceURL = newUrl;
END;
CREATE PROCEDURE overrideDefaultHTTPRequestURL(IN LocalEnvironment REFERENCE, IN newUrl char) BEGIN
/*******************************************************************************
* A procedure that changes the URL to which the HTTPRequest node sends the request.
*
* IN LocalEnvironment: the LocalEnvironment to be modified.
* IN queue: the URL to which to send the request.
*
*******************************************************************************/
SET OutputLocalEnvironment.Destination.HTTP.RequestURL = newUrl;
END;
CREATE PROCEDURE addToRouteToLabelList(IN LocalEnvironment REFERENCE, IN newLabel char) BEGIN
/*******************************************************************************
* A procedure that adds a label name to the RouteToLabel list in the local environment.
* This list is used by a RoteToLabel node.
*
* IN LocalEnvironment: the LocalEnvironment to be modified.
* IN label: the label to be added to the list
*
*******************************************************************************/
IF LocalEnvironment.Destination.RouterList.DestinationData is null THEN
SET OutputLocalEnvironment.Destination.RouterList.DestinationData."label" = newLabel;
ELSE
CREATE LASTCHILD OF LocalEnvironment.Destination.RouterList.DestinationData
NAME 'label' VALUE newLabel;
END IF;
END;
CREATE PROCEDURE CreateJMSDestinationList() BEGIN
SET OutputLocalEnvironment.Destination.JMSDestinationList.DestinationData[1] = 'jndi://TestDestQueue1';
SET OutputLocalEnvironment.Destination.JMSDestinationList.DestinationData[2] = 'jndi://TestDestQueue2';
SET OutputLocalEnvironment.Destination.JMSDestinationList.DestinationData[3] = 'jndi://TestDestQueue3';
END;