Skip to main content

HTTP & HTTPS

The http extension extension receives and publishes events via HTTP and HTTPS transports, calls external services, and serves incoming requests and provide synchronous responses.

Features

  • http (Sink)

    HTTP sink publishes messages via HTTP or HTTPS protocols using methods such as POST, GET, PUT, and DELETE on formats text, XML and JSON. It can also publish to endpoints protected by basic authentication or OAuth 2.0.

  • http-call (Sink)

    The http-call sink publishes messages to endpoints via HTTP or HTTPS protocols using methods such as POST, GET, PUT, and DELETE on formats text, XML or JSON and consume responses through its corresponding http-call-response source. It also supports calling endpoints protected with basic authentication or OAuth 2.0.

  • http-service-response (Sink)

    The http-service-response sink send responses of the requests consumed by its corresponding http-service source, by mapping the response messages to formats such as text, XML and JSON.

  • http (Source)

    HTTP source receives POST requests via HTTP and HTTPS protocols in format such as text, XML and JSON. It also supports basic authentication to ensure events are received from authorized users/systems. The request headers and properties can be accessed via transport properties in the format trp:<header>.

  • http-call-response (Source)

    The http-call-response source receives the responses for the calls made by its corresponding http-call sink, and maps them from formats such as text, XML and JSON.

    To handle messages with different http status codes having different formats, multiple http-call-response sources are allowed to associate with a single http-call sink.

    It allows accessing the attributes of the event that initiated the call, and the response headers and properties via transport properties in the format trp:<attribute name> and trp:<header/property> respectively.

  • http-service (Source)

    The http-service source receives POST requests via HTTP and HTTPS protocols in format such as text, XML and JSON and sends responses via its corresponding http-service-response sink correlated through a unique source.id.

    For request and response correlation, it generates a messageId upon each incoming request and expose it via transport properties in the format trp:messageId to correlate them with the responses at the http-service-response sink.

    The request headers and properties can be accessed via transport properties in the format trp:<header>.

    It also supports basic authentication to ensure events are received from authorized users/systems.

Sink

http (Sink)

HTTP sink publishes messages via HTTP or HTTPS protocols using methods such as POST, GET, PUT, and DELETE on formats text, XML and JSON. It can also publish to endpoints protected by basic authentication or OAuth 2.0.

Syntax:

    CREATE SINK <name> WITH (type="http", publisher.url="<STRING>", basic.auth.username="<STRING>", basic.auth.password="<STRING>", https.truststore.file="<STRING>", https.truststore.password="<STRING>", oauth.username="<STRING>", oauth.password="<STRING>", consumer.key="<STRING>", consumer.secret="<STRING>", token.url="<STRING>", refresh.token="<STRING>", headers="<STRING>", method="<STRING>", socket.idle.timeout="<INT>", chunk.disabled="<BOOL>", ssl.protocol="<STRING>", ssl.verification.disabled="<BOOL>", tls.store.type="<STRING>", ssl.configurations="<STRING>", proxy.host="<STRING>", proxy.port="<STRING>", proxy.username="<STRING>", proxy.password="<STRING>", client.bootstrap.configurations="<STRING>", max.pool.active.connections="<INT>", min.pool.idle.connections="<INT>", max.pool.idle.connections="<INT>", min.evictable.idle.time="<STRING>", time.between.eviction.runs="<STRING>", max.wait.time="<STRING>", test.on.borrow="<BOOL>", test.while.idle="<BOOL>", exhausted.action="<INT>", hostname.verification.enabled="<BOOL>", map.type="<STRING>")

QUERY PARAMETERS

NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
publisher.urlThe URL to which the outgoing events should be published.
Examples:
http://localhost:8080/endpoint,
https://localhost:8080/endpoint
STRINGNoNo
basic.auth.usernameThe username to be included in the authentication header when calling endpoints protected by basic authentication. basic.auth.password property should be also set when using this property.STRINGYesNo
basic.auth.passwordThe password to be included in the authentication header when calling endpoints protected by basic authentication. basic.auth.username property should be also set when using this property.STRINGYesNo
https.truststore.fileThe file path of the client truststore when sending messages through https protocol.${cep.home}/resources/security/client-truststore.jksSTRINGYesNo
https.truststore.passwordThe password for the client-truststore.macrometaSTRINGYesNo
oauth.usernameThe username to be included in the authentication header when calling endpoints protected by OAuth 2.0. oauth.password property should be also set when using this property.STRINGYesNo
oauth.passwordThe password to be included in the authentication header when calling endpoints protected by OAuth 2.0. oauth.username property should be also set when using this property.STRINGYesNo
consumer.keyConsumer key used for calling endpoints protected by OAuth 2.0STRINGYesNo
consumer.secretConsumer secret used for calling endpoints protected by OAuth 2.0STRINGYesNo
token.urlToken URL to generate a new access tokens when calling endpoints protected by OAuth 2.0STRINGYesNo
refresh.tokenRefresh token used for generating new access tokens when calling endpoints protected by OAuth 2.0STRINGYesNo
headersHTTP request headers in format "'&lt;key&gt;:&lt;value&gt;','&lt;key&gt;:&lt;value&gt;'".
When Content-Type header is not provided the system derives the Content-Type based on the provided sink mapper as following:
 - @map(type='xml'): application/xml
 - @map(type='json'): application/json
 - @map(type='text'): plain/text
 - @map(type='keyvalue'): application/x-www-form-urlencoded
 - For all other cases system defaults to plain/text
Also the Content-Length header need not to be provided, as the system automatically defines it by calculating the size of the payload.
Content-Type and Content-Length headersSTRINGYesNo
methodThe HTTP method used for calling the endpoint.POSTSTRINGYesNo
socket.idle.timeoutSocket timeout in millis.6000INTYesNo
ssl.protocolSSL/TLS protocol.TLSSTRINGYesNo
ssl.verification.disabledDisable SSL verification.falseBOOLYesNo
ssl.configurationsSSL/TSL configurations in format "'&lt;key&gt;:&lt;value&gt;','&lt;key&gt;:&lt;value&gt;'".
Some supported parameters:
 - SSL/TLS protocols: 'sslEnabledProtocols:TLSv1.1,TLSv1.2'
 - List of ciphers: 'ciphers:TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256'
 - Enable session creation: 'client.enable.session.creation:true'
 - Supported server names: 'server.suported.server.names:server'
 - Add HTTP SNIMatcher: `'server.supported.snimatchers:SNIMatcher'
STRINGYesNo
proxy.hostProxy server hostSTRINGYesNo
proxy.portProxy server portSTRINGYesNo
proxy.usernameProxy server usernameSTRINGYesNo
proxy.passwordProxy server passwordSTRINGYesNo
client.bootstrap.configurationsClient bootstrap configurations in format "'&lt;key&gt;:&lt;value&gt;','&lt;key&gt;:&lt;value&gt;'".
Some supported configurations :
 - Client connect timeout in millis: 'client.bootstrap.connect.timeout:15000'
 - Client socket timeout in seconds: 'client.bootstrap.socket.timeout:15'
 - Client socket reuse: 'client.bootstrap.socket.reuse:true'
 - Enable TCP no delay: 'client.bootstrap.nodelay:true'
 - Enable client keep alive: 'client.bootstrap.keepalive:true'
 - Send buffer size: 'client.bootstrap.sendbuffersize:1048576'
 - Receive buffer size: 'client.bootstrap.recievebuffersize:1048576'
STRINGYesNo
max.pool.active.connectionsMaximum possible number of active connection per client pool.INTYesNo
min.pool.idle.connectionsMinimum possible number of idle connections that can exist per client pool.INTYesNo
max.pool.idle.connectionsMaximum possible number of idle connections that can exist per client pool.INTYesNo
min.evictable.idle.timeMinimum time (in millis) a connection may sit idle in the client pool before it become eligible for eviction.300000STRINGYesNo
time.between.eviction.runsTime between two eviction operations (in millis) on the client pool.300000STRINGYesNo
max.wait.timeThe maximum time (in millis) the pool will wait (when there are no available connections) for a connection to be returned to the pool.600000STRINGYesNo
test.on.borrowEnable connections to be validated before being borrowed from the client pool.trueBOOLYesNo
test.while.idleEnable connections to be validated during the eviction operation (if any).trueBOOLYesNo
exhausted.actionAction that should be taken when the maximum number of active connections are being used. This action should be indicated as an int and possible action values are following.
0 - Fail the request.
1 - Block the request, until a connection returns to the pool.
2 - Grow the connection pool size.
INTYesNo
hostname.verification.enabledEnable hostname verification.trueBOOLYesNo

SYSTEM PARAMETERS:

NameDescriptionDefault ValuePossible Parameters
clientBootstrapClientGroupSizeNumber of client threads to perform non-blocking read and write to one or more channels.(Number of available processors) * 2Any positive integer
clientBootstrapBossGroupSizeNumber of boss threads to accept incoming connections.Number of available processorsAny positive integer
clientBootstrapWorkerGroupSizeNumber of worker threads to accept the connections from boss threads and perform non-blocking read and write from one or more channels.(Number of available processors) * 2Any positive integer
trustStoreLocationThe default truststore file path.`${cep.home}/resources/security/client-truststore.jksPath to client truststore .jks file
trustStorePasswordThe default truststore password.macrometaTruststore password as string

EXAMPLE:1

CREATE SINK StockStream WITH (type = 'http', publisher.url = 'http://stocks.com/stocks', map.type = 'json') (symbol string, price float, volume long);

Events arriving on the StockStream will be published to the HTTP endpoint http://stocks.com/stocks using POST method with Content-Type application/json by converting those events to the default JSON format as following:

  "event": {
"symbol": "FB",
"price": 24.5,
"volume": 5000
}

EXAMPLE:2

CREATE SINK FooStream WITH (type='http', publisher.url = 'http://localhost:8009/foo', client.bootstrap.configurations = "'client.bootstrap.socket.timeout:20'", max.pool.active.connections = '1', headers = "{{headers}}", map.type='xml', map.payload="""<stock>{{payloadBody}}</stock>""") (payloadBody String, headers string);

Events arriving on FooStream will be published to the HTTP endpoint http://localhost:8009/foo using POST method with Content-Type application/xml and setting payloadBody and header attribute values.

If the payloadBody contains

<symbol>WSO2</symbol>
<price>55.6</price>
<volume>100</volume>

and header contains 'topic:foobar' values, then the system will generate an output with the body:

<stock>
<symbol>WSO2</symbol>
<price>55.6</price>
<volume>100</volume>
</stock>

and HTTP headers:

Content-Length:xxx,
Content-Location:'xxx',
Content-Type:'application/xml',
HTTP_METHOD:'POST'

http-call (Sink)

The http-call sink publishes messages to endpoints via HTTP or HTTPS protocols using methods such as POST, GET, PUT, and DELETE on formats text, XML or JSON and consume responses through its corresponding http-call-response source. It also supports calling endpoints protected with basic authentication or OAuth 2.0.

Syntax:

CREATE SINK <name> WITH (type="http-call", publisher.url="<STRING>", sink.id="<STRING>", basic.auth.username="<STRING>", basic.auth.password="<STRING>", https.truststore.file="<STRING>", https.truststore.password="<STRING>", oauth.username="<STRING>", oauth.password="<STRING>", consumer.key="<STRING>", consumer.secret="<STRING>", token.url="<STRING>", refresh.token="<STRING>", headers="<STRING>", method="<STRING>", downloading.enabled="<BOOL>", download.path="<STRING>", blocking.io="<BOOL>", socket.idle.timeout="<INT>", chunk.disabled="<BOOL>", ssl.protocol="<STRING>", ssl.verification.disabled="<BOOL>", ssl.configurations="<STRING>", proxy.host="<STRING>", proxy.port="<STRING>", proxy.username="<STRING>", proxy.password="<STRING>", client.bootstrap.configurations="<STRING>", max.pool.active.connections="<INT>", min.pool.idle.connections="<INT>", max.pool.idle.connections="<INT>", min.evictable.idle.time="<STRING>", time.between.eviction.runs="<STRING>", max.wait.time="<STRING>", test.on.borrow="<BOOL>", test.while.idle="<BOOL>", exhausted.action="<INT>", hostname.verification.enabled="<BOOL>", map.type="<STRING>")

QUERY PARAMETERS:

NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
publisher.url

The URL which should be called.
Examples:
`http://localhost:8080/endpoint`,
`https://localhost:8080/endpoint`

STRINGNoNo
sink.id

Identifier to correlate the http-call sink to its corresponding http-call-response sources to retrieved the responses.

STRINGNoNo
basic.auth.username

The username to be included in the authentication header when calling endpoints protected by basic authentication. `basic.auth.password` property should be also set when using this property.

-STRINGYesNo
basic.auth.password

The password to be included in the authentication header when calling endpoints protected by basic authentication. `basic.auth.username` property should be also set when using this property.

-STRINGYesNo
https.truststore.file

The file path of the client truststore when sending messages through `https` protocol.

`$/resources/security/client-truststore.jks`STRINGYesNo
https.truststore.password

The password for the client-truststore.

macrometaSTRINGYesNo
oauth.username

The username to be included in the authentication header when calling endpoints protected by OAuth 2.0. `oauth.password` property should be also set when using this property.

-STRINGYesNo
oauth.password

The password to be included in the authentication header when calling endpoints protected by OAuth 2.0. `oauth.username` property should be also set when using this property.

-STRINGYesNo
consumer.key

Consumer key used for calling endpoints protected by OAuth 2.0

-STRINGYesNo
consumer.secret

Consumer secret used for calling endpoints protected by OAuth 2.0

-STRINGYesNo
token.url

Token URL to generate a new access tokens when calling endpoints protected by OAuth 2.0

-STRINGYesNo
refresh.token

Refresh token used for generating new access tokens when calling endpoints protected by OAuth 2.0

-STRINGYesNo
headers

HTTP request headers in format `"'<key>:<value>','<key>:<value>'"`.
When the `Content-Type` header is not provided the system decides the Content-Type based on the provided sink mapper as following:
 - `@map(type='xml')`: `application/xml`
 - `@map(type='json')`: `application/json`
 - `@map(type='text')`: `plain/text`
 - `@map(type='keyvalue')`: `application/x-www-form-urlencoded`
  - `@map(type='query')`: This Sink Mapper can be used to to send the payload as query parameters. In this case `Content-Type` header will not be set.
 - For all other cases system defaults to `plain/text`
Also the `Content-Length` header need not to be provided, as the system automatically defines it by calculating the size of the payload.

Content-Type and Content-Length headersSTRINGYesNo
method

The HTTP method used for calling the endpoint.

`POST`STRINGYesNo
downloading.enabled

Enable response received by the http-call-response source to be written to a file. When this is enabled the `download.path` property should be also set.

falseBOOLYesNo
download.path

The absolute file path along with the file name where the downloads should be saved.

-STRINGYesYes
blocking.io

Blocks the request thread until a response it received from HTTP call-response source before sending any other request.

falseBOOLYesNo
socket.idle.timeout

Socket timeout in millis.

6000INTYesNo
chunk.disabled

Disable chunked transfer encoding.

falseBOOLYesNo
ssl.protocol

SSL/TLS protocol.

TLSSTRINGYesNo
ssl.verification.disabled

Disable SSL verification.

falseBOOLYesNo
ssl.configurations

SSL/TSL configurations.
Expected format `"'<key>:<value>','<key>:<value>'"`.
Some supported parameters:
 - SSL/TLS protocols: `'sslEnabledProtocols:TLSv1.1,TLSv1.2'`
 - List of ciphers: `'ciphers:TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256'`
 - Enable session creation: `'client.enable.session.creation:true'`
 - Supported server names: `'server.suported.server.names:server'`
 - Add HTTP SNIMatcher: `'server.supported.snimatchers:SNIMatcher'`

-STRINGYesNo
proxy.host

Proxy server host

-STRINGYesNo
proxy.port

Proxy server port

-STRINGYesNo
proxy.username

Proxy server username

-STRINGYesNo
proxy.password

Proxy server password

-STRINGYesNo
client.bootstrap.configurations

Client bootstrap configurations in format `"'<key>:<value>','<key>:<value>'"`.
Some supported configurations :
 - Client connect timeout in millis: `'client.bootstrap.connect.timeout:15000'`
 - Client socket timeout in seconds: `'client.bootstrap.socket.timeout:15'`
 - Client socket reuse: `'client.bootstrap.socket.reuse:true'`
 - Enable TCP no delay: `'client.bootstrap.nodelay:true'`
 - Enable client keep alive: `'client.bootstrap.keepalive:true'`
 - Send buffer size: `'client.bootstrap.sendbuffersize:1048576'`
 - Receive buffer size: `'client.bootstrap.recievebuffersize:1048576'`

-STRINGYesNo
max.pool.active.connections

Maximum possible number of active connection per client pool.

-1INTYesNo
min.pool.idle.connections

Minimum number of idle connections that can exist per client pool.

0INTYesNo
max.pool.idle.connections

Maximum number of idle connections that can exist per client pool.

100INTYesNo
min.evictable.idle.time

Minimum time (in millis) a connection may sit idle in the client pool before it become eligible for eviction.

300000STRINGYesNo
time.between.eviction.runs

Time between two eviction operations (in millis) on the client pool.

30000STRINGYesNo
max.wait.time

The maximum time (in millis) the pool will wait (when there are no available connections) for a connection to be returned to the pool.

60000STRINGYesNo
test.on.borrow

Enable connections to be validated before being borrowed from the client pool.

trueBOOLYesNo
test.while.idle

Enable connections to be validated during the eviction operation (if any).

trueBOOLYesNo
exhausted.action

Action that should be taken when the maximum number of active connections are being used. This action should be indicated as an int and possible action values are following.
0 - Fail the request.
1 - Block the request, until a connection returns to the pool.
2 - Grow the connection pool size.

1 (Block when exhausted)INTYesNo
hostname.verification.enabled

Enable hostname verification

trueBOOLYesNo

SYSTEM PARAMETERS:

NameDescriptionDefault ValuePossible Parameters
clientBootstrapClientGroupSize

Number of client threads to perform non-blocking read and write to one or more channels.

(Number of available processors) * 2Any positive integer
clientBootstrapBossGroupSize

Number of boss threads to accept incoming connections.

Number of available processorsAny positive integer
clientBootstrapWorkerGroupSize

Number of worker threads to accept the connections from boss threads and perform non-blocking read and write from one or more channels.

(Number of available processors) * 2Any positive integer
trustStoreLocation

The default truststore file path.

`$/resources/security/client-truststore.jks`Path to client truststore `.jks` file
trustStorePassword

The default truststore password.

macrometaTruststore password as string

EXAMPLE 1:

    CREATE SINK FooStream WITH (type='http-call', sink.id='foo', publisher.url='http://localhost:8009/foo', map.type='xml', map.payload='{{payloadBody}}') (payloadBody string);

CREATE SOURCE ResponseStream WITH (type='http-call-response', sink.id='foo', map.type='text', regex.A='((.|\n)*)', map.attributes="headers='trp:headers'", message='A[1]') (message string, headers string);

When events arrive in FooStream, http-call sink makes calls to endpoint on url http://localhost:8009/foo with POST method and Content-Type application/xml.

If the event payloadBody attribute contains following XML:

<item>
<name>apple</name>
<price>55</price>
<quantity>5</quantity>
</item>

the http-call sink maps that and sends it to the endpoint.

When endpoint sends a response it will be consumed by the corresponding http-call-response source correlated via the same sink.id foo and that will map the response message and send it via ResponseStream steam by assigning the message body as message attribute and response headers as headers attribute of the event.

EXAMPLE 2:

    CREATE SINK DownloadRequestStream WITH (type='http-call', publisher.url='http://localhost:8005/files/{{name}}', downloading.enabled='true', download.path='{{downloadPath}}{{name}}', method='`GET`', sink.id='download', map.type='json') (name String, id int, downloadPath string);

CREATE SOURCE ResponseStream2xx WITH (type='http-call-response', sink.id='download', http.status.code='2\\d+', map.type='text', regex.A='((.|\n)*)', map.attributes="name='trp:name'", id='trp:id', file='A[1]') (name string, id string, file string);

CREATE SOURCE ResponseStream4xx WITH (type='http-call-response', sink.id='download', http.status.code='4\\d+', map.type='text', map.regex.A='((.|\n)*)', map.attributes="errorMsg='A[1]'") (errorMsg string);

When events arrive in DownloadRequestStream with name:foo.txt, id:75 and downloadPath:/user/download/ the http-call sink sends a GET request to the url http://localhost:8005/files/foo.txt to download the file to the given path /user/download/foo.txt and capture the response via its corresponding http-call-response source based on the response status code.

If the response status code is in the range of 200 the message will be received by the http-call-response source associated with the ResponseStream2xx stream which expects http.status.code with regex 2\\d+ while downloading the file to the local file system on the path /user/download/foo.txt and mapping the response message having the absolute file path to event's file attribute.

If the response status code is in the range of 400 then the message will be received by the http-call-response source associated with the ResponseStream4xx stream which expects http.status.code with regex 4\\d+ while mapping the error response to the errorMsg attribute of the event.

EXAMPLE 3:

    CREATE SINK FooStream WITH (type='http-call', method='GET', sink.id='foo', publisher.url='http://localhost:8009/foo', map.type='query', map.payload="'{{payloadBody}}'") (payloadBody string);

When events arrive in FooStream, http-call sink makes calls to endpoint on url http://localhost:8009/foo with GET method. The Content-Type will not be set. All the attributes in the payload will be sent to url as query parameters.

If the event payloadBody attribute contains following JSON:

{
"name": "apple",
"price": 55
}

the http-call sink maps that and sends it to the endpoint. The effective URL will be http://localhost:8009/foo?name=apple&price=55

http-service-response (Sink)

The http-service-response sink send responses of the requests consumed by its corresponding http-service source, by mapping the response messages to formats such as text, XML and JSON.

Syntax:

    CREATE SINK <name> WITH (type="http-service-response", source.id="<STRING>", message.id="<STRING>", headers="<STRING>", map.type="<STRING>")

QUERY PARAMETERS:

NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
source.id

Identifier to correlate the http-service-response sink to its corresponding http-service source which consumed the request.

STRINGNoNo
message.id

Identifier to correlate the response with the request received by http-service source.

STRINGNoYes
headers

HTTP request headers in format `"'<key>:<value>','<key>:<value>'"`.
When the `Content-Type` header is not provided the system decides the Content-Type based on the provided sink mapper as following:
 - `@map(type='xml')`: `application/xml`
 - `@map(type='json')`: `application/json`
 - `@map(type='text')`: `plain/text`
 - `@map(type='keyvalue')`: `application/x-www-form-urlencoded`
 - For all other cases system defaults to `plain/text`
Also the `Content-Length` header need not to be provided, as the system automatically defines it by calculating the size of the payload.

Content-Type and Content-Length headersSTRINGYesNo

EXAMPLE:1

    CREATE SOURCE AddStream WITH (type='http-service', receiver.url='http://localhost:5005/add', source.id='adder', map.type='json', map.attributes="messageId='trp:messageId', value1='$.event.value1', value2='$.event.value2'") (messageId string, value1 long, value2 long);

CREATE SINK ResultStream WITH (type='http-service-response', source.id='adder', message.id='{{messageId}}', map.type='json') (messageId string, results long);

@info(name = 'query1')
insert into ResultStream
select messageId, value1 + value2 as results
from AddStream ;

The http-service source on stream AddStream listens on url http://localhost:5005/stocks for JSON messages with format:

{
"event": {
"value1": 3,
"value2": 4
}
}

and when events arrive it maps to AddStream events and pass them to query query1 for processing. The query results produced on ResultStream are sent as a response via http-service-response sink with format:

{
"event": {
"results": 7
}
}

Here the request and response are correlated by passing the messageId produced by the http-service to the respective http-service-response sink.

Source

http (Source)

HTTP source receives POST requests via HTTP and HTTPS protocols in format such as text, XML and JSON. It also supports basic authentication to ensure events are received from authorized users/systems.

The request headers and properties can be accessed via transport properties in the format trp:&lt;header&gt;.

Syntax:

    CREATE SOURCE <name> WITH (type="http", receiver.url="<STRING>", basic.auth.enabled="<STRING>", worker.count="<INT>", socket.idle.timeout="<INT>", ssl.verify.client="<STRING>", ssl.protocol="<STRING>", tls.store.type="<STRING>", ssl.configurations="<STRING>", request.size.validation.configurations="<STRING>", header.validation.configurations="<STRING>", server.bootstrap.configurations="<STRING>", trace.log.enabled="<BOOL>", map.type="<STRING>")

QUERY PARAMETERS:

NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
receiver.url

The URL on which events should be received. To enable SSL use `https` protocol in the url.

`http://0.0.0.0:9763//`STRINGYesNo
basic.auth.enabled

This only works in VM, Docker and Kubernetes.
Where when enabled it authenticates each request using the `Authorization:'Basic encodeBase64(username:Password)'` header.

falseSTRINGYesNo
worker.count

The number of active worker threads to serve the incoming events. By default the value is set to `1` to ensure events are processed in the same order they arrived. By increasing this value, higher performance can be achieved in the expense of loosing event ordering.

1INTYesNo
socket.idle.timeout

Idle timeout for HTTP connection in millis.

120000INTYesNo
ssl.verify.client

The type of client certificate verification. Supported values are `require`, `optional`.

-STRINGYesNo
ssl.protocol

SSL/TLS protocol.

TLSSTRINGYesNo
tls.store.type

TLS store type.

JKSSTRINGYesNo
ssl.configurations

SSL/TSL configurations in format `"'<key>:<value>','<key>:<value>'"`.
Some supported parameters:
 - SSL/TLS protocols: `'sslEnabledProtocols:TLSv1.1,TLSv1.2'`
 - List of ciphers: `'ciphers:TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256'`
 - Enable session creation: `'client.enable.session.creation:true'`
 - Supported server names: `'server.suported.server.names:server'`
 - Add HTTP SNIMatcher: `'server.supported.snimatchers:SNIMatcher'`

-STRINGYesNo
request.size.validation.configurations

Configurations to validate the HTTP request size.
Expected format `"'<key>:<value>','<key>:<value>'"`.
Some supported configurations :
 - Enable request size validation: `'request.size.validation:true'`
 If request size is validated
 - Maximum request size: `'request.size.validation.maximum.value:2048'`
 - Response status code when request size validation fails: `'request.size.validation.reject.status.code:401'`
 - Response message when request size validation fails: `'request.size.validation.reject.message:Message is bigger than the valid size'`
 - Response Content-Type when request size validation fails: `'request.size.validation.reject.message.content.type:plain/text'`

-STRINGYesNo
header.validation.configurations

Configurations to validate HTTP headers.
Expected format `"'<key>:<value>','<key>:<value>'"`.
Some supported configurations :
 - Enable header size validation: `'header.size.validation:true'`
 If header size is validated
 - Maximum length of initial line: `'header.validation.maximum.request.line:4096'`
 - Maximum length of all headers: `'header.validation.maximum.size:8192'`
 - Maximum length of the content or each chunk: `'header.validation.maximum.chunk.size:8192'`
 - Response status code when header validation fails: `'header.validation.reject.status.code:401'`
 - Response message when header validation fails: `'header.validation.reject.message:Message header is bigger than the valid size'`
 - Response Content-Type when header validation fails: `'header.validation.reject.message.content.type:plain/text'`

-STRINGYesNo
server.bootstrap.configurations

Server bootstrap configurations in format `"'<key>:<value>','<key>:<value>'"`.
Some supported configurations :
 - Server connect timeout in millis: `'server.bootstrap.connect.timeout:15000'`
 - Server socket timeout in seconds: `'server.bootstrap.socket.timeout:15'`
 - Enable TCP no delay: `'server.bootstrap.nodelay:true'`
 - Enable server keep alive: `'server.bootstrap.keepalive:true'`
 - Send buffer size: `'server.bootstrap.sendbuffersize:1048576'`
 - Receive buffer size: `'server.bootstrap.recievebuffersize:1048576'`
 - Number of connections queued: `'server.bootstrap.socket.backlog:100'`

-STRINGYesNo
trace.log.enabled

Enable trace log for traffic monitoring.

falseBOOLYesNo

System Parameters:

NameDescriptionDefault ValuePossible Parameters
serverBootstrapBossGroupSize

Number of boss threads to accept incoming connections.

Number of available processorsAny positive integer
serverBootstrapWorkerGroupSize

Number of worker threads to accept the connections from boss threads and perform non-blocking read and write from one or more channels.

(Number of available processors) * 2Any positive integer
serverBootstrapClientGroupSize

Number of client threads to perform non-blocking read and write to one or more channels.

(Number of available processors) * 2Any positive integer
defaultHost

The default host of the transport.

0.0.0.0Any valid host
defaultScheme

The default protocol.

httphttp
https
defaultHttpPort

The default HTTP port when default scheme is `http`.

8280Any valid port
defaultHttpsPort

The default HTTPS port when default scheme is `https`.

8243Any valid port
keyStoreLocation

The default keystore file path.

`$/resources/security/macrometa.jks`Path to `.jks` file
keyStorePassword

The default keystore password.

macrometaKeystore password as string

EXAMPLE:1

    @app.name('StockProcessor')

CREATE SOURCE StockStream WITH (type='http', map.type='json') (symbol string, price float, volume long);

Above HTTP source listeners on url http://0.0.0.0:9763/StockProcessor/StockStream for JSON messages on the format:

{
"event": {
"symbol": "FB",
"price": 24.5,
"volume": 5000
}
}

It maps the incoming messages and sends them to StockStream for processing.

EXAMPLE:2

CREATE SOURCE StockStream WITH (type='http', receiver.url='http://localhost:5005/stocks', map.type = 'xml') (symbol string, price float, volume long);

Above HTTP source listeners on url http://localhost:5005/stocks for JSON messages on the format:

<events>
<event>
<symbol>Fb</symbol>
<price>55.6</price>
<volume>100</volume>
</event>
</events>

It maps the incoming messages and sends them to StockStream for processing.

http-call-response (Source)

The http-call-response source receives the responses for the calls made by its corresponding http-call sink, and maps them from formats such as text, XML and JSON.

To handle messages with different http status codes having different formats, multiple http-call-response sources are allowed to associate with a single http-call sink.

It allows accessing the attributes of the event that initiated the call, and the response headers and properties via transport properties in the format trp:&lt;attribute name&gt; and trp:&lt;header/property&gt; respectively.

Syntax:

CREATE SOURCE <name> WITH (type="http-call-response", sink.id="<STRING>", http.status.code="<STRING>", allow.streaming.responses="<BOOL>", map.type="<STRING>")

QUERY PARAMETERS:

NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
sink.id

Identifier to correlate the http-call-response source with its corresponding http-call sink that published the messages.

STRINGNoNo
http.status.code

The matching http responses status code regex, that is used to filter the the messages which will be processed by the source.Eg: `http.status.code = '200'`,
`http.status.code = '4\\d+'`

200STRINGYesNo
allow.streaming.responses

Enable consuming responses on a streaming manner.

falseBOOLYesNo

EXAMPLE:1

CREATE SINK EmployeeRequestStream WITH (type='http-call', method='`POST`', publisher.url='http://localhost:8005/registry/employee', sink.id='employee-info', map.type='json') (name string, id int);

CREATE SOURCE EmployeeResponseStream WITH (type='http-call-response', sink.id='employee-info', http.status.code='2\\d+', map.type='json', map.attributes="name='trp:name', id='trp:id', location='$.town', age='$.age'") (name string, id int, location string, age int);

CREATE SOURCE EmployeeErrorStream WITH (type='http-call-response', sink.id='employee-info', http.status.code='4\\d+', map.type='text', map.regex.A='((.|\n)*)', map.attributes="error='A[1]'") (error string);

When events arrive in EmployeeRequestStream, http-call sink makes calls to endpoint on url http://localhost:8005/registry/employee with POST method and Content-Type application/json.

If the arriving event has attributes name:John and id:1423 it will send a message with default JSON mapping as follows:

{
"event": {
"name": "John",
"id": 1423
}
}

When the endpoint responds with status code in the range of 200 the message will be received by the http-call-response source associated with the EmployeeResponseStream stream, because it is correlated with the sink by the same sink.id employee-info and as that expects messages with http.status.code in regex format 2\\d+. If the response message is in the format

{
"town": "NY",
"age": 24
}

the source maps the location and age attributes by executing JSON path on the message and maps the name and id attributes by extracting them from the request event via as transport properties.

If the response status code is in the range of 400 then the message will be received by the http-call-response source associated with the EmployeeErrorStream stream, because it is correlated with the sink by the same sink.id employee-info and it expects messages with http.status.code in regex format 4\\d+, and maps the error response to the error attribute of the event.

http-service (Source)

The http-service source receives POST requests via HTTP and HTTPS protocols in format such as text, XML and JSON and sends responses via its corresponding http-service-response sink correlated through a unique source.id.

For request and response correlation, it generates a messageId upon each incoming request and expose it via transport properties in the format trp:messageId to correlate them with the responses at the http-service-response sink.

The request headers and properties can be accessed via transport properties in the format trp:&lt;header&gt;.

It also supports basic authentication to ensure events are received from authorized users/systems.

Syntax:

    CREATE SOURCE <name> WITH (type="http-service", receiver.url="<STRING>", source.id="<STRING>", connection.timeout="<INT>", basic.auth.enabled="<STRING>", worker.count="<INT>", socket.idle.timeout="<INT>", ssl.verify.client="<STRING>", ssl.protocol="<STRING>", tls.store.type="<STRING>", ssl.configurations="<STRING>", request.size.validation.configurations="<STRING>", header.validation.configurations="<STRING>", server.bootstrap.configurations="<STRING>", trace.log.enabled="<BOOL>", map.type="<STRING>")

QUERY PARAMETERS:

NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
receiver.url

The URL on which events should be received. To enable SSL use `https` protocol in the url.

`http://0.0.0.0:9763//`STRINGYesNo
source.id

Identifier to correlate the http-service source to its corresponding http-service-response sinks to send responses.

STRINGNoNo
connection.timeout

Connection timeout in millis. The system will send a timeout, if a corresponding response is not sent by an associated http-service-response sink within the given time.

120000INTYesNo
basic.auth.enabled

This only works in VM, Docker and Kubernetes.
Where when enabled it authenticates each request using the `Authorization:'Basic encodeBase64(username:Password)'` header.

falseSTRINGYesNo
worker.count

The number of active worker threads to serve the incoming events. By default the value is set to `1` to ensure events are processed in the same order they arrived. By increasing this value, higher performance can be achieved in the expense of loosing event ordering.

1INTYesNo
socket.idle.timeout

Idle timeout for HTTP connection in millis.

120000INTYesNo
ssl.verify.client

The type of client certificate verification. Supported values are `require`, `optional`.

-STRINGYesNo
ssl.protocol

SSL/TLS protocol.

TLSSTRINGYesNo
tls.store.type

TLS store type.

JKSSTRINGYesNo
ssl.configurations

SSL/TSL configurations in format `"'<key>:<value>','<key>:<value>'"`.
Some supported parameters:
 - SSL/TLS protocols: `'sslEnabledProtocols:TLSv1.1,TLSv1.2'`
 - List of ciphers: `'ciphers:TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256'`
 - Enable session creation: `'client.enable.session.creation:true'`
 - Supported server names: `'server.suported.server.names:server'`
 - Add HTTP SNIMatcher: `'server.supported.snimatchers:SNIMatcher'`

-STRINGYesNo
request.size.validation.configurations

Configurations to validate the HTTP request size.
Expected format `"'<key>:<value>','<key>:<value>'"`.
Some supported configurations :
 - Enable request size validation: `'request.size.validation:true'`
 If request size is validated
 - Maximum request size: `'request.size.validation.maximum.value:2048'`
 - Response status code when request size validation fails: `'request.size.validation.reject.status.code:401'`
 - Response message when request size validation fails: `'request.size.validation.reject.message:Message is bigger than the valid size'`
 - Response Content-Type when request size validation fails: `'request.size.validation.reject.message.content.type:plain/text'`

-STRINGYesNo
header.validation.configurations

Configurations to validate HTTP headers.
Expected format `"'<key>:<value>','<key>:<value>'"`.
Some supported configurations :
 - Enable header size validation: `'header.size.validation:true'`
 If header size is validated
 - Maximum length of initial line: `'header.validation.maximum.request.line:4096'`
 - Maximum length of all headers: `'header.validation.maximum.size:8192'`
 - Maximum length of the content or each chunk: `'header.validation.maximum.chunk.size:8192'`
 - Response status code when header validation fails: `'header.validation.reject.status.code:401'`
 - Response message when header validation fails: `'header.validation.reject.message:Message header is bigger than the valid size'`
 - Response Content-Type when header validation fails: `'header.validation.reject.message.content.type:plain/text'`

-STRINGYesNo
server.bootstrap.configurations

Server bootstrap configurations in format `"'<key>:<value>','<key>:<value>'"`.
Some supported configurations :
 - Server connect timeout in millis: `'server.bootstrap.connect.timeout:15000'`
 - Server socket timeout in seconds: `'server.bootstrap.socket.timeout:15'`
 - Enable TCP no delay: `'server.bootstrap.nodelay:true'`
 - Enable server keep alive: `'server.bootstrap.keepalive:true'`
 - Send buffer size: `'server.bootstrap.sendbuffersize:1048576'`
 - Receive buffer size: `'server.bootstrap.recievebuffersize:1048576'`
 - Number of connections queued: `'server.bootstrap.socket.backlog:100'`

-STRINGYesNo
trace.log.enabled

Enable trace log for traffic monitoring.

falseBOOLYesNo

SYSTEM PARAMETERS:

NameDescriptionDefault ValuePossible Parameters
serverBootstrapBossGroupSize

Number of boss threads to accept incoming connections.

Number of available processorsAny positive integer
serverBootstrapWorkerGroupSize

Number of worker threads to accept the connections from boss threads and perform non-blocking read and write from one or more channels.

(Number of available processors) * 2Any positive integer
serverBootstrapClientGroupSize

Number of client threads to perform non-blocking read and write to one or more channels.

(Number of available processors) * 2Any positive integer
defaultHost

The default host of the transport.

0.0.0.0Any valid host
defaultScheme

The default protocol.

httphttp
https
defaultHttpPort

The default HTTP port when default scheme is `http`.

8280Any valid port
defaultHttpsPort

The default HTTPS port when default scheme is `https`.

8243Any valid port
keyStoreLocation

The default keystore file path.

`$/resources/security/macrometa.jks`Path to `.jks` file
keyStorePassword

The default keystore password.

macrometaKeystore password as string

EXAMPLE:1

    CREATE SOURCE AddStream WITH (type='http-service', receiver.url='http://localhost:5005/add', source.id='adder', map.type='json', map.attributes="messageId='trp:messageId', value1='$.event.value1', value2='$.event.value2'") (messageId string, value1 long, value2 long);

CREATE SINK ResultStream WITH (type='http-service-response', source.id='adder', message.id='{{messageId}}', map.type = 'json') (messageId string, results long);

@info(name = 'query1')
insert into ResultStream
select messageId, value1 + value2 as results
from AddStream;

Above sample listens events on http://localhost:5005/stocks url for JSON messages on the format:

    {
"event": {
"value1": 3,
"value2": 4
}
}

Map the vents into AddStream, process the events through query query1, and sends the results produced on ResultStream via http-service-response sink on the message format:

    {
"event": {
"results": 7
}
}