Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

A workflow containing a TCP/IP collection agent can be set up to send responses back to the source from which the incoming data was received. This requires an APL agent (Analysis or Aggregation) to be part of the workflow.

...


Number of ConnectionsDescription

Single Connection

bytearray is sent back as reply.

Multiple Connections

A UDR, extended with the built-in TCPIPUDR format. The reply message must be inserted in the response field (a bytearray).


Note
titleNote!

To keep the example as simple as possible, the valid records are not processed. Usually, no reply is sent back until the UDRs are fully validated and processed. The example aims to focus on the response handling only.

Single TCP/IP Connection

Disabling the Allow Multiple Connections option in the TCP/IP Collection agent, will allow only one TCP/IP session at a time. If another attempt to create a connection is made while a connection already exists, the new connection will be rejected.

The TCP/IP Collection Agent

 In order to be able to send reply messages,  Send Response  must be enabled in the configuration window of the agent. Drop an Analysis agent in the workflow and connect it to the TCP/IP agent. Drag and release in the opposite direction to create a response route in the workflow.

...

TCP/IP agent configuration

The Analysis Agent

The Analysis agent handles both the validation of the incoming records, as well as sending the response. If the field duration is less than or equal to zero, the UDR is discarded and the field anum, in form of a bytearray, is sent back as response. All other UDRs are routed to the next agent in turn, and instead a sequence number is sent as response.

...

Code Block
languagetext
themeEclipse
int seqNum;
synchronized int createSeqNum() {
  seqNum = seqNum + 1;
  return seqNum;
}

consume { 
    bytearray reply; 


    if ( input.duration <= 0 ) {
      strToBA( reply, input.anum );
      udrRoute( reply, "response" ); 
    } else { 
      strToBA( reply, (string)createSeqNum() );
      udrRoute( reply, "response" ); 
      udrRoute( input, "UDRs" ); 
    }
}

Multiple TCP/IP Connections

Enabling the Allow Multiple Connections option in the TCP/IP Collection agent, will allow several simultaneous TCP/IP sessions at a time. If an attempt to open a new connection is made when the maximum number of connections are already open, the new connection will be refused.

The TCP/IP Collection Agent

In order to be able to send reply messages,  Send Response must be enabled in the configuration window of the agent. An additional connection point will appear on the agent, to which an Analysis agent is to be linked. Also, an Ultra format for the decoding of the incoming data must be defined. This format must contain the built-in TCPIP format. See the section below.

...

TCP/IP agent configuration

The Format Definition

The incoming external format must be extended with the TCPIPUDR format. 

Code Block
languagetext
themeEclipse
external asciiSEQ_ext sequential { 
    ascii callId: terminated_by(":"); 
    int seqNum: terminated_by(","); 
    ascii anum: terminated_by(","); 
    ascii bnum: terminated_by(","); 
    ascii causeForOutput: terminated_by(","); 
    int duration: terminated_by(0xA); 
};


internal TCP_Int : 
    extends_class( "com.digitalroute.wfc.tcpipcoll.TCPIPUDR" ) {
};


in_map TCP_InMap : 
    external( asciiSEQ_ext ), 
    internal( TCP_Int ), 
    target_internal( ascii_TCP_TI ) { 
    automatic;
};


out_map ascii_TCP_outMap : external( asciiSEQ_ext ), 
                           internal( ascii_TCP_TI ) { 
                              automatic; 
};


decoder TCPData : in_map( TCP_InMap );


encoder TCPData : out_map( ascii_TCP_outMap );

The Analysis Agent

The Analysis agent handles both the validation of the incoming records, as well as sending the response. If the field duration is less than or equal to zero, the UDR is discarded and the field anum is inserted into the response field, and the complete UDR is sent back as response. All other UDRs are routed to the next agent in turn and a sequence number is inserted into the response field before any routing.

...

Code Block
languagetext
themeEclipse
int seqNum;
synchronized int createSeqNum() {
  seqNum = seqNum + 1; 
  return seqNum; 
}


consume { 
    bytearray reply;
    if ( input.duration <= 0 ) {
      strToBA( reply, input.anum ); 
      input.response = reply; 
      udrRoute( input, "response" ); 
    } else { 
      strToBA( reply, (string)createSeqNum() ); 
      input.response = reply; 
      udrRoute( input, "response" ); 
      udrRoute( input, "UDRs" ); 
    }
}


Scroll ignore
scroll-viewportfalse
scroll-pdftrue
scroll-officefalse
scroll-chmtrue
scroll-docbooktrue
scroll-eclipsehelptrue
scroll-epubtrue
scroll-htmlfalse


Next:


Scroll pagebreak