WebSphere Message Brokers
File: ac16862_
Writer: Kate Hostler

Task topic

This build: July 31, 2007 21:18:45

Populating Destination in the LocalEnvironment tree

You can use the Destination subtree to set up target destinations that are used by output nodes, the HTTPRequest node, and the RouteToLabel node. The examples below show how you can create and use an ESQL procedure to perform the task of setting up values for each of these uses.

You can copy and use these procedures as shown, or you can modify or extend them to perform similar tasks.

Adding a queue name for the MQOutput node.
CREATE PROCEDURE addToMQDestinationList(IN LocalEnvironment REFERENCE, IN newQueue char) BEGIN
  /*******************************************************************************
  * A procedure that will add a queue name to the MQ destination list
  * in the local environment.
  * This list is used by a MQOuput node which has its mode set to Destination list.
  *
  * IN LocalEnvironment: LocalEnvironment to be modified. 
  * Set this to OutputLocalEnvironment when calling this procedure
  * IN queue:    queue to be added to the list
  *
  *******************************************************************************/
  DECLARE I INTEGER CARDINALITY(LocalEnvironment.Destination.MQDestinationList.DestinationData[]);
		IF I = 0 THEN
			SET LocalEnvironment.Destination.MQDestinationList.DestinationData[1].queueName = newQueue;
		ELSE
			SET LocalEnvironment.Destination.MQDestinationList.DestinationData[I+1].queueName = newQueue;
		END IF;
	END;
Changing the default URL for an HTTPRequest node request.
CREATE PROCEDURE overrideDefaultHTTPRequestURL(IN LocalEnvironment REFERENCE, IN newUrl char) BEGIN
  /*******************************************************************************
  * A procedure that will change the URL to which the HTTPRequest node will send the request.
  * 
  * IN LocalEnvironment: LocalEnvironment to be modified. 
  * Set this to OutputLocalEnvironment when calling this procedure
  * IN queue:    URL to send the request to.
  *
  *******************************************************************************/
  set LocalEnvironment.Destination.HTTP.RequestURL  = newUrl;
END;
Adding a label for the RouteToLabel node.
CREATE PROCEDURE addToRouteToLabelList(IN LocalEnvironment REFERENCE, IN newLabel char) BEGIN
  /*******************************************************************************
  * A procedure that will add a label name to the RouteToLabel list
  * in the local environment.
  * This list is used by a RoteToLabel node.
  *
  * IN LocalEnvironment: LocalEnvironment to be modified. 
  * Set this to OutputLocalEnvironment when calling this procedure
  * IN label:    label to be added to the list
  *
  *******************************************************************************/
	if LocalEnvironment.Destination.RouterList.DestinationData is null then
     set LocalEnvironment.Destination.RouterList.DestinationData."label" = newLabel;
  else
     create LASTCHILD OF LocalEnvironment.Destination.RouterList.DestinationData
     NAME 'label' VALUE newLabel; 
  end if;
END;
Related concepts
Message flows overview
LocalEnvironment tree structure
Related reference
Compute node
Data types for elements in the DestinationData subtree
CREATE PROCEDURE statement
SET statement
Notices | Trademarks | Downloads | Library | Support | Feedback

Copyright IBM Corporation 1999, 2007Copyright IBM Corporation 1999, 2007. All Rights Reserved.
This build: July 31, 2007 21:18:45

ac16862_ This topic's URL is: