Tuesday, 6 May 2014

Working with HTTPNodes

Create Consumer and Provider Flows like
Consumer Flow:-
Properties  On Each Node of Consumer flow are given below
CSV_IN
Passing_Dept_Salary

esql in ComputeNode:-
CREATE COMPUTE MODULE Consumer_flow_Compute
      CREATE FUNCTION Main() RETURNS BOOLEAN
      BEGIN

            DECLARE DEPT CHARACTER;
            DECLARE SAL INTEGER;
           
            SET DEPT=InputRoot.MRM.DEPT;
            SET SAL=InputRoot.MRM.SAL;
     
            SET OutputLocalEnvironment.Destination.HTTP.QueryString.key =DEPT;
            SET OutputLocalEnvironment.Destination.HTTP.QueryString.key1 =SAL;
           
            SET OutputLocalEnvironment.Destination.HTTP.RequestURL='http://localhost:7080/getQueryString?';
                 
            RETURN TRUE;
      END;

END MODULE;

Request_Details
Just give a sample url to supress error at node like http://test.com


Result_Details
Provider Flow:-

Properties  On Each Node of Provider  flow are given below

Take_Dept_Salary
Retrieve_Details

esql in ComputeNode:-

CREATE COMPUTE MODULE Provider_flow_Compute
      CREATE FUNCTION Main() RETURNS BOOLEAN
      BEGIN

            DECLARE Dept_Sal_Location,SPLIT,DEPT CHARACTER;
            DECLARE SAL INTEGER;
            SET Dept_Sal_Location=InputRoot.HTTPInputHeader.[10];   
           
            SET SPLIT=SUBSTRING(Dept_Sal_Location AFTER '=');
            SET DEPT =SUBSTRING(SPLIT BEFORE '&');
            SET SAL  =SUBSTRING(SPLIT AFTER  '=');
           
      SET OutputRoot.XMLNSC.Employee.Details[]=PASSTHRU('SELECT * FROM mdeai.EMPLOYEE WHERE DEPT=? AND SALARY>?' TO Database.EmpTestDSN VALUES(DEPT,SAL));
                             
            RETURN TRUE;
      END;

END MODULE;


Provide_Respone

Input Message:-
EAI,10000

Create Message set for the Input Message with below details

DataBase records in the table

Tree Structure created with DataBase Details upon successful process

Message in Output Queue upon successful transaction is completed