Configure a client node
to dynamically use a port and hostname that are set in the local environment,
by the use of a message flow with MQInput, Compute, and TCPIPClientOutput nodes.
Scenario: A client node dynamically calls a port.
Instructions: The
following steps show how to override the connection details specified
on a client output node to dynamically use a port and hostname that
are set in the local environment:
- Create a message flow called TCPIP_Task16 with
an MQInput node, a Compute node, and a TCPIPClientOutput node. For more information, see Creating a message flow.
- Connect the Out terminal of the MQInput node to the In terminal
of the Compute node.
- Connect the Out terminal of the Compute node to the In terminal
of the TCPIPClientOutput node.
- On the MQInput node,
set the Queue name property
(on the Basic tab) to TCPIP.TASK16.IN1 .
- On the Compute node,
set the ESQL property (on
the Basic tab) to:
BROKER SCHEMA Tasks
CREATE COMPUTE MODULE TCPIP_Task16_Compute
CREATE FUNCTION Main() RETURNS BOOLEAN
BEGIN
-- CALL CopyMessageHeaders();
CALL CopyEntireMessage();
set InputLocalEnvironment.Destination.TCPIP.Output.Hostname = 'localhost';
set InputLocalEnvironment.Destination.TCPIP.Output.Port = 14156;
RETURN TRUE;
END;
CREATE PROCEDURE CopyMessageHeaders() BEGIN
DECLARE I INTEGER 1;
DECLARE J INTEGER;
SET J = CARDINALITY(InputRoot.*[]);
WHILE I < J DO
SET OutputRoot.*[I] = InputRoot.*[I];
SET I = I + 1;
END WHILE;
END;
CREATE PROCEDURE CopyEntireMessage() BEGIN
SET OutputRoot = InputRoot;
END;
END MODULE;
- On the TCPIPClientOutput node,
set the Connection details property
(on the Basic tab) to 9999.
- Save the message flow.