Writing close connection details to a file

Configure a message flow to write details of a connection closure to a file, by the use of TCPIPServerInput, Compute, and FileOutput or FTEOutput nodes.

About this task

Scenario: A message flow writes close connection details to a file. The scenario uses the FileOutput node; the steps shown also apply to the FTEOutput node.

Instructions The following steps show how to configure a message flow to write details of the closure of any connection to a file:

Procedure

  1. Create a message flow called TCPIP_Task15 with a TCPIPServerInput node, a Compute node, and a FileOutput node.
    For more information, see Creating a message flow.
  2. Connect the Close terminal of the TCPIPServerInput node to the In terminal of the Compute node.
  3. Connect the Out terminal of the Compute node to the In terminal of the FileOutput node.
    Message flow consisting of TCPIPServerInput, Compute, and FileOutput nodes.
  4. On the TCPIPServerInput node, set the Connection details property (on the Basic tab) to 14155.
  5. On the Compute node, set the ESQL property (on the Basic tab) to:
    BROKER SCHEMA Tasks
    
    
    CREATE COMPUTE MODULE TCPIP_Task15_Compute
    	CREATE FUNCTION Main() RETURNS BOOLEAN
    	BEGIN
    		-- CALL CopyMessageHeaders();
    		-- CALL CopyEntireMessage();
    		Set OutputRoot.XMLNSC.CloseEvent = InputLocalEnvironment.TCPIP;
    		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;
  6. Set the following properties of the FileOutput node.
    1. On the Basic tab, set the following properties:
      • Set the Directory property to c:\temp\Task15.
      • Set the File name or pattern property to CloseEvents.txt.
    2. On the Records and elements tab, set the Record definition property to Record is unmodified data.
  7. Save the message flow.