SPL File HTTPParallelRequest.spl
Content
- Operators
-
- HTTPParallelRequest: The operator HTTPParallelRequest issues HTTP requests in parallel asynchronously from the input stream.
- Functions
-
- passThrough(rstring): This function passes the input string unchanged
- Types
-
- HTTPParallelRequest.HttpMethod: This type determines the kind of the http operation values are httpGet, httpPut, httpPost, httpDelete
Composites
composite HTTPParallelRequest(output Result, Error; input Request)
The operator HTTPParallelRequest issues HTTP requests in parallel asynchronously from the input stream. The operator opens on request up to maxConnections parallel http connections an sends the results downstream once the response is received. The operator has one input stream. The attributes of the input stream may define the kind and the parameters of the http operation like method, url, headers and data. When the response to an request is received, the result is passed in an output tuple of the Result port. If an http operation fails, the status information and the error is sent to the Result port and optionally to the Error port. The operator maintains a pool of up to maxConnections http connections. An incoming request is routed round-robin to one of the connections. If the connection is busy the request is queued. The length of the queues is determined with parameter queue. Finally the congestion policy of the queues is defined with parameter congestionPolicy.
Parameters
- method: This required parameter determines the kind of the http request. Type HttpMethod
- url: The request url. Required parameter.
- urlEncode: Defines the function to be used to prepare the url. Predefined values are function:com.teracloud.streams.inet.http::urlEncode(rstring) or passThrough. The user may define an own function for url-preprocessing. This function must have a signature *rstring myfunction(rstring)* If the function returns an empty string, no http request is performed and an error tuple is sent. Default is *urlEncode*
- data: The body of the operation. Default is the empty string.
- headers: http headers passes in the http request. Default is the empty list.
- contentTypeHeader: The content type header. If this header is not empty, it is appended to the headers list. Default is "ContentType: application/x-www-form-urlencoded"
- requestTimeout: This is the maximum time in seconds that you allow the transfer operation to take. Normally, name lookups can take a considerable time and limiting operations to less than a few minutes risk aborting perfectly normal operations. Default timeout is 5
- connectionTimeout: This is the maximum time in seconds that you allow the connection to the server to take. This only limits the connection phase, once it has connected, this option is of no more use. Default is 20 seconds
- width: The number of parallel used threads. This conforms to the maximum number if used http connections. Default is 8
- queue: The length of the input queue of each thread. Default 100
- congestionPolicy: The congestion policy of the input queue. Type Sys.CongestionPolicy. Default Sys.Wait
- user: This user name for authentication is passed to to the server. Ignored if empty.
- password: This password for authentication is passed to the server. Ignored if empty.
- certFile: Absolute path to a certificate file sent to the server. Ignored if empty.
- certType: The certification file type (PEM, P12). Ignored if empty.
- keyFile: Absolute path to a private key file to be sent to the server. Ignored if empty.
- keyType: The key file type (PEM, P12). Ignored if empty.
- keyPass: The password for the private key. Ignored if empty.
Input Ports
- Request: The request stream with attributes of the http request.
Output Ports
- Result: The result stream. One tuple is generated for each input tuple. The *Result* port must have at least the following attributes : *rstring body, list<rstring> headers, rstring message, int32 status, rstring url* where body is the response body, headers is the response header list, message is the error/success message, status is the error status of the operation, url is the encoded url. All other attributes are assigned from the input stream.
- Error: The optional error stream. One tuple indicates a failed http operation. The type is : *tuple<rstring url, rstring message, int32 status>*
Static Types
- HTTPParallelRequest.HttpMethod = enum { httpGet, httpPut, httpPost, httpDelete };
-
This type determines the kind of the http operation values are httpGet, httpPut, httpPost, httpDelete
Functions
rstring passThrough(rstring val)
This function passes the input string unchanged
Parameters
- val: the input string
Returns
- the unchanged input string