HTTP Writer
Sends a custom response to an HTTP Reader source when the source's Defer Response property is set to True. If HTTPWriter does not return a response before the Defer Response Timeout specified in HTTPReader, HTTPReader will respond with error 408 with the body, "Request timed out. Make sure that there is an HTTPWriter in the current application with property Mode set to RESPOND and HTTPWriter property RequestContextKey is mapped correctly, or set HTTPReader property DeferResponse to FALSE, or check Striim server log for details."
HTTP Writer properties
property | type | default value | notes |
|---|---|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
HTTP Writer sample application
You can download the following example TQL files as HTTPWriter.zip from https://github.com/striim/doc-downloads.
To see how this works, run striim/docs/HTTPWriter/HttpCacheResponseApp.tql, open a terminal or command prompt, and enter the following (if Striim is not running on your local system, change 127.0.0.1 to the IP address of the Striim server):
curl --location --request POST '127.0.0.1:8765' \ --header 'Content-Type: text/csv' \ --data-raw 'COMPANY 1'
That will return the cache entry for Company 1:
{
"BUSINESS_NAME":"COMPANY 1",
"MERCHANT_ID":"D6RJPwyuLXoLqQRQcOcouJ26KGxJSf6hgbu",
"PRIMARY_ACCOUNT_NUMBER":"6705362103919221351",
"POS_DATA_CODE":0,
"DATETIME":"2607-11-27T09:22:53.210-08:00",
"EXP_DATE":"0916",
"CURRENCY_CODE":"USD",
"AUTH_AMOUNT":2.2,
"TERMINAL_ID":"5150279519809946",
"ZIP":"41363",
"CITY":"Quicksand"
}
Then enter the following:
curl --location --request POST '127.0.0.1:8765' \ --header 'Content-Type: text/csv' \ --data-raw 'COMPANY 99'
Since there is no entry for Company 99 in the cache, that will return:
{
"MESSAGE":"Requested entry was not found in cache."
}See the comments in HttpCacheResponseApp.tql for more information.