diff --git a/README.md b/README.md index d38067b2..1806b3e5 100644 --- a/README.md +++ b/README.md @@ -2,8 +2,8 @@ Siddhi IO HTTP ====================================== [![Jenkins Build Status](https://wso2.org/jenkins/job/siddhi/job/siddhi-io-http/badge/icon)](https://wso2.org/jenkins/job/siddhi/job/siddhi-io-http/) - [![GitHub (pre-)Release](https://img.shields.io/github/release/siddhi-io/siddhi-io-http/all.svg)](https://github.com/siddhi-io/siddhi-io-http/releases) - [![GitHub (Pre-)Release Date](https://img.shields.io/github/release-date-pre/siddhi-io/siddhi-io-http.svg)](https://github.com/siddhi-io/siddhi-io-http/releases) + [![GitHub Release](https://img.shields.io/github/release/siddhi-io/siddhi-io-http.svg)](https://github.com/siddhi-io/siddhi-io-http/releases) + [![GitHub Release Date](https://img.shields.io/github/release-date/siddhi-io/siddhi-io-http.svg)](https://github.com/siddhi-io/siddhi-io-http/releases) [![GitHub Open Issues](https://img.shields.io/github/issues-raw/siddhi-io/siddhi-io-http.svg)](https://github.com/siddhi-io/siddhi-io-http/issues) [![GitHub Last Commit](https://img.shields.io/github/last-commit/siddhi-io/siddhi-io-http.svg)](https://github.com/siddhi-io/siddhi-io-http/commits/master) [![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0) @@ -15,7 +15,7 @@ For information on Siddhi and i ## Download * Versions 2.x and above with group id `io.siddhi.extension.*` from here. -* Versions 1.x and lower with group id `org.wso2.extension.siddhi.*` from here. +* Versions 1.x and lower with group id `org.wso2.extension.siddhi.*` from here. ## Latest API Docs diff --git a/component/pom.xml b/component/pom.xml index 4ac357a5..0ae04789 100644 --- a/component/pom.xml +++ b/component/pom.xml @@ -18,7 +18,7 @@ siddhi-io-http-parent io.siddhi.extension.io.http - 2.0.9-SNAPSHOT + 2.1.0-SNAPSHOT ../pom.xml 4.0.0 diff --git a/component/src/main/java/io/siddhi/extension/io/http/sink/HttpCallSink.java b/component/src/main/java/io/siddhi/extension/io/http/sink/HttpCallSink.java new file mode 100644 index 00000000..747863d7 --- /dev/null +++ b/component/src/main/java/io/siddhi/extension/io/http/sink/HttpCallSink.java @@ -0,0 +1,725 @@ +/* + * Copyright (c) 2019, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. + * + * WSO2 Inc. licenses this file to you under the Apache License, + * Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package io.siddhi.extension.io.http.sink; + +import io.netty.buffer.ByteBuf; +import io.netty.buffer.Unpooled; +import io.netty.handler.codec.base64.Base64; +import io.netty.handler.codec.http.DefaultHttpRequest; +import io.netty.handler.codec.http.DefaultLastHttpContent; +import io.netty.handler.codec.http.HttpMethod; +import io.netty.handler.codec.http.HttpVersion; +import io.siddhi.annotation.Example; +import io.siddhi.annotation.Extension; +import io.siddhi.annotation.Parameter; +import io.siddhi.annotation.SystemParameter; +import io.siddhi.annotation.util.DataType; +import io.siddhi.core.config.SiddhiAppContext; +import io.siddhi.core.event.Event; +import io.siddhi.core.exception.ConnectionUnavailableException; +import io.siddhi.core.util.config.ConfigReader; +import io.siddhi.core.util.snapshot.state.State; +import io.siddhi.core.util.snapshot.state.StateFactory; +import io.siddhi.core.util.transport.DynamicOptions; +import io.siddhi.core.util.transport.Option; +import io.siddhi.core.util.transport.OptionHolder; +import io.siddhi.extension.io.http.sink.exception.HttpSinkAdaptorRuntimeException; +import io.siddhi.extension.io.http.sink.updatetoken.AccessTokenCache; +import io.siddhi.extension.io.http.sink.util.HttpSinkUtil; +import io.siddhi.extension.io.http.source.HttpResponseMessageListener; +import io.siddhi.extension.io.http.util.HttpConstants; +import io.siddhi.query.api.definition.Attribute; +import io.siddhi.query.api.definition.StreamDefinition; +import org.apache.log4j.Logger; +import org.wso2.carbon.messaging.Header; +import org.wso2.transport.http.netty.contract.Constants; +import org.wso2.transport.http.netty.contract.HttpResponseFuture; +import org.wso2.transport.http.netty.message.HttpCarbonMessage; + +import java.nio.charset.Charset; +import java.nio.charset.StandardCharsets; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.TimeUnit; + +import static io.siddhi.extension.io.http.util.HttpConstants.EMPTY_STRING; + + +/** + * {@code HttpCallSink} Handle the HTTP calling tasks. + */ +@Extension(name = "http-call", namespace = "sink", + description = "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.", + parameters = { + @Parameter( + name = "publisher.url", + description = "The URL which should be called.\n" + + "Examples:\n" + + "`http://localhost:8080/endpoint`,\n" + + "`https://localhost:8080/endpoint`", + type = {DataType.STRING}), + @Parameter( + name = "sink.id", + description = "Identifier to correlate the http-call sink to its corresponding " + + "http-call-response sources to retrieved the responses.", + type = {DataType.STRING}), + @Parameter( + name = "basic.auth.username", + description = "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.", + type = {DataType.STRING}, + optional = true, + defaultValue = "-"), + @Parameter( + name = "basic.auth.password", + description = "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.", + type = {DataType.STRING}, + optional = true, + defaultValue = "-"), + @Parameter( + name = "https.truststore.file", + description = "The file path of the client truststore when sending messages through `https`" + + " protocol.", + type = {DataType.STRING}, + optional = true, defaultValue = "`${carbon.home}/resources/security/client-truststore.jks`"), + @Parameter( + name = "https.truststore.password", + description = "The password for the client-truststore.", + type = {DataType.STRING}, + optional = true, + defaultValue = "wso2carbon"), + @Parameter( + name = "oauth.username", + description = "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.", + type = {DataType.STRING}, + optional = true, + defaultValue = "-"), + @Parameter( + name = "oauth.password", + description = "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.", + type = {DataType.STRING}, + optional = true, + defaultValue = "-"), + @Parameter( + name = "consumer.key", + description = "Consumer key used for calling endpoints protected by OAuth 2.0", + type = {DataType.STRING}, + optional = true, + defaultValue = "-"), + @Parameter( + name = "consumer.secret", + description = "Consumer secret used for calling endpoints protected by OAuth 2.0", + type = {DataType.STRING}, + optional = true, + defaultValue = "-"), + @Parameter( + name = "token.url", + description = "Token URL to generate a new access tokens " + + "when calling endpoints protected by OAuth 2.0", + type = {DataType.STRING}, + optional = true, + defaultValue = "-"), + @Parameter( + name = "refresh.token", + description = "Refresh token used for generating new access tokens " + + "when calling endpoints protected by OAuth 2.0", + type = {DataType.STRING}, + optional = true, + defaultValue = "-"), + @Parameter( + name = "headers", + description = "HTTP request headers in format `\"':',':'\"`.\n" + + "When the `Content-Type` header is not provided the system decides the " + + "Content-Type based on the provided sink mapper as following: \n" + + " - `@map(type='xml')`: `application/xml`\n" + + " - `@map(type='json')`: `application/json`\n" + + " - `@map(type='text')`: `plain/text`\n" + + " - `@map(type='keyvalue')`: `application/x-www-form-urlencoded`\n" + + " - For all other cases system defaults to `plain/text`\n" + + "Also the `Content-Length` header need not to be provided, as the system " + + "automatically defines it by calculating the size of the payload.", + type = {DataType.STRING}, + optional = true, + defaultValue = "Content-Type and Content-Length headers"), + @Parameter( + name = "method", + description = "The HTTP method used for calling the endpoint.", + type = {DataType.STRING}, + optional = true, + defaultValue = "POST"), + @Parameter( + name = "downloading.enabled", + description = "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.", + type = {DataType.BOOL}, + optional = true, + defaultValue = "false"), + @Parameter( + name = "download.path", + description = "The absolute file path along with the file name where the downloads should " + + "be saved.", + type = {DataType.STRING}, + optional = true, + defaultValue = "-", + dynamic = true), + @Parameter( + name = "blocking.io", + description = "Blocks the request thread until a response it received from HTTP " + + "call-response source before sending any other request.", + type = {DataType.BOOL}, + optional = true, + defaultValue = "false"), + @Parameter( + name = "socket.idle.timeout", + description = "Socket timeout in millis.", + type = {DataType.INT}, + optional = true, + defaultValue = "6000"), + @Parameter( + name = "chunk.disabled", + description = "Disable chunked transfer encoding.", + type = {DataType.BOOL}, + optional = true, + defaultValue = "false"), + @Parameter( + name = "ssl.protocol", + description = "SSL/TLS protocol.", + type = {DataType.STRING}, + optional = true, + defaultValue = "TLS"), + @Parameter( + name = "ssl.configurations", + description = "SSL/TSL configurations.\n" + + "Expected format `\"':',':'\"`.\n" + + "Some supported parameters:\n" + + " - SSL/TLS protocols: `'sslEnabledProtocols:TLSv1.1,TLSv1.2'`\n" + + " - List of ciphers: `'ciphers:TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256'`\n" + + " - Enable session creation: `'client.enable.session.creation:true'`\n" + + " - Supported server names: `'server.suported.server.names:server'`\n" + + " - Add HTTP SNIMatcher: `'server.supported.snimatchers:SNIMatcher'`", + type = {DataType.STRING}, + optional = true, + defaultValue = "-"), + @Parameter( + name = "proxy.host", + description = "Proxy server host", + type = {DataType.STRING}, + optional = true, + defaultValue = "-"), + @Parameter( + name = "proxy.port", + description = "Proxy server port", + type = {DataType.STRING}, + optional = true, + defaultValue = "-"), + @Parameter( + name = "proxy.username", + description = "Proxy server username", + type = {DataType.STRING}, + optional = true, + defaultValue = "-"), + @Parameter( + name = "proxy.password", + description = "Proxy server password", + type = {DataType.STRING}, + optional = true, + defaultValue = "-"), + @Parameter( + name = "client.bootstrap.configurations", + description = "Client bootstrap configurations in " + + "format `\"':',':'\"`.\n" + + "Some supported configurations :\n" + + " - Client connect timeout in millis: `'client.bootstrap.connect.timeout:15000'`\n" + + " - Client socket timeout in seconds: `'client.bootstrap.socket.timeout:15'`\n" + + " - Client socket reuse: `'client.bootstrap.socket.reuse:true'`\n" + + " - Enable TCP no delay: `'client.bootstrap.nodelay:true'`\n" + + " - Enable client keep alive: `'client.bootstrap.keepalive:true'`\n" + + " - Send buffer size: `'client.bootstrap.sendbuffersize:1048576'`\n" + + " - Receive buffer size: `'client.bootstrap.recievebuffersize:1048576'`", + type = {DataType.STRING}, + optional = true, + defaultValue = "-"), + @Parameter( + name = "max.pool.active.connections", + description = "Maximum possible number of active connection per client pool.", + type = {DataType.INT}, + optional = true, + defaultValue = "-1"), + @Parameter( + name = "min.pool.idle.connections", + description = "Minimum number of idle connections that can exist per client pool.", + type = {DataType.INT}, + optional = true, + defaultValue = "0"), + @Parameter( + name = "max.pool.idle.connections", + description = "Maximum number of idle connections that can exist per client pool.", + type = {DataType.INT}, + optional = true, + defaultValue = "100"), + @Parameter( + name = "min.evictable.idle.time", + description = "Minimum time (in millis) a connection may sit idle in the " + + "client pool before it become eligible for eviction.", + type = {DataType.STRING}, + optional = true, + defaultValue = "300000"), + @Parameter( + name = "time.between.eviction.runs", + description = "Time between two eviction operations (in millis) on the client pool.", + type = {DataType.STRING}, + optional = true, + defaultValue = "30000"), + @Parameter( + name = "max.wait.time", + description = "The maximum time (in millis) the pool will wait (when there are no " + + "available connections) for a connection to be returned to the pool.", + type = {DataType.STRING}, + optional = true, + defaultValue = "60000"), + @Parameter( + name = "test.on.borrow", + description = "Enable connections to be validated " + + "before being borrowed from the client pool.", + type = {DataType.BOOL}, + optional = true, + defaultValue = "true"), + @Parameter( + name = "test.while.idle", + description = "Enable connections to be validated during the eviction operation (if any).", + type = {DataType.BOOL}, + optional = true, + defaultValue = "true"), + @Parameter( + name = "exhausted.action", + description = "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.\n" + + "0 - Fail the request.\n" + + "1 - Block the request, until a connection returns to the " + + "pool.\n" + + "2 - Grow the connection pool size.", + type = {DataType.INT}, + optional = true, + defaultValue = "1 (Block when exhausted)"), + @Parameter( + name = "hostname.verification.enabled", + description = "Enable hostname verification", + type = {DataType.BOOL}, + optional = true, + defaultValue = "true"), + }, + examples = { + @Example(syntax = "" + + "@sink(type='http-call', sink.id='foo',\n" + + " publisher.url='http://localhost:8009/foo',\n" + + " @map(type='xml', @payload('{{payloadBody}}')))\n" + + "define stream FooStream (payloadBody string);\n" + + "\n" + + "@source(type='http-call-response', sink.id='foo',\n" + + " @map(type='text', regex.A='((.|\\n)*)',\n" + + " @attributes(headers='trp:headers', message='A[1]')))\n" + + "define stream ResponseStream(message string, headers string);", + description = "" + + "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`.\n" + + "If the event `payloadBody` attribute contains following XML:\n" + + "```\n" + + " apple\n" + + " 55\n" + + " 5\n" + + "```" + + "the http-call sink maps that and sends it to the endpoint.\n" + + "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(syntax = "" + + "@sink(type='http-call', publisher.url='http://localhost:8005/files/{{name}}'\n" + + " downloading.enabled='true', download.path='{{downloadPath}}{{name}}',\n" + + " method='GET', sink.id='download', @map(type='json'))\n" + + "define stream DownloadRequestStream(name String, id int, downloadPath string);\n" + + "\n" + + "@source(type='http-call-response', sink.id='download',\n" + + " http.status.code='2\\\\d+',\n" + + " @map(type='text', regex.A='((.|\\n)*)',\n" + + " @attributes(name='trp:name', id='trp:id', file='A[1]')))\n" + + "define stream ResponseStream2xx(name string, id string, file string);\n" + + "\n" + + "@source(type='http-call-response', sink.id='download',\n" + + " http.status.code='4\\\\d+',\n" + + " @map(type='text', regex.A='((.|\\n)*)', @attributes(errorMsg='A[1]')))\n" + + "define stream ResponseStream4xx(errorMsg string);", + description = "" + + "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.\n" + + "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.\n" + + "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." + )}, + systemParameter = { + @SystemParameter( + name = "clientBootstrapClientGroupSize", + description = "Number of client threads to perform non-blocking read and write to " + + "one or more channels.", + defaultValue = "(Number of available processors) * 2", + possibleParameters = "Any positive integer" + ), + @SystemParameter( + name = "clientBootstrapBossGroupSize", + description = "Number of boss threads to accept incoming connections.", + defaultValue = "Number of available processors", + possibleParameters = "Any positive integer" + ), + @SystemParameter( + name = "clientBootstrapWorkerGroupSize", + description = "Number of worker threads to accept the connections from boss threads and " + + "perform non-blocking read and write from one or more channels.", + defaultValue = "(Number of available processors) * 2", + possibleParameters = "Any positive integer" + ), + @SystemParameter( + name = "trustStoreLocation", + description = "The default truststore file path.", + defaultValue = "`${carbon.home}/resources/security/client-truststore.jks`", + possibleParameters = "Path to client truststore `.jks` file" + ), + @SystemParameter( + name = "trustStorePassword", + description = "The default truststore password.", + defaultValue = "wso2carbon", + possibleParameters = "Truststore password as string" + ) + } +) +public class HttpCallSink extends HttpSink { + + private static final Logger log = Logger.getLogger(HttpCallSink.class); + private String sinkId; + private boolean isDownloadEnabled; + private StreamDefinition outputStreamDefinition; + private Option downloadPath; + private Option publisherURLOption; + private String consumerKey; + private String consumerSecret; + private String authType; + private AccessTokenCache accessTokenCache = AccessTokenCache.getInstance(); + private String publisherURL; + private String tokenURL; + private boolean isBlockingIO; + private CountDownLatch responseLatch; + + @Override + protected StateFactory init(StreamDefinition outputStreamDefinition, OptionHolder optionHolder, + ConfigReader configReader, SiddhiAppContext siddhiAppContext) { + StateFactory stateFactory = super.init(outputStreamDefinition, optionHolder, configReader, siddhiAppContext); + this.outputStreamDefinition = outputStreamDefinition; + this.sinkId = optionHolder.validateAndGetStaticValue(HttpConstants.SINK_ID); + this.isDownloadEnabled = Boolean.parseBoolean(optionHolder.validateAndGetStaticValue(HttpConstants + .DOWNLOAD_ENABLED, HttpConstants.DEFAULT_DOWNLOAD_ENABLED_VALUE)); + if (isDownloadEnabled) { + this.downloadPath = optionHolder.validateAndGetOption(HttpConstants.DOWNLOAD_PATH); + } + this.tokenURL = optionHolder.validateAndGetStaticValue(HttpConstants.TOKEN_URL, EMPTY_STRING); + String userName = optionHolder.validateAndGetStaticValue(HttpConstants.RECEIVER_USERNAME, EMPTY_STRING); + String password = optionHolder.validateAndGetStaticValue(HttpConstants.RECEIVER_PASSWORD, EMPTY_STRING); + this.consumerKey = optionHolder.validateAndGetStaticValue(HttpConstants.CONSUMER_KEY, EMPTY_STRING); + this.consumerSecret = optionHolder.validateAndGetStaticValue(HttpConstants.CONSUMER_SECRET, EMPTY_STRING); + String oauthUsername = optionHolder.validateAndGetStaticValue(HttpConstants.RECEIVER_OAUTH_USERNAME, + EMPTY_STRING); + this.publisherURLOption = optionHolder.validateAndGetOption(HttpConstants.PUBLISHER_URL); + String oauthUserPassword = optionHolder.validateAndGetStaticValue(HttpConstants.RECEIVER_OAUTH_PASSWORD, + EMPTY_STRING); + if (!HttpConstants.EMPTY_STRING.equals(userName) && !HttpConstants.EMPTY_STRING.equals(password)) { + authType = HttpConstants.BASIC_AUTH; + } else if ((!HttpConstants.EMPTY_STRING.equals(consumerKey) + && !HttpConstants.EMPTY_STRING.equals(consumerSecret)) || + (!HttpConstants.EMPTY_STRING.equals(oauthUsername) + && !HttpConstants.EMPTY_STRING.equals(oauthUserPassword))) { + authType = HttpConstants.OAUTH; + } else { + authType = HttpConstants.NO_AUTH; + } + isBlockingIO = Boolean.parseBoolean( + optionHolder.validateAndGetStaticValue(HttpConstants.BLOCKING_IO, HttpConstants.FALSE)); + if (isBlockingIO) { + responseLatch = new CountDownLatch(1); + } + return stateFactory; + } + + /** + * This method will be called when events need to be published via this sink + * + * @param payload payload of the event based on the supported event class exported by the extensions + * @param dynamicOptions holds the dynamic options of this sink and Use this object to obtain dynamic options. + * @param state current state of the sink + * @throws ConnectionUnavailableException throw when connections are unavailable. + */ + @Override + public void publish(Object payload, DynamicOptions dynamicOptions, State state) + throws ConnectionUnavailableException { + //get the dynamic parameter + String headers = httpHeaderOption.getValue(dynamicOptions); + List
headersList = HttpSinkUtil.getHeaders(headers); + if (publisherURLOption.isStatic()) { + publisherURL = publisherURLOption.getValue(); + } else { + publisherURL = publisherURLOption.getValue(dynamicOptions); + } + + if (authType.equals(HttpConstants.BASIC_AUTH) || authType.equals(HttpConstants.NO_AUTH)) { + sendRequest(payload, dynamicOptions, headersList, HttpConstants.MAXIMUM_TRY_COUNT); + } else { + sendOauthRequest(payload, dynamicOptions, headersList); + } + } + + private void sendOauthRequest(Object payload, DynamicOptions dynamicOptions, List
headersList) { + //generate encoded base64 auth for getting refresh token + String consumerKeyValue = consumerKey + ":" + consumerSecret; + String encodedAuth = "Basic " + encodeBase64(consumerKeyValue); + //check the availability of access token in the header + setAccessToken(encodedAuth, dynamicOptions, headersList); + //send a request to API and get the response + int response = sendRequest(payload, dynamicOptions, headersList, HttpConstants.MINIMUM_TRY_COUNT); + //if authentication fails then get the new access token + if (response == HttpConstants.AUTHENTICATION_FAIL_CODE) { + handleOAuthFailure(payload, dynamicOptions, headersList, encodedAuth); + } else if (response == HttpConstants.SUCCESS_CODE) { + log.debug("Request sent successfully to " + publisherURL); + } else if (response == HttpConstants.INTERNAL_SERVER_FAIL_CODE) { + log.error("Error at sending oauth request to API endpoint " + publisherURL + "', with response code: " + + response + "- Internal server error. Message dropped."); + throw new HttpSinkAdaptorRuntimeException("Error at sending oauth request to API endpoint: " + + publisherURL + "', with response code: " + response + "- Internal server error. Message dropped."); + } else { + log.error("Error at sending oauth request to API endpoint: " + + publisherURL + "', with response code: " + response + ". Message dropped. Message dropped."); + throw new HttpSinkAdaptorRuntimeException("Error at sending oauth request to API endpoint: " + + publisherURL + "', with response code: " + response + ". Message dropped. Message dropped."); + } + } + + private void handleOAuthFailure(Object payload, DynamicOptions dynamicOptions, List
headersList, + String encodedAuth) { + + Boolean checkFromCache = accessTokenCache.checkAvailableKey(encodedAuth); + if (checkFromCache) { + getNewAccessTokenWithCache(payload, dynamicOptions, headersList, encodedAuth); + } else { + requestForNewAccessToken(payload, dynamicOptions, headersList, encodedAuth); + } + } + + private void getNewAccessTokenWithCache(Object payload, DynamicOptions dynamicOptions, List
headersList, + String encodedAuth) { + String accessToken = accessTokenCache.getAccessToken(encodedAuth); + for (Header header : headersList) { + if (header.getName().equals(HttpConstants.AUTHORIZATION_HEADER)) { + header.setValue(accessToken); + break; + } + } + //send a request to API with a new access token + int response = sendRequest(payload, dynamicOptions, headersList, HttpConstants.MINIMUM_TRY_COUNT); + if (response == HttpConstants.SUCCESS_CODE) { + log.debug("Request sent successfully to " + publisherURL); + } else if (response == HttpConstants.AUTHENTICATION_FAIL_CODE) { + requestForNewAccessToken(payload, dynamicOptions, headersList, encodedAuth); + } else if (response == HttpConstants.INTERNAL_SERVER_FAIL_CODE) { + log.error("Error at sending oauth request to API endpoint " + publisherURL + "', with response code: " + + response + "- Internal server error. Message dropped."); + throw new HttpSinkAdaptorRuntimeException("Error at sending oauth request to API endpoint " + + publisherURL + "', with response code: " + response + "- Internal server error. Message dropped."); + } else { + log.error("Error at sending oauth request to API endpoint " + publisherURL + "', with response code: " + + response + ". Message dropped. "); + throw new HttpSinkAdaptorRuntimeException("Error at sending oauth request to API endpoint " + + publisherURL + "', with response code: " + response + ". Message dropped."); + } + } + + private void requestForNewAccessToken(Object payload, DynamicOptions dynamicOptions, List
headersList, + String encodedAuth) { + Boolean checkRefreshToken = accessTokenCache.checkRefreshAvailableKey(encodedAuth); + if (checkRefreshToken) { + for (Header header : headersList) { + if (header.getName().equals(HttpConstants.RECEIVER_REFRESH_TOKEN)) { + if (accessTokenCache.getRefreshtoken(encodedAuth) != null) { + header.setValue(accessTokenCache.getRefreshtoken(encodedAuth)); + } + break; + } + } + } + getAccessToken(dynamicOptions, encodedAuth, tokenURL); + if (accessTokenCache.getResponseCode(encodedAuth) == HttpConstants.SUCCESS_CODE) { + String newAccessToken = accessTokenCache.getAccessToken(encodedAuth); + accessTokenCache.setAccessToken(encodedAuth, newAccessToken); + if (accessTokenCache.getRefreshtoken(encodedAuth) != null) { + accessTokenCache.setRefreshtoken(encodedAuth, accessTokenCache.getRefreshtoken(encodedAuth)); + } + for (Header header : headersList) { + if (header.getName().equals(HttpConstants.AUTHORIZATION_HEADER)) { + header.setValue(newAccessToken); + break; + } + } + //send a request to API with a new access token + int response = sendRequest(payload, dynamicOptions, headersList, HttpConstants.MAXIMUM_TRY_COUNT); + if (response == HttpConstants.SUCCESS_CODE) { + log.debug("Request sent successfully to " + publisherURL); + } else if (response == HttpConstants.AUTHENTICATION_FAIL_CODE) { + log.error("Error at sending oauth request to API endpoint " + publisherURL + "', with response code: " + + response + "- Authentication Failure. Please provide a valid Consumer key, Consumer secret" + + " and token endpoint URL . Message dropped"); + throw new HttpSinkAdaptorRuntimeException("Error at sending oauth request to API endpoint " + + publisherURL + "', with response code: " + response + "- Authentication Failure. Please" + + " provide a valid Consumer key, Consumer secret and token endpoint URL . Message dropped"); + } else if (response == HttpConstants.INTERNAL_SERVER_FAIL_CODE) { + log.error("Error at sending oauth request to API endpoint " + publisherURL + "', with response code: " + + response + "- Internal server error. Message dropped."); + throw new HttpSinkAdaptorRuntimeException("Error at sending oauth request to API endpoint " + + publisherURL + "', with response code:" + response + + "- Internal server error. Message dropped."); + } else { + log.error("Error at sending oauth request to API endpoint " + publisherURL + "', with response code: " + + response + ". Message dropped."); + throw new HttpSinkAdaptorRuntimeException("Error at sending oauth request to API endpoint " + + publisherURL + "', with response code: " + response + ". Message dropped."); + } + + } else if (accessTokenCache.getResponseCode(encodedAuth) == HttpConstants.AUTHENTICATION_FAIL_CODE) { + log.error("Failed to generate new access token for the expired access token to " + publisherURL + "', " + + accessTokenCache.getResponseCode(encodedAuth) + ": Authentication Failure. Please provide" + + " a valid Consumer key, Consumer secret and token endpoint URL . Message dropped"); + throw new HttpSinkAdaptorRuntimeException("Failed to generate new access token for the expired access " + + "token to " + publisherURL + "', " + accessTokenCache.getResponseCode(encodedAuth) + + ": Authentication Failure.Please provide a valid Consumer key, Consumer secret" + + " and token endpoint URL . Message dropped"); + } else { + log.error("Failed to generate new access token for the expired access token. Error code: " + + accessTokenCache.getResponseCode(encodedAuth) + ". Message dropped."); + throw new HttpSinkAdaptorRuntimeException("Failed to generate new access token for the expired" + + " access token. Error code: " + accessTokenCache.getResponseCode(encodedAuth) + + ". Message dropped."); + } + } + + private int sendRequest(Object payload, DynamicOptions dynamicOptions, List
headersList, int tryCount) { + if (!publisherURLOption.isStatic()) { + super.initClientConnector(dynamicOptions); + } + String httpMethod = EMPTY_STRING.equals(httpMethodOption.getValue(dynamicOptions)) ? + HttpConstants.METHOD_DEFAULT : httpMethodOption.getValue(dynamicOptions); + String contentType = HttpSinkUtil.getContentType(mapType, headersList); + String messageBody = getMessageBody(payload); + HttpMethod httpReqMethod = new HttpMethod(httpMethod); + HttpCarbonMessage cMessage = new HttpCarbonMessage( + new DefaultHttpRequest(HttpVersion.HTTP_1_1, httpReqMethod, EMPTY_STRING)); + cMessage = generateCarbonMessage(headersList, contentType, httpMethod, cMessage); + if (!Constants.HTTP_GET_METHOD.equals(httpMethod)) { + cMessage.addHttpContent(new DefaultLastHttpContent(Unpooled.wrappedBuffer(messageBody + .getBytes(Charset.defaultCharset())))); + } + cMessage.completeMessage(); + HttpResponseFuture httpResponseFuture = clientConnector.send(cMessage); + HttpResponseMessageListener httpListener; + CountDownLatch latch = isBlockingIO ? responseLatch : new CountDownLatch(1); + httpListener = new HttpResponseMessageListener(this, getTrpProperties(dynamicOptions), sinkId, + isDownloadEnabled, latch, tryCount, authType, isBlockingIO); + httpResponseFuture.setHttpConnectorListener(httpListener); + + if (isBlockingIO || HttpConstants.OAUTH.equals(authType)) { + try { + boolean latchCount = latch.await(30, TimeUnit.SECONDS); + if (!latchCount) { + log.debug("Time out due to getting getting response from " + publisherURL + ". Message dropped."); + throw new HttpSinkAdaptorRuntimeException("Time out due to getting getting response from " + + publisherURL + ". Message dropped."); + + } + } catch (InterruptedException e) { + log.debug("Failed to get a response from " + publisherURL + "," + e + ". Message dropped."); + throw new HttpSinkAdaptorRuntimeException("Failed to get a response from " + + publisherURL + ", " + e + ". Message dropped."); + } + if (isBlockingIO) { + responseLatch = new CountDownLatch(1); + return HttpConstants.SUCCESS_CODE; + } + HttpCarbonMessage response = httpListener.getHttpResponseMessage(); + return response.getNettyHttpResponse().status().code(); + } else { + return HttpConstants.SUCCESS_CODE; + } + } + + @Override + public String[] getSupportedDynamicOptions() { + return new String[]{HttpConstants.HEADERS, HttpConstants.METHOD, HttpConstants.PUBLISHER_URL, + HttpConstants.DOWNLOAD_PATH, HttpConstants.PUBLISHER_URL, HttpConstants.RECEIVER_REFRESH_TOKEN}; + } + + private Map getTrpProperties(DynamicOptions dynamicOptions) { + Event event = dynamicOptions.getEvent(); + Object[] data = event.getData(); + List attributes = outputStreamDefinition.getAttributeList(); + Map trpProperties = new HashMap<>(); + for (int i = 0; i < attributes.size(); i++) { + trpProperties.put(attributes.get(i).getName(), data[i]); + } + if (isDownloadEnabled) { + trpProperties.put(HttpConstants.DOWNLOAD_PATH, downloadPath.getValue(dynamicOptions)); + } + return trpProperties; + } + + private String encodeBase64(String consumerKeyValue) { + ByteBuf byteBuf = Unpooled.wrappedBuffer(consumerKeyValue.getBytes(StandardCharsets.UTF_8)); + ByteBuf encodedByteBuf = Base64.encode(byteBuf); + return encodedByteBuf.toString(StandardCharsets.UTF_8); + } +} diff --git a/component/src/main/java/io/siddhi/extension/io/http/sink/HttpRequestSink.java b/component/src/main/java/io/siddhi/extension/io/http/sink/HttpRequestSink.java index 5f11648c..3114829c 100644 --- a/component/src/main/java/io/siddhi/extension/io/http/sink/HttpRequestSink.java +++ b/component/src/main/java/io/siddhi/extension/io/http/sink/HttpRequestSink.java @@ -18,773 +18,386 @@ */ package io.siddhi.extension.io.http.sink; -import io.netty.buffer.ByteBuf; -import io.netty.buffer.Unpooled; -import io.netty.handler.codec.base64.Base64; -import io.netty.handler.codec.http.DefaultHttpRequest; -import io.netty.handler.codec.http.DefaultLastHttpContent; -import io.netty.handler.codec.http.HttpMethod; -import io.netty.handler.codec.http.HttpVersion; import io.siddhi.annotation.Example; import io.siddhi.annotation.Extension; import io.siddhi.annotation.Parameter; +import io.siddhi.annotation.SystemParameter; import io.siddhi.annotation.util.DataType; -import io.siddhi.core.config.SiddhiAppContext; -import io.siddhi.core.event.Event; -import io.siddhi.core.exception.ConnectionUnavailableException; -import io.siddhi.core.util.config.ConfigReader; -import io.siddhi.core.util.snapshot.state.State; -import io.siddhi.core.util.snapshot.state.StateFactory; -import io.siddhi.core.util.transport.DynamicOptions; -import io.siddhi.core.util.transport.Option; -import io.siddhi.core.util.transport.OptionHolder; -import io.siddhi.extension.io.http.sink.exception.HttpSinkAdaptorRuntimeException; -import io.siddhi.extension.io.http.sink.updatetoken.AccessTokenCache; -import io.siddhi.extension.io.http.sink.util.HttpSinkUtil; -import io.siddhi.extension.io.http.source.HttpResponseMessageListener; -import io.siddhi.extension.io.http.util.HttpConstants; -import io.siddhi.query.api.definition.Attribute; -import io.siddhi.query.api.definition.StreamDefinition; -import org.apache.log4j.Logger; -import org.wso2.carbon.messaging.Header; -import org.wso2.transport.http.netty.contract.Constants; -import org.wso2.transport.http.netty.contract.HttpResponseFuture; -import org.wso2.transport.http.netty.message.HttpCarbonMessage; - -import java.nio.charset.Charset; -import java.nio.charset.StandardCharsets; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.concurrent.CountDownLatch; -import java.util.concurrent.TimeUnit; - -import static io.siddhi.extension.io.http.util.HttpConstants.EMPTY_STRING; /** * {@code HttpRequestSink} Handle the HTTP publishing tasks. */ @Extension(name = "http-request", namespace = "sink", + deprecated = true, description = "" + - "This extension publish the HTTP events in any HTTP method POST, GET, PUT, DELETE via HTTP " + - "or https protocols. As the additional features this component can provide basic authentication " + - "as well as user can publish events using custom client truststore files when publishing events " + - "via https protocol. And also user can add any number of headers including HTTP_METHOD header for " + - "each event dynamically.\n" + - "Following content types will be set by default according to the type of sink mapper used.\n" + - "You can override them by setting the new content types in headers.\n" + - " - TEXT : text/plain\n" + - " - XML : application/xml\n" + - " - JSON : application/json\n" + - " - KEYVALUE : application/x-www-form-urlencoded\n\n" + - "HTTP request sink is correlated with the " + - "The HTTP reponse source, through a unique `sink.id`." + - "It sends the request to the defined url and the response is received by the response source " + - "which has the same 'sink.id'.", + "_(Use http-call sink instead)._\n" + + "The http-request 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-response source. It also supports " + + "calling endpoints protected with basic authentication or OAuth 2.0.", parameters = { @Parameter( name = "publisher.url", - description = "The URL to which the outgoing events should be published via HTTP. " + - "This is a mandatory parameter and if this is not specified, an error is logged in " + - "the CLI. If user wants to enable SSL for the events, use `https` instead of `http` " + - "in the publisher.url.\n" + - "e.g., " + - "`http://localhost:8080/endpoint`, " + - "`https://localhost:8080/endpoint`\n" + - "This can be used as a dynamic parameter as well.", - type = {DataType.STRING}, - dynamic = true), + description = "The URL which should be called.\n" + + "Examples:\n" + + "`http://localhost:8080/endpoint`,\n" + + "`https://localhost:8080/endpoint`", + type = {DataType.STRING}), + @Parameter( + name = "sink.id", + description = "Identifier to correlate the http-request sink to its corresponding " + + "http-response sources to retrieved the responses.", + type = {DataType.STRING}), @Parameter( name = "basic.auth.username", - description = "The username to be included in the authentication header of the basic " + - "authentication enabled events. It is required to specify both username and " + - "password to enable basic authentication. If one of the parameter is not given " + - "by user then an error is logged in the CLI.", + description = "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.", type = {DataType.STRING}, optional = true, - defaultValue = " "), + defaultValue = "-"), @Parameter( name = "basic.auth.password", - description = "The password to include in the authentication header of the basic " + - "authentication enabled events. It is required to specify both username and " + - "password to enable basic authentication. If one of the parameter is not given " + - "by user then an error is logged in the CLI.", + description = "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.", type = {DataType.STRING}, - optional = true, defaultValue = " "), + optional = true, + defaultValue = "-"), @Parameter( name = "https.truststore.file", - description = "The file path to the location of the truststore of the client that sends " + - "the HTTP events through 'https' protocol. A custom client-truststore can be " + - "specified if required.", + description = "The file path of the client truststore when sending messages through `https`" + + " protocol.", type = {DataType.STRING}, - optional = true, defaultValue = "${carbon.home}/resources/security/client-truststore.jks"), + optional = true, defaultValue = "`${carbon.home}/resources/security/client-truststore.jks`"), @Parameter( name = "https.truststore.password", - description = "The password for the client-truststore. A custom password can be specified " + - "if required. If no custom password is specified and the protocol of URL is 'https' " + - "then, the system uses default password.", + description = "The password for the client-truststore.", type = {DataType.STRING}, - optional = true, defaultValue = "wso2carbon"), + optional = true, + defaultValue = "wso2carbon"), @Parameter( - name = "headers", - description = "The headers that should be included as HTTP request headers. \n" + - "There can be any number of headers concatenated in following format. " + - "\"'header1:value1','header2:value2'\". User can include Content-Type header if he " + - "needs to use a specific content-type for the payload. Or else, system decides the " + - "Content-Type by considering the type of sink mapper, in following way.\n" + - " - @map(xml):application/xml\n" + - " - @map(json):application/json\n" + - " - @map(text):plain/text )\n" + - " - if user does not include any mapping type then the system gets 'plain/text' " + - "as default Content-Type header.\n" + - "Note that providing content-length as a header is not supported. The size of the " + - "payload will be automatically calculated and included in the content-length header.", + name = "oauth.username", + description = "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.", type = {DataType.STRING}, optional = true, - defaultValue = " "), + defaultValue = "-"), @Parameter( - name = "method", - description = "For HTTP events, HTTP_METHOD header should be included as a request header." + - " If the parameter is null then system uses 'POST' as a default header.", + name = "oauth.password", + description = "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.", type = {DataType.STRING}, optional = true, - defaultValue = "POST"), - + defaultValue = "-"), @Parameter( - name = "socket.idle.timeout", - description = "Socket timeout value in millisecond", - type = {DataType.INT}, + name = "consumer.key", + description = "Consumer key used for calling endpoints protected by OAuth 2.0", + type = {DataType.STRING}, optional = true, - defaultValue = "6000"), + defaultValue = "-"), @Parameter( - name = "chunk.disabled", - description = "port: Port number of the remote service", - type = {DataType.BOOL}, + name = "consumer.secret", + description = "Consumer secret used for calling endpoints protected by OAuth 2.0", + type = {DataType.STRING}, optional = true, - defaultValue = "false"), + defaultValue = "-"), @Parameter( - name = "ssl.protocol", - description = "The SSL protocol version", + name = "token.url", + description = "Token URL to generate a new access tokens " + + "when calling endpoints protected by OAuth 2.0", type = {DataType.STRING}, optional = true, - defaultValue = "TLS"), + defaultValue = "-"), @Parameter( - name = "parameters", - description = "Parameters other than basics such as ciphers,sslEnabledProtocols,client.enable" + - ".session.creation. Expected format of these parameters is as follows: " + - "\"'ciphers:xxx','sslEnabledProtocols,client.enable:xxx'\"", + name = "refresh.token", + description = "Refresh token used for generating new access tokens " + + "when calling endpoints protected by OAuth 2.0", type = {DataType.STRING}, optional = true, - defaultValue = "null"), + defaultValue = "-"), @Parameter( - name = "ciphers", - description = "List of ciphers to be used. This parameter should include under parameters Ex:" + - " 'ciphers:TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256'", + name = "headers", + description = "HTTP request headers in format `\"':',':'\"`.\n" + + "When the `Content-Type` header is not provided the system decides the " + + "Content-Type based on the provided sink mapper as following: \n" + + " - `@map(type='xml')`: `application/xml`\n" + + " - `@map(type='json')`: `application/json`\n" + + " - `@map(type='text')`: `plain/text`\n" + + " - `@map(type='keyvalue')`: `application/x-www-form-urlencoded`\n" + + " - For all other cases system defaults to `plain/text`\n" + + "Also the `Content-Length` header need not to be provided, as the system " + + "automatically defines it by calculating the size of the payload.", type = {DataType.STRING}, optional = true, - defaultValue = "null"), + defaultValue = "Content-Type and Content-Length headers"), @Parameter( - name = "ssl.enabled.protocols", - description = "SSL/TLS protocols to be enabled. This parameter should be in camel case format" + - "(sslEnabledProtocols) under parameters. Ex 'sslEnabledProtocols:true'", + name = "method", + description = "The HTTP method used for calling the endpoint.", type = {DataType.STRING}, optional = true, - defaultValue = "null"), + defaultValue = "POST"), + @Parameter( + name = "downloading.enabled", + description = "Enable response received by the http-response " + + "source to be written to a file. When this is enabled the `download.path` property " + + "should be also set.", + type = {DataType.BOOL}, + optional = true, + defaultValue = "false"), @Parameter( - name = "client.enable.session.creation", - description = "Enable HTTP session creation.This parameter should include under parameters " + - "Ex:" + - " 'client.enable.session.creation:true'", + name = "download.path", + description = "The absolute file path along with the file name where the downloads should " + + "be saved.", type = {DataType.STRING}, optional = true, - defaultValue = "null"), + defaultValue = "-", + dynamic = true), @Parameter( - name = "follow.redirect", - description = "Redirect related enabled.", + name = "blocking.io", + description = "Blocks the request thread until a response it received from HTTP " + + "call-response source before sending any other request.", type = {DataType.BOOL}, optional = true, - defaultValue = "true"), + defaultValue = "false"), @Parameter( - name = "max.redirect.count", - description = "Maximum redirect count.", + name = "socket.idle.timeout", + description = "Socket timeout in millis.", type = {DataType.INT}, optional = true, - defaultValue = "5"), + defaultValue = "6000"), + @Parameter( + name = "chunk.disabled", + description = "Disable chunked transfer encoding.", + type = {DataType.BOOL}, + optional = true, + defaultValue = "false"), + @Parameter( + name = "ssl.protocol", + description = "SSL/TLS protocol.", + type = {DataType.STRING}, + optional = true, + defaultValue = "TLS"), @Parameter( - name = "tls.store.type", - description = "TLS store type to be used.", + name = "ssl.configurations", + description = "SSL/TSL configurations in format `\"':',':'\"`.\n" + + "Some supported parameters:\n" + + " - SSL/TLS protocols: `'sslEnabledProtocols:TLSv1.1,TLSv1.2'`\n" + + " - List of ciphers: `'ciphers:TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256'`\n" + + " - Enable session creation: `'client.enable.session.creation:true'`\n" + + " - Supported server names: `'server.suported.server.names:server'`\n" + + " - Add HTTP SNIMatcher: `'server.supported.snimatchers:SNIMatcher'`", type = {DataType.STRING}, optional = true, - defaultValue = "JKS"), + defaultValue = "-"), @Parameter( name = "proxy.host", description = "Proxy server host", type = {DataType.STRING}, optional = true, - defaultValue = "null"), + defaultValue = "-"), @Parameter( name = "proxy.port", description = "Proxy server port", type = {DataType.STRING}, optional = true, - defaultValue = "null"), + defaultValue = "-"), @Parameter( name = "proxy.username", description = "Proxy server username", type = {DataType.STRING}, optional = true, - defaultValue = "null"), + defaultValue = "-"), @Parameter( name = "proxy.password", description = "Proxy server password", type = {DataType.STRING}, optional = true, - defaultValue = "null"), - //bootstrap configurations - @Parameter( - name = "client.bootstrap.configuration", - description = "Client bootsrap configurations. Expected format of these parameters is as " + - "follows:" + - " \"'client.bootstrap.nodelay:xxx','client.bootstrap.keepalive:xxx'\"", + defaultValue = "-"), + @Parameter( + name = "client.bootstrap.configurations", + description = "Client bootstrap configurations in " + + "format `\"':',':'\"`.\n" + + "Some supported configurations :\n" + + " - Client connect timeout in millis: `'client.bootstrap.connect.timeout:15000'`\n" + + " - Client socket timeout in seconds: `'client.bootstrap.socket.timeout:15'`\n" + + " - Client socket reuse: `'client.bootstrap.socket.reuse:true'`\n" + + " - Enable TCP no delay: `'client.bootstrap.nodelay:true'`\n" + + " - Enable client keep alive: `'client.bootstrap.keepalive:true'`\n" + + " - Send buffer size: `'client.bootstrap.sendbuffersize:1048576'`\n" + + " - Receive buffer size: `'client.bootstrap.recievebuffersize:1048576'`", type = {DataType.STRING}, optional = true, - defaultValue = "TODO"), - @Parameter( - name = "client.bootstrap.nodelay", - description = "Http client no delay.", - type = {DataType.BOOL}, - optional = true, - defaultValue = "true"), - @Parameter( - name = "client.bootstrap.keepalive", - description = "Http client keep alive.", - type = {DataType.BOOL}, - optional = true, - defaultValue = "true"), - @Parameter( - name = "client.bootstrap.sendbuffersize", - description = "Http client send buffer size.", - type = {DataType.INT}, - optional = true, - defaultValue = "1048576"), + defaultValue = "-"), @Parameter( - name = "client.bootstrap.recievebuffersize", - description = "Http client receive buffer size.", - type = {DataType.INT}, - optional = true, - defaultValue = "1048576"), - @Parameter( - name = "client.bootstrap.connect.timeout", - description = "Http client connection timeout.", - type = {DataType.INT}, - optional = true, - defaultValue = "15000"), - @Parameter( - name = "client.bootstrap.socket.reuse", - description = "To enable http socket reuse.", - type = {DataType.BOOL}, - optional = true, - defaultValue = "false"), - @Parameter( - name = "client.bootstrap.socket.timeout", - description = "Http client socket timeout.", - type = {DataType.STRING}, - optional = true, - defaultValue = "15"), - - @Parameter( - name = "client.threadpool.configurations", - description = "Thread pool configuration. Expected format of these parameters is as follows:" + - " \"'client.connection.pool.count:xxx','client.max.active.connections.per.pool:xxx'\"", - type = {DataType.STRING}, - optional = true, - defaultValue = "TODO"), - @Parameter( - name = "client.connection.pool.count", - description = "Connection pool count.", - type = {DataType.INT}, - optional = true, - defaultValue = "0"), - @Parameter( - name = "client.max.active.connections.per.pool", - description = "Active connections per pool.", + name = "max.pool.active.connections", + description = "Maximum possible number of active connection per client pool.", type = {DataType.INT}, optional = true, defaultValue = "-1"), @Parameter( - name = "client.min.idle.connections.per.pool", - description = "Minimum ideal connection per pool.", + name = "min.pool.idle.connections", + description = "Minimum number of idle connections that can exist per client pool.", type = {DataType.INT}, optional = true, defaultValue = "0"), @Parameter( - name = "client.max.idle.connections.per.pool", - description = "Maximum ideal connection per pool.", + name = "max.pool.idle.connections", + description = "Maximum number of idle connections that can exist per client pool.", type = {DataType.INT}, optional = true, defaultValue = "100"), @Parameter( - name = "client.min.eviction.idle.time", - description = "Minimum eviction idle time.", + name = "min.evictable.idle.time", + description = "Minimum time (in millis) a connection may sit idle in the " + + "client pool before it become eligible for eviction.", type = {DataType.STRING}, optional = true, - defaultValue = "5 * 60 * 1000"), + defaultValue = "300000"), @Parameter( - name = "sender.thread.count", - description = "Http sender thread count.", + name = "time.between.eviction.runs", + description = "Time between two eviction operations (in millis) on the client pool.", type = {DataType.STRING}, optional = true, - defaultValue = "20"), + defaultValue = "30000"), @Parameter( - name = "event.group.executor.thread.size", - description = "Event group executor thread size.", - type = {DataType.STRING}, - optional = true, - defaultValue = "15"), - @Parameter( - name = "max.wait.for.client.connection.pool", - description = "Maximum wait for client connection pool.", + name = "max.wait.time", + description = "The maximum time (in millis) the pool will wait (when there are no " + + "available connections) for a connection to be returned to the pool.", type = {DataType.STRING}, optional = true, defaultValue = "60000"), @Parameter( - name = "sink.id", - description = "Identifier of the sink. This is used to co-relate with the corresponding " + - "http-response source which needs to process the repose for the request sent by this" + - " sink.", - type = {DataType.STRING}), - @Parameter( - name = "downloading.enabled", - description = "If this is set to 'true' then the response received by the response source " + - "will be written to a file. If downloading is enabled, the download.path parameter is" + - " mandatory.", + name = "test.on.borrow", + description = "Enable connections to be validated " + + "before being borrowed from the client pool.", type = {DataType.BOOL}, optional = true, - defaultValue = "false"), - @Parameter( - name = "download.path", - description = "If downloading is enabled, the path of the file which is going to be " + - "downloaded should be specified using 'download.path' parameter. This should be an " + - "absolute path including the file name.", - type = {DataType.STRING}, - optional = true, - defaultValue = "null", - dynamic = true), - @Parameter( - name = "oauth.username", - description = "The username to be included in the authentication header of the oauth " + - "authentication enabled events. It is required to specify both username and " + - "password to enable oauth authentication. If one of the parameter is not given " + - "by user then an error is logged in the CLI. It is only applicable for for Oauth" + - " requests ", - type = {DataType.STRING}, - optional = true, - defaultValue = " "), - @Parameter( - name = "oauth.password", - description = "The password to be included in the authentication header of the oauth " + - "authentication enabled events. It is required to specify both username and " + - "password to enable oauth authentication. If one of the parameter is not given " + - "by user then an error is logged in the CLI. It is only applicable for for Oauth " + - " requests ", - type = {DataType.STRING}, - optional = true, - defaultValue = " "), - @Parameter( - name = "consumer.key", - description = "consumer key for the Http request. It is only applicable for for Oauth requests", - type = {DataType.STRING}, - optional = true, - defaultValue = " "), + defaultValue = "true"), @Parameter( - name = "consumer.secret", - description = "consumer secret for the Http request. It is only applicable for for " + - "Oauth requests", - type = {DataType.STRING}, + name = "test.while.idle", + description = "Enable connections to be validated during the eviction operation (if any).", + type = {DataType.BOOL}, optional = true, - defaultValue = " "), + defaultValue = "true"), @Parameter( - name = "refresh.token", - description = "refresh token for the Http request. It is only applicable for for" + - " Oauth requests", - type = {DataType.STRING}, + name = "exhausted.action", + description = "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.\n" + + "0 - Fail the request.\n" + + "1 - Block the request, until a connection returns to the " + + "pool.\n" + + "2 - Grow the connection pool size.", + type = {DataType.INT}, optional = true, - defaultValue = " "), + defaultValue = "1 (Block when exhausted)"), @Parameter( - name = "blocking.io", - description = "If this is set to 'true', after sending a request, http-request sink waits " + - "until it receives the response for that request, before sending any other request.", + name = "hostname.verification.enabled", + description = "Enable hostname verification", type = {DataType.BOOL}, optional = true, - defaultValue = "false"), + defaultValue = "true"), }, examples = { - @Example(syntax = - "@sink(type='http-request', sink.id='foo', " + - "publisher.url='http://localhost:8009/foo', " + - "@map(type='xml', @payload('{{payloadBody}}')))\n" + - "define stream FooStream (payloadBody String, method string, headers string);\n" + - "" + - "@source(type='http-response', sink.id='foo', http.status.code='2\\\\d+', \n" + - "@map(type='text', regex.A='((.|\\n)*)', " + - "@attributes(headers='trp:headers', fileName='A[1]')))\n" + - "define stream responseStream2xx(fileName string, headers string);\n\n" + - "" + - "@source(type='http-response', sink.id='foo', http.status.code='4\\\\d+', \n" + - "@map(type='text', regex.A='((.|\\n)*)', @attributes(errorMsg='A[1]'))" + - ")\n" + - "define stream responseStream4xx(errorMsg string);", - description = - "In above example, the payload body for 'FooStream' will be in following " + - "format.\n" + - "{\n" + - "\n" + - " \n" + - " WSO2\n" + - " 55.6\n" + - " 100\n" + - " \n" + - ",\n" + - "This message will sent as the body of a POST request with the content-type " + - "'application/xml' to the endpoint defined as the 'publisher.url' and in " + - "order to process the responses for these requests, there should be a source " + - "of type 'http-response' defined with the same sink id 'foo' in the siddhi " + - "app.\n The responses with 2xx status codes will be received by the " + - "http-response source which has the http.status.code defined by the regex " + - "'2\\\\d+'.\n" + - "If the response has a 4xx status code, it will be received by the " + - "http-response source which has the http.status.code defined by the regex " + - "'4\\\\d+'.\n"), - @Example(syntax = "" + - "define stream FooStream (name String, id int, headers String, downloadPath string);" + + "@sink(type='http-request', sink.id='foo',\n" + + " publisher.url='http://localhost:8009/foo',\n" + + " @map(type='xml', @payload('{{payloadBody}}')))\n" + + "define stream FooStream (payloadBody string);\n" + "\n" + - "@sink(type='http-request', \n" + - "downloading.enabled='true',\n" + - "download.path='{{downloadPath}}'," + - "publisher.url='http://localhost:8005/files',\n" + - "method='GET', " + - "headers='{{headers}}',sink.id='download-sink',\n" + - "@map(type='json')) \n" + - "define stream BarStream (name String, id int, headers String, downloadPath string);" + - "\n\n" + - "@source(type='http-response', sink.id='download-sink', " + - "http.status.code='2\\\\d+', \n" + - "@map(type='text', regex.A='((.|\\n)*)', " + - "@attributes(headers='trp:headers', fileName='A[1]')))\n" + - "define stream responseStream2xx(fileName string, headers string);\n\n" + - "" + - "@source(type='http-response', sink.id='download-sink', " + - "http.status.code='4\\\\d+', \n" + - "@map(type='text', regex.A='((.|\\n)*)', @attributes(errorMsg='A[1]')))\n" + - "define stream responseStream4xx(errorMsg string);", - description = - "In above example, http-request sink will send a GET request to the publisher url and" + - " the requested file will be received as the response by a corresponding " + - "http-response source.\n" + - "If the http status code of the response is a successful one (2xx), it will " + - "be received by the http-response source which has the http.status.code " + - "'2\\\\d+' and downloaded as a local file. Then the event received to the " + - "responseStream2xx will have the headers included in the request and " + - "the downloaded file name.\n" + - "If the http status code of the response is a 4xx code, it will be received " + - "by the http-response source which has the http.status.code '4\\\\d+'. Then " + - "the event received to the responseStream4xx will have the response message " + - "body in text format." - )} -) -public class HttpRequestSink extends HttpSink { - - private static final Logger log = Logger.getLogger(HttpRequestSink.class); - private String sinkId; - private boolean isDownloadEnabled; - private StreamDefinition outputStreamDefinition; - private Option downloadPath; - private Option publisherURLOption; - private String consumerKey; - private String consumerSecret; - private String authType; - private AccessTokenCache accessTokenCache = AccessTokenCache.getInstance(); - private String publisherURL; - private String tokenURL; - private boolean isBlockingIO; - private CountDownLatch responseLatch; - - @Override - protected StateFactory init(StreamDefinition outputStreamDefinition, OptionHolder optionHolder, - ConfigReader configReader, SiddhiAppContext siddhiAppContext) { - StateFactory stateFactory = super.init(outputStreamDefinition, optionHolder, configReader, siddhiAppContext); - this.outputStreamDefinition = outputStreamDefinition; - this.sinkId = optionHolder.validateAndGetStaticValue(HttpConstants.SINK_ID); - this.isDownloadEnabled = Boolean.parseBoolean(optionHolder.validateAndGetStaticValue(HttpConstants - .DOWNLOAD_ENABLED, HttpConstants.DEFAULT_DOWNLOAD_ENABLED_VALUE)); - if (isDownloadEnabled) { - this.downloadPath = optionHolder.validateAndGetOption(HttpConstants.DOWNLOAD_PATH); - } - this.tokenURL = optionHolder.validateAndGetStaticValue(HttpConstants.TOKEN_URL, EMPTY_STRING); - String userName = optionHolder.validateAndGetStaticValue(HttpConstants.RECEIVER_USERNAME, EMPTY_STRING); - String password = optionHolder.validateAndGetStaticValue(HttpConstants.RECEIVER_PASSWORD, EMPTY_STRING); - this.consumerKey = optionHolder.validateAndGetStaticValue(HttpConstants.CONSUMER_KEY, EMPTY_STRING); - this.consumerSecret = optionHolder.validateAndGetStaticValue(HttpConstants.CONSUMER_SECRET, EMPTY_STRING); - String oauthUsername = optionHolder.validateAndGetStaticValue(HttpConstants.RECEIVER_OAUTH_USERNAME, - EMPTY_STRING); - this.publisherURLOption = optionHolder.validateAndGetOption(HttpConstants.PUBLISHER_URL); - String oauthUserPassword = optionHolder.validateAndGetStaticValue(HttpConstants.RECEIVER_OAUTH_PASSWORD, - EMPTY_STRING); - if (!HttpConstants.EMPTY_STRING.equals(userName) && !HttpConstants.EMPTY_STRING.equals(password)) { - authType = HttpConstants.BASIC_AUTH; - } else if ((!HttpConstants.EMPTY_STRING.equals(consumerKey) - && !HttpConstants.EMPTY_STRING.equals(consumerSecret)) || - (!HttpConstants.EMPTY_STRING.equals(oauthUsername) - && !HttpConstants.EMPTY_STRING.equals(oauthUserPassword))) { - authType = HttpConstants.OAUTH; - } else { - authType = HttpConstants.NO_AUTH; - } - isBlockingIO = Boolean.parseBoolean( - optionHolder.validateAndGetStaticValue(HttpConstants.BLOCKING_IO, HttpConstants.FALSE)); - if (isBlockingIO) { - responseLatch = new CountDownLatch(1); - } - return stateFactory; - } - - /** - * This method will be called when events need to be published via this sink - * - * @param payload payload of the event based on the supported event class exported by the extensions - * @param dynamicOptions holds the dynamic options of this sink and Use this object to obtain dynamic options. - * @param state current state of the sink - * @throws ConnectionUnavailableException throw when connections are unavailable. - */ - @Override - public void publish(Object payload, DynamicOptions dynamicOptions, State state) - throws ConnectionUnavailableException { - //get the dynamic parameter - String headers = httpHeaderOption.getValue(dynamicOptions); - List
headersList = HttpSinkUtil.getHeaders(headers); - if (publisherURLOption.isStatic()) { - publisherURL = publisherURLOption.getValue(); - } else { - publisherURL = publisherURLOption.getValue(dynamicOptions); - } - - if (authType.equals(HttpConstants.BASIC_AUTH) || authType.equals(HttpConstants.NO_AUTH)) { - sendRequest(payload, dynamicOptions, headersList, HttpConstants.MAXIMUM_TRY_COUNT); - } else { - sendOauthRequest(payload, dynamicOptions, headersList); - } - } - - private void sendOauthRequest(Object payload, DynamicOptions dynamicOptions, List
headersList) { - //generate encoded base64 auth for getting refresh token - String consumerKeyValue = consumerKey + ":" + consumerSecret; - String encodedAuth = "Basic " + encodeBase64(consumerKeyValue); - //check the availability of access token in the header - setAccessToken(encodedAuth, dynamicOptions, headersList); - //send a request to API and get the response - int response = sendRequest(payload, dynamicOptions, headersList, HttpConstants.MINIMUM_TRY_COUNT); - //if authentication fails then get the new access token - if (response == HttpConstants.AUTHENTICATION_FAIL_CODE) { - handleOAuthFailure(payload, dynamicOptions, headersList, encodedAuth); - } else if (response == HttpConstants.SUCCESS_CODE) { - log.info("Request sent successfully to " + publisherURL); - } else if (response == HttpConstants.INTERNAL_SERVER_FAIL_CODE) { - log.error("Error at sending oauth request to API endpoint " + publisherURL + "', with response code: " + - response + "- Internal server error. Message dropped."); - throw new HttpSinkAdaptorRuntimeException("Error at sending oauth request to API endpoint: " + - publisherURL + "', with response code: " + response + "- Internal server error. Message dropped."); - } else { - log.error("Error at sending oauth request to API endpoint: " + - publisherURL + "', with response code: " + response + ". Message dropped. Message dropped."); - throw new HttpSinkAdaptorRuntimeException("Error at sending oauth request to API endpoint: " + - publisherURL + "', with response code: " + response + ". Message dropped. Message dropped."); - } - } - - private void handleOAuthFailure(Object payload, DynamicOptions dynamicOptions, List
headersList, - String encodedAuth) { - - Boolean checkFromCache = accessTokenCache.checkAvailableKey(encodedAuth); - if (checkFromCache) { - getNewAccessTokenWithCache(payload, dynamicOptions, headersList, encodedAuth); - } else { - requestForNewAccessToken(payload, dynamicOptions, headersList, encodedAuth); - } - } - - private void getNewAccessTokenWithCache(Object payload, DynamicOptions dynamicOptions, List
headersList, - String encodedAuth) { - String accessToken = accessTokenCache.getAccessToken(encodedAuth); - for (Header header : headersList) { - if (header.getName().equals(HttpConstants.AUTHORIZATION_HEADER)) { - header.setValue(accessToken); - break; - } - } - //send a request to API with a new access token - int response = sendRequest(payload, dynamicOptions, headersList, HttpConstants.MINIMUM_TRY_COUNT); - if (response == HttpConstants.SUCCESS_CODE) { - log.info("Request sent successfully to " + publisherURL); - } else if (response == HttpConstants.AUTHENTICATION_FAIL_CODE) { - requestForNewAccessToken(payload, dynamicOptions, headersList, encodedAuth); - } else if (response == HttpConstants.INTERNAL_SERVER_FAIL_CODE) { - log.error("Error at sending oauth request to API endpoint " + publisherURL + "', with response code: " + - response + "- Internal server error. Message dropped."); - throw new HttpSinkAdaptorRuntimeException("Error at sending oauth request to API endpoint " + - publisherURL + "', with response code: " + response + "- Internal server error. Message dropped."); - } else { - log.error("Error at sending oauth request to API endpoint " + publisherURL + "', with response code: " + - response + ". Message dropped. "); - throw new HttpSinkAdaptorRuntimeException("Error at sending oauth request to API endpoint " + - publisherURL + "', with response code: " + response + ". Message dropped."); - } - } - - private void requestForNewAccessToken(Object payload, DynamicOptions dynamicOptions, List
headersList, - String encodedAuth) { - Boolean checkRefreshToken = accessTokenCache.checkRefreshAvailableKey(encodedAuth); - if (checkRefreshToken) { - for (Header header : headersList) { - if (header.getName().equals(HttpConstants.RECEIVER_REFRESH_TOKEN)) { - if (accessTokenCache.getRefreshtoken(encodedAuth) != null) { - header.setValue(accessTokenCache.getRefreshtoken(encodedAuth)); - } - break; - } - } - } - getAccessToken(dynamicOptions, encodedAuth, tokenURL); - if (accessTokenCache.getResponseCode(encodedAuth) == HttpConstants.SUCCESS_CODE) { - String newAccessToken = accessTokenCache.getAccessToken(encodedAuth); - accessTokenCache.setAccessToken(encodedAuth, newAccessToken); - if (accessTokenCache.getRefreshtoken(encodedAuth) != null) { - accessTokenCache.setRefreshtoken(encodedAuth, accessTokenCache.getRefreshtoken(encodedAuth)); - } - for (Header header : headersList) { - if (header.getName().equals(HttpConstants.AUTHORIZATION_HEADER)) { - header.setValue(newAccessToken); - break; - } - } - //send a request to API with a new access token - int response = sendRequest(payload, dynamicOptions, headersList, HttpConstants.MAXIMUM_TRY_COUNT); - if (response == HttpConstants.SUCCESS_CODE) { - log.info("Request sent successfully to " + publisherURL); - } else if (response == HttpConstants.AUTHENTICATION_FAIL_CODE) { - log.error("Error at sending oauth request to API endpoint " + publisherURL + "', with response code: " + - response + "- Authentication Failure. Please provide a valid Consumer key, Consumer secret" + - " and token endpoint URL . Message dropped"); - throw new HttpSinkAdaptorRuntimeException("Error at sending oauth request to API endpoint " + - publisherURL + "', with response code: " + response + "- Authentication Failure. Please" + - " provide a valid Consumer key, Consumer secret and token endpoint URL . Message dropped"); - } else if (response == HttpConstants.INTERNAL_SERVER_FAIL_CODE) { - log.error("Error at sending oauth request to API endpoint " + publisherURL + "', with response code: " + - response + "- Internal server error. Message dropped."); - throw new HttpSinkAdaptorRuntimeException("Error at sending oauth request to API endpoint " + - publisherURL + "', with response code:" + response + - "- Internal server error. Message dropped."); - } else { - log.error("Error at sending oauth request to API endpoint " + publisherURL + "', with response code: " + - response + ". Message dropped."); - throw new HttpSinkAdaptorRuntimeException("Error at sending oauth request to API endpoint " + - publisherURL + "', with response code: " + response + ". Message dropped."); - } - - } else if (accessTokenCache.getResponseCode(encodedAuth) == HttpConstants.AUTHENTICATION_FAIL_CODE) { - log.error("Failed to generate new access token for the expired access token to " + publisherURL + "', " + - accessTokenCache.getResponseCode(encodedAuth) + ": Authentication Failure. Please provide" + - " a valid Consumer key, Consumer secret and token endpoint URL . Message dropped"); - throw new HttpSinkAdaptorRuntimeException("Failed to generate new access token for the expired access " + - "token to " + publisherURL + "', " + accessTokenCache.getResponseCode(encodedAuth) + - ": Authentication Failure.Please provide a valid Consumer key, Consumer secret" + - " and token endpoint URL . Message dropped"); - } else { - log.error("Failed to generate new access token for the expired access token. Error code: " + - accessTokenCache.getResponseCode(encodedAuth) + ". Message dropped."); - throw new HttpSinkAdaptorRuntimeException("Failed to generate new access token for the expired" + - " access token. Error code: " + accessTokenCache.getResponseCode(encodedAuth) + - ". Message dropped."); - } - } - - private int sendRequest(Object payload, DynamicOptions dynamicOptions, List
headersList, int tryCount) { - if (!publisherURLOption.isStatic()) { - super.initClientConnector(dynamicOptions); - } - - if (mapType == null) { - mapType = getMapper().getType(); - } - - String httpMethod = EMPTY_STRING.equals(httpMethodOption.getValue(dynamicOptions)) ? - HttpConstants.METHOD_DEFAULT : httpMethodOption.getValue(dynamicOptions); - String contentType = HttpSinkUtil.getContentType(mapType, headersList); - String messageBody = getMessageBody(payload); - HttpMethod httpReqMethod = new HttpMethod(httpMethod); - HttpCarbonMessage cMessage = new HttpCarbonMessage( - new DefaultHttpRequest(HttpVersion.HTTP_1_1, httpReqMethod, EMPTY_STRING)); - cMessage = generateCarbonMessage(headersList, contentType, httpMethod, cMessage); - if (!Constants.HTTP_GET_METHOD.equals(httpMethod)) { - cMessage.addHttpContent(new DefaultLastHttpContent(Unpooled.wrappedBuffer(messageBody - .getBytes(Charset.defaultCharset())))); - } - cMessage.completeMessage(); - HttpResponseFuture httpResponseFuture = clientConnector.send(cMessage); - HttpResponseMessageListener httpListener; - CountDownLatch latch = isBlockingIO ? responseLatch : new CountDownLatch(1); - httpListener = new HttpResponseMessageListener(this, getTrpProperties(dynamicOptions), sinkId, - isDownloadEnabled, latch, tryCount, authType, isBlockingIO); - httpResponseFuture.setHttpConnectorListener(httpListener); - - if (isBlockingIO || HttpConstants.OAUTH.equals(authType)) { - try { - boolean latchCount = latch.await(30, TimeUnit.SECONDS); - if (!latchCount) { - log.debug("Time out due to getting getting response from " + publisherURL + ". Message dropped."); - throw new HttpSinkAdaptorRuntimeException("Time out due to getting getting response from " - + publisherURL + ". Message dropped."); - - } - } catch (InterruptedException e) { - log.debug("Failed to get a response from " + publisherURL + "," + e + ". Message dropped."); - throw new HttpSinkAdaptorRuntimeException("Failed to get a response from " + - publisherURL + ", " + e + ". Message dropped."); - } - if (isBlockingIO) { - responseLatch = new CountDownLatch(1); - return HttpConstants.SUCCESS_CODE; - } - HttpCarbonMessage response = httpListener.getHttpResponseMessage(); - return response.getNettyHttpResponse().status().code(); - } else { - return HttpConstants.SUCCESS_CODE; - } - } - - @Override - public String[] getSupportedDynamicOptions() { - return new String[]{HttpConstants.HEADERS, HttpConstants.METHOD, HttpConstants.PUBLISHER_URL, - HttpConstants.DOWNLOAD_PATH, HttpConstants.PUBLISHER_URL, HttpConstants.RECEIVER_REFRESH_TOKEN}; - } + "@source(type='http-response', sink.id='foo',\n" + + " @map(type='text', regex.A='((.|\\n)*)',\n" + + " @attributes(headers='trp:headers', message='A[1]')))\n" + + "define stream ResponseStream(message string, headers string);", + description = "" + + "When events arrive in `FooStream`, http-request sink makes calls to endpoint on " + + "url `http://localhost:8009/foo` with " + + "`POST` method and Content-Type `application/xml`.\n" + + "If the event `payloadBody` attribute contains following XML:\n" + + "```\n" + + " apple\n" + + " 55\n" + + " 5\n" + + "```" + + "the http-request sink maps that and sends it to the endpoint.\n" + + "When endpoint sends a " + + "response it will be consumed by the corresponding http-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."), - private Map getTrpProperties(DynamicOptions dynamicOptions) { - Event event = dynamicOptions.getEvent(); - Object[] data = event.getData(); - List attributes = outputStreamDefinition.getAttributeList(); - Map trpProperties = new HashMap<>(); - for (int i = 0; i < attributes.size(); i++) { - trpProperties.put(attributes.get(i).getName(), data[i]); - } - if (isDownloadEnabled) { - trpProperties.put(HttpConstants.DOWNLOAD_PATH, downloadPath.getValue(dynamicOptions)); + @Example(syntax = "" + + "@sink(type='http-request', publisher.url='http://localhost:8005/files/{{name}}'\n" + + " downloading.enabled='true', download.path='{{downloadPath}}{{name}}',\n" + + " method='GET', sink.id='download', @map(type='json'))\n" + + "define stream DownloadRequestStream(name String, id int, downloadPath string);\n" + + "\n" + + "@source(type='http-response', sink.id='download',\n" + + " http.status.code='2\\\\d+',\n" + + " @map(type='text', regex.A='((.|\\n)*)',\n" + + " @attributes(name='trp:name', id='trp:id', file='A[1]')))\n" + + "define stream ResponseStream2xx(name string, id string, file string);\n" + + "\n" + + "@source(type='http-response', sink.id='download',\n" + + " http.status.code='4\\\\d+',\n" + + " @map(type='text', regex.A='((.|\\n)*)', @attributes(errorMsg='A[1]')))\n" + + "define stream ResponseStream4xx(errorMsg string);", + description = "" + + "When events arrive in `DownloadRequestStream` with `name`:`foo.txt`, `id`:`75` and " + + "`downloadPath`:`/user/download/` the http-request 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-response source based on the response status code.\n" + + "If the response status code is in the range of 200 the message will be received by " + + "the http-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.\n" + + "If the response status code is in the range of 400 then the message will be " + + "received by the http-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." + )}, + systemParameter = { + @SystemParameter( + name = "clientBootstrapClientGroupSize", + description = "Number of client threads to perform non-blocking read and write to " + + "one or more channels.", + defaultValue = "(Number of available processors) * 2", + possibleParameters = "Any positive integer" + ), + @SystemParameter( + name = "clientBootstrapBossGroupSize", + description = "Number of boss threads to accept incoming connections.", + defaultValue = "Number of available processors", + possibleParameters = "Any positive integer" + ), + @SystemParameter( + name = "clientBootstrapWorkerGroupSize", + description = "Number of worker threads to accept the connections from boss threads and " + + "perform non-blocking read and write from one or more channels.", + defaultValue = "(Number of available processors) * 2", + possibleParameters = "Any positive integer" + ), + @SystemParameter( + name = "trustStoreLocation", + description = "The default truststore file path.", + defaultValue = "`${carbon.home}/resources/security/client-truststore.jks`", + possibleParameters = "Path to client truststore `.jks` file" + ), + @SystemParameter( + name = "trustStorePassword", + description = "The default truststore password.", + defaultValue = "wso2carbon", + possibleParameters = "Truststore password as string" + ) } - return trpProperties; - } +) +@Deprecated +public class HttpRequestSink extends HttpCallSink { - private String encodeBase64(String consumerKeyValue) { - ByteBuf byteBuf = Unpooled.wrappedBuffer(consumerKeyValue.getBytes(StandardCharsets.UTF_8)); - ByteBuf encodedByteBuf = Base64.encode(byteBuf); - return encodedByteBuf.toString(StandardCharsets.UTF_8); - } } diff --git a/component/src/main/java/io/siddhi/extension/io/http/sink/HttpResponseSink.java b/component/src/main/java/io/siddhi/extension/io/http/sink/HttpResponseSink.java index 9ff5eb1a..4ea8f913 100644 --- a/component/src/main/java/io/siddhi/extension/io/http/sink/HttpResponseSink.java +++ b/component/src/main/java/io/siddhi/extension/io/http/sink/HttpResponseSink.java @@ -22,199 +22,84 @@ import io.siddhi.annotation.Extension; import io.siddhi.annotation.Parameter; import io.siddhi.annotation.util.DataType; -import io.siddhi.core.config.SiddhiAppContext; -import io.siddhi.core.exception.ConnectionUnavailableException; -import io.siddhi.core.stream.ServiceDeploymentInfo; -import io.siddhi.core.stream.output.sink.Sink; -import io.siddhi.core.util.config.ConfigReader; -import io.siddhi.core.util.snapshot.state.State; -import io.siddhi.core.util.snapshot.state.StateFactory; -import io.siddhi.core.util.transport.DynamicOptions; -import io.siddhi.core.util.transport.Option; -import io.siddhi.core.util.transport.OptionHolder; -import io.siddhi.extension.io.http.sink.util.HttpSinkUtil; -import io.siddhi.extension.io.http.util.HTTPSourceRegistry; -import io.siddhi.extension.io.http.util.HttpConstants; -import io.siddhi.query.api.definition.StreamDefinition; -import org.apache.log4j.Logger; -import org.wso2.carbon.messaging.Header; - -import java.util.List; /** * {@code HttpResponseSink} Handle the HTTP publishing tasks. */ @Extension(name = "http-response", namespace = "sink", - description = "HTTP response sink is correlated with the " + - "The HTTP request source, through a unique `source.id`, and it send a response to the HTTP request " + - "source having the same `source.id`. The response message can be formatted in `text`, `XML` or `JSON` " - + "and can be sent with appropriate headers.", + deprecated = true, + description = "" + + "_(Use http-service-response sink instead)._\n" + + "The http-response sink send responses of the requests consumed by its corresponding " + + "http-request source, by mapping the response messages to formats such as `text`, `XML` and `JSON`.", parameters = { @Parameter( name = "source.id", - description = "Identifier of the source.", + description = "Identifier to correlate the http-response sink to its corresponding " + + "http-request source which consumed the request.", type = {DataType.STRING}), @Parameter( name = "message.id", - description = "Identifier of the message.", + description = "Identifier to correlate the response with the request received " + + "by http-request source.", dynamic = true, type = {DataType.STRING}), @Parameter( name = "headers", - description = "The headers that should be included as HTTP response headers. There can be any" + - " number of headers concatenated on following format. \"'header1:value1'," + - "'header2:value2'\" User can include content-type header if he/she need to have any " + - "specific type for payload. If not system get the mapping type as the content-Type " + - "header (ie.`@map(xml)`:`application/xml`, `@map(json)`:`application/json`, " + - "`@map(text)`:`plain/text`) and if user does not include any mapping type then system " - + "gets the `plain/text` as default Content-Type header. If user does not include " + - "Content-Length header then system calculate the bytes size of payload and include it" + - " as content-length header.", + description = "HTTP request headers in format `\"':',':'\"`.\n" + + "When the `Content-Type` header is not provided the system decides the " + + "Content-Type based on the provided sink mapper as following: \n" + + " - `@map(type='xml')`: `application/xml`\n" + + " - `@map(type='json')`: `application/json`\n" + + " - `@map(type='text')`: `plain/text`\n" + + " - `@map(type='keyvalue')`: `application/x-www-form-urlencoded`\n" + + " - For all other cases system defaults to `plain/text`\n" + + "Also the `Content-Length` header need not to be provided, as the system " + + "automatically defines it by calculating the size of the payload.", type = {DataType.STRING}, optional = true, - defaultValue = " "), + defaultValue = "Content-Type and Content-Length headers"), }, examples = { - @Example(syntax = - "@sink(type='http-response', source.id='sampleSourceId', message.id='{{messageId}}', " - + "headers=\"'content-type:json','content-length:94'\"" - + "@map(type='json', @payload('{{payloadBody}}')))\n" - + "define stream FooStream (payloadBody String, messageId string, headers string);\n", - description = - "If it is json mapping expected input should be in following format for FooStream:\n" - + "{\n" - + "{\"events\":\n" - + " {\"event\":\n" - + " \"symbol\":WSO2,\n" - + " \"price\":55.6,\n" - + " \"volume\":100,\n" - + " }\n" - + "},\n" - + "0cf708b1-7eae-440b-a93e-e72f801b486a,\n" - + "Content-Length:24#Content-Location:USA\n" - + "}\n\n" - + "Above event will generate response for the matching source message " + - "as below.\n\n" - + "~Output http event payload\n" - + "{\"events\":\n" - + " {\"event\":\n" - + " \"symbol\":WSO2,\n" - + " \"price\":55.6,\n" - + " \"volume\":100,\n" - + " }\n" - + "}\n\n" - + "~Output http event headers\n" - + "Content-Length:24,\n" - + "Content-Location:'USA',\n" - + "Content-Type:'application/json'\n" - )} -) -public class HttpResponseSink extends Sink { - - private static final Logger log = Logger.getLogger(HttpResponseSink.class); - private Option messageIdOption; - private String sourceId; - private Option httpHeaderOption; - private String mapType; - - /** - * Returns the list of classes which this sink can consume. - * Based on the type of the sink, it may be limited to being able to publish specific type of classes. - * For example, a sink of type file can only write objects of type String . - * - * @return array of supported classes , if extension can support of any types of classes - * then return empty array . - */ - @Override - public Class[] getSupportedInputEventClasses() { - return new Class[]{String.class}; - } - - /** - * Give information to the deployment about the service exposed by the sink. - * - * @return ServiceDeploymentInfo Service related information to the deployment - */ - @Override - protected ServiceDeploymentInfo exposeServiceDeploymentInfo() { - return null; - } - - /** - * Returns a list of supported dynamic options (that means for each event value of the option can change) by - * the transport - * - * @return the list of supported dynamic option keys - */ - @Override - public String[] getSupportedDynamicOptions() { - return new String[]{ - HttpConstants.HEADERS, - HttpConstants.MESSAGE_ID - }; - } - - /** - * The initialization method for {@link Sink}, which will be called before other methods and validate - * the all configuration and getting the intial values. - * - * @param outputStreamDefinition containing stream definition bind to the {@link Sink} - * @param optionHolder Option holder containing static and dynamic configuration related - * to the {@link Sink} - * @param configReader to read the sink related system configuration. - * @param siddhiAppContext the context of the {@link io.siddhi.query.api.SiddhiApp} used to - * get siddhi related utilty functions. - */ - @Override - protected StateFactory init(StreamDefinition outputStreamDefinition, OptionHolder optionHolder, - ConfigReader configReader, SiddhiAppContext siddhiAppContext) { - //read configurations - this.messageIdOption = optionHolder.validateAndGetOption(HttpConstants.MESSAGE_ID); - this.sourceId = optionHolder.validateAndGetStaticValue(HttpConstants.SOURCE_ID); - this.httpHeaderOption = optionHolder.getOrCreateOption(HttpConstants.HEADERS, HttpConstants.DEFAULT_HEADER); - this.mapType = outputStreamDefinition.getAnnotations().get(0).getAnnotations().get(0).getElements().get(0) - .getValue(); - return null; - } + @Example(syntax = "" + + "@source(type='http-request', receiver.url='http://localhost:5005/add',\n" + + " source.id='adder',\n" + + " @map(type='json, @attributes(messageId='trp:messageId',\n" + + " value1='$.event.value1',\n" + + " value2='$.event.value2')))\n" + + "define stream AddStream (messageId string, value1 long, value2 long);\n" + + "\n" + + "@sink(type='http-response', source.id='adder',\n" + + " message.id='{{messageId}}', @map(type = 'json'))\n" + + "define stream ResultStream (messageId string, results long);\n" + + "\n" + + "@info(name = 'query1')\n" + + "from AddStream \n" + + "select messageId, value1 + value2 as results \n" + + "insert into ResultStream;", + description = "The http-request source on stream `AddStream` listens on " + + "url `http://localhost:5005/stocks` for JSON messages with format:\n" + + "```{\n" + + " \"event\": {\n" + + " \"value1\": 3,\n" + + " \"value2\": 4\n" + + " }\n" + + "}```\n" + + "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-response sink with format:" + + "```{\n" + + " \"event\": {\n" + + " \"results\": 7\n" + + " }\n" + + "}```" + + "Here the request and response are correlated by passing the `messageId` " + + "produced by the http-request to the respective http-response sink." + ), - @Override - public void publish(Object payload, DynamicOptions dynamicOptions, State state) - throws ConnectionUnavailableException { - String headers = httpHeaderOption.getValue(dynamicOptions); - List
headersList = HttpSinkUtil.getHeaders(headers); - String messageId = messageIdOption.getValue(dynamicOptions); - String contentType = HttpSinkUtil.getContentType(mapType, headersList); - HTTPSourceRegistry. - getRequestSource(sourceId).handleCallback(messageId, (String) payload, headersList, contentType); - } - - /** - * This method will be called before the processing method. - * Intention to establish connection to publish event. - * - * @throws ConnectionUnavailableException if end point is unavailable the ConnectionUnavailableException thrown - * such that the system will take care retrying for connection - */ - @Override - public void connect() throws ConnectionUnavailableException { - - } - - /** - * Called after all publishing is done, or when {@link ConnectionUnavailableException} is thrown - * Implementation of this method should contain the steps needed to disconnect from the sink. - */ - @Override - public void disconnect() { - - } - - /** - * The method can be called when removing an event receiver. - * The cleanups that has to be done when removing the receiver has to be done here. - */ - @Override - public void destroy() { + } +) +@Deprecated +public class HttpResponseSink extends HttpServiceResponseSink { - } } diff --git a/component/src/main/java/io/siddhi/extension/io/http/sink/HttpServiceResponseSink.java b/component/src/main/java/io/siddhi/extension/io/http/sink/HttpServiceResponseSink.java new file mode 100644 index 00000000..96e3bb2c --- /dev/null +++ b/component/src/main/java/io/siddhi/extension/io/http/sink/HttpServiceResponseSink.java @@ -0,0 +1,227 @@ +/* + * Copyright (c) 2019, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. + * + * WSO2 Inc. licenses this file to you under the Apache License, + * Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package io.siddhi.extension.io.http.sink; + +import io.siddhi.annotation.Example; +import io.siddhi.annotation.Extension; +import io.siddhi.annotation.Parameter; +import io.siddhi.annotation.util.DataType; +import io.siddhi.core.config.SiddhiAppContext; +import io.siddhi.core.exception.ConnectionUnavailableException; +import io.siddhi.core.stream.ServiceDeploymentInfo; +import io.siddhi.core.stream.output.sink.Sink; +import io.siddhi.core.util.config.ConfigReader; +import io.siddhi.core.util.snapshot.state.State; +import io.siddhi.core.util.snapshot.state.StateFactory; +import io.siddhi.core.util.transport.DynamicOptions; +import io.siddhi.core.util.transport.Option; +import io.siddhi.core.util.transport.OptionHolder; +import io.siddhi.extension.io.http.sink.util.HttpSinkUtil; +import io.siddhi.extension.io.http.util.HTTPSourceRegistry; +import io.siddhi.extension.io.http.util.HttpConstants; +import io.siddhi.query.api.definition.StreamDefinition; +import org.apache.log4j.Logger; +import org.wso2.carbon.messaging.Header; + +import java.util.List; + +/** + * {@code HttpServiceResponseSink} Handle the HTTP Service Response publishing tasks. + */ +@Extension( + name = "http-service-response", + namespace = "sink", + description = "" + + "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`.", + parameters = { + @Parameter( + name = "source.id", + description = "Identifier to correlate the http-service-response sink to its corresponding " + + "http-service source which consumed the request.", + type = {DataType.STRING}), + @Parameter( + name = "message.id", + description = "Identifier to correlate the response with the request received " + + "by http-service source.", + dynamic = true, + type = {DataType.STRING}), + @Parameter( + name = "headers", + description = "HTTP request headers in format `\"':',':'\"`.\n" + + "When the `Content-Type` header is not provided the system decides the " + + "Content-Type based on the provided sink mapper as following: \n" + + " - `@map(type='xml')`: `application/xml`\n" + + " - `@map(type='json')`: `application/json`\n" + + " - `@map(type='text')`: `plain/text`\n" + + " - `@map(type='keyvalue')`: `application/x-www-form-urlencoded`\n" + + " - For all other cases system defaults to `plain/text`\n" + + "Also the `Content-Length` header need not to be provided, as the system " + + "automatically defines it by calculating the size of the payload.", + type = {DataType.STRING}, + optional = true, + defaultValue = "Content-Type and Content-Length headers"), + }, + examples = { + @Example(syntax = "" + + "@source(type='http-service', receiver.url='http://localhost:5005/add',\n" + + " source.id='adder',\n" + + " @map(type='json, @attributes(messageId='trp:messageId',\n" + + " value1='$.event.value1',\n" + + " value2='$.event.value2')))\n" + + "define stream AddStream (messageId string, value1 long, value2 long);\n" + + "\n" + + "@sink(type='http-service-response', source.id='adder',\n" + + " message.id='{{messageId}}', @map(type = 'json'))\n" + + "define stream ResultStream (messageId string, results long);\n" + + "\n" + + "@info(name = 'query1')\n" + + "from AddStream \n" + + "select messageId, value1 + value2 as results \n" + + "insert into ResultStream;", + description = "The http-service source on stream `AddStream` listens on " + + "url `http://localhost:5005/stocks` for JSON messages with format:\n" + + "```{\n" + + " \"event\": {\n" + + " \"value1\": 3,\n" + + " \"value2\": 4\n" + + " }\n" + + "}```\n" + + "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:" + + "```{\n" + + " \"event\": {\n" + + " \"results\": 7\n" + + " }\n" + + "}```" + + "Here the request and response are correlated by passing the `messageId` " + + "produced by the http-service to the respective http-service-response sink." + ), + + } +) +public class HttpServiceResponseSink extends Sink { + + private static final Logger log = Logger.getLogger(HttpServiceResponseSink.class); + private Option messageIdOption; + private String sourceId; + private Option httpHeaderOption; + private String mapType; + + /** + * Returns the list of classes which this sink can consume. + * Based on the type of the sink, it may be limited to being able to publish specific type of classes. + * For example, a sink of type file can only write objects of type String . + * + * @return array of supported classes , if extension can support of any types of classes + * then return empty array . + */ + @Override + public Class[] getSupportedInputEventClasses() { + return new Class[]{String.class}; + } + + /** + * Give information to the deployment about the service exposed by the sink. + * + * @return ServiceDeploymentInfo Service related information to the deployment + */ + @Override + protected ServiceDeploymentInfo exposeServiceDeploymentInfo() { + return null; + } + + /** + * Returns a list of supported dynamic options (that means for each event value of the option can change) by + * the transport + * + * @return the list of supported dynamic option keys + */ + @Override + public String[] getSupportedDynamicOptions() { + return new String[]{ + HttpConstants.HEADERS, + HttpConstants.MESSAGE_ID + }; + } + + /** + * The initialization method for {@link Sink}, which will be called before other methods and validate + * the all configuration and getting the intial values. + * + * @param outputStreamDefinition containing stream definition bind to the {@link Sink} + * @param optionHolder Option holder containing static and dynamic configuration related + * to the {@link Sink} + * @param configReader to read the sink related system configuration. + * @param siddhiAppContext the context of the {@link io.siddhi.query.api.SiddhiApp} used to + * get siddhi related utilty functions. + */ + @Override + protected StateFactory init(StreamDefinition outputStreamDefinition, OptionHolder optionHolder, + ConfigReader configReader, SiddhiAppContext siddhiAppContext) { + //read configurations + this.messageIdOption = optionHolder.validateAndGetOption(HttpConstants.MESSAGE_ID); + this.sourceId = optionHolder.validateAndGetStaticValue(HttpConstants.SOURCE_ID); + this.httpHeaderOption = optionHolder.getOrCreateOption(HttpConstants.HEADERS, HttpConstants.DEFAULT_HEADER); + this.mapType = outputStreamDefinition.getAnnotations().get(0).getAnnotations().get(0).getElements().get(0) + .getValue(); + return null; + } + + @Override + public void publish(Object payload, DynamicOptions dynamicOptions, State state) + throws ConnectionUnavailableException { + String headers = httpHeaderOption.getValue(dynamicOptions); + List
headersList = HttpSinkUtil.getHeaders(headers); + String messageId = messageIdOption.getValue(dynamicOptions); + String contentType = HttpSinkUtil.getContentType(mapType, headersList); + HTTPSourceRegistry. + getServiceSource(sourceId).handleCallback(messageId, (String) payload, headersList, contentType); + } + + /** + * This method will be called before the processing method. + * Intention to establish connection to publish event. + * + * @throws ConnectionUnavailableException if end point is unavailable the ConnectionUnavailableException thrown + * such that the system will take care retrying for connection + */ + @Override + public void connect() throws ConnectionUnavailableException { + + } + + /** + * Called after all publishing is done, or when {@link ConnectionUnavailableException} is thrown + * Implementation of this method should contain the steps needed to disconnect from the sink. + */ + @Override + public void disconnect() { + + } + + /** + * The method can be called when removing an event receiver. + * The cleanups that has to be done when removing the receiver has to be done here. + */ + @Override + public void destroy() { + + } +} diff --git a/component/src/main/java/io/siddhi/extension/io/http/sink/HttpSink.java b/component/src/main/java/io/siddhi/extension/io/http/sink/HttpSink.java index 501f1e9f..360ebfe6 100644 --- a/component/src/main/java/io/siddhi/extension/io/http/sink/HttpSink.java +++ b/component/src/main/java/io/siddhi/extension/io/http/sink/HttpSink.java @@ -83,444 +83,330 @@ * {@code HttpSink } Handle the HTTP publishing tasks. */ @Extension(name = "http", namespace = "sink", - description = "This extension publish the HTTP events in any HTTP method POST, GET, PUT, DELETE via HTTP " + - "or https protocols. As the additional features this component can provide basic authentication " + - "as well as user can publish events using custom client truststore files when publishing events " + - "via https protocol. And also user can add any number of headers including HTTP_METHOD header for " + - "each event dynamically.\n" + - "Following content types will be set by default according to the type of sink mapper used.\n" + - "You can override them by setting the new content types in headers.\n" + - " - TEXT : text/plain\n" + - " - XML : application/xml\n" + - " - JSON : application/json\n" + - " - KEYVALUE : application/x-www-form-urlencoded", + description = "" + + "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.", parameters = { @Parameter( name = "publisher.url", - description = "The URL to which the outgoing events should be published via HTTP. " + - "This is a mandatory parameter and if this is not specified, an error is logged in " + - "the CLI. If user wants to enable SSL for the events, use `https` instead of `http` " + - "in the publisher.url." + - "e.g., " + - "`http://localhost:8080/endpoint`, " - + "`https://localhost:8080/endpoint`", + description = "The URL to which the outgoing events should be published.\n" + + "Examples:\n" + + "`http://localhost:8080/endpoint`,\n" + + "`https://localhost:8080/endpoint`", type = {DataType.STRING}), @Parameter( name = "basic.auth.username", - description = "The username to be included in the authentication header of the basic " + - "authentication enabled events. It is required to specify both username and " + - "password to enable basic authentication. If one of the parameter is not given " + - "by user then an error is logged in the CLI.", + description = "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.", type = {DataType.STRING}, optional = true, - defaultValue = " "), + defaultValue = "-"), @Parameter( name = "basic.auth.password", - description = "The password to include in the authentication header of the basic " + - "authentication enabled events. It is required to specify both username and " + - "password to enable basic authentication. If one of the parameter is not given " + - "by user then an error is logged in the CLI.", + description = "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.", type = {DataType.STRING}, - optional = true, defaultValue = " "), + optional = true, + defaultValue = "-"), @Parameter( name = "https.truststore.file", - description = "The file path to the location of the truststore of the client that sends " + - "the HTTP events through 'https' protocol. A custom client-truststore can be " + - "specified if required.", + description = "The file path of the client truststore when sending messages through `https`" + + " protocol.", type = {DataType.STRING}, - optional = true, defaultValue = "${carbon.home}/resources/security/client-truststore.jks"), + optional = true, defaultValue = "`${carbon.home}/resources/security/client-truststore.jks`"), @Parameter( name = "https.truststore.password", - description = "The password for the client-truststore. A custom password can be specified " + - "if required. If no custom password is specified and the protocol of URL is 'https' " + - "then, the system uses default password.", + description = "The password for the client-truststore.", type = {DataType.STRING}, - optional = true, defaultValue = "wso2carbon"), + optional = true, + defaultValue = "wso2carbon"), @Parameter( - name = "headers", - description = "The headers that should be included as HTTP request headers. \n" + - "There can be any number of headers concatenated in following format. " + - "\"'header1:value1','header2:value2'\". User can include Content-Type header if he " + - "needs to use a specific content-type for the payload. Or else, system decides the " + - "Content-Type by considering the type of sink mapper, in following way.\n" + - " - @map(xml):application/xml\n" + - " - @map(json):application/json\n" + - " - @map(text):plain/text )\n" + - " - if user does not include any mapping type then the system gets 'plain/text' " + - "as default Content-Type header.\n" + - "Note that providing content-length as a header is not supported. The size of the " + - "payload will be automatically calculated and included in the content-length header.", + name = "oauth.username", + description = "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.", type = {DataType.STRING}, optional = true, - defaultValue = " "), + defaultValue = "-"), @Parameter( - name = "method", - description = "For HTTP events, HTTP_METHOD header should be included as a request header." + - " If the parameter is null then system uses 'POST' as a default header.", + name = "oauth.password", + description = "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.", type = {DataType.STRING}, optional = true, - defaultValue = "POST"), + defaultValue = "-"), @Parameter( - name = "socket.idle.timeout", - description = "Socket timeout value in millisecond", - type = {DataType.INT}, + name = "consumer.key", + description = "Consumer key used for calling endpoints protected by OAuth 2.0", + type = {DataType.STRING}, optional = true, - defaultValue = "6000"), + defaultValue = "-"), @Parameter( - name = "chunk.disabled", - description = "This parameter is used to disable/enable chunked transfer encoding", - type = {DataType.BOOL}, + name = "consumer.secret", + description = "Consumer secret used for calling endpoints protected by OAuth 2.0", + type = {DataType.STRING}, optional = true, - defaultValue = "false"), + defaultValue = "-"), @Parameter( - name = "ssl.protocol", - description = "The SSL protocol version", + name = "token.url", + description = "Token URL to generate a new access tokens " + + "when calling endpoints protected by OAuth 2.0", type = {DataType.STRING}, optional = true, - defaultValue = "TLS"), + defaultValue = "-"), @Parameter( - name = "parameters", - description = "Parameters other than basics such as ciphers,sslEnabledProtocols,client.enable" + - ".session.creation. Expected format of these parameters is as follows: " + - "\"'ciphers:xxx','sslEnabledProtocols,client.enable:xxx'\"", + name = "refresh.token", + description = "Refresh token used for generating new access tokens " + + "when calling endpoints protected by OAuth 2.0", type = {DataType.STRING}, optional = true, - defaultValue = "null"), + defaultValue = "-"), @Parameter( - name = "ciphers", - description = "List of ciphers to be used. This parameter should include under parameters Ex:" + - " 'ciphers:TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256'", + name = "headers", + description = "HTTP request headers in format `\"':',':'\"`.\n" + + "When `Content-Type` header is not provided the system derives the " + + "Content-Type based on the provided sink mapper as following: \n" + + " - `@map(type='xml')`: `application/xml`\n" + + " - `@map(type='json')`: `application/json`\n" + + " - `@map(type='text')`: `plain/text`\n" + + " - `@map(type='keyvalue')`: `application/x-www-form-urlencoded`\n" + + " - For all other cases system defaults to `plain/text`\n" + + "Also the `Content-Length` header need not to be provided, as the system " + + "automatically defines it by calculating the size of the payload.", type = {DataType.STRING}, optional = true, - defaultValue = "null"), + defaultValue = "Content-Type and Content-Length headers"), @Parameter( - name = "ssl.enabled.protocols", - description = "SSL/TLS protocols to be enabled. This parameter should be in camel case format" + - "(sslEnabledProtocols) under parameters. Ex 'sslEnabledProtocols:true'", + name = "method", + description = "The HTTP method used for calling the endpoint.", type = {DataType.STRING}, optional = true, - defaultValue = "null"), + defaultValue = "POST"), @Parameter( - name = "client.enable.session.creation", - description = "Enable HTTP session creation.This parameter should include under parameters " + - "Ex:" + - " 'client.enable.session.creation:true'", - type = {DataType.STRING}, + name = "socket.idle.timeout", + description = "Socket timeout in millis.", + type = {DataType.INT}, optional = true, - defaultValue = "null"), + defaultValue = "6000"), @Parameter( - name = "follow.redirect", - description = "Redirect related enabled.", + name = "chunk.disabled", + description = "Disable chunked transfer encoding.", type = {DataType.BOOL}, optional = true, - defaultValue = "true"), + defaultValue = "false"), @Parameter( - name = "max.redirect.count", - description = "Maximum redirect count.", - type = {DataType.INT}, + name = "ssl.protocol", + description = "SSL/TLS protocol.", + type = {DataType.STRING}, optional = true, - defaultValue = "5"), + defaultValue = "TLS"), @Parameter( name = "tls.store.type", - description = "TLS store type to be used.", + description = "TLS store type.", type = {DataType.STRING}, optional = true, defaultValue = "JKS"), + @Parameter( + name = "ssl.configurations", + description = "SSL/TSL configurations in format `\"':',':'\"`.\n" + + "Some supported parameters:\n" + + " - SSL/TLS protocols: `'sslEnabledProtocols:TLSv1.1,TLSv1.2'`\n" + + " - List of ciphers: `'ciphers:TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256'`\n" + + " - Enable session creation: `'client.enable.session.creation:true'`\n" + + " - Supported server names: `'server.suported.server.names:server'`\n" + + " - Add HTTP SNIMatcher: `'server.supported.snimatchers:SNIMatcher'`", + type = {DataType.STRING}, + optional = true, + defaultValue = "-"), @Parameter( name = "proxy.host", description = "Proxy server host", type = {DataType.STRING}, optional = true, - defaultValue = "null"), + defaultValue = "-"), @Parameter( name = "proxy.port", description = "Proxy server port", type = {DataType.STRING}, optional = true, - defaultValue = "null"), + defaultValue = "-"), @Parameter( name = "proxy.username", description = "Proxy server username", type = {DataType.STRING}, optional = true, - defaultValue = "null"), + defaultValue = "-"), @Parameter( name = "proxy.password", description = "Proxy server password", type = {DataType.STRING}, optional = true, - defaultValue = "null"), - //bootstrap configurations + defaultValue = "-"), @Parameter( - name = "client.bootstrap.configuration", - description = "Client bootsrap configurations. Expected format of these parameters is as " + - "follows:" + - " \"'client.bootstrap.nodelay:xxx','client.bootstrap.keepalive:xxx'\"", + name = "client.bootstrap.configurations", + description = "Client bootstrap configurations in format " + + "`\"':',':'\"`.\n" + + "Some supported configurations :\n" + + " - Client connect timeout in millis: `'client.bootstrap.connect.timeout:15000'`\n" + + " - Client socket timeout in seconds: `'client.bootstrap.socket.timeout:15'`\n" + + " - Client socket reuse: `'client.bootstrap.socket.reuse:true'`\n" + + " - Enable TCP no delay: `'client.bootstrap.nodelay:true'`\n" + + " - Enable client keep alive: `'client.bootstrap.keepalive:true'`\n" + + " - Send buffer size: `'client.bootstrap.sendbuffersize:1048576'`\n" + + " - Receive buffer size: `'client.bootstrap.recievebuffersize:1048576'`", type = {DataType.STRING}, optional = true, - defaultValue = "TODO"), - @Parameter( - name = "client.bootstrap.nodelay", - description = " This is mapped to TCP_NODELAY socket option which allows the network to " + - "bypass Nagle Delays by disabling Nagle's algorithm, and sending the data " + - "as soon as it's available\n. " + - "Setting this parameter to 'true' forces a socket to send the data in its buffer, " + - "whatever the packet size. \n" , - type = {DataType.BOOL}, - optional = true, - defaultValue = "true"), - @Parameter( - name = "client.bootstrap.keepalive", - description = "This parameter defines whether the tcp connection should remain open for " + - "multiple HTTP requests/responses. If this is set to 'false', HTTP connections will " + - "be closed after each request.", - type = {DataType.BOOL}, - optional = true, - defaultValue = "true"), - @Parameter( - name = "client.bootstrap.sendbuffersize", - description = "Http client send buffer size.", - type = {DataType.INT}, - optional = true, - defaultValue = "1048576"), - @Parameter( - name = "client.bootstrap.recievebuffersize", - description = "Http client receive buffer size.", - type = {DataType.INT}, - optional = true, - defaultValue = "1048576"), - @Parameter( - name = "client.bootstrap.connect.timeout", - description = "Http client connection timeout.", - type = {DataType.INT}, - optional = true, - defaultValue = "15000"), - @Parameter( - name = "client.bootstrap.socket.reuse", - description = "To enable http socket reuse.", - type = {DataType.BOOL}, - optional = true, - defaultValue = "false"), - @Parameter( - name = "client.bootstrap.socket.timeout", - description = "Http client socket timeout.", - type = {DataType.STRING}, - optional = true, - defaultValue = "15"), - - // pool configurations - @Parameter( - name = "connection.pool.count", - description = "Number of connection pools that need to be created for the particular client.", - type = {DataType.INT}, - optional = true, - defaultValue = "0"), + defaultValue = "-"), @Parameter( name = "max.pool.active.connections", - description = "Maximum possible number of active connection per pool for the client.", + description = "Maximum possible number of active connection per client pool.", type = {DataType.INT}, optional = true, defaultValue = "-1"), @Parameter( name = "min.pool.idle.connections", - description = "Minimum allowed number of idle connections that can be existed in a pool of " + - "the client.", + description = "Minimum number of idle connections that can exist per client pool.", type = {DataType.INT}, optional = true, defaultValue = "0"), @Parameter( name = "max.pool.idle.connections", - description = "Maximum number of idle connections that can be existed in a pool of the " + - "client.", + description = "Maximum number of idle connections that can exist per client pool.", type = {DataType.INT}, optional = true, defaultValue = "100"), @Parameter( name = "min.evictable.idle.time", - description = "Minimum amount of time (in milliseconds) a connection may sit idle in the pool" + - " before it is eligible for eviction.", + description = "Minimum time (in millis) a connection may sit idle in the " + + "client pool before it become eligible for eviction.", type = {DataType.STRING}, optional = true, - defaultValue = "300000ms"), + defaultValue = "300000"), @Parameter( name = "time.between.eviction.runs", - description = "Time between two eviction operations (in milliseconds) on the connection pool.", + description = "Time between two eviction operations (in millis) on the client pool.", type = {DataType.STRING}, optional = true, - defaultValue = "30000ms"), + defaultValue = "30000"), @Parameter( name = "max.wait.time", - description = "The maximum number of milliseconds that the pool will wait " + - "(when there are no available connections) for a connection to be returned.", + description = "The maximum time (in millis) the pool will wait (when there are no " + + "available connections) for a connection to be returned to the pool.", type = {DataType.STRING}, optional = true, defaultValue = "60000"), @Parameter( name = "test.on.borrow", - description = "The indication of whether objects will be validated " + - "before being borrowed from the pool. " + - "If the object validation is failed, it will be dropped from the pool, " + - "and will attempt to borrow another.", + description = "Enable connections to be validated " + + "before being borrowed from the client pool.", type = {DataType.BOOL}, optional = true, defaultValue = "true"), @Parameter( name = "test.while.idle", - description = "The indication of whether objects will be validated " + - "by the idle object evictor (if any). " + - "If the object validation is failed, it will be dropped from the pool.", + description = "Enable connections to be validated during the eviction operation (if any).", type = {DataType.BOOL}, optional = true, defaultValue = "true"), @Parameter( name = "exhausted.action", - description = "Action which should be taken when the maximum number of active connections " + - "are being used. This action is indicated as an integer. Possible action are as " + - "following.\n" + - "0 - Fail the request when pool is exhausted.\n" + - "1 - Block the request when pool is exhausted, until a connection returns to the " + + description = "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.\n" + + "0 - Fail the request.\n" + + "1 - Block the request, until a connection returns to the " + "pool.\n" + - "2 - Grow the connection pool size when it's exhausted.", + "2 - Grow the connection pool size.", type = {DataType.INT}, optional = true, defaultValue = "1 (Block when exhausted)"), - - - @Parameter( - name = "oauth.username", - description = "The username to be included in the authentication header of the oauth " + - "authentication enabled events. It is required to specify both username and " + - "password to enable oauth authentication. If one of the parameter is not given " + - "by user then an error is logged in the CLI. It is only applicable for for Oauth" + - " requests ", - type = {DataType.STRING}, - optional = true, - defaultValue = "NONE"), - @Parameter( - name = "oauth.password", - description = "The password to be included in the authentication header of the oauth " + - "authentication enabled events. It is required to specify both username and " + - "password to enable oauth authentication. If one of the parameter is not given " + - "by user then an error is logged in the CLI. It is only applicable for for Oauth" + - " requests ", - type = {DataType.STRING}, - optional = true, - defaultValue = "NONE"), - @Parameter( - name = "consumer.key", - description = "consumer key for the Http request. It is only applicable for for Oauth requests", - type = {DataType.STRING}, - optional = true, - defaultValue = "NONE"), - @Parameter( - name = "consumer.secret", - description = "consumer secret for the Http request. It is only applicable for for " + - "Oauth requests", - type = {DataType.STRING}, - optional = true, - defaultValue = "NONE"), - @Parameter( - name = "refresh.token", - description = "refresh token for the Http request. It is only applicable for for" + - " Oauth requests", - type = {DataType.STRING}, - optional = true, - defaultValue = " "), - @Parameter( - name = "token.url", - description = "token url for generate a new access token. It is only applicable for for" + - " Oauth requests", - type = {DataType.STRING}, - optional = true, - defaultValue = " "), @Parameter( name = "hostname.verification.enabled", - description = "To enable hostname verification", + description = "Enable hostname verification.", type = {DataType.BOOL}, optional = true, defaultValue = "true"), }, examples = { - @Example(syntax = - "@sink(type='http',publisher.url='http://localhost:8009/foo', method='{{method}}'," - + "headers=\"'content-type:xml','content-length:94'\", client.bootstrap" + - ".configuration=\"'client" + - ".bootstrap" + - ".socket" + - ".timeout:20', 'client.bootstrap.worker.group.size:10'\", client.pool" + - ".configuration=\"'client.connection.pool.count:10','client.max.active.connections" + - ".per.pool:1'\", " - + "@map(type='xml', @payload('{{payloadBody}}')))\n" - + "define stream FooStream (payloadBody String, method string, headers string);\n", - description = - "If it is xml mapping expected input should be in following format for FooStream:\n" - + "{\n" - + "\n" - + " \n" - + " WSO2\n" - + " 55.6\n" - + " 100\n" - + " \n" - + ",\n" - + "POST,\n" - + "Content-Length:24#Content-Location:USA#Retry-After:120\n" - + "}\n\n" - + "Above event will generate output as below.\n" - + "~Output http event payload\n" - + "\n" - + " \n" - + " WSO2\n" - + " 55.6\n" - + " 100\n" - + " \n" - + "\n\n" - + "~Output http event headers\n" - + "Content-Length:24,\n" - + "Content-Location:'USA',\n" - + "Retry-After:120,\n" - + "Content-Type:'application/xml',\n" - + "HTTP_METHOD:'POST',\n\n" - + "~Output http event properties\n" - + "HTTP_METHOD:'POST',\n" - + "HOST:'localhost',\n" - + "PORT:8009,\n" - + "PROTOCOL:'http',\n" - + "TO:'/foo'" + @Example(syntax = "" + + "@sink(type = 'http', publisher.url = 'http://stocks.com/stocks',\n" + + " @map(type = 'json'))\n" + + "define stream StockStream (symbol string, price float, volume long);", + description = "" + + "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:\n" + + "```{\n" + + " \"event\": {\n" + + " \"symbol\": \"FB\",\n" + + " \"price\": 24.5,\n" + + " \"volume\": 5000\n" + + " }\n" + + "}```" + ), + @Example(syntax = "" + + "@sink(type='http', publisher.url = 'http://localhost:8009/foo',\n" + + " client.bootstrap.configurations = \"'client.bootstrap.socket.timeout:20'\",\n" + + " max.pool.active.connections = '1', headers = \"{{headers}}\",\n" + + " @map(type='xml', @payload(\"\"\"\n{{payloadBody}}\n\"\"\")))\n" + + "define stream FooStream (payloadBody String, headers string);", + description = "" + + "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.\n" + + "If the `payloadBody` contains\n" + + "```WSO2\n" + + "55.6\n" + + "100```" + + "and `header` contains `'topic:foobar'` values, then the system will generate " + + "an output with the body:\n" + + "```\n" + + "WSO2\n" + + "55.6\n" + + "100\n" + + "```" + + "and HTTP headers:\n" + + "`Content-Length:xxx`,\n" + + "`Content-Location:'xxx'`,\n" + + "`Content-Type:'application/xml'`,\n" + + "`HTTP_METHOD:'POST'`" )}, systemParameter = { + @SystemParameter( + name = "clientBootstrapClientGroupSize", + description = "Number of client threads to perform non-blocking read and write to " + + "one or more channels.", + defaultValue = "(Number of available processors) * 2", + possibleParameters = "Any positive integer" + ), @SystemParameter( name = "clientBootstrapBossGroupSize", - description = "property to configure number of boss threads, which accepts incoming " + - "connections until the ports are unbound. Once connection accepts successfully, " + - "boss thread passes the accepted channel to one of the worker threads.", + description = "Number of boss threads to accept incoming connections.", defaultValue = "Number of available processors", - possibleParameters = "Any integer" + possibleParameters = "Any positive integer" ), @SystemParameter( name = "clientBootstrapWorkerGroupSize", - description = "property to configure number of worker threads, which performs non " + - "blocking read and write for one or more channels in non-blocking mode.", - defaultValue = "(Number of available processors)*2", - possibleParameters = "Any integer" - ), - @SystemParameter( - name = "clientBootstrapClientGroupSize", - description = "property to configure number of client threads, which performs non " + - "blocking read and write for one or more channels in non-blocking mode.", - defaultValue = "(Number of available processors)*2", - possibleParameters = "Any integer" + description = "Number of worker threads to accept the connections from boss threads and " + + "perform non-blocking read and write from one or more channels.", + defaultValue = "(Number of available processors) * 2", + possibleParameters = "Any positive integer" ), @SystemParameter( name = "trustStoreLocation", description = "The default truststore file path.", - defaultValue = "${carbon.home}/resources/security/client-truststore.jks", - possibleParameters = "Path to client-truststore.jks" + defaultValue = "`${carbon.home}/resources/security/client-truststore.jks`", + possibleParameters = "Path to client truststore `.jks` file" ), @SystemParameter( name = "trustStorePassword", description = "The default truststore password.", defaultValue = "wso2carbon", - possibleParameters = "Truststore password" + possibleParameters = "Truststore password as string" ) } ) @@ -551,7 +437,7 @@ public class HttpSink extends Sink { private String proxyUsername; private String proxyPassword; private String clientBootstrapConfiguration; - private String clientPoolConfiguration; +// private String clientPoolConfiguration; private String bootstrapWorker; private String bootstrapBoss; private String bootstrapClient; @@ -571,7 +457,7 @@ public class HttpSink extends Sink { private long timeBetweenEvictionRuns; private long minEvictableIdleTime; private byte exhaustedAction; - private int numberOfPools; + // private int numberOfPools; private long maxWaitTime; private String hostnameVerificationEnabled; @@ -641,7 +527,7 @@ protected StateFactory init(StreamDefinition outputStreamDefinition, OptionHolde (HttpConstants.SOCKET_IDEAL_TIMEOUT, SOCKET_IDEAL_TIMEOUT_VALUE)); sslProtocol = optionHolder.validateAndGetStaticValue(HttpConstants.SSL_PROTOCOL, EMPTY_STRING); tlsStoreType = optionHolder.validateAndGetStaticValue(HttpConstants.TLS_STORE_TYPE, EMPTY_STRING); - chunkDisabled = optionHolder.validateAndGetStaticValue(HttpConstants.CLIENT_CHUNK_ENABLED, EMPTY_STRING); + chunkDisabled = optionHolder.validateAndGetStaticValue(HttpConstants.CLIENT_CHUNK_DISABLED, EMPTY_STRING); //pool configurations maxIdlePerPool = Integer.parseInt(optionHolder.validateAndGetStaticValue( @@ -660,10 +546,10 @@ protected StateFactory init(StreamDefinition outputStreamDefinition, OptionHolde HttpConstants.MIN_EVICTABLE_IDLE_TIME, HttpConstants.DEFAULT_MIN_EVICTABLE_IDLE_TIME)); exhaustedAction = (byte) Integer.parseInt(optionHolder.validateAndGetStaticValue( HttpConstants.EXHAUSTED_ACTION, HttpConstants.DEFAULT_EXHAUSTED_ACTION)); - numberOfPools = Integer.parseInt(optionHolder.validateAndGetStaticValue(HttpConstants.CONNECTION_POOL_COUNT, - HttpConstants.DEFAULT_CONNECTION_POOL_COUNT)); +// numberOfPools = Integer.parseInt(optionHolder.validateAndGetStaticValue(HttpConstants.CONNECTION_POOL_COUNT, +// HttpConstants.DEFAULT_CONNECTION_POOL_COUNT)); maxWaitTime = Integer.parseInt(optionHolder.validateAndGetStaticValue( - HttpConstants.MAX_WAIT_TIME, HttpConstants.DEFAULT_MAX_WAIT_TIME)); + HttpConstants.MAX_WAIT_TIME, HttpConstants.DEFAULT_MAX_WAIT_TIME)); parametersList = optionHolder.validateAndGetStaticValue(HttpConstants.SINK_PARAMETERS, EMPTY_STRING); proxyHost = optionHolder.validateAndGetStaticValue(HttpConstants.PROXY_HOST, EMPTY_STRING); @@ -674,8 +560,8 @@ protected StateFactory init(StreamDefinition outputStreamDefinition, OptionHolde EMPTY_STRING); clientBootstrapConfiguration = optionHolder .validateAndGetStaticValue(HttpConstants.CLIENT_BOOTSTRAP_CONFIGURATION, EMPTY_STRING); - clientPoolConfiguration = optionHolder - .validateAndGetStaticValue(HttpConstants.CLIENT_POOL_CONFIGURATION, EMPTY_STRING); +// clientPoolConfiguration = optionHolder +// .validateAndGetStaticValue(HttpConstants.CLIENT_POOL_CONFIGURATION, EMPTY_STRING); //read trp globe configuration bootstrapWorker = configReader .readConfig(HttpConstants.CLIENT_BOOTSTRAP_WORKER_GROUP_SIZE, EMPTY_STRING); @@ -1171,7 +1057,7 @@ public void initClientConnector(DynamicOptions dynamicOptions) { poolConfiguration.setTimeBetweenEvictionRuns(timeBetweenEvictionRuns); poolConfiguration.setMinEvictableIdleTime(minEvictableIdleTime); poolConfiguration.setExhaustedAction(exhaustedAction); - poolConfiguration.setNumberOfPools(numberOfPools); +// poolConfiguration.setNumberOfPools(numberOfPools); poolConfiguration.setMaxWaitTime(maxWaitTime); senderConfig.setPoolConfiguration(poolConfiguration); @@ -1202,10 +1088,9 @@ public void initClientConnector(DynamicOptions dynamicOptions) { } //overwrite default transport configuration - Map properties = HttpSinkUtil - .populateTransportConfiguration(clientBootstrapConfiguration, clientPoolConfiguration); - - clientConnector = httpConnectorFactory.createHttpClientConnector(properties, senderConfig); + Map bootStrapProperties = HttpSinkUtil + .populateTransportConfiguration(clientBootstrapConfiguration); + clientConnector = httpConnectorFactory.createHttpClientConnector(bootStrapProperties, senderConfig); } private String encodeMessage(Object s) { diff --git a/component/src/main/java/io/siddhi/extension/io/http/sink/util/HttpSinkUtil.java b/component/src/main/java/io/siddhi/extension/io/http/sink/util/HttpSinkUtil.java index c00aebc2..c8da39c2 100644 --- a/component/src/main/java/io/siddhi/extension/io/http/sink/util/HttpSinkUtil.java +++ b/component/src/main/java/io/siddhi/extension/io/http/sink/util/HttpSinkUtil.java @@ -176,11 +176,9 @@ private static boolean isHTTPTraceLoggerEnabled(ConfigReader configReader) { * Method is responsible for set transportation configuration values. * * @param clientBootstrapConfigurationList client bootstrap configuration list. - * @param clientConnectionConfiguration client connection configuration. * @return return the set of config transportation configuration. */ - public static Map populateTransportConfiguration(String clientBootstrapConfigurationList, String - clientConnectionConfiguration) { + public static Map populateTransportConfiguration(String clientBootstrapConfigurationList) { Map properties = new HashMap<>(); //populate bootstrap configurations if (!HttpConstants.EMPTY_STRING.equals(clientBootstrapConfigurationList.trim())) { @@ -189,13 +187,13 @@ public static Map populateTransportConfiguration(String clientBo .split(PARAMETER_SEPARATOR); properties.putAll(populateClientConnectionConfiguration(populateParameterMap(valueList))); } - //populate connection configurations - if (!HttpConstants.EMPTY_STRING.equals(clientConnectionConfiguration.trim())) { - String[] valueList = clientConnectionConfiguration.trim() - .substring(1, clientConnectionConfiguration.length() - 1) - .split(PARAMETER_SEPARATOR); - properties.putAll(populateClientConnectionConfiguration(populateParameterMap(valueList))); - } +// //populate connection configurations +// if (!HttpConstants.EMPTY_STRING.equals(clientConnectionConfiguration.trim())) { +// String[] valueList = clientConnectionConfiguration.trim() +// .substring(1, clientConnectionConfiguration.length() - 1) +// .split(PARAMETER_SEPARATOR); +// properties.putAll(populateClientConnectionConfiguration(populateParameterMap(valueList))); +// } return properties; } diff --git a/component/src/main/java/io/siddhi/extension/io/http/source/HttpResponseConnectorListener.java b/component/src/main/java/io/siddhi/extension/io/http/source/HttpCallResponseConnectorListener.java similarity index 87% rename from component/src/main/java/io/siddhi/extension/io/http/source/HttpResponseConnectorListener.java rename to component/src/main/java/io/siddhi/extension/io/http/source/HttpCallResponseConnectorListener.java index 413ef2f9..3e36edd5 100644 --- a/component/src/main/java/io/siddhi/extension/io/http/source/HttpResponseConnectorListener.java +++ b/component/src/main/java/io/siddhi/extension/io/http/source/HttpCallResponseConnectorListener.java @@ -31,8 +31,8 @@ /** * Connector Listener for HttpResponseSource */ -public class HttpResponseConnectorListener implements HttpConnectorListener { - private static final Logger log = LoggerFactory.getLogger(HttpResponseConnectorListener.class); +public class HttpCallResponseConnectorListener implements HttpConnectorListener { + private static final Logger log = LoggerFactory.getLogger(HttpCallResponseConnectorListener.class); private SourceEventListener sourceEventListener; private String sinkId; private ExecutorService executorService; @@ -40,9 +40,9 @@ public class HttpResponseConnectorListener implements HttpConnectorListener { private String[] trpPropertyNames; private boolean shouldAllowStreamingResponses; - public HttpResponseConnectorListener(int numberOfThreads, SourceEventListener sourceEventListener, - boolean shouldAllowStreamingResponses, - String sinkId, String[] trpPropertyNames, String siddhiAppName) { + public HttpCallResponseConnectorListener(int numberOfThreads, SourceEventListener sourceEventListener, + boolean shouldAllowStreamingResponses, + String sinkId, String[] trpPropertyNames, String siddhiAppName) { this.sourceEventListener = sourceEventListener; this.sinkId = sinkId; this.executorService = Executors.newFixedThreadPool(numberOfThreads); diff --git a/component/src/main/java/io/siddhi/extension/io/http/source/HttpCallResponseSource.java b/component/src/main/java/io/siddhi/extension/io/http/source/HttpCallResponseSource.java new file mode 100644 index 00000000..97812701 --- /dev/null +++ b/component/src/main/java/io/siddhi/extension/io/http/source/HttpCallResponseSource.java @@ -0,0 +1,215 @@ +/* + * Copyright (c) 2019, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. + * + * WSO2 Inc. licenses this file to you under the Apache License, + * Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package io.siddhi.extension.io.http.source; + +import io.siddhi.annotation.Example; +import io.siddhi.annotation.Extension; +import io.siddhi.annotation.Parameter; +import io.siddhi.annotation.util.DataType; +import io.siddhi.core.config.SiddhiAppContext; +import io.siddhi.core.exception.ConnectionUnavailableException; +import io.siddhi.core.stream.ServiceDeploymentInfo; +import io.siddhi.core.stream.input.source.Source; +import io.siddhi.core.stream.input.source.SourceEventListener; +import io.siddhi.core.util.config.ConfigReader; +import io.siddhi.core.util.snapshot.state.State; +import io.siddhi.core.util.snapshot.state.StateFactory; +import io.siddhi.core.util.transport.OptionHolder; +import io.siddhi.extension.io.http.util.HTTPSourceRegistry; +import io.siddhi.extension.io.http.util.HttpConstants; +import org.apache.log4j.Logger; + +import static io.siddhi.extension.io.http.util.HttpConstants.DEFAULT_WORKER_COUNT; + +/** + * Http source for receive responses for the requests sent by http-call sinks + */ +@Extension( + name = "http-call-response", + namespace = "source", + description = "" + + "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`.\n" + + "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 also allows accessing the attributes of the event that " + + "initiated the call via transport properties and map them with the " + + "format `trp:`'." + + "The response headers and properties are exposed via transport properties and they can be retrieved " + + "in the mapper in the format `trp:
`.", + parameters = { + @Parameter( + name = "sink.id", + description = "Identifier to correlate the http-call-response source with its corresponding " + + "http-call sink that published the messages.", + type = {DataType.STRING}), + @Parameter( + name = "http.status.code", + description = "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'`,\n" + + "`http.status.code = '4\\\\d+'`", + type = {DataType.STRING}, + optional = true, + defaultValue = "200"), + @Parameter( + name = "allow.streaming.responses", + description = "Enable consuming responses on a streaming manner.", + type = {DataType.BOOL}, + optional = true, + defaultValue = "false" + )}, + examples = { + @Example( + syntax = "" + + "@sink(type='http-call', method='POST',\n" + + " publisher.url='http://localhost:8005/registry/employee',\n" + + " sink.id='employee-info', @map(type='json')) \n" + + "define stream EmployeeRequestStream (name string, id int);\n" + + "\n" + + "@source(type='http-call-response', sink.id='employee-info',\n" + + " http.status.code='2\\\\d+',\n" + + " @map(type='json',\n" + + " @attributes(name='trp:name', id='trp:id',\n" + + " location='$.town', age='$.age')))\n" + + "define stream EmployeeResponseStream(name string, id int,\n" + + " location string, age int);\n" + + "\n" + + "@source(type='http-call-response', sink.id='employee-info',\n" + + " http.status.code='4\\\\d+',\n" + + " @map(type='text', regex.A='((.|\\n)*)',\n" + + " @attributes(error='A[1]')))\n" + + "define stream EmployeeErrorStream(error string);", + + description = "" + + "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`.\n" + + "If the arriving event has attributes `name`:`John` and `id`:`1423` it will send a " + + "message with default JSON mapping as follows:\n" + + "```{\n" + + " \"event\": {\n" + + " \"name\": \"John\",\n" + + " \"id\": 1423\n" + + " }\n" + + "}```" + + "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\n" + + "```{\n" + + " \"town\": \"NY\",\n" + + " \"age\": 24\n" + + "}```" + + "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.\n" + + "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." + )} +) +public class HttpCallResponseSource extends Source { + + private static final Logger log = Logger.getLogger(HttpCallResponseSource.class); + private String sinkId; + private SourceEventListener sourceEventListener; + private String[] requestedTransportPropertyNames; + private String siddhiAppName; + private String workerThread; + private HttpCallResponseConnectorListener httpCallResponseSourceListener; + private HttpCallResponseSourceConnectorRegistry httpConnectorRegistry; + private String httpStatusCode; + private boolean shouldAllowStreamingResponses; + + + @Override + protected ServiceDeploymentInfo exposeServiceDeploymentInfo() { + return null; + } + + @Override + public StateFactory init(SourceEventListener sourceEventListener, OptionHolder optionHolder, + String[] requestedTransportPropertyNames, ConfigReader configReader, + SiddhiAppContext siddhiAppContext) { + + this.sourceEventListener = sourceEventListener; + this.requestedTransportPropertyNames = requestedTransportPropertyNames.clone(); + this.sinkId = optionHolder.validateAndGetStaticValue(HttpConstants.SINK_ID); + this.httpConnectorRegistry = HttpCallResponseSourceConnectorRegistry.getInstance(); + this.siddhiAppName = siddhiAppContext.getName(); + this.workerThread = optionHolder + .validateAndGetStaticValue(HttpConstants.WORKER_COUNT, DEFAULT_WORKER_COUNT); + this.httpStatusCode = optionHolder.validateAndGetStaticValue(HttpConstants.HTTP_STATUS_CODE, + HttpConstants.DEFAULT_HTTP_SUCCESS_CODE); + this.shouldAllowStreamingResponses = Boolean.parseBoolean( + optionHolder.validateAndGetStaticValue(HttpConstants.ALLOW_STREAMING_RESPONSES, HttpConstants.FALSE)); + return null; + } + + @Override + public Class[] getOutputEventClasses() { + return new Class[0]; + } + + /** + * Called to connect to the source backend for receiving events + * + * @param connectionCallback Callback to pass the ConnectionUnavailableException for connection failure after + * initial successful connection + * @param state current state of the source + * @throws ConnectionUnavailableException if it cannot connect to the source backend + */ + @Override + public void connect(ConnectionCallback connectionCallback, State state) throws ConnectionUnavailableException { + this.httpCallResponseSourceListener = + new HttpCallResponseConnectorListener(Integer.parseInt(workerThread), sourceEventListener, + shouldAllowStreamingResponses, sinkId, requestedTransportPropertyNames, siddhiAppName); + this.httpConnectorRegistry.registerSourceListener(httpCallResponseSourceListener, sinkId, httpStatusCode); + + HTTPSourceRegistry.registerCallResponseSource(sinkId, httpStatusCode, this); + } + + @Override + public void disconnect() { + this.httpConnectorRegistry.unregisterSourceListener(sinkId, httpStatusCode, siddhiAppName); + HTTPSourceRegistry.removeCallResponseSource(sinkId, httpStatusCode); + } + + @Override + public void destroy() { + } + + @Override + public void pause() { + + } + + @Override + public void resume() { + + } + + public HttpCallResponseConnectorListener getConnectorListener() { + return httpCallResponseSourceListener; + } +} diff --git a/component/src/main/java/io/siddhi/extension/io/http/source/HttpResponseSourceConnectorRegistry.java b/component/src/main/java/io/siddhi/extension/io/http/source/HttpCallResponseSourceConnectorRegistry.java similarity index 73% rename from component/src/main/java/io/siddhi/extension/io/http/source/HttpResponseSourceConnectorRegistry.java rename to component/src/main/java/io/siddhi/extension/io/http/source/HttpCallResponseSourceConnectorRegistry.java index 7b5e3744..48b7908f 100644 --- a/component/src/main/java/io/siddhi/extension/io/http/source/HttpResponseSourceConnectorRegistry.java +++ b/component/src/main/java/io/siddhi/extension/io/http/source/HttpCallResponseSourceConnectorRegistry.java @@ -27,20 +27,20 @@ * {@code HttpConnectorRegistry} The code is responsible for maintaining the all active connector listeners for * http-response source. */ -class HttpResponseSourceConnectorRegistry { - private static HttpResponseSourceConnectorRegistry instance = new HttpResponseSourceConnectorRegistry(); - private Map sourceListenersMap = new ConcurrentHashMap<>(); +class HttpCallResponseSourceConnectorRegistry { + private static HttpCallResponseSourceConnectorRegistry instance = new HttpCallResponseSourceConnectorRegistry(); + private Map sourceListenersMap = new ConcurrentHashMap<>(); - private HttpResponseSourceConnectorRegistry() { + private HttpCallResponseSourceConnectorRegistry() { } /** - * Get HttpResponseSourceConnectorRegistry instance. + * Get HttpCallResponseSourceConnectorRegistry instance. * - * @return HttpResponseSourceConnectorRegistry instance + * @return HttpCallResponseSourceConnectorRegistry instance */ - static HttpResponseSourceConnectorRegistry getInstance() { + static HttpCallResponseSourceConnectorRegistry getInstance() { return instance; } @@ -50,7 +50,7 @@ static HttpResponseSourceConnectorRegistry getInstance() { * * @return the source listener map */ - Map getSourceListenersMap() { + Map getSourceListenersMap() { return this.sourceListenersMap; } @@ -60,9 +60,9 @@ Map getSourceListenersMap() { * * @param sinkId the sink id for the source */ - void registerSourceListener(HttpResponseConnectorListener httpResponseSourceListener, String sinkId, + void registerSourceListener(HttpCallResponseConnectorListener httpResponseSourceListener, String sinkId, String statusCode) { - HttpResponseConnectorListener sourceListener = + HttpCallResponseConnectorListener sourceListener = this.sourceListenersMap.putIfAbsent((sinkId + statusCode), httpResponseSourceListener); if (sourceListener != null) { throw new SiddhiAppCreationException("There is a connection already established for the source with " + @@ -77,7 +77,7 @@ void registerSourceListener(HttpResponseConnectorListener httpResponseSourceList * @param siddhiAppName name of the siddhi app */ void unregisterSourceListener(String sinkId, String statusCode, String siddhiAppName) { - HttpResponseConnectorListener httpSourceListener = + HttpCallResponseConnectorListener httpSourceListener = this.sourceListenersMap.get(sinkId + statusCode); if (httpSourceListener != null && httpSourceListener.getSiddhiAppName().equals(siddhiAppName)) { sourceListenersMap.remove(sinkId + statusCode); diff --git a/component/src/main/java/io/siddhi/extension/io/http/source/HttpRequestSource.java b/component/src/main/java/io/siddhi/extension/io/http/source/HttpRequestSource.java index d9c88f6d..f8ad4763 100644 --- a/component/src/main/java/io/siddhi/extension/io/http/source/HttpRequestSource.java +++ b/component/src/main/java/io/siddhi/extension/io/http/source/HttpRequestSource.java @@ -18,113 +18,76 @@ */ package io.siddhi.extension.io.http.source; -import io.netty.buffer.Unpooled; -import io.netty.handler.codec.http.DefaultHttpResponse; -import io.netty.handler.codec.http.DefaultLastHttpContent; -import io.netty.handler.codec.http.HttpHeaders; -import io.netty.handler.codec.http.HttpResponseStatus; -import io.netty.handler.codec.http.HttpVersion; -import io.netty.util.HashedWheelTimer; -import io.netty.util.Timeout; -import io.netty.util.TimerTask; import io.siddhi.annotation.Example; import io.siddhi.annotation.Extension; import io.siddhi.annotation.Parameter; import io.siddhi.annotation.SystemParameter; import io.siddhi.annotation.util.DataType; -import io.siddhi.core.config.SiddhiAppContext; -import io.siddhi.core.exception.ConnectionUnavailableException; -import io.siddhi.core.stream.input.source.SourceEventListener; -import io.siddhi.core.util.config.ConfigReader; -import io.siddhi.core.util.snapshot.state.State; -import io.siddhi.core.util.snapshot.state.StateFactory; -import io.siddhi.core.util.transport.OptionHolder; -import io.siddhi.extension.io.http.source.exception.HttpSourceAdaptorRuntimeException; -import io.siddhi.extension.io.http.source.util.HttpSourceUtil; -import io.siddhi.extension.io.http.util.HTTPSourceRegistry; -import io.siddhi.extension.io.http.util.HttpConstants; -import org.apache.log4j.Logger; -import org.wso2.carbon.messaging.Header; -import org.wso2.transport.http.netty.contract.ServerConnectorException; -import org.wso2.transport.http.netty.message.HttpCarbonMessage; - -import java.nio.charset.Charset; -import java.util.List; -import java.util.Map; -import java.util.WeakHashMap; -import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.TimeUnit; - -import static org.wso2.carbon.messaging.Constants.DIRECTION; -import static org.wso2.carbon.messaging.Constants.DIRECTION_RESPONSE; -import static org.wso2.transport.http.netty.contract.Constants.HTTP_STATUS_CODE; /** * Http source for receive the http and https request. */ -@Extension(name = "http-request", namespace = "source", description = "The HTTP request is correlated with the " + - "HTTP response sink, through a unique `source.id`, and for each POST requests it receives via " + - "HTTP or HTTPS in format such as `text`, `XML` and `JSON` it sends the response via the HTTP response sink. " + - "The individual request and response messages are correlated at the sink using the `message.id` of " + - "the events. " + - "If required, you can enable basic authentication at the source " + - "to ensure that events are received only from users who are authorized to access the service.", +@Extension(name = "http-request", namespace = "source", + deprecated = true, + description = "" + + "_(Use http-service source instead)._\n" + + "The http-request source receives POST requests via HTTP and HTTPS protocols " + + "in format such as `text`, `XML` and `JSON` and sends responses via its corresponding " + + "http-response sink correlated through a unique `source.id`.\n" + + "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-response sink.\n" + + "It also supports basic " + + "authentication to ensure events are received from authorized users/systems.", parameters = { @Parameter(name = "receiver.url", - description = "The URL to which the events should be received. " + - "User can provide any valid url and if the url is not provided the system will use" + - " the " + - "following format `http://0.0.0.0:9763//`" + - "If the user want to use SSL the url should be given in following format " + - "`https://localhost:8080/`", + description = "The URL on which events should be received. " + + "To enable SSL use `https` protocol in the url.", type = {DataType.STRING}, optional = true, - defaultValue = "http://0.0.0.0:9763//"), + defaultValue = "`http://0.0.0.0:9763//`"), @Parameter(name = "source.id", - description = "Identifier need to map the source to sink.", + description = "Identifier to correlate the http-request source to its corresponding " + + "http-response sinks to send responses.", type = {DataType.STRING}), @Parameter(name = "connection.timeout", - description = "Connection timeout in milliseconds. If the mapped http-response sink does not " - + "get a correlated message, after this timeout value, a timeout response is sent", + description = "Connection timeout in millis. The system will send a timeout, " + + "if a corresponding response is not sent by an associated " + + "http-response sink within the given time.", type = {DataType.INT}, optional = true, defaultValue = "120000"), @Parameter(name = "basic.auth.enabled", - description = "If this is set to `true`, " + - "basic authentication is enabled for incoming events, and the credentials with " + - "which each " + - "event is sent are verified to ensure that the user is authorized to access the " + - "service. " + - "If basic authentication fails, the event is not authenticated and an " + - "authentication error is logged in the CLI. By default this values 'false' ", + description = "This only works in VM, Docker and Kubernetes.\nWhere when enabled " + + "it authenticates each request using the " + + "`Authorization:'Basic encodeBase64(username:Password)'` header.", type = {DataType.STRING}, optional = true, defaultValue = "false"), @Parameter(name = "worker.count", description = "The number of active worker threads to serve the " + - "incoming events. The value is 1 by default. This will ensure that the events are " + - "directed " + - "to the event stream in the same order in which they arrive. By increasing this " + - "value " + - "the performance might increase at the cost of loosing event ordering.", + "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.", type = {DataType.INT}, optional = true, defaultValue = "1"), @Parameter( name = "socket.idle.timeout", - description = "Idle timeout for HTTP connection.", + description = "Idle timeout for HTTP connection in millis.", type = {DataType.INT}, optional = true, defaultValue = "120000"), @Parameter( name = "ssl.verify.client", - description = "The type of client certificate verification.", + description = "The type of client certificate verification. " + + "Supported values are `require`, `optional`.", type = {DataType.STRING}, optional = true, - defaultValue = "null"), + defaultValue = "-"), @Parameter( name = "ssl.protocol", - description = "ssl/tls related options", + description = "SSL/TLS protocol.", type = {DataType.STRING}, optional = true, defaultValue = "TLS"), @@ -135,248 +98,133 @@ optional = true, defaultValue = "JKS"), @Parameter( - name = "parameters", - description = "Parameters other than basics such as ciphers,sslEnabledProtocols,client.enable" + - ".session.creation. Expected format of these parameters is as follows: " + - "\"'ciphers:xxx','sslEnabledProtocols,client.enable:xxx'\"", - type = {DataType.STRING}, - optional = true, - defaultValue = "null"), - @Parameter( - name = "ciphers", - description = "List of ciphers to be used. This parameter should include under parameters Ex:" + - " 'ciphers:TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256'", - type = {DataType.STRING}, - optional = true, - defaultValue = "null"), - @Parameter( - name = "ssl.enabled.protocols", - description = "SSL/TLS protocols to be enabled. This parameter should be in camel case format" + - "(sslEnabledProtocols) under parameters. Ex 'sslEnabledProtocols:true'", - type = {DataType.STRING}, - optional = true, - defaultValue = "null"), - @Parameter( - name = "server.enable.session.creation", - description = "Enable HTTP session creation.This parameter should include under parameters " + - "Ex:" + - " 'client.enable.session.creation:true'", - type = {DataType.STRING}, - optional = true, - defaultValue = "null"), - @Parameter( - name = "server.supported.snimatchers", - description = "Http SNIMatcher to be added. This parameter should include under parameters" + - " Ex:" + - " 'server.supported.snimatchers:SNIMatcher'", - type = {DataType.STRING}, - optional = true, - defaultValue = "null"), - @Parameter( - name = "server.suported.server.names", - description = "Http supported servers. This parameter should include under parameters Ex:" + - " 'server.suported.server.names:server'", - type = {DataType.STRING}, - optional = true, - defaultValue = "null"), - - //header validation parameters - @Parameter( - name = "request.size.validation.configuration", - description = "Parameters that responsible for validating the http request and request " + - "headers. Expected format of these parameters is as follows:" + - " \"'request.size.validation:xxx','request.size.validation.maximum.value:xxx'\"", - type = {DataType.STRING}, - optional = true, - defaultValue = "null"), - @Parameter( - name = "request.size.validation", - description = "To enable the request size validation.", - type = {DataType.STRING}, - optional = true, - defaultValue = "false"), - @Parameter( - name = "request.size.validation.maximum.value", - description = "If request size is validated then maximum size.", - type = {DataType.STRING}, - optional = true, - defaultValue = "Integer.MAX_VALUE"), - @Parameter( - name = "request.size.validation.reject.status.code", - description = "If request is exceed maximum size and request.size.validation is enabled then " + - "status code to be send as response.", - type = {DataType.STRING}, - optional = true, - defaultValue = "401"), - @Parameter( - name = "request.size.validation.reject.message", - description = "If request is exceed maximum size and request.size.validation is enabled then " + - "status message to be send as response.", - type = {DataType.STRING}, - optional = true, - defaultValue = "Message is bigger than the valid size"), - @Parameter( - name = "request.size.validation.reject.message.content.type", - description = "If request is exceed maximum size and request.size.validation is enabled then " + - "content type to be send as response.", + name = "ssl.configurations", + description = "SSL/TSL configurations in format `\"':',':'\"`.\n" + + "Some supported parameters:\n" + + " - SSL/TLS protocols: `'sslEnabledProtocols:TLSv1.1,TLSv1.2'`\n" + + " - List of ciphers: `'ciphers:TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256'`\n" + + " - Enable session creation: `'client.enable.session.creation:true'`\n" + + " - Supported server names: `'server.suported.server.names:server'`\n" + + " - Add HTTP SNIMatcher: `'server.supported.snimatchers:SNIMatcher'`", type = {DataType.STRING}, optional = true, - defaultValue = "plain/text"), - @Parameter( - name = "header.size.validation", - description = "To enable the header size validation.", - type = {DataType.STRING}, - optional = true, - defaultValue = "false"), - @Parameter( - name = "header.validation.maximum.request.line", - description = "If header header validation is enabled then the maximum request line.", + defaultValue = "-"), + @Parameter( + name = "request.size.validation.configurations", + description = "Configurations to validate the HTTP request size.\n" + + "Expected format `\"':',':'\"`.\n" + + "Some supported configurations :\n" + + " - Enable request size validation: `'request.size.validation:true'`\n" + + " If request size is validated\n" + + " - Maximum request size: `'request.size.validation.maximum.value:2048'`\n" + + " - Response status code when request size validation fails: " + + "`'request.size.validation.reject.status.code:401'`\n" + + " - Response message when request size validation fails: " + + "`'request.size.validation.reject.message:Message is bigger than the valid size'`\n" + + " - Response Content-Type when request size validation fails: " + + "`'request.size.validation.reject.message.content.type:plain/text'`", type = {DataType.STRING}, optional = true, - defaultValue = "4096"), - @Parameter( - name = "header.validation.maximum.size", - description = "If header header validation is enabled then the maximum expected header size.", + defaultValue = "-"), + @Parameter( + name = "header.validation.configurations", + description = "Configurations to validate HTTP headers.\n" + + "Expected format `\"':',':'\"`.\n" + + "Some supported configurations :\n" + + " - Enable header size validation: `'header.size.validation:true'`\n" + + " If header size is validated\n" + + " - Maximum length of initial line: `'header.validation.maximum.request.line:4096'`\n" + + " - Maximum length of all headers: `'header.validation.maximum.size:8192'`\n" + + " - Maximum length of the content or each chunk: " + + "`'header.validation.maximum.chunk.size:8192'`\n" + + " - Response status code when header validation fails: " + + "`'header.validation.reject.status.code:401'`\n" + + " - Response message when header validation fails: " + + "`'header.validation.reject.message:Message header is bigger than the valid size'`\n" + + " - Response Content-Type when header validation fails: " + + "`'header.validation.reject.message.content.type:plain/text'`", type = {DataType.STRING}, optional = true, - defaultValue = "8192"), - @Parameter( - name = "header.validation.maximum.chunk.size", - description = "If header header validation is enabled then the maximum expected chunk size.", - type = {DataType.STRING}, - optional = true, - defaultValue = "8192"), - @Parameter( - name = "header.validation.reject.status.code", - description = "401", + defaultValue = "-"), + @Parameter( + name = "server.bootstrap.configurations", + description = "Server bootstrap configurations in " + + "format `\"':',':'\"`.\n" + + "Some supported configurations :\n" + + " - Server connect timeout in millis:" + + " `'server.bootstrap.connect.timeout:15000'`\n" + + " - Server socket timeout in seconds:" + + " `'server.bootstrap.socket.timeout:15'`\n" + + " - Enable TCP no delay: `'server.bootstrap.nodelay:true'`\n" + + " - Enable server keep alive: `'server.bootstrap.keepalive:true'`\n" + + " - Send buffer size: `'server.bootstrap.sendbuffersize:1048576'`\n" + + " - Receive buffer size: `'server.bootstrap.recievebuffersize:1048576'`\n" + + " - Number of connections queued: `'server.bootstrap.socket.backlog:100'`", type = {DataType.STRING}, optional = true, - defaultValue = "If header is exceed maximum size and header.size.validation is enabled then " + - "status code to be send as response."), - @Parameter( - name = "header.validation.reject.message", - description = "If header is exceed maximum size and header.size.validation is enabled then " + - "message to be send as response.", - type = {DataType.STRING}, - optional = true, - defaultValue = "Message header is bigger than the valid size"), - @Parameter( - name = "header.validation.reject.message.content.type", - description = "If header is exceed maximum size and header.size.validation is enabled then " + - "content type to be send as response.", - type = {DataType.STRING}, - optional = true, - defaultValue = "plain/text"), - - //bootstrap configuration - @Parameter( - name = "server.bootstrap.configuration", - description = "Parameters that for bootstrap configurations of the server. Expected format of" + - " these parameters is as follows:" + - " \"'ciphers:xxx','sslEnabledProtocols,client.enable:xxx'\"", - type = {DataType.OBJECT}, - optional = true, - defaultValue = "null"), - @Parameter( - name = "server.bootstrap.nodelay", - description = "Http server no delay.", - type = {DataType.BOOL}, - optional = true, - defaultValue = "true"), - @Parameter( - name = "server.bootstrap.keepalive", - description = "Http server keep alive.", - type = {DataType.BOOL}, - optional = true, - defaultValue = "true"), - @Parameter( - name = "server.bootstrap.sendbuffersize", - description = "Http server send buffer size.", - type = {DataType.INT}, - optional = true, - defaultValue = "1048576"), - @Parameter( - name = "server.bootstrap.recievebuffersize", - description = "Http server receive buffer size.", - type = {DataType.INT}, - optional = true, - defaultValue = "1048576"), - @Parameter( - name = "server.bootstrap.connect.timeout", - description = "Http server connection timeout.", - type = {DataType.INT}, - optional = true, - defaultValue = "15000"), - @Parameter( - name = "server.bootstrap.socket.reuse", - description = "To enable http socket reuse.", - type = {DataType.BOOL}, - optional = true, - defaultValue = "false"), - @Parameter( - name = "server.bootstrap.socket.timeout", - description = "Http server socket timeout.", - type = {DataType.BOOL}, - optional = true, - defaultValue = "15"), - @Parameter( - name = "server.bootstrap.socket.backlog", - description = "THttp server socket backlog.", - type = {DataType.BOOL}, - optional = true, - defaultValue = "100"), + defaultValue = "-"), @Parameter( name = "trace.log.enabled", - description = "Http traffic monitoring.", + description = "Enable trace log for traffic monitoring.", defaultValue = "false", optional = true, type = {DataType.BOOL} - ) }, examples = { - @Example(syntax = "@source(type='http-request', source.id='sampleSourceId, " + - "receiver.url='http://localhost:9055/endpoints/RecPro', " + - "connection.timeout='150000', parameters=\"'ciphers : TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256'," + - " 'sslEnabledProtocols:TLSv1.1,TLSv1.2'\", request.size.validation.configuration=\"request" + - ".size.validation:true\", server.bootstrap.configuration=\"server.bootstrap.socket" + - ".timeout:25\", " + - "@map(type='json, @attributes(messageId='trp:messageId', symbol='$.events.event.symbol', " + - "price='$.events.event.price', volume='$.events.event.volume')))\n" - + "define stream FooStream (messageId string, symbol string, price float, volume long);\n", - description = "The expected input is as follows:\n" - + "{\"events\":\n" - + " {\"event\":\n" - + " \"symbol\":WSO2,\n" - + " \"price\":55.6,\n" - + " \"volume\":100,\n" - + " }\n" - + "}\n" - + "If basic authentication is enabled via the `basic.auth.enabled='true` setting, " + - "each input event is also expected to contain the " + - "`Authorization:'Basic encodeBase64(username:Password)'` header.")}, + @Example(syntax = "" + + "@source(type='http-request', receiver.url='http://localhost:5005/add',\n" + + " source.id='adder',\n" + + " @map(type='json, @attributes(messageId='trp:messageId',\n" + + " value1='$.event.value1',\n" + + " value2='$.event.value2')))\n" + + "define stream AddStream (messageId string, value1 long, value2 long);\n" + + "\n" + + "@sink(type='http-response', source.id='adder',\n" + + " message.id='{{messageId}}', @map(type = 'json'))\n" + + "define stream ResultStream (messageId string, results long);\n" + + "\n" + + "@info(name = 'query1')\n" + + "from AddStream \n" + + "select messageId, value1 + value2 as results \n" + + "insert into ResultStream;", + description = "Above sample listens events on `http://localhost:5005/stocks` url for " + + "JSON messages on the format:\n" + + "```{\n" + + " \"event\": {\n" + + " \"value1\": 3,\n" + + " \"value2\": 4\n" + + " }\n" + + "}```\n" + + "Map the vents into AddStream, process the events through query `query1`, and " + + "sends the results produced on ResultStream via http-response sink " + + "on the message format:" + + "```{\n" + + " \"event\": {\n" + + " \"results\": 7\n" + + " }\n" + + "}```"), + }, systemParameter = { @SystemParameter( name = "serverBootstrapBossGroupSize", - description = "property to configure number of boss threads, which accepts incoming " + - "connections until the ports are unbound. Once connection accepts successfully, " + - "boss thread passes the accepted channel to one of the worker threads.", + description = "Number of boss threads to accept incoming connections.", defaultValue = "Number of available processors", - possibleParameters = "Any integer" + possibleParameters = "Any positive integer" ), @SystemParameter( name = "serverBootstrapWorkerGroupSize", - description = "property to configure number of worker threads, which performs non " + - "blocking read and write for one or more channels in non-blocking mode.", - defaultValue = "(Number of available processors)*2", - possibleParameters = "Any integer" + description = "Number of worker threads to accept the connections from boss threads and " + + "perform non-blocking read and write from one or more channels.", + defaultValue = "(Number of available processors) * 2", + possibleParameters = "Any positive integer" ), @SystemParameter( name = "serverBootstrapClientGroupSize", - description = "property to configure number of client threads, which performs non " + - "blocking read and write for one or more channels in non-blocking mode.", - defaultValue = "(Number of available processors)*2", - possibleParameters = "Any integer" + description = "Number of client threads to perform non-blocking read and write to " + + "one or more channels.", + defaultValue = "(Number of available processors) * 2", + possibleParameters = "Any positive integer" ), @SystemParameter( name = "defaultHost", @@ -384,280 +232,39 @@ defaultValue = "0.0.0.0", possibleParameters = "Any valid host" ), + @SystemParameter( + name = "defaultScheme", + description = "The default protocol.", + defaultValue = "http", + possibleParameters = {"http", "https"} + ), @SystemParameter( name = "defaultHttpPort", - description = "The default port if the default scheme is 'http'.", + description = "The default HTTP port when default scheme is `http`.", defaultValue = "8280", possibleParameters = "Any valid port" ), @SystemParameter( name = "defaultHttpsPort", - description = "The default port if the default scheme is 'https'.", + description = "The default HTTPS port when default scheme is `https`.", defaultValue = "8243", possibleParameters = "Any valid port" ), - @SystemParameter( - name = "defaultScheme", - description = "The default protocol.", - defaultValue = "http", - possibleParameters = {"http", "https"} - ), @SystemParameter( name = "keyStoreLocation", description = "The default keystore file path.", - defaultValue = "${carbon.home}/resources/security/wso2carbon.jks", - possibleParameters = "Path to wso2carbon.jks file" + defaultValue = "`${carbon.home}/resources/security/wso2carbon.jks`", + possibleParameters = "Path to `.jks` file" ), @SystemParameter( name = "keyStorePassword", description = "The default keystore password.", defaultValue = "wso2carbon", - possibleParameters = "String of keystore password" - ), - @SystemParameter( - name = "certPassword", - description = "The default cert password.", - defaultValue = "wso2carbon", - possibleParameters = "String of cert password" + possibleParameters = "Keystore password as string" ) } ) -public class HttpRequestSource extends HttpSource { +@Deprecated +public class HttpRequestSource extends HttpServiceSource { - private static final Logger log = Logger.getLogger(HttpRequestSource.class); - private HttpSyncConnectorRegistry httpConnectorRegistry; - private String sourceId; - private long connectionTimeout; - - private Map requestContainerMap = new ConcurrentHashMap<>(); - - private HashedWheelTimer timer; - private WeakHashMap schedularMap = new WeakHashMap<>(); - private String siddhiAppName; - - /** - * The initialization method for {@link io.siddhi.core.stream.input.source.Source}, which will be called - * before other methods and validate the all listenerConfiguration and getting the intial values. - * - * @param sourceEventListener After receiving events, the source should trigger onEvent() of this listener. - * Listener will then pass on the events to the appropriate mappers for processing . - * @param optionHolder Option holder containing static listenerConfiguration related to the - * {@link io.siddhi.core.stream.input.source.Source} - * @param configReader to read the {@link io.siddhi.core.stream.input.source.Source} related system - * listenerConfiguration. - * @param siddhiAppContext the context of the {@link io.siddhi.query.api.SiddhiApp} used to get siddhi - * related utilty functions. - */ - @Override - public StateFactory init(SourceEventListener sourceEventListener, OptionHolder optionHolder, - String[] requestedTransportPropertyNames, ConfigReader configReader, - SiddhiAppContext siddhiAppContext) { - - initSource(sourceEventListener, optionHolder, requestedTransportPropertyNames, configReader, siddhiAppContext); - initConnectorRegistry(optionHolder, configReader); - timer = new HashedWheelTimer(); - return null; - } - - protected void initSource(SourceEventListener sourceEventListener, OptionHolder optionHolder, - String[] requestedTransportPropertyNames, ConfigReader configReader, - SiddhiAppContext siddhiAppContext) { - - super.initSource(sourceEventListener, optionHolder, requestedTransportPropertyNames, configReader, - siddhiAppContext); - this.sourceId = optionHolder.validateAndGetStaticValue(HttpConstants.SOURCE_ID); - this.connectionTimeout = Long.parseLong( - optionHolder.validateAndGetStaticValue(HttpConstants.CONNECTION_TIMEOUT, "120000")); - siddhiAppName = siddhiAppContext.getName(); - } - - protected void initConnectorRegistry(OptionHolder optionHolder, ConfigReader configReader) { - - String requestSizeValidationConfigList = optionHolder - .validateAndGetStaticValue(HttpConstants.REQUEST_SIZE_VALIDATION_CONFIG, HttpConstants.EMPTY_STRING); - String serverBootstrapPropertiesList = optionHolder - .validateAndGetStaticValue(HttpConstants.SERVER_BOOTSTRAP_CONFIGURATION, HttpConstants.EMPTY_STRING); - - this.httpConnectorRegistry = HttpSyncConnectorRegistry.getInstance(); - this.httpConnectorRegistry.initBootstrapConfigIfFirst(configReader); - this.httpConnectorRegistry.setTransportConfig(serverBootstrapPropertiesList, requestSizeValidationConfigList); - } - - /** - * Returns the list of classes which this source can output. - * - * @return Array of classes that will be output by the source. - * Null or empty array if it can produce any type of class. - */ - @Override - public Class[] getOutputEventClasses() { - return new Class[]{String.class}; - } - - /** - * Called to connect to the source backend for receiving events - * - * @param connectionCallback Callback to pass the ConnectionUnavailableException for connection failure after - * initial successful connection - * @param state current state of the source - * @throws ConnectionUnavailableException if it cannot connect to the source backend - */ - @Override - public void connect(ConnectionCallback connectionCallback, State state) throws ConnectionUnavailableException { - this.httpConnectorRegistry.createHttpServerConnector(listenerConfiguration); - this.httpConnectorRegistry.registerSourceListener(sourceEventListener, listenerUrl, - workerThread, isAuth, requestedTransportPropertyNames, sourceId, siddhiAppName); - - HTTPSourceRegistry.registerRequestSource(sourceId, this); - } - - /** - * This method can be called when it is needed to disconnect from the end point. - */ - @Override - public void disconnect() { - this.httpConnectorRegistry.unregisterSourceListener(this.listenerUrl, siddhiAppName); - this.httpConnectorRegistry.unregisterServerConnector(this.listenerUrl); - - HTTPSourceRegistry.removeRequestSource(sourceId); - for (Map.Entry entry : requestContainerMap.entrySet()) { - cancelRequest(entry.getKey(), entry.getValue()); - } - } - - /** - * Called at the end to clean all the resources consumed by the - * {@link io.siddhi.core.stream.input.source.Source} - */ - @Override - public void destroy() { - this.httpConnectorRegistry.clearBootstrapConfigIfLast(); - HTTPSourceRegistry.removeRequestSource(sourceId); - timer.stop(); - } - - @Override - public void pause() { - HttpSourceListener httpSourceListener = this.httpConnectorRegistry.getSyncSourceListenersMap() - .get(HttpSourceUtil.getSourceListenerKey(listenerUrl)); - if ((httpSourceListener != null) && (httpSourceListener.isRunning())) { - httpSourceListener.pause(); - } - } - - /** - * Called to resume event consumption - */ - @Override - public void resume() { - HttpSourceListener httpSourceListener = this.httpConnectorRegistry.getSyncSourceListenersMap() - .get(HttpSourceUtil.getSourceListenerKey(listenerUrl)); - if ((httpSourceListener != null) && (httpSourceListener.isPaused())) { - httpSourceListener.resume(); - } - } - - public void registerCallback(HttpCarbonMessage carbonMessage, String messageId) { - - // Add timeout handler to the timer. - addTimeout(messageId); - - requestContainerMap.put(messageId, carbonMessage); - } - - public void handleCallback(String messageId, String payload, List
headersList, String contentType) { - - HttpCarbonMessage carbonMessage = requestContainerMap.get(messageId); - if (carbonMessage != null) { - // Remove the message from the map as we are going to reply to the message. - requestContainerMap.remove(messageId); - // Remove the timeout task as are replying to the message. - removeTimeout(messageId); - // Send the response to the correlating message. - handleResponse(carbonMessage, 200, payload, headersList, contentType); - } else { - log.warn("No source message found for source: " + sourceId + " and message: " + messageId); - } - } - - private void addTimeout(String messageId) { - - Timeout timeout = timer.newTimeout(new HttpRequestSource.TimerTaskImpl(messageId), connectionTimeout, - TimeUnit.MILLISECONDS); - schedularMap.put(messageId, timeout); - } - - private void removeTimeout(String messageId) { - - schedularMap.get(messageId).cancel(); - } - - private void handleResponse(HttpCarbonMessage requestMsg, HttpCarbonMessage responseMsg) { - - try { - requestMsg.respond(responseMsg); - } catch (ServerConnectorException e) { - throw new HttpSourceAdaptorRuntimeException("Error occurred during response", e); - } - } - - private void handleResponse(HttpCarbonMessage requestMessage, Integer code, String payload, List
- headers, String contentType) { - - int statusCode = (code == null) ? 500 : code; - String responsePayload = (payload != null) ? payload : ""; - handleResponse(requestMessage, createResponseMessage(responsePayload, statusCode, headers, contentType)); - } - - private void cancelRequest(String messageId, HttpCarbonMessage carbonMessage) { - - requestContainerMap.remove(messageId); - schedularMap.remove(messageId); - handleResponse(carbonMessage, 504, null, null, null); - } - - private HttpCarbonMessage createResponseMessage(String payload, int statusCode, List
headers, - String contentType) { - - HttpCarbonMessage response = new HttpCarbonMessage( - new DefaultHttpResponse(HttpVersion.HTTP_1_1, HttpResponseStatus.OK)); - response.addHttpContent(new DefaultLastHttpContent(Unpooled.wrappedBuffer(payload - .getBytes(Charset.defaultCharset())))); - - HttpHeaders httpHeaders = response.getHeaders(); - - response.setProperty(HTTP_STATUS_CODE, statusCode); - response.setProperty(DIRECTION, DIRECTION_RESPONSE); - - // Set the Content-Type header as the system generated value. If the user has defined a specific Content-Type - // header this will be overridden. - if (contentType != null) { - httpHeaders.set(HttpConstants.HTTP_CONTENT_TYPE, contentType); - } - - if (headers != null) { - for (Header header : headers) { - httpHeaders.set(header.getName(), header.getValue()); - } - } - - return response; - } - - class TimerTaskImpl implements TimerTask { - - String messageId; - - TimerTaskImpl(String messageId) { - - this.messageId = messageId; - } - - @Override - public void run(Timeout timeout) { - - HttpCarbonMessage carbonMessage = requestContainerMap.get(messageId); - cancelRequest(messageId, carbonMessage); - } - } } diff --git a/component/src/main/java/io/siddhi/extension/io/http/source/HttpResponseMessageListener.java b/component/src/main/java/io/siddhi/extension/io/http/source/HttpResponseMessageListener.java index bd32b714..71b98b03 100644 --- a/component/src/main/java/io/siddhi/extension/io/http/source/HttpResponseMessageListener.java +++ b/component/src/main/java/io/siddhi/extension/io/http/source/HttpResponseMessageListener.java @@ -40,7 +40,7 @@ public class HttpResponseMessageListener implements HttpConnectorListener { private static final Logger log = LoggerFactory.getLogger(HttpResponseMessageListener.class); - private HttpResponseConnectorListener responseConnectorListener; + private HttpCallResponseConnectorListener responseConnectorListener; private Map trpProperties; private boolean isDownloadEnabled; private String sinkId; @@ -74,7 +74,7 @@ public void onMessage(HttpCarbonMessage carbonMessage) { String statusCode = Integer.toString(carbonMessage.getNettyHttpResponse().status().code()); if (carbonMessage.getNettyHttpResponse().status().code() == (HttpConstants.SUCCESS_CODE) || HttpConstants.MAXIMUM_TRY_COUNT == tryCount) { - HttpResponseSource responseSource = findAndGetResponseSource(statusCode); + HttpCallResponseSource responseSource = findAndGetResponseSource(statusCode); if (responseSource != null) { responseConnectorListener = responseSource.getConnectorListener(); responseConnectorListener.onMessage(carbonMessage); @@ -94,7 +94,8 @@ public void onError(Throwable throwable) { sink.initClientConnector(null); } - HttpResponseSource source = HTTPSourceRegistry.getResponseSource(sinkId, HttpConstants.DEFAULT_HTTP_ERROR_CODE); + HttpCallResponseSource source = HTTPSourceRegistry.getCallResponseSource(sinkId, + HttpConstants.DEFAULT_HTTP_ERROR_CODE); if (source != null) { responseConnectorListener = source.getConnectorListener(); } else { @@ -118,12 +119,12 @@ void disconnect() { responseConnectorListener.disconnect(); } - private HttpResponseSource findAndGetResponseSource(String statusCode) { + private HttpCallResponseSource findAndGetResponseSource(String statusCode) { ResponseSourceId id = new ResponseSourceId(sinkId, statusCode); - for (Map.Entry entry : HTTPSourceRegistry.getResponseSourceRegistry().entrySet()) { + for (Map.Entry entry : HTTPSourceRegistry.getCallResponseSourceRegistry().entrySet()) { ResponseSourceId key = (ResponseSourceId) entry.getKey(); if (id.equals(key)) { - return (HttpResponseSource) entry.getValue(); + return (HttpCallResponseSource) entry.getValue(); } } return null; diff --git a/component/src/main/java/io/siddhi/extension/io/http/source/HttpResponseSource.java b/component/src/main/java/io/siddhi/extension/io/http/source/HttpResponseSource.java index 17c17682..9c6b84db 100644 --- a/component/src/main/java/io/siddhi/extension/io/http/source/HttpResponseSource.java +++ b/component/src/main/java/io/siddhi/extension/io/http/source/HttpResponseSource.java @@ -22,20 +22,6 @@ import io.siddhi.annotation.Extension; import io.siddhi.annotation.Parameter; import io.siddhi.annotation.util.DataType; -import io.siddhi.core.config.SiddhiAppContext; -import io.siddhi.core.exception.ConnectionUnavailableException; -import io.siddhi.core.stream.ServiceDeploymentInfo; -import io.siddhi.core.stream.input.source.Source; -import io.siddhi.core.stream.input.source.SourceEventListener; -import io.siddhi.core.util.config.ConfigReader; -import io.siddhi.core.util.snapshot.state.State; -import io.siddhi.core.util.snapshot.state.StateFactory; -import io.siddhi.core.util.transport.OptionHolder; -import io.siddhi.extension.io.http.util.HTTPSourceRegistry; -import io.siddhi.extension.io.http.util.HttpConstants; -import org.apache.log4j.Logger; - -import static io.siddhi.extension.io.http.util.HttpConstants.DEFAULT_WORKER_COUNT; /** * Http source for receive responses for the requests sent by http-request sinks @@ -43,148 +29,93 @@ @Extension( name = "http-response", namespace = "source", + deprecated = true, description = "" + - "The http-response source co-relates with http-request sink with the parameter 'sink.id'.\n" + - "This receives responses for the requests sent by the http-request sink which has the same " + - "sink id.\n" + - "Response messages can be in formats such as TEXT, JSON and XML.\n" + - "In order to handle the responses with different http status codes, user is allowed to defined the " + - "acceptable response source code using the parameter 'http.status.code'\n", + "_(Use http-call-response source instead)._\n" + + "The http-response source receives the responses for the calls made by its corresponding " + + "http-request sink, and maps them from formats such as `text`, `XML` and `JSON`.\n" + + "To handle messages with different http status codes having different formats, multiple " + + "http-response sources are allowed to associate with a single http-request sink. " + + "It also allows accessing the attributes of the event that " + + "initiated the call via transport properties and map them with the " + + "format `trp:`'.", parameters = { - @Parameter(name = "sink.id", - description = "This parameter is used to map the http-response source to a " + - "http-request sink. Then this source will accepts the response messages for " + - "the requests sent by corresponding http-request sink.", + @Parameter( + name = "sink.id", + description = "Identifier to correlate the http-response source with its corresponding " + + "http-request sink that published the messages.", type = {DataType.STRING}), - @Parameter(name = "http.status.code", - description = "Acceptable http status code for the responses.\n" + - "This can be a complete string or a regex.\n" + - "Only the responses with matching status codes to the defined value, will be received" + - " by the http-response source.\n" + - "Eg: 'http.status.code = '200', http.status.code = '2\\\\d+''", + @Parameter( + name = "http.status.code", + description = "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'`,\n" + + "`http.status.code = '4\\\\d+'`", type = {DataType.STRING}, optional = true, defaultValue = "200"), - @Parameter(name = "allow.streaming.responses", - description = "If responses can be received multiple times for a single request, " + - "this option should be enabled. If this is not enabled, for every request, response " + - "will be extracted only once.", + @Parameter( + name = "allow.streaming.responses", + description = "Enable consuming responses on a streaming manner.", type = {DataType.BOOL}, optional = true, defaultValue = "false" - )}, examples = { - @Example(syntax = "" + - "@sink(type='http-request', \n" + - "downloading.enabled='true',\n" + - "publisher.url='http://localhost:8005/registry/employee',\n" + - "method='POST', " + - "headers='{{headers}}',sink.id='employee-info',\n" + - "@map(type='json')) \n" + - "define stream BarStream (name String, id int, headers String, downloadPath string);\n\n" + - "" + - "@source(type='http-response' , sink.id='employee-info', http.status.code='2\\\\d+',\n" + - "@map(type='text', regex.A='((.|\\n)*)', @attributes(message='A[1]'))) \n" + - "define stream responseStream2xx(message string);" + - "" + - "@source(type='http-response' , sink.id='employee-info', http.status.code='4\\\\d+' ,\n" + - "@map(type='text', regex.A='((.|\\n)*)', @attributes(message='A[1]'))) \n" + - "define stream responseStream4xx(message string);", + @Example( + syntax = "" + + "@sink(type='http-request', method='POST',\n" + + " publisher.url='http://localhost:8005/registry/employee',\n" + + " sink.id='employee-info', @map(type='json')) \n" + + "define stream EmployeeRequestStream (name string, id int);\n" + + "\n" + + "@source(type='http-response', sink.id='employee-info',\n" + + " http.status.code='2\\\\d+',\n" + + " @map(type='json',\n" + + " @attributes(name='trp:name', id='trp:id',\n" + + " location='$.town', age='$.age')))\n" + + "define stream EmployeeResponseStream(name string, id int,\n" + + " location string, age int);\n" + + "\n" + + "@source(type='http-response', sink.id='employee-info',\n" + + " http.status.code='4\\\\d+',\n" + + " @map(type='text', regex.A='((.|\\n)*)',\n" + + " @attributes(error='A[1]')))\n" + + "define stream EmployeeErrorStream(error string);", description = "" + - "In above example, the defined http-request sink will send a POST requests to the " + - "endpoint defined by 'publisher.url'.\n" + - "Then for those requests, the source with the response code '2\\\\d+' and sink.id " + - "'employee-info' will receive the responses with 2xx status codes. \n" + - "The http-response source which has 'employee-info' as the 'sink.id' and '4\\\\d+' " + - "as the http.response.code will receive all the responses with 4xx status codes.\n. " + - "Then the body of the response message will be extracted using text mapper and " + - "converted into siddhi events.\n.")} + "When events arrive in `EmployeeRequestStream`, http-request sink makes calls to " + + "endpoint on url `http://localhost:8005/registry/employee` with " + + "`POST` method and Content-Type `application/json`.\n" + + "If the arriving event has attributes `name`:`John` and `id`:`1423` it will send a " + + "message with default JSON mapping as follows:\n" + + "```{\n" + + " \"event\": {\n" + + " \"name\": \"John\",\n" + + " \"id\": 1423\n" + + " }\n" + + "}```" + + "When the endpoint responds with status code in the range of 200 " + + "the message will be received by the http-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\n" + + "```{\n" + + " \"town\": \"NY\",\n" + + " \"age\": 24\n" + + "}```" + + "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.\n" + + "If the response status code is in the range of 400 then the message will be " + + "received by the http-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." + )} ) +@Deprecated +public class HttpResponseSource extends HttpCallResponseSource { -public class HttpResponseSource extends Source { - - private static final Logger log = Logger.getLogger(HttpResponseSource.class); - private String sinkId; - private SourceEventListener sourceEventListener; - private String[] requestedTransportPropertyNames; - private String siddhiAppName; - private String workerThread; - private HttpResponseConnectorListener httpResponseSourceListener; - private HttpResponseSourceConnectorRegistry httpConnectorRegistry; - private String httpStatusCode; - private boolean shouldAllowStreamingResponses; - - - @Override - protected ServiceDeploymentInfo exposeServiceDeploymentInfo() { - return null; - } - - @Override - public StateFactory init(SourceEventListener sourceEventListener, OptionHolder optionHolder, - String[] requestedTransportPropertyNames, ConfigReader configReader, - SiddhiAppContext siddhiAppContext) { - - this.sourceEventListener = sourceEventListener; - this.requestedTransportPropertyNames = requestedTransportPropertyNames.clone(); - this.sinkId = optionHolder.validateAndGetStaticValue(HttpConstants.SINK_ID); - this.httpConnectorRegistry = HttpResponseSourceConnectorRegistry.getInstance(); - this.siddhiAppName = siddhiAppContext.getName(); - this.workerThread = optionHolder - .validateAndGetStaticValue(HttpConstants.WORKER_COUNT, DEFAULT_WORKER_COUNT); - this.httpStatusCode = optionHolder.validateAndGetStaticValue(HttpConstants.HTTP_STATUS_CODE, - HttpConstants.DEFAULT_HTTP_SUCCESS_CODE); - this.shouldAllowStreamingResponses = Boolean.parseBoolean( - optionHolder.validateAndGetStaticValue(HttpConstants.ALLOW_STREAMING_RESPONSES, HttpConstants.FALSE)); - return null; - } - - @Override - public Class[] getOutputEventClasses() { - return new Class[0]; - } - - /** - * Called to connect to the source backend for receiving events - * - * @param connectionCallback Callback to pass the ConnectionUnavailableException for connection failure after - * initial successful connection - * @param state current state of the source - * @throws ConnectionUnavailableException if it cannot connect to the source backend - */ - @Override - public void connect(ConnectionCallback connectionCallback, State state) throws ConnectionUnavailableException { - this.httpResponseSourceListener = - new HttpResponseConnectorListener(Integer.parseInt(workerThread), sourceEventListener, - shouldAllowStreamingResponses, sinkId, requestedTransportPropertyNames, siddhiAppName); - this.httpConnectorRegistry.registerSourceListener(httpResponseSourceListener, sinkId, httpStatusCode); - - HTTPSourceRegistry.registerResponseSource(sinkId, httpStatusCode, this); - } - - @Override - public void disconnect() { - this.httpConnectorRegistry.unregisterSourceListener(sinkId, httpStatusCode, siddhiAppName); - HTTPSourceRegistry.removeResponseSource(sinkId, httpStatusCode); - } - - @Override - public void destroy() { - } - - @Override - public void pause() { - - } - - @Override - public void resume() { - - } - - public HttpResponseConnectorListener getConnectorListener() { - return httpResponseSourceListener; - } } diff --git a/component/src/main/java/io/siddhi/extension/io/http/source/HttpServiceSource.java b/component/src/main/java/io/siddhi/extension/io/http/source/HttpServiceSource.java new file mode 100644 index 00000000..b08cd548 --- /dev/null +++ b/component/src/main/java/io/siddhi/extension/io/http/source/HttpServiceSource.java @@ -0,0 +1,539 @@ +/* + * Copyright (c) 2019, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. + * + * WSO2 Inc. licenses this file to you under the Apache License, + * Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package io.siddhi.extension.io.http.source; + +import io.netty.buffer.Unpooled; +import io.netty.handler.codec.http.DefaultHttpResponse; +import io.netty.handler.codec.http.DefaultLastHttpContent; +import io.netty.handler.codec.http.HttpHeaders; +import io.netty.handler.codec.http.HttpResponseStatus; +import io.netty.handler.codec.http.HttpVersion; +import io.netty.util.HashedWheelTimer; +import io.netty.util.Timeout; +import io.netty.util.TimerTask; +import io.siddhi.annotation.Example; +import io.siddhi.annotation.Extension; +import io.siddhi.annotation.Parameter; +import io.siddhi.annotation.SystemParameter; +import io.siddhi.annotation.util.DataType; +import io.siddhi.core.config.SiddhiAppContext; +import io.siddhi.core.exception.ConnectionUnavailableException; +import io.siddhi.core.stream.input.source.SourceEventListener; +import io.siddhi.core.util.config.ConfigReader; +import io.siddhi.core.util.snapshot.state.State; +import io.siddhi.core.util.snapshot.state.StateFactory; +import io.siddhi.core.util.transport.OptionHolder; +import io.siddhi.extension.io.http.source.exception.HttpSourceAdaptorRuntimeException; +import io.siddhi.extension.io.http.source.util.HttpSourceUtil; +import io.siddhi.extension.io.http.util.HTTPSourceRegistry; +import io.siddhi.extension.io.http.util.HttpConstants; +import org.apache.log4j.Logger; +import org.wso2.carbon.messaging.Header; +import org.wso2.transport.http.netty.contract.ServerConnectorException; +import org.wso2.transport.http.netty.message.HttpCarbonMessage; + +import java.nio.charset.Charset; +import java.util.List; +import java.util.Map; +import java.util.WeakHashMap; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.TimeUnit; + +import static org.wso2.carbon.messaging.Constants.DIRECTION; +import static org.wso2.carbon.messaging.Constants.DIRECTION_RESPONSE; +import static org.wso2.transport.http.netty.contract.Constants.HTTP_STATUS_CODE; + +/** + * http-service source for receive the http and https request. + */ +@Extension(name = "http-service", namespace = "source", + description = "" + + "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`.\n" + + "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.\n" + + "It also supports basic " + + "authentication to ensure events are received from authorized users/systems.\n" + + "The request headers and properties are exposed via transport properties and they can be retrieved " + + "in the mapper in the format `trp:
`.", + parameters = { + @Parameter(name = "receiver.url", + description = "The URL on which events should be received. " + + "To enable SSL use `https` protocol in the url.", + type = {DataType.STRING}, + optional = true, + defaultValue = "`http://0.0.0.0:9763//`"), + @Parameter(name = "source.id", + description = "Identifier to correlate the http-service source to its corresponding " + + "http-service-response sinks to send responses.", + type = {DataType.STRING}), + @Parameter(name = "connection.timeout", + description = "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.", + type = {DataType.INT}, + optional = true, + defaultValue = "120000"), + @Parameter(name = "basic.auth.enabled", + description = "This only works in VM, Docker and Kubernetes.\nWhere when enabled " + + "it authenticates each request using the " + + "`Authorization:'Basic encodeBase64(username:Password)'` header.", + type = {DataType.STRING}, + optional = true, + defaultValue = "false"), + @Parameter(name = "worker.count", + description = "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.", + type = {DataType.INT}, + optional = true, + defaultValue = "1"), + @Parameter( + name = "socket.idle.timeout", + description = "Idle timeout for HTTP connection in millis.", + type = {DataType.INT}, + optional = true, + defaultValue = "120000"), + @Parameter( + name = "ssl.verify.client", + description = "The type of client certificate verification. " + + "Supported values are `require`, `optional`.", + type = {DataType.STRING}, + optional = true, + defaultValue = "-"), + @Parameter( + name = "ssl.protocol", + description = "SSL/TLS protocol.", + type = {DataType.STRING}, + optional = true, + defaultValue = "TLS"), + @Parameter( + name = "tls.store.type", + description = "TLS store type.", + type = {DataType.STRING}, + optional = true, + defaultValue = "JKS"), + @Parameter( + name = "ssl.configurations", + description = "SSL/TSL configurations in format `\"':',':'\"`.\n" + + "Some supported parameters:\n" + + " - SSL/TLS protocols: `'sslEnabledProtocols:TLSv1.1,TLSv1.2'`\n" + + " - List of ciphers: `'ciphers:TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256'`\n" + + " - Enable session creation: `'client.enable.session.creation:true'`\n" + + " - Supported server names: `'server.suported.server.names:server'`\n" + + " - Add HTTP SNIMatcher: `'server.supported.snimatchers:SNIMatcher'`", + type = {DataType.STRING}, + optional = true, + defaultValue = "-"), + @Parameter( + name = "request.size.validation.configurations", + description = "Configurations to validate the HTTP request size.\n" + + "Expected format `\"':',':'\"`.\n" + + "Some supported configurations :\n" + + " - Enable request size validation: `'request.size.validation:true'`\n" + + " If request size is validated\n" + + " - Maximum request size: `'request.size.validation.maximum.value:2048'`\n" + + " - Response status code when request size validation fails: " + + "`'request.size.validation.reject.status.code:401'`\n" + + " - Response message when request size validation fails: " + + "`'request.size.validation.reject.message:Message is bigger than the valid size'`\n" + + " - Response Content-Type when request size validation fails: " + + "`'request.size.validation.reject.message.content.type:plain/text'`", + type = {DataType.STRING}, + optional = true, + defaultValue = "-"), + @Parameter( + name = "header.validation.configurations", + description = "Configurations to validate HTTP headers.\n" + + "Expected format `\"':',':'\"`.\n" + + "Some supported configurations :\n" + + " - Enable header size validation: `'header.size.validation:true'`\n" + + " If header size is validated\n" + + " - Maximum length of initial line: `'header.validation.maximum.request.line:4096'`\n" + + " - Maximum length of all headers: `'header.validation.maximum.size:8192'`\n" + + " - Maximum length of the content or each chunk: " + + "`'header.validation.maximum.chunk.size:8192'`\n" + + " - Response status code when header validation fails: " + + "`'header.validation.reject.status.code:401'`\n" + + " - Response message when header validation fails: " + + "`'header.validation.reject.message:Message header is bigger than the valid size'`\n" + + " - Response Content-Type when header validation fails: " + + "`'header.validation.reject.message.content.type:plain/text'`", + type = {DataType.STRING}, + optional = true, + defaultValue = "-"), + @Parameter( + name = "server.bootstrap.configurations", + description = "Server bootstrap configurations in " + + "format `\"':',':'\"`.\n" + + "Some supported configurations :\n" + + " - Server connect timeout in millis:" + + " `'server.bootstrap.connect.timeout:15000'`\n" + + " - Server socket timeout in seconds:" + + " `'server.bootstrap.socket.timeout:15'`\n" + + " - Enable TCP no delay: `'server.bootstrap.nodelay:true'`\n" + + " - Enable server keep alive: `'server.bootstrap.keepalive:true'`\n" + + " - Send buffer size: `'server.bootstrap.sendbuffersize:1048576'`\n" + + " - Receive buffer size: `'server.bootstrap.recievebuffersize:1048576'`\n" + + " - Number of connections queued: `'server.bootstrap.socket.backlog:100'`", + type = {DataType.STRING}, + optional = true, + defaultValue = "-"), + @Parameter( + name = "trace.log.enabled", + description = "Enable trace log for traffic monitoring.", + defaultValue = "false", + optional = true, + type = {DataType.BOOL} + ) + }, + examples = { + @Example(syntax = "" + + "@source(type='http-service', receiver.url='http://localhost:5005/add',\n" + + " source.id='adder',\n" + + " @map(type='json, @attributes(messageId='trp:messageId',\n" + + " value1='$.event.value1',\n" + + " value2='$.event.value2')))\n" + + "define stream AddStream (messageId string, value1 long, value2 long);\n" + + "\n" + + "@sink(type='http-service-response', source.id='adder',\n" + + " message.id='{{messageId}}', @map(type = 'json'))\n" + + "define stream ResultStream (messageId string, results long);\n" + + "\n" + + "@info(name = 'query1')\n" + + "from AddStream \n" + + "select messageId, value1 + value2 as results \n" + + "insert into ResultStream;", + description = "Above sample listens events on `http://localhost:5005/stocks` url for " + + "JSON messages on the format:\n" + + "```{\n" + + " \"event\": {\n" + + " \"value1\": 3,\n" + + " \"value2\": 4\n" + + " }\n" + + "}```\n" + + "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:" + + "```{\n" + + " \"event\": {\n" + + " \"results\": 7\n" + + " }\n" + + "}```"), + }, + systemParameter = { + @SystemParameter( + name = "serverBootstrapBossGroupSize", + description = "Number of boss threads to accept incoming connections.", + defaultValue = "Number of available processors", + possibleParameters = "Any positive integer" + ), + @SystemParameter( + name = "serverBootstrapWorkerGroupSize", + description = "Number of worker threads to accept the connections from boss threads and " + + "perform non-blocking read and write from one or more channels.", + defaultValue = "(Number of available processors) * 2", + possibleParameters = "Any positive integer" + ), + @SystemParameter( + name = "serverBootstrapClientGroupSize", + description = "Number of client threads to perform non-blocking read and write to " + + "one or more channels.", + defaultValue = "(Number of available processors) * 2", + possibleParameters = "Any positive integer" + ), + @SystemParameter( + name = "defaultHost", + description = "The default host of the transport.", + defaultValue = "0.0.0.0", + possibleParameters = "Any valid host" + ), + @SystemParameter( + name = "defaultScheme", + description = "The default protocol.", + defaultValue = "http", + possibleParameters = {"http", "https"} + ), + @SystemParameter( + name = "defaultHttpPort", + description = "The default HTTP port when default scheme is `http`.", + defaultValue = "8280", + possibleParameters = "Any valid port" + ), + @SystemParameter( + name = "defaultHttpsPort", + description = "The default HTTPS port when default scheme is `https`.", + defaultValue = "8243", + possibleParameters = "Any valid port" + ), + @SystemParameter( + name = "keyStoreLocation", + description = "The default keystore file path.", + defaultValue = "`${carbon.home}/resources/security/wso2carbon.jks`", + possibleParameters = "Path to `.jks` file" + ), + @SystemParameter( + name = "keyStorePassword", + description = "The default keystore password.", + defaultValue = "wso2carbon", + possibleParameters = "Keystore password as string" + ) + } +) +public class HttpServiceSource extends HttpSource { + + private static final Logger log = Logger.getLogger(HttpServiceSource.class); + private HttpSyncConnectorRegistry httpConnectorRegistry; + private String sourceId; + private long connectionTimeout; + + private Map requestContainerMap = new ConcurrentHashMap<>(); + + private HashedWheelTimer timer; + private WeakHashMap schedulerMap = new WeakHashMap<>(); + private String siddhiAppName; + + /** + * The initialization method for {@link io.siddhi.core.stream.input.source.Source}, which will be called + * before other methods and validate the all listenerConfiguration and getting the intial values. + * + * @param sourceEventListener After receiving events, the source should trigger onEvent() of this listener. + * Listener will then pass on the events to the appropriate mappers for processing . + * @param optionHolder Option holder containing static listenerConfiguration related to the + * {@link io.siddhi.core.stream.input.source.Source} + * @param configReader to read the {@link io.siddhi.core.stream.input.source.Source} related system + * listenerConfiguration. + * @param siddhiAppContext the context of the {@link io.siddhi.query.api.SiddhiApp} used to get siddhi + * related utilty functions. + */ + @Override + public StateFactory init(SourceEventListener sourceEventListener, OptionHolder optionHolder, + String[] requestedTransportPropertyNames, ConfigReader configReader, + SiddhiAppContext siddhiAppContext) { + + initSource(sourceEventListener, optionHolder, requestedTransportPropertyNames, configReader, siddhiAppContext); + initConnectorRegistry(optionHolder, configReader); + timer = new HashedWheelTimer(); + return null; + } + + protected void initSource(SourceEventListener sourceEventListener, OptionHolder optionHolder, + String[] requestedTransportPropertyNames, ConfigReader configReader, + SiddhiAppContext siddhiAppContext) { + + super.initSource(sourceEventListener, optionHolder, requestedTransportPropertyNames, configReader, + siddhiAppContext); + this.sourceId = optionHolder.validateAndGetStaticValue(HttpConstants.SOURCE_ID); + this.connectionTimeout = Long.parseLong( + optionHolder.validateAndGetStaticValue(HttpConstants.CONNECTION_TIMEOUT, "120000")); + siddhiAppName = siddhiAppContext.getName(); + } + + protected void initConnectorRegistry(OptionHolder optionHolder, ConfigReader configReader) { + + String requestSizeValidationConfigList = optionHolder + .validateAndGetStaticValue(HttpConstants.REQUEST_SIZE_VALIDATION_CONFIGS, HttpConstants.EMPTY_STRING); + String serverBootstrapPropertiesList = optionHolder + .validateAndGetStaticValue(HttpConstants.SERVER_BOOTSTRAP_CONFIGS, HttpConstants.EMPTY_STRING); + + this.httpConnectorRegistry = HttpSyncConnectorRegistry.getInstance(); + this.httpConnectorRegistry.initBootstrapConfigIfFirst(configReader); + this.httpConnectorRegistry.setTransportConfig(serverBootstrapPropertiesList, requestSizeValidationConfigList); + } + + /** + * Returns the list of classes which this source can output. + * + * @return Array of classes that will be output by the source. + * Null or empty array if it can produce any type of class. + */ + @Override + public Class[] getOutputEventClasses() { + return new Class[]{String.class}; + } + + /** + * Called to connect to the source backend for receiving events + * + * @param connectionCallback Callback to pass the ConnectionUnavailableException for connection failure after + * initial successful connection + * @param state current state of the source + * @throws ConnectionUnavailableException if it cannot connect to the source backend + */ + @Override + public void connect(ConnectionCallback connectionCallback, State state) throws ConnectionUnavailableException { + this.httpConnectorRegistry.createHttpServerConnector(listenerConfiguration); + this.httpConnectorRegistry.registerSourceListener(sourceEventListener, listenerUrl, + workerThread, isAuth, requestedTransportPropertyNames, sourceId, siddhiAppName); + + HTTPSourceRegistry.registerServiceSource(sourceId, this); + } + + /** + * This method can be called when it is needed to disconnect from the end point. + */ + @Override + public void disconnect() { + this.httpConnectorRegistry.unregisterSourceListener(this.listenerUrl, siddhiAppName); + this.httpConnectorRegistry.unregisterServerConnector(this.listenerUrl); + + HTTPSourceRegistry.removeServiceSource(sourceId); + for (Map.Entry entry : requestContainerMap.entrySet()) { + cancelRequest(entry.getKey(), entry.getValue()); + } + } + + /** + * Called at the end to clean all the resources consumed by the + * {@link io.siddhi.core.stream.input.source.Source} + */ + @Override + public void destroy() { + this.httpConnectorRegistry.clearBootstrapConfigIfLast(); + HTTPSourceRegistry.removeServiceSource(sourceId); + timer.stop(); + } + + @Override + public void pause() { + HttpSourceListener httpSourceListener = this.httpConnectorRegistry.getSyncSourceListenersMap() + .get(HttpSourceUtil.getSourceListenerKey(listenerUrl)); + if ((httpSourceListener != null) && (httpSourceListener.isRunning())) { + httpSourceListener.pause(); + } + } + + /** + * Called to resume event consumption + */ + @Override + public void resume() { + HttpSourceListener httpSourceListener = this.httpConnectorRegistry.getSyncSourceListenersMap() + .get(HttpSourceUtil.getSourceListenerKey(listenerUrl)); + if ((httpSourceListener != null) && (httpSourceListener.isPaused())) { + httpSourceListener.resume(); + } + } + + public void registerCallback(HttpCarbonMessage carbonMessage, String messageId) { + + // Add timeout handler to the timer. + addTimeout(messageId); + + requestContainerMap.put(messageId, carbonMessage); + } + + public void handleCallback(String messageId, String payload, List
headersList, String contentType) { + + HttpCarbonMessage carbonMessage = requestContainerMap.get(messageId); + if (carbonMessage != null) { + // Remove the message from the map as we are going to reply to the message. + requestContainerMap.remove(messageId); + // Remove the timeout task as are replying to the message. + removeTimeout(messageId); + // Send the response to the correlating message. + handleResponse(carbonMessage, 200, payload, headersList, contentType); + } else { + log.warn("No source message found for source: " + sourceId + " and message: " + messageId); + } + } + + private void addTimeout(String messageId) { + + Timeout timeout = timer.newTimeout(new HttpServiceSource.TimerTaskImpl(messageId), connectionTimeout, + TimeUnit.MILLISECONDS); + schedulerMap.put(messageId, timeout); + } + + private void removeTimeout(String messageId) { + + schedulerMap.get(messageId).cancel(); + } + + private void handleResponse(HttpCarbonMessage requestMsg, HttpCarbonMessage responseMsg) { + + try { + requestMsg.respond(responseMsg); + } catch (ServerConnectorException e) { + throw new HttpSourceAdaptorRuntimeException("Error occurred during response", e); + } + } + + private void handleResponse(HttpCarbonMessage requestMessage, Integer code, String payload, List
+ headers, String contentType) { + + int statusCode = (code == null) ? 500 : code; + String responsePayload = (payload != null) ? payload : ""; + handleResponse(requestMessage, createResponseMessage(responsePayload, statusCode, headers, contentType)); + } + + private void cancelRequest(String messageId, HttpCarbonMessage carbonMessage) { + + requestContainerMap.remove(messageId); + schedulerMap.remove(messageId); + handleResponse(carbonMessage, 504, null, null, null); + } + + private HttpCarbonMessage createResponseMessage(String payload, int statusCode, List
headers, + String contentType) { + + HttpCarbonMessage response = new HttpCarbonMessage( + new DefaultHttpResponse(HttpVersion.HTTP_1_1, HttpResponseStatus.OK)); + response.addHttpContent(new DefaultLastHttpContent(Unpooled.wrappedBuffer(payload + .getBytes(Charset.defaultCharset())))); + + HttpHeaders httpHeaders = response.getHeaders(); + + response.setProperty(HTTP_STATUS_CODE, statusCode); + response.setProperty(DIRECTION, DIRECTION_RESPONSE); + + // Set the Content-Type header as the system generated value. If the user has defined a specific Content-Type + // header this will be overridden. + if (contentType != null) { + httpHeaders.set(HttpConstants.HTTP_CONTENT_TYPE, contentType); + } + + if (headers != null) { + for (Header header : headers) { + httpHeaders.set(header.getName(), header.getValue()); + } + } + + return response; + } + + class TimerTaskImpl implements TimerTask { + + String messageId; + + TimerTaskImpl(String messageId) { + + this.messageId = messageId; + } + + @Override + public void run(Timeout timeout) { + + HttpCarbonMessage carbonMessage = requestContainerMap.get(messageId); + cancelRequest(messageId, carbonMessage); + } + } +} diff --git a/component/src/main/java/io/siddhi/extension/io/http/source/HttpSource.java b/component/src/main/java/io/siddhi/extension/io/http/source/HttpSource.java index 465db5fd..ba9db46f 100644 --- a/component/src/main/java/io/siddhi/extension/io/http/source/HttpSource.java +++ b/component/src/main/java/io/siddhi/extension/io/http/source/HttpSource.java @@ -43,59 +43,54 @@ import static io.siddhi.extension.io.http.util.HttpConstants.DEFAULT_WORKER_COUNT; import static io.siddhi.extension.io.http.util.HttpConstants.SOCKET_IDEAL_TIMEOUT_VALUE; + /** * Http source for receive the http and https request. */ -@Extension(name = "http", namespace = "source", description = "The HTTP source receives POST requests via HTTP or " + - "HTTPS in format such as `text`, `XML` and `JSON`. In WSO2 SP, if required, you can enable basic " + - "authentication to ensure that events are received only from users who are authorized to access " + - "the service.", +@Extension(name = "http", namespace = "source", + description = "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.\n" + + "The request headers and properties are exposed via transport properties and they can be retrieved " + + "in the mapper in the format `trp:
`." , parameters = { @Parameter(name = "receiver.url", - description = "The URL to which the events should be received. " + - "User can provide any valid url and if the url is not provided the system will " + - "use the following format `http://0.0.0.0:9763//`" + - "If the user want to use SSL the url should be given in following format " + - "`https://localhost:8080/`", + description = "The URL on which events should be received. " + + "To enable SSL use `https` protocol in the url.", type = {DataType.STRING}, optional = true, - defaultValue = "http://0.0.0.0:9763//"), + defaultValue = "`http://0.0.0.0:9763//`"), @Parameter(name = "basic.auth.enabled", - description = "This works only in WSO2 SP. If this is set to `true`, " + - "basic authentication is enabled for incoming events, and the credentials with " + - "which each " + - "event is sent are verified to ensure that the user is authorized to access the " + - "service. " + - "If basic authentication fails, the event is not authenticated and an " + - "authentication error is logged in the CLI.", + description = "This only works in VM, Docker and Kubernetes.\nWhere when enabled " + + "it authenticates each request using the " + + "`Authorization:'Basic encodeBase64(username:Password)'` header.", type = {DataType.STRING}, optional = true, defaultValue = "false"), @Parameter(name = "worker.count", description = "The number of active worker threads to serve the " + - "incoming events. The value is 1 by default. This will ensure that the events are " + - "directed " + - "to the event stream in the same order in which they arrive. By increasing this " + - "value " + - "the performance might increase at the cost of loosing event ordering.", + "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.", type = {DataType.INT}, optional = true, defaultValue = "1"), @Parameter( name = "socket.idle.timeout", - description = "Idle timeout for HTTP connection.", + description = "Idle timeout for HTTP connection in millis.", type = {DataType.INT}, optional = true, defaultValue = "120000"), @Parameter( name = "ssl.verify.client", - description = "The type of client certificate verification.", + description = "The type of client certificate verification. " + + "Supported values are `require`, `optional`.", type = {DataType.STRING}, optional = true, - defaultValue = "null"), + defaultValue = "-"), @Parameter( name = "ssl.protocol", - description = "ssl/tls related options", + description = "SSL/TLS protocol.", type = {DataType.STRING}, optional = true, defaultValue = "TLS"), @@ -106,248 +101,130 @@ optional = true, defaultValue = "JKS"), @Parameter( - name = "parameters", - description = "Parameters other than basics such as ciphers,sslEnabledProtocols,client.enable" + - ".session.creation. Expected format of these parameters is as follows: " + - "\"'ciphers:xxx','sslEnabledProtocols,client.enable:xxx'\"", - type = {DataType.STRING}, - optional = true, - defaultValue = "null"), - @Parameter( - name = "ciphers", - description = "List of ciphers to be used. This parameter should include under parameters Ex:" + - " 'ciphers:TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256'", - type = {DataType.STRING}, - optional = true, - defaultValue = "null"), - @Parameter( - name = "ssl.enabled.protocols", - description = "SSL/TLS protocols to be enabled. This parameter should be in camel case format" + - "(sslEnabledProtocols) under parameters. Ex 'sslEnabledProtocols:true'", - type = {DataType.STRING}, - optional = true, - defaultValue = "null"), - @Parameter( - name = "server.enable.session.creation", - description = "Enable HTTP session creation.This parameter should include under parameters " + - "Ex:" + - " 'client.enable.session.creation:true'", - type = {DataType.STRING}, - optional = true, - defaultValue = "null"), - @Parameter( - name = "server.supported.snimatchers", - description = "Http SNIMatcher to be added. This parameter should include under parameters" + - " Ex:" + - " 'server.supported.snimatchers:SNIMatcher'", - type = {DataType.STRING}, - optional = true, - defaultValue = "null"), - @Parameter( - name = "server.suported.server.names", - description = "Http supported servers. This parameter should include under parameters Ex:" + - " 'server.suported.server.names:server'", - type = {DataType.STRING}, - optional = true, - defaultValue = "null"), - - //header validation parameters - @Parameter( - name = "request.size.validation.configuration", - description = "Parameters that responsible for validating the http request and request " + - "headers. Expected format of these parameters is as follows:" + - " \"'request.size.validation:xxx','request.size.validation.maximum.value:xxx'\"", - type = {DataType.STRING}, - optional = true, - defaultValue = "null"), - @Parameter( - name = "request.size.validation", - description = "To enable the request size validation.", + name = "ssl.configurations", + description = "SSL/TSL configurations in format `\"':',':'\"`.\n" + + "Some supported parameters:\n" + + " - SSL/TLS protocols: `'sslEnabledProtocols:TLSv1.1,TLSv1.2'`\n" + + " - List of ciphers: `'ciphers:TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256'`\n" + + " - Enable session creation: `'client.enable.session.creation:true'`\n" + + " - Supported server names: `'server.suported.server.names:server'`\n" + + " - Add HTTP SNIMatcher: `'server.supported.snimatchers:SNIMatcher'`", type = {DataType.STRING}, optional = true, - defaultValue = "false"), - @Parameter( - name = "request.size.validation.maximum.value", - description = "If request size is validated then maximum size.", - type = {DataType.STRING}, - optional = true, - defaultValue = "Integer.MAX_VALUE"), - @Parameter( - name = "request.size.validation.reject.status.code", - description = "If request is exceed maximum size and request.size.validation is enabled then " + - "status code to be send as response.", - type = {DataType.STRING}, - optional = true, - defaultValue = "401"), - @Parameter( - name = "request.size.validation.reject.message", - description = "If request is exceed maximum size and request.size.validation is enabled then " + - "status message to be send as response.", - type = {DataType.STRING}, - optional = true, - defaultValue = "Message is bigger than the valid size"), - @Parameter( - name = "request.size.validation.reject.message.content.type", - description = "If request is exceed maximum size and request.size.validation is enabled then " + - "content type to be send as response.", + defaultValue = "-"), + @Parameter( + name = "request.size.validation.configurations", + description = "Configurations to validate the HTTP request size.\n" + + "Expected format `\"':',':'\"`.\n" + + "Some supported configurations :\n" + + " - Enable request size validation: `'request.size.validation:true'`\n" + + " If request size is validated\n" + + " - Maximum request size: `'request.size.validation.maximum.value:2048'`\n" + + " - Response status code when request size validation fails: " + + "`'request.size.validation.reject.status.code:401'`\n" + + " - Response message when request size validation fails: " + + "`'request.size.validation.reject.message:Message is bigger than the valid size'`\n" + + " - Response Content-Type when request size validation fails: " + + "`'request.size.validation.reject.message.content.type:plain/text'`", type = {DataType.STRING}, optional = true, - defaultValue = "plain/text"), - @Parameter( - name = "header.size.validation", - description = "To enable the header size validation.", + defaultValue = "-"), + @Parameter( + name = "header.validation.configurations", + description = "Configurations to validate HTTP headers.\n" + + "Expected format `\"':',':'\"`.\n" + + "Some supported configurations :\n" + + " - Enable header size validation: `'header.size.validation:true'`\n" + + " If header size is validated\n" + + " - Maximum length of initial line: `'header.validation.maximum.request.line:4096'`\n" + + " - Maximum length of all headers: `'header.validation.maximum.size:8192'`\n" + + " - Maximum length of the content or each chunk: " + + "`'header.validation.maximum.chunk.size:8192'`\n" + + " - Response status code when header validation fails: " + + "`'header.validation.reject.status.code:401'`\n" + + " - Response message when header validation fails: " + + "`'header.validation.reject.message:Message header is bigger than the valid size'`\n" + + " - Response Content-Type when header validation fails: " + + "`'header.validation.reject.message.content.type:plain/text'`", type = {DataType.STRING}, optional = true, - defaultValue = "false"), - @Parameter( - name = "header.validation.maximum.request.line", - description = "If header header validation is enabled then the maximum request line.", - type = {DataType.STRING}, - optional = true, - defaultValue = "4096"), - @Parameter( - name = "header.validation.maximum.size", - description = "If header header validation is enabled then the maximum expected header size.", - type = {DataType.STRING}, - optional = true, - defaultValue = "8192"), - @Parameter( - name = "header.validation.maximum.chunk.size", - description = "If header header validation is enabled then the maximum expected chunk size.", - type = {DataType.STRING}, - optional = true, - defaultValue = "8192"), - @Parameter( - name = "header.validation.reject.status.code", - description = "401", + defaultValue = "-"), + @Parameter( + name = "server.bootstrap.configurations", + description = "Server bootstrap configurations in " + + "format `\"':',':'\"`.\n" + + "Some supported configurations :\n" + + " - Server connect timeout in millis:" + + " `'server.bootstrap.connect.timeout:15000'`\n" + + " - Server socket timeout in seconds:" + + " `'server.bootstrap.socket.timeout:15'`\n" + + " - Enable TCP no delay: `'server.bootstrap.nodelay:true'`\n" + + " - Enable server keep alive: `'server.bootstrap.keepalive:true'`\n" + + " - Send buffer size: `'server.bootstrap.sendbuffersize:1048576'`\n" + + " - Receive buffer size: `'server.bootstrap.recievebuffersize:1048576'`\n" + + " - Number of connections queued: `'server.bootstrap.socket.backlog:100'`", type = {DataType.STRING}, optional = true, - defaultValue = "If header is exceed maximum size and header.size.validation is enabled then " + - "status code to be send as response."), - @Parameter( - name = "header.validation.reject.message", - description = "If header is exceed maximum size and header.size.validation is enabled then " + - "message to be send as response.", - type = {DataType.STRING}, - optional = true, - defaultValue = "Message header is bigger than the valid size"), - @Parameter( - name = "header.validation.reject.message.content.type", - description = "If header is exceed maximum size and header.size.validation is enabled then " + - "content type to be send as response.", - type = {DataType.STRING}, - optional = true, - defaultValue = "plain/text"), - - //bootstrap configuration - @Parameter( - name = "server.bootstrap.configuration", - description = "Parameters that for bootstrap configurations of the server. Expected format of" + - " these parameters is as follows:" + - " \"'ciphers:xxx','sslEnabledProtocols,client.enable:xxx'\"", - type = {DataType.OBJECT}, - optional = true, - defaultValue = "null"), - @Parameter( - name = "server.bootstrap.nodelay", - description = "Http server no delay.", - type = {DataType.BOOL}, - optional = true, - defaultValue = "true"), - @Parameter( - name = "server.bootstrap.keepalive", - description = "Http server keep alive.", - type = {DataType.BOOL}, - optional = true, - defaultValue = "true"), - @Parameter( - name = "server.bootstrap.sendbuffersize", - description = "Http server send buffer size.", - type = {DataType.INT}, - optional = true, - defaultValue = "1048576"), - @Parameter( - name = "server.bootstrap.recievebuffersize", - description = "Http server receive buffer size.", - type = {DataType.INT}, - optional = true, - defaultValue = "1048576"), - @Parameter( - name = "server.bootstrap.connect.timeout", - description = "Http server connection timeout.", - type = {DataType.INT}, - optional = true, - defaultValue = "15000"), - @Parameter( - name = "server.bootstrap.socket.reuse", - description = "To enable http socket reuse.", - type = {DataType.BOOL}, - optional = true, - defaultValue = "false"), - @Parameter( - name = "server.bootstrap.socket.timeout", - description = "Http server socket timeout.", - type = {DataType.BOOL}, - optional = true, - defaultValue = "15"), - @Parameter( - name = "server.bootstrap.socket.backlog", - description = "THttp server socket backlog.", - type = {DataType.BOOL}, - optional = true, - defaultValue = "100"), + defaultValue = "-"), @Parameter( name = "trace.log.enabled", - description = "Http traffic monitoring.", + description = "Enable trace log for traffic monitoring.", defaultValue = "false", optional = true, type = {DataType.BOOL} - ) }, examples = { - @Example(syntax = "@source(type='http', receiver.url='http://localhost:9055/endpoints/RecPro', " + - "socketIdleTimeout='150000', parameters=\"'ciphers : TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256'," + - " 'sslEnabledProtocols:TLSv1.1,TLSv1.2'\",request.size.validation.configuration=\"request" + - ".size.validation:true\",server.bootstrap.configuration=\"server.bootstrap.socket" + - ".timeout:25\" " + - "@map(type='xml'))\n" - + "define stream FooStream (symbol string, price float, volume long);\n", - description = "Above source listenerConfiguration performs a default XML input mapping. " + - "The expected " - + "input is as follows:\n" - + "\n" + @Example(syntax = "" + + "@app.name('StockProcessor')\n\n" + + "@source(type='http', @map(type = 'json'))\n" + + "define stream StockStream (symbol string, price float, volume long);\n", + description = "Above HTTP source listeners on url " + + "`http://0.0.0.0:9763/StockProcessor/StockStream` " + + "for JSON messages on the format:\n" + + "```{\n" + + " \"event\": {\n" + + " \"symbol\": \"FB\",\n" + + " \"price\": 24.5,\n" + + " \"volume\": 5000\n" + + " }\n" + + "}```" + + "It maps the incoming messages and sends them to `StockStream` for processing."), + @Example(syntax = "" + + "@source(type='http', receiver.url='http://localhost:5005/stocks',\n" + + " @map(type = 'xml'))\n" + + "define stream StockStream (symbol string, price float, volume long);\n", + description = "Above HTTP source listeners on url `http://localhost:5005/stocks` for " + + "JSON messages on the format:\n" + + "```\n" + " \n" - + " WSO2\n" + + " Fb\n" + " 55.6\n" + " 100\n" + " \n" - + "\n" - + "If basic authentication is enabled via the `basic.auth.enabled='true` setting, " + - "each input event is also expected to contain the " + - "`Authorization:'Basic encodeBase64(username:Password)'` header.")}, + + "```\n" + + "It maps the incoming messages and sends them to `StockStream` for processing."), + }, systemParameter = { @SystemParameter( name = "serverBootstrapBossGroupSize", - description = "property to configure number of boss threads, which accepts incoming " + - "connections until the ports are unbound. Once connection accepts successfully, " + - "boss thread passes the accepted channel to one of the worker threads.", + description = "Number of boss threads to accept incoming connections.", defaultValue = "Number of available processors", - possibleParameters = "Any integer" + possibleParameters = "Any positive integer" ), @SystemParameter( name = "serverBootstrapWorkerGroupSize", - description = "property to configure number of worker threads, which performs non " + - "blocking read and write for one or more channels in non-blocking mode.", - defaultValue = "(Number of available processors)*2", - possibleParameters = "Any integer" + description = "Number of worker threads to accept the connections from boss threads and " + + "perform non-blocking read and write from one or more channels.", + defaultValue = "(Number of available processors) * 2", + possibleParameters = "Any positive integer" ), @SystemParameter( name = "serverBootstrapClientGroupSize", - description = "property to configure number of client threads, which performs non " + - "blocking read and write for one or more channels in non-blocking mode.", - defaultValue = "(Number of available processors)*2", - possibleParameters = "Any integer" + description = "Number of client threads to perform non-blocking read and write to " + + "one or more channels.", + defaultValue = "(Number of available processors) * 2", + possibleParameters = "Any positive integer" ), @SystemParameter( name = "defaultHost", @@ -355,35 +232,35 @@ defaultValue = "0.0.0.0", possibleParameters = "Any valid host" ), + @SystemParameter( + name = "defaultScheme", + description = "The default protocol.", + defaultValue = "http", + possibleParameters = {"http", "https"} + ), @SystemParameter( name = "defaultHttpPort", - description = "The default port if the default scheme is 'http'.", + description = "The default HTTP port when default scheme is `http`.", defaultValue = "8280", possibleParameters = "Any valid port" ), @SystemParameter( name = "defaultHttpsPort", - description = "The default port if the default scheme is 'https'.", + description = "The default HTTPS port when default scheme is `https`.", defaultValue = "8243", possibleParameters = "Any valid port" ), - @SystemParameter( - name = "defaultScheme", - description = "The default protocol.", - defaultValue = "http", - possibleParameters = {"http", "https"} - ), @SystemParameter( name = "keyStoreLocation", description = "The default keystore file path.", - defaultValue = "${carbon.home}/resources/security/wso2carbon.jks", - possibleParameters = "Path to wso2carbon.jks file" + defaultValue = "`${carbon.home}/resources/security/wso2carbon.jks`", + possibleParameters = "Path to `.jks` file" ), @SystemParameter( name = "keyStorePassword", description = "The default keystore password.", defaultValue = "wso2carbon", - possibleParameters = "String of keystore password" + possibleParameters = "Keystore password as string" ) } ) @@ -424,9 +301,9 @@ public StateFactory init(SourceEventListener sourceEventListener, OptionHolder o protected void initConnectorRegistry(OptionHolder optionHolder, ConfigReader configReader) { String requestSizeValidationConfigList = optionHolder - .validateAndGetStaticValue(HttpConstants.REQUEST_SIZE_VALIDATION_CONFIG, HttpConstants.EMPTY_STRING); + .validateAndGetStaticValue(HttpConstants.REQUEST_SIZE_VALIDATION_CONFIGS, HttpConstants.EMPTY_STRING); String serverBootstrapPropertiesList = optionHolder - .validateAndGetStaticValue(HttpConstants.SERVER_BOOTSTRAP_CONFIGURATION, HttpConstants.EMPTY_STRING); + .validateAndGetStaticValue(HttpConstants.SERVER_BOOTSTRAP_CONFIGS, HttpConstants.EMPTY_STRING); this.httpConnectorRegistry = HttpConnectorRegistry.getInstance(); this.httpConnectorRegistry.initBootstrapConfigIfFirst(configReader); @@ -476,9 +353,14 @@ protected void initSource(SourceEventListener sourceEventListener, OptionHolder String tlsStoreType = optionHolder .validateAndGetStaticValue(HttpConstants.TLS_STORE_TYPE, HttpConstants.EMPTY_STRING); String requestSizeValidationConfigList = optionHolder - .validateAndGetStaticValue(HttpConstants.REQUEST_SIZE_VALIDATION_CONFIG, HttpConstants.EMPTY_STRING); - String parameterList = optionHolder - .validateAndGetStaticValue(HttpConstants.SOURCE_PARAMETERS, HttpConstants.EMPTY_STRING); + .validateAndGetStaticValue(HttpConstants.REQUEST_SIZE_VALIDATION_CONFIGS, HttpConstants.EMPTY_STRING); + + String sslConfigs = optionHolder + .validateAndGetStaticValue(HttpConstants.SSS_CONFIGS, HttpConstants.EMPTY_STRING); + if (sslConfigs.equalsIgnoreCase(HttpConstants.EMPTY_STRING)) { + sslConfigs = optionHolder + .validateAndGetStaticValue(HttpConstants.SOURCE_PARAMETERS, HttpConstants.EMPTY_STRING); + } String traceLog = optionHolder.validateAndGetStaticValue(HttpConstants.TRACE_LOG_ENABLED, configReader .readConfig(HttpConstants.DEFAULT_TRACE_LOG_ENABLED, HttpConstants.EMPTY_STRING)); this.listenerConfiguration = HttpSourceUtil.getListenerConfiguration(this.listenerUrl, configReader); @@ -503,7 +385,7 @@ protected void initSource(SourceEventListener sourceEventListener, OptionHolder } isSecured = (listenerConfiguration.getScheme().equalsIgnoreCase(HttpConstants.SCHEME_HTTPS)); port = listenerConfiguration.getPort(); - listenerConfiguration.setParameters(HttpIoUtil.populateParameters(parameterList)); + listenerConfiguration.setParameters(HttpIoUtil.populateParameters(sslConfigs)); serviceDeploymentInfo = new ServiceDeploymentInfo(port, isSecured); } diff --git a/component/src/main/java/io/siddhi/extension/io/http/source/HttpSourceListener.java b/component/src/main/java/io/siddhi/extension/io/http/source/HttpSourceListener.java index ce02c9ea..89851dd5 100644 --- a/component/src/main/java/io/siddhi/extension/io/http/source/HttpSourceListener.java +++ b/component/src/main/java/io/siddhi/extension/io/http/source/HttpSourceListener.java @@ -100,7 +100,10 @@ protected void populateTransportHeaders(HttpCarbonMessage carbonMessage, String[ if (requestedTransportPropertyNames.length > 0) { //cannot be null according to siddhi impl int i = 0; for (String property : requestedTransportPropertyNames) { - properties[i] = carbonMessage.getHeader(property); //can be null + String value = carbonMessage.getHeader(property); + if (value != null) { + properties[i] = value; + } i++; } } @@ -110,7 +113,10 @@ protected void populateTransportProperties(HttpCarbonMessage carbonMessage, Stri if (requestedTransportPropertyNames.length > 0) { //cannot be null according to siddhi impl int i = 0; for (String property : requestedTransportPropertyNames) { - properties[i] = String.valueOf(carbonMessage.getProperty(property)); //can be null + String value = String.valueOf(carbonMessage.getProperty(property)); + if (value != null) { + properties[i] = value; + } i++; } } diff --git a/component/src/main/java/io/siddhi/extension/io/http/source/HttpSyncWorkerThread.java b/component/src/main/java/io/siddhi/extension/io/http/source/HttpSyncWorkerThread.java index b2572f8d..0316922d 100644 --- a/component/src/main/java/io/siddhi/extension/io/http/source/HttpSyncWorkerThread.java +++ b/component/src/main/java/io/siddhi/extension/io/http/source/HttpSyncWorkerThread.java @@ -64,7 +64,7 @@ public void run() { String payload = buf.lines().collect(Collectors.joining("\n")); if (!payload.equals(HttpConstants.EMPTY_STRING)) { - HTTPSourceRegistry.getRequestSource(sourceId).registerCallback(carbonMessage, messageId); + HTTPSourceRegistry.getServiceSource(sourceId).registerCallback(carbonMessage, messageId); sourceEventListener.onEvent(payload, trpProperties); if (logger.isDebugEnabled()) { logger.debug("Submitted Event " + payload + " Stream"); diff --git a/component/src/main/java/io/siddhi/extension/io/http/source/util/HttpSourceUtil.java b/component/src/main/java/io/siddhi/extension/io/http/source/util/HttpSourceUtil.java index 62bc8a08..2a5f1dd4 100644 --- a/component/src/main/java/io/siddhi/extension/io/http/source/util/HttpSourceUtil.java +++ b/component/src/main/java/io/siddhi/extension/io/http/source/util/HttpSourceUtil.java @@ -49,17 +49,17 @@ import static io.siddhi.extension.io.http.util.HttpConstants.REQUEST_SIZE_VALIDATION_REJECT_MESSAGE; import static io.siddhi.extension.io.http.util.HttpConstants.REQUEST_SIZE_VALIDATION_REJECT_MESSAGE_CONTENT_TYPE; import static io.siddhi.extension.io.http.util.HttpConstants.REQUEST_SIZE_VALIDATION_REJECT_STATUS_CODE; -import static io.siddhi.extension.io.http.util.HttpConstants.SERVER_BOOTSTRAP_BOSS_GROUP_SIZE_PARAM; -import static io.siddhi.extension.io.http.util.HttpConstants.SERVER_BOOTSTRAP_CLIENT_GROUP_SIZE_PARAM; +//import static io.siddhi.extension.io.http.util.HttpConstants.SERVER_BOOTSTRAP_BOSS_GROUP_SIZE_PARAM; +//import static io.siddhi.extension.io.http.util.HttpConstants.SERVER_BOOTSTRAP_CLIENT_GROUP_SIZE_PARAM; import static io.siddhi.extension.io.http.util.HttpConstants.SERVER_BOOTSTRAP_CONNECT_TIMEOUT_PARAM; import static io.siddhi.extension.io.http.util.HttpConstants.SERVER_BOOTSTRAP_KEEPALIVE_PARAM; import static io.siddhi.extension.io.http.util.HttpConstants.SERVER_BOOTSTRAP_NODELAY_PARAM; import static io.siddhi.extension.io.http.util.HttpConstants.SERVER_BOOTSTRAP_RECIEVEBUFFERSIZE_PARAM; import static io.siddhi.extension.io.http.util.HttpConstants.SERVER_BOOTSTRAP_SENDBUFFERSIZE_PARAM; import static io.siddhi.extension.io.http.util.HttpConstants.SERVER_BOOTSTRAP_SOCKET_BACKLOG_PARAM; -import static io.siddhi.extension.io.http.util.HttpConstants.SERVER_BOOTSTRAP_SOCKET_REUSE_PARAM; +//import static io.siddhi.extension.io.http.util.HttpConstants.SERVER_BOOTSTRAP_SOCKET_REUSE_PARAM; import static io.siddhi.extension.io.http.util.HttpConstants.SERVER_BOOTSTRAP_SOCKET_TIMEOUT_PARAM; -import static io.siddhi.extension.io.http.util.HttpConstants.SERVER_BOOTSTRAP_WORKER_GROUP_SIZE_PARAM; +//import static io.siddhi.extension.io.http.util.HttpConstants.SERVER_BOOTSTRAP_WORKER_GROUP_SIZE_PARAM; /** * Handles the http source util functions. @@ -238,15 +238,15 @@ private static Map trpPropertyTypeMap() { trpPropertyTypes.put(HEADER_VALIDATION_REJECT_STATUS_CODE, TrpPropertyTypes.INTEGER); trpPropertyTypes.put(HEADER_VALIDATION_REJECT_MESSAGE, TrpPropertyTypes.STRING); trpPropertyTypes.put(HEADER_VALIDATION_REJECT_MESSAGE_CONTENT_TYPE, TrpPropertyTypes.STRING); - trpPropertyTypes.put(SERVER_BOOTSTRAP_BOSS_GROUP_SIZE_PARAM, TrpPropertyTypes.INTEGER); - trpPropertyTypes.put(SERVER_BOOTSTRAP_WORKER_GROUP_SIZE_PARAM, TrpPropertyTypes.INTEGER); - trpPropertyTypes.put(SERVER_BOOTSTRAP_CLIENT_GROUP_SIZE_PARAM, TrpPropertyTypes.INTEGER); +// trpPropertyTypes.put(SERVER_BOOTSTRAP_BOSS_GROUP_SIZE_PARAM, TrpPropertyTypes.INTEGER); +// trpPropertyTypes.put(SERVER_BOOTSTRAP_WORKER_GROUP_SIZE_PARAM, TrpPropertyTypes.INTEGER); +// trpPropertyTypes.put(SERVER_BOOTSTRAP_CLIENT_GROUP_SIZE_PARAM, TrpPropertyTypes.INTEGER); trpPropertyTypes.put(SERVER_BOOTSTRAP_NODELAY_PARAM, TrpPropertyTypes.BOOLEAN); trpPropertyTypes.put(SERVER_BOOTSTRAP_KEEPALIVE_PARAM, TrpPropertyTypes.BOOLEAN); trpPropertyTypes.put(SERVER_BOOTSTRAP_SENDBUFFERSIZE_PARAM, TrpPropertyTypes.INTEGER); trpPropertyTypes.put(SERVER_BOOTSTRAP_RECIEVEBUFFERSIZE_PARAM, TrpPropertyTypes.INTEGER); trpPropertyTypes.put(SERVER_BOOTSTRAP_CONNECT_TIMEOUT_PARAM, TrpPropertyTypes.INTEGER); - trpPropertyTypes.put(SERVER_BOOTSTRAP_SOCKET_REUSE_PARAM, TrpPropertyTypes.BOOLEAN); +// trpPropertyTypes.put(SERVER_BOOTSTRAP_SOCKET_REUSE_PARAM, TrpPropertyTypes.BOOLEAN); trpPropertyTypes.put(SERVER_BOOTSTRAP_SOCKET_TIMEOUT_PARAM, TrpPropertyTypes.INTEGER); trpPropertyTypes.put(SERVER_BOOTSTRAP_SOCKET_BACKLOG_PARAM, TrpPropertyTypes.INTEGER); return trpPropertyTypes; diff --git a/component/src/main/java/io/siddhi/extension/io/http/util/HTTPSourceRegistry.java b/component/src/main/java/io/siddhi/extension/io/http/util/HTTPSourceRegistry.java index ed9dfa3a..d15e585d 100644 --- a/component/src/main/java/io/siddhi/extension/io/http/util/HTTPSourceRegistry.java +++ b/component/src/main/java/io/siddhi/extension/io/http/util/HTTPSourceRegistry.java @@ -18,8 +18,8 @@ */ package io.siddhi.extension.io.http.util; -import io.siddhi.extension.io.http.source.HttpRequestSource; -import io.siddhi.extension.io.http.source.HttpResponseSource; +import io.siddhi.extension.io.http.source.HttpCallResponseSource; +import io.siddhi.extension.io.http.source.HttpServiceSource; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; @@ -29,36 +29,36 @@ */ public class HTTPSourceRegistry { - private static Map requestSourceRegistry = new ConcurrentHashMap<>(); - private static Map responseSourceRegistry = new ConcurrentHashMap<>(); + private static Map serviceSourceRegistry = new ConcurrentHashMap<>(); + private static Map callResponseSourceRegistry = new ConcurrentHashMap<>(); - // handle request sources - public static HttpRequestSource getRequestSource(String sourceId) { - return requestSourceRegistry.get(sourceId); + // handle service sources + public static HttpServiceSource getServiceSource(String sourceId) { + return serviceSourceRegistry.get(sourceId); } - public static void registerRequestSource(String sourceId, HttpRequestSource source) { - requestSourceRegistry.put(sourceId, source); + public static void registerServiceSource(String sourceId, HttpServiceSource source) { + serviceSourceRegistry.put(sourceId, source); } - public static void removeRequestSource(String sourceId) { - requestSourceRegistry.remove(sourceId); + public static void removeServiceSource(String sourceId) { + serviceSourceRegistry.remove(sourceId); } // handle response sources - public static HttpResponseSource getResponseSource(String sinkId, String statusCode) { - return responseSourceRegistry.get(new ResponseSourceId(sinkId, statusCode)); + public static HttpCallResponseSource getCallResponseSource(String sinkId, String statusCode) { + return callResponseSourceRegistry.get(new ResponseSourceId(sinkId, statusCode)); } - public static void registerResponseSource(String sinkId, String statusCode, HttpResponseSource source) { - responseSourceRegistry.put(new ResponseSourceId(sinkId, statusCode), source); + public static void registerCallResponseSource(String sinkId, String statusCode, HttpCallResponseSource source) { + callResponseSourceRegistry.put(new ResponseSourceId(sinkId, statusCode), source); } - public static void removeResponseSource(String sinkId, String statusCode) { - responseSourceRegistry.remove(new ResponseSourceId(sinkId, statusCode)); + public static void removeCallResponseSource(String sinkId, String statusCode) { + callResponseSourceRegistry.remove(new ResponseSourceId(sinkId, statusCode)); } - public static Map getResponseSourceRegistry() { - return responseSourceRegistry; + public static Map getCallResponseSourceRegistry() { + return callResponseSourceRegistry; } } diff --git a/component/src/main/java/io/siddhi/extension/io/http/util/HttpConstants.java b/component/src/main/java/io/siddhi/extension/io/http/util/HttpConstants.java index 812b32e2..312fe5bf 100644 --- a/component/src/main/java/io/siddhi/extension/io/http/util/HttpConstants.java +++ b/component/src/main/java/io/siddhi/extension/io/http/util/HttpConstants.java @@ -101,8 +101,8 @@ public class HttpConstants { public static final String KEYSTORE_FILE_VALUE = "${carbon.home}/resources/security/wso2carbon.jks"; public static final String KEYSTORE_PASSWORD = "keyStorePassword"; public static final String KEYSTORE_PASSWORD_VALUE = "wso2carbon"; - public static final String CERT_PASSWORD = "certPassword"; - public static final String CERT_PASSWORD_VALUE = "wso2carbon"; +// public static final String CERT_PASSWORD = "certPassword"; +// public static final String CERT_PASSWORD_VALUE = "wso2carbon"; public static final String DEFAULT_SOURCE_SCHEME = "defaultScheme"; public static final String DEFAULT_SOURCE_SCHEME_VALUE = "http"; public static final String DEFAULT_TRACE_LOG_ENABLED = "httpTraceLogEnabled"; @@ -121,18 +121,21 @@ public class HttpConstants { public static final String SSL_VERIFY_CLIENT = "ssl.verify.client"; public static final String SSL_PROTOCOL = "ssl.protocol"; public static final String TLS_STORE_TYPE = "tls.store.type"; + @Deprecated public static final String SOURCE_PARAMETERS = "parameters"; - public static final String REQUEST_SIZE_VALIDATION_CONFIG = "request.size.validation.configurations"; - public static final String SERVER_BOOTSTRAP_CONFIGURATION = "server.bootstrap.configurations"; - public static final String CLIENT_CHUNK_ENABLED = "chunk.disabled"; - public static final String CLIENT_FOLLOW_REDIRECT = "follow.redirect"; - public static final String CLIENT_MAX_REDIRECT_COUNT = "max.redirect.count"; + public static final String SSS_CONFIGS = "ssl.configurations"; + public static final String REQUEST_SIZE_VALIDATION_CONFIGS = "request.size.validation.configurations"; + public static final String SERVER_BOOTSTRAP_CONFIGS = "server.bootstrap.configurations"; + public static final String CLIENT_CHUNK_DISABLED = "chunk.disabled"; +// public static final String CLIENT_FOLLOW_REDIRECT = "follow.redirect"; +// public static final String CLIENT_MAX_REDIRECT_COUNT = "max.redirect.count"; public static final String CLIENT_BOOTSTRAP_CONFIGURATION = "client.bootstrap.configurations"; - public static final String CLIENT_POOL_CONFIGURATION = "client.threadpool.configurations"; +// public static final String CLIENT_POOL_CONFIGURATION = "client.threadpool.configurations"; public static final String PROXY_HOST = "proxy.host"; public static final String PROXY_PORT = "proxy.port"; public static final String PROXY_USERNAME = "proxy.username"; public static final String PROXY_PASSWORD = "proxy.password"; + @Deprecated public static final String SINK_PARAMETERS = "parameters"; public static final String MSG_ID = "msgId"; //http sink transport properties @@ -152,16 +155,17 @@ public class HttpConstants { public static final String HEADER_VALIDATION_REJECT_MESSAGE = "header.validation.reject.message"; public static final String HEADER_VALIDATION_REJECT_MESSAGE_CONTENT_TYPE = "header.validation.reject.message" + ".content.type"; - public static final String SERVER_BOOTSTRAP_BOSS_GROUP_SIZE_PARAM = "server.bootstrap.boss.group.size"; - public static final String SERVER_BOOTSTRAP_WORKER_GROUP_SIZE_PARAM = "server.bootstrap.worker.group.size"; - public static final String SERVER_BOOTSTRAP_CLIENT_GROUP_SIZE_PARAM = "server.bootstrap.client.group.size"; + // Not read in the carbon http + // public static final String SERVER_BOOTSTRAP_BOSS_GROUP_SIZE_PARAM = "server.bootstrap.boss.group.size"; + // public static final String SERVER_BOOTSTRAP_WORKER_GROUP_SIZE_PARAM = "server.bootstrap.worker.group.size"; + // public static final String SERVER_BOOTSTRAP_CLIENT_GROUP_SIZE_PARAM = "server.bootstrap.client.group.size"; + // public static final String SERVER_BOOTSTRAP_SOCKET_REUSE_PARAM = "server.bootstrap.socket.reuse"; + public static final String SERVER_BOOTSTRAP_SOCKET_TIMEOUT_PARAM = "server.bootstrap.socket.timeout"; + public static final String SERVER_BOOTSTRAP_CONNECT_TIMEOUT_PARAM = "server.bootstrap.connect.timeout"; public static final String SERVER_BOOTSTRAP_NODELAY_PARAM = "server.bootstrap.nodelay"; public static final String SERVER_BOOTSTRAP_KEEPALIVE_PARAM = "server.bootstrap.keepalive"; public static final String SERVER_BOOTSTRAP_SENDBUFFERSIZE_PARAM = "server.bootstrap.sendbuffersize"; public static final String SERVER_BOOTSTRAP_RECIEVEBUFFERSIZE_PARAM = "server.bootstrap.recievebuffersize"; - public static final String SERVER_BOOTSTRAP_CONNECT_TIMEOUT_PARAM = "server.bootstrap.connect.timeout"; - public static final String SERVER_BOOTSTRAP_SOCKET_REUSE_PARAM = "server.bootstrap.socket.reuse"; - public static final String SERVER_BOOTSTRAP_SOCKET_TIMEOUT_PARAM = "server.bootstrap.socket.timeout"; public static final String SERVER_BOOTSTRAP_SOCKET_BACKLOG_PARAM = "server.bootstrap.socket.backlog"; //http source transport properties @@ -219,8 +223,8 @@ public class HttpConstants { public static final String BLOCKING_IO = "blocking.io"; //pool configurations - public static final String CONNECTION_POOL_COUNT = "connection.pool.count"; - public static final String DEFAULT_CONNECTION_POOL_COUNT = "0"; +// public static final String CONNECTION_POOL_COUNT = "connection.pool.count"; +// public static final String DEFAULT_CONNECTION_POOL_COUNT = "0"; public static final String MAX_ACTIVE_CONNECTIONS_PER_POOL = "max.pool.active.connections"; public static final String DEFAULT_MAX_ACTIVE_CONNECTIONS_PER_POOL = "-1"; // unlimited public static final String MIN_IDLE_CONNECTIONS_PER_POOL = "min.pool.idle.connections"; diff --git a/component/src/test/java/io/siddhi/extension/io/http/sink/HttpCallResponseTestCase.java b/component/src/test/java/io/siddhi/extension/io/http/sink/HttpCallResponseTestCase.java new file mode 100644 index 00000000..7b807856 --- /dev/null +++ b/component/src/test/java/io/siddhi/extension/io/http/sink/HttpCallResponseTestCase.java @@ -0,0 +1,311 @@ +/* + * Copyright (c) 2019, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. + * + * WSO2 Inc. licenses this file to you under the Apache License, + * Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package io.siddhi.extension.io.http.sink; + +import io.siddhi.core.SiddhiAppRuntime; +import io.siddhi.core.SiddhiManager; +import io.siddhi.core.event.Event; +import io.siddhi.core.stream.input.InputHandler; +import io.siddhi.core.stream.output.StreamCallback; +import io.siddhi.core.util.EventPrinter; +import io.siddhi.core.util.SiddhiTestHelper; +import io.siddhi.extension.io.http.sink.util.HttpFileServerListenerHandler; +import io.siddhi.extension.io.http.sink.util.HttpServerListenerHandler; +import org.apache.log4j.Logger; +import org.testng.Assert; +import org.testng.annotations.BeforeClass; +import org.testng.annotations.Test; + +import java.io.File; +import java.util.concurrent.atomic.AtomicInteger; + +public class HttpCallResponseTestCase { + private static final Logger log = Logger.getLogger(HttpCallResponseTestCase.class); + + private AtomicInteger eventCount = new AtomicInteger(0); + private String downloadPath; + private String rootPath; + + + @BeforeClass + public void init() { + ClassLoader classLoader = getClass().getClassLoader(); + rootPath = classLoader.getResource("files").getFile(); + downloadPath = rootPath + "/downloads"; + } + + @Test + public void testHTTPRequestResponse1() throws Exception { + log.info("Send a POST request with a json body message and receive the response"); + SiddhiManager siddhiManager = new SiddhiManager(); + String inStreamDefinition = "" + + "define stream FooStream (message String,headers String);" + + "@sink(type='http-call',publisher.url='http://localhost:8005/abc'," + + " method='POST'," + + "headers='{{headers}}',sink.id='source-1'," + + "@map(type='json', @payload('{{message}}'))) " + + "Define stream BarStream (message String, headers String);" + + "" + + "@source(type='http-call-response', sink.id='source-1', " + + "@map(type='json',@attributes(name='name', id='id')))" + + "define stream responseStream(name String, id int);"; + String query = ( + "@info(name = 'query') " + + "from FooStream " + + "select message,headers " + + "insert into BarStream;" + ); + + String payload = "{\"name\":\"wso2\", \"id\":\"1234\"}"; + String headers = "'comapny:wso2', country:sl'"; + SiddhiAppRuntime siddhiAppRuntime = siddhiManager.createSiddhiAppRuntime(inStreamDefinition + query); + InputHandler fooStream = siddhiAppRuntime.getInputHandler("FooStream"); + StreamCallback streamCallback = new StreamCallback() { + @Override + public void receive(Event[] events) { + for (int i = 0; i < events.length; i++) { + eventCount.incrementAndGet(); + switch (i) { + case 0: + Assert.assertEquals("wso2", (String) events[i].getData()[0]); + Assert.assertEquals(1234, events[i].getData()[1]); + break; + + default: + Assert.fail(); + } + } + } + }; + + siddhiAppRuntime.addCallback("responseStream", streamCallback); + HttpServerListenerHandler httpServerListenerHandler = new HttpServerListenerHandler(8005); + httpServerListenerHandler.run(); + siddhiAppRuntime.start(); + + fooStream.send(new Object[]{payload, headers}); + Thread.sleep(1000); + SiddhiTestHelper.waitForEvents(1000, 1, eventCount, 1000); + + Assert.assertEquals(eventCount.get(), 1); + siddhiAppRuntime.shutdown(); + httpServerListenerHandler.shutdown(); + } + + @Test + public void testHTTPRequestResponse2() throws Exception { + log.info("Send a POST request with a json body message and receive the response along with attributes in the " + + "request"); + SiddhiManager siddhiManager = new SiddhiManager(); + String inStreamDefinition = "" + + "define stream FooStream (name String, id int, headers String, volume long, price float);" + + "@sink(type='http-call',publisher.url='http://localhost:8005/abc'," + + " method='POST'," + + "headers='{{headers}}',sink.id='source-1'," + + "@map(type='json', @payload(\"\"\"{\"name\":\"{{name}}\",\"id\":{{id}}}\"\"\"))) " + + "Define stream BarStream (name String, id int, headers String, volume long, price float);" + + "" + + "@source(type='http-call-response', sink.id='source-1', " + + "@map(type='json',@attributes(name='name', id='id', headers='trp:headers', volume='trp:volume', " + + "price='trp:price')))" + + "define stream responseStream(name String, id int, headers String, volume long, price float);"; + String query = ( + "@info(name = 'query') " + + "from FooStream " + + "select * " + + "insert into BarStream;" + ); + + SiddhiAppRuntime siddhiAppRuntime = siddhiManager.createSiddhiAppRuntime(inStreamDefinition + query); + InputHandler fooStream = siddhiAppRuntime.getInputHandler("FooStream"); + StreamCallback streamCallback = new StreamCallback() { + @Override + public void receive(Event[] events) { + for (int i = 0; i < events.length; i++) { + EventPrinter.print(events); + switch (eventCount.getAndIncrement()) { + case 0: + Assert.assertEquals(events[i].getData()[0].toString(), "wso2"); + Assert.assertEquals(events[i].getData()[1], 100); + Assert.assertEquals(events[i].getData()[2].toString(), "'country:sri-lanka'"); + Assert.assertEquals(events[i].getData(3), "1000"); + Assert.assertEquals(events[i].getData(4).toString(), "111.11"); + break; + + default: + Assert.fail(); + } + } + } + }; + + siddhiAppRuntime.addCallback("responseStream", streamCallback); + HttpServerListenerHandler httpServerListenerHandler = new HttpServerListenerHandler(8005); + httpServerListenerHandler.run(); + siddhiAppRuntime.start(); + + fooStream.send(new Object[]{"wso2", 100, "'country:sri-lanka'", 1000L, 111.11f}); + + SiddhiTestHelper.waitForEvents(1000, 1, eventCount, 1000); + + Assert.assertEquals(eventCount.get(), 1); + siddhiAppRuntime.shutdown(); + httpServerListenerHandler.shutdown(); + } + + @Test + public void testHTTPRequestResponse3() throws Exception { + log.info("Download a file"); + SiddhiManager siddhiManager = new SiddhiManager(); + String inStreamDefinition = "" + + "define stream FooStream (name String, id int, headers String, downloadPath string);" + + "@sink(type='http-call'," + + "downloading.enabled='true'," + + "download.path='{{downloadPath}}'," + + "publisher.url='http://localhost:8005/files'," + + " method='GET'," + + "headers='{{headers}}',sink.id='source-1'," + + "@map(type='json')) " + + "Define stream BarStream (name String, id int, headers String, downloadPath string);" + + "" + + "@source(type='http-call-response', sink.id='source-1', http.status.code='2\\d+', " + + "@map(type='text', regex.A='((.|\\n)*)', @attributes(headers='trp:headers', fileName='A[1]'))) " + + "define stream responseStream(fileName string, headers string);"; + String query = ( + "@info(name = 'query') " + + "from FooStream " + + "select * " + + "insert into BarStream;" + ); + + String downloadPath = rootPath + File.separator + "downloadedFile.txt"; + + SiddhiAppRuntime siddhiAppRuntime = siddhiManager.createSiddhiAppRuntime(inStreamDefinition + query); + InputHandler fooStream = siddhiAppRuntime.getInputHandler("FooStream"); + StreamCallback streamCallback = new StreamCallback() { + @Override + public void receive(Event[] events) { + for (int i = 0; i < events.length; i++) { + EventPrinter.print(events); + switch (eventCount.getAndIncrement()) { + case 0: + Assert.assertEquals(events[i].getData()[0].toString(), downloadPath); + break; + default: + Assert.fail(); + } + } + } + }; + + siddhiAppRuntime.addCallback("responseStream", streamCallback); + HttpFileServerListenerHandler httpFileServerListenerHandler = new HttpFileServerListenerHandler(8005); + httpFileServerListenerHandler.run(); + siddhiAppRuntime.start(); + + fooStream.send(new Object[]{"wso2", 100, "'country:sri-lanka'", downloadPath}); + + SiddhiTestHelper.waitForEvents(1000, 1, eventCount, 1000); + + File file = new File(downloadPath); + Assert.assertTrue(file != null); + Assert.assertTrue(file.isFile()); + Assert.assertEquals(file.getName(), "downloadedFile.txt"); + + Assert.assertEquals(eventCount.get(), 1); + siddhiAppRuntime.shutdown(); + httpFileServerListenerHandler.shutdown(); + } + + @Test + public void testHTTPRequestResponse4() throws Exception { + log.info("Try to download a file that not exists."); + SiddhiManager siddhiManager = new SiddhiManager(); + String inStreamDefinition = "" + + "define stream FooStream (name String, id int, headers String, downloadPath string);" + + "@sink(type='http-call'," + + "downloading.enabled='true'," + + "download.path='{{downloadPath}}'," + + "publisher.url='http://localhost:8005/files2', " + + "method='GET'," + + "headers='{{headers}}',sink.id='source-1'," + + "@map(type='json')) " + + "Define stream BarStream (name String, id int, headers String, downloadPath string);" + + "" + + "@source(type='http-call-response', sink.id='source-1', http.status.code='2\\d+', " + + "@map(type='text', regex.A='((.|\\n)*)', @attributes(headers='trp:headers', fileName='A[1]'))) " + + "define stream responseStream2xx(fileName string, headers string);" + + + "@source(type='http-call-response', sink.id='source-1', http.status.code='4\\d+', " + + "@map(type='text', regex.A='((.|\\n)*)', @attributes(headers='trp:headers', errorMsg='A[1]'))) " + + "define stream responseStream4xx(errorMsg string);"; + String query = ( + "@info(name = 'query') " + + "from FooStream " + + "select * " + + "insert into BarStream;" + ); + + String downloadPath = rootPath + File.separator + "downloadedFile.txt"; + + SiddhiAppRuntime siddhiAppRuntime = siddhiManager.createSiddhiAppRuntime(inStreamDefinition + query); + InputHandler fooStream = siddhiAppRuntime.getInputHandler("FooStream"); + StreamCallback streamCallback2xx = new StreamCallback() { + @Override + public void receive(Event[] events) { + EventPrinter.print(events); + eventCount.getAndIncrement(); + Assert.fail(); + } + }; + + StreamCallback streamCallback4xx = new StreamCallback() { + @Override + public void receive(Event[] events) { + EventPrinter.print(events); + for (int i = 0; i < events.length; i++) { + switch (eventCount.getAndIncrement()) { + case 0: + break; + default: + Assert.fail(); + } + } + } + }; + + siddhiAppRuntime.addCallback("responseStream2xx", streamCallback2xx); + siddhiAppRuntime.addCallback("responseStream4xx", streamCallback4xx); + HttpFileServerListenerHandler httpFileServerListenerHandler = new HttpFileServerListenerHandler(8005, 400); + httpFileServerListenerHandler.run(); + siddhiAppRuntime.start(); + + fooStream.send(new Object[]{"wso2", 100, "'country:sri-lanka'", downloadPath}); + + SiddhiTestHelper.waitForEvents(1000, 1, eventCount, 1000); + + File file = new File(downloadPath); + Assert.assertTrue(file != null); + Assert.assertTrue(file.isFile()); + Assert.assertEquals(file.getName(), "downloadedFile.txt"); + + Assert.assertEquals(eventCount.get(), 1); + siddhiAppRuntime.shutdown(); + httpFileServerListenerHandler.shutdown(); + } +} diff --git a/component/src/test/java/io/siddhi/extension/io/http/sink/HttpOAuthTestCase.java b/component/src/test/java/io/siddhi/extension/io/http/sink/HttpOAuthTestCase.java index 7d32fc0e..da3d8da4 100644 --- a/component/src/test/java/io/siddhi/extension/io/http/sink/HttpOAuthTestCase.java +++ b/component/src/test/java/io/siddhi/extension/io/http/sink/HttpOAuthTestCase.java @@ -28,6 +28,7 @@ import io.siddhi.extension.map.xml.sinkmapper.XMLSinkMapper; import org.apache.log4j.Logger; import org.testng.Assert; +import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; import java.nio.file.Path; @@ -39,6 +40,13 @@ public class HttpOAuthTestCase { private static final Logger log = Logger.getLogger(HttpAuthTestCase.class); private AtomicInteger eventCount = new AtomicInteger(0); + @BeforeMethod + public void init() { + eventCount.set(0); + setCarbonHome(); + } + + /** * Set carbon-home */ @@ -56,7 +64,6 @@ private void setCarbonHome() { */ @Test public void testHTTPOAuthTrue() throws Exception { - setCarbonHome(); log.info("Creating test for publishing events with valid access token."); SiddhiManager siddhiManager = new SiddhiManager(); siddhiManager.setExtension("xml-output-mapper", XMLSinkMapper.class); @@ -109,7 +116,6 @@ public void testHTTPOAuthTrue() throws Exception { */ @Test public void testHTTPOAuthTrueWithoutAccessToken() throws Exception { - setCarbonHome(); log.info(" Creating test for publishing events with OAuth without access token."); SiddhiManager siddhiManager = new SiddhiManager(); siddhiManager.setExtension("xml-output-mapper", XMLSinkMapper.class); @@ -163,7 +169,6 @@ public void testHTTPOAuthTrueWithoutAccessToken() throws Exception { */ @Test public void testHTTPOAuthClientCredentialGrant() throws Exception { - setCarbonHome(); log.info(" Creating test for publishing events with expired access token and generate new access token " + "using client credential grant"); SiddhiManager siddhiManager = new SiddhiManager(); @@ -220,7 +225,6 @@ public void testHTTPOAuthClientCredentialGrant() throws Exception { public void testHTTPOAuthPasswordGrant() throws Exception { log.info(" Creating test for publishing events with expired access token and generate new access token " + "using Password grant"); - setCarbonHome(); SiddhiManager siddhiManager = new SiddhiManager(); siddhiManager.setExtension("xml-output-mapper", XMLSinkMapper.class); String inStreamDefinition = "Define stream FooStream (message String,method String,headers String);" + @@ -276,7 +280,6 @@ public void testHTTPOAuthPasswordGrant() throws Exception { public void testHTTPOAuthRefreshGrant() throws Exception { log.info(" Creating test for publishing events with expired access token and generate new access token " + "using Refresh grant"); - setCarbonHome(); SiddhiManager siddhiManager = new SiddhiManager(); siddhiManager.setExtension("xml-output-mapper", XMLSinkMapper.class); String inStreamDefinition = "Define stream FooStream (message String,method String,headers String," + @@ -333,7 +336,6 @@ public void testHTTPOAuthRefreshGrant() throws Exception { public void testHTTPOAuthWithExpiredTokens() throws Exception { log.info(" Creating test for publishing events with expired access token, refresh token and generate " + "new access token using client credential grant"); - setCarbonHome(); SiddhiManager siddhiManager = new SiddhiManager(); siddhiManager.setExtension("xml-output-mapper", XMLSinkMapper.class); String inStreamDefinition = "Define stream FooStream (message String,method String,headers String," + @@ -389,7 +391,6 @@ public void testHTTPOAuthWithExpiredTokens() throws Exception { public void testHTTPRequestResponse() throws Exception { log.info(" Creating test for send a request and get a response with expired access token and generate" + " new access token using client credential grant"); - setCarbonHome(); SiddhiManager siddhiManager = new SiddhiManager(); String inStreamDefinition = "define stream FooStream (message String,headers String);" + "@sink(type='http-request',publisher.url='https://localhost:8015/abc', method='POST'," @@ -442,4 +443,66 @@ public void receive(Event[] events) { httpOAuthListenerHandler.shutdown(); } + /** + * Creating test for send a request and get a response with expired access token. From the system it will generate + * new access token using client credential grant + * + * @throws Exception Interrupted exception + */ + @Test + public void testHTTPCallResponse() throws Exception { + log.info(" Creating test for send a request and get a response with expired access token and generate" + + " new access token using client credential grant"); + SiddhiManager siddhiManager = new SiddhiManager(); + String inStreamDefinition = "define stream FooStream (message String,headers String);" + + "@sink(type='http-call',publisher.url='https://localhost:8016/abc', method='POST'," + + "headers='{{headers}}',sink.id='source-1',consumer.key='addConsumerKey'," + + " consumer.secret='addConsumerSecret', token.url='https://localhost:8005/token', " + + "@map(type='json', @payload('{{message}}'))) " + + "Define stream BarStream (message String, headers String);" + + "@source(type='http-call-response', sink.id='source-1', " + + "@map(type='json',@attributes(name='name', id='id')))" + + "define stream responseStream(name String, id int);"; + String query = ( + "@info(name = 'query') " + + "from FooStream " + + "select message,headers " + + "insert into BarStream;" + ); + + String payload = "{\"name\":\"wso2\", \"id\":\"1234\"}"; + String headers = "'company:wso2','country:sl','Content-Type:plan/text','Authorization: Bearer xxxxx'"; + SiddhiAppRuntime siddhiAppRuntime = siddhiManager.createSiddhiAppRuntime(inStreamDefinition + query); + InputHandler fooStream = siddhiAppRuntime.getInputHandler("FooStream"); + StreamCallback streamCallback = new StreamCallback() { + @Override + public void receive(Event[] events) { + for (int i = 0; i < events.length; i++) { + eventCount.incrementAndGet(); + switch (i) { + case 0: + Assert.assertEquals("wso2", (String) events[i].getData()[0]); + Assert.assertEquals(1234, events[i].getData()[1]); + break; + + default: + Assert.fail(); + } + } + } + }; + siddhiAppRuntime.addCallback("responseStream", streamCallback); + HttpOAuthListenerHandler httpOAuthListenerHandler = new HttpOAuthListenerHandler(8005, 8016); + httpOAuthListenerHandler.run(); + siddhiAppRuntime.start(); + + fooStream.send(new Object[]{payload, headers}); + Thread.sleep(1000); + SiddhiTestHelper.waitForEvents(1000, 1, eventCount, 1000); + + Assert.assertEquals(eventCount.get(), 1); + siddhiAppRuntime.shutdown(); + httpOAuthListenerHandler.shutdown(); + } + } diff --git a/component/src/test/java/io/siddhi/extension/io/http/sink/HttpRequestResponseTestCase.java b/component/src/test/java/io/siddhi/extension/io/http/sink/HttpRequestResponseTestCase.java index de3b127c..0184d41f 100644 --- a/component/src/test/java/io/siddhi/extension/io/http/sink/HttpRequestResponseTestCase.java +++ b/component/src/test/java/io/siddhi/extension/io/http/sink/HttpRequestResponseTestCase.java @@ -30,6 +30,7 @@ import org.apache.log4j.Logger; import org.testng.Assert; import org.testng.annotations.BeforeClass; +import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; import java.io.File; @@ -50,13 +51,18 @@ public void init() { downloadPath = rootPath + "/downloads"; } + @BeforeMethod + public void initMethod() { + eventCount.set(0); + } + @Test public void testHTTPRequestResponse1() throws Exception { log.info("Send a POST request with a json body message and receive the response"); SiddhiManager siddhiManager = new SiddhiManager(); String inStreamDefinition = "" + "define stream FooStream (message String,headers String);" - + "@sink(type='http-request',publisher.url='http://localhost:8005/abc'," + + + "@sink(type='http-request',publisher.url='http://localhost:8007/abc'," + " method='POST'," + "headers='{{headers}}',sink.id='source-1'," + "@map(type='json', @payload('{{message}}'))) " @@ -95,7 +101,7 @@ public void receive(Event[] events) { }; siddhiAppRuntime.addCallback("responseStream", streamCallback); - HttpServerListenerHandler httpServerListenerHandler = new HttpServerListenerHandler(8005); + HttpServerListenerHandler httpServerListenerHandler = new HttpServerListenerHandler(8007); httpServerListenerHandler.run(); siddhiAppRuntime.start(); @@ -115,7 +121,7 @@ public void testHTTPRequestResponse2() throws Exception { SiddhiManager siddhiManager = new SiddhiManager(); String inStreamDefinition = "" + "define stream FooStream (name String, id int, headers String, volume long, price float);" - + "@sink(type='http-request',publisher.url='http://localhost:8005/abc'," + + + "@sink(type='http-request',publisher.url='http://localhost:8007/abc'," + " method='POST'," + "headers='{{headers}}',sink.id='source-1'," + "@map(type='json', @payload(\"\"\"{\"name\":\"{{name}}\",\"id\":{{id}}}\"\"\"))) " @@ -156,7 +162,7 @@ public void receive(Event[] events) { }; siddhiAppRuntime.addCallback("responseStream", streamCallback); - HttpServerListenerHandler httpServerListenerHandler = new HttpServerListenerHandler(8005); + HttpServerListenerHandler httpServerListenerHandler = new HttpServerListenerHandler(8007); httpServerListenerHandler.run(); siddhiAppRuntime.start(); @@ -178,7 +184,7 @@ public void testHTTPRequestResponse3() throws Exception { + "@sink(type='http-request'," + "downloading.enabled='true'," + "download.path='{{downloadPath}}'," + - "publisher.url='http://localhost:8005/files'," + + "publisher.url='http://localhost:8007/files'," + " method='GET'," + "headers='{{headers}}',sink.id='source-1'," + "@map(type='json')) " @@ -215,7 +221,7 @@ public void receive(Event[] events) { }; siddhiAppRuntime.addCallback("responseStream", streamCallback); - HttpFileServerListenerHandler httpFileServerListenerHandler = new HttpFileServerListenerHandler(8005); + HttpFileServerListenerHandler httpFileServerListenerHandler = new HttpFileServerListenerHandler(8007); httpFileServerListenerHandler.run(); siddhiAppRuntime.start(); @@ -242,7 +248,7 @@ public void testHTTPRequestResponse4() throws Exception { "@sink(type='http-request'," + "downloading.enabled='true'," + "download.path='{{downloadPath}}'," + - "publisher.url='http://localhost:8005/files2', " + + "publisher.url='http://localhost:8007/files2', " + "method='GET'," + "headers='{{headers}}',sink.id='source-1'," + "@map(type='json')) " + @@ -292,7 +298,7 @@ public void receive(Event[] events) { siddhiAppRuntime.addCallback("responseStream2xx", streamCallback2xx); siddhiAppRuntime.addCallback("responseStream4xx", streamCallback4xx); - HttpFileServerListenerHandler httpFileServerListenerHandler = new HttpFileServerListenerHandler(8005, 400); + HttpFileServerListenerHandler httpFileServerListenerHandler = new HttpFileServerListenerHandler(8007, 400); httpFileServerListenerHandler.run(); siddhiAppRuntime.start(); diff --git a/component/src/test/java/io/siddhi/extension/io/http/sink/HttpSinkCustomConfigurationTestCase.java b/component/src/test/java/io/siddhi/extension/io/http/sink/HttpSinkCustomConfigurationTestCase.java index a9916562..55bb516e 100644 --- a/component/src/test/java/io/siddhi/extension/io/http/sink/HttpSinkCustomConfigurationTestCase.java +++ b/component/src/test/java/io/siddhi/extension/io/http/sink/HttpSinkCustomConfigurationTestCase.java @@ -52,10 +52,7 @@ public void testHTTPCustomConfig() throws Exception { "socket.idle.timeout='150000'," + "ssl.protocol='TLS'," + "chunk.disabled='false'," + - "follow.redirect='false'," + - "max.redirect.count='5'," + "parameters=\"'ciphers : TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256','sslEnabledProtocols : TLSv1.1'\"," + - "client.pool.configurations=\"'client.connection.pool.count:1','sender.thread.count:20'\"," + "client.bootstrap.configurations=\"'client.bootstrap.nodelay:true','client.bootstrap" + ".recievebuffersize:1048576'\"," + "@map(type='xml', @payload('{{message}}'))) " + diff --git a/component/src/test/java/io/siddhi/extension/io/http/source/HttpSyncServiceResponseTestCase.java b/component/src/test/java/io/siddhi/extension/io/http/source/HttpSyncServiceResponseTestCase.java new file mode 100644 index 00000000..1b271e77 --- /dev/null +++ b/component/src/test/java/io/siddhi/extension/io/http/source/HttpSyncServiceResponseTestCase.java @@ -0,0 +1,75 @@ +/* + * Copyright (c) 2019, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. + * + * WSO2 Inc. licenses this file to you under the Apache License, + * Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package io.siddhi.extension.io.http.source; + +import io.siddhi.core.SiddhiAppRuntime; +import io.siddhi.core.SiddhiManager; +import io.siddhi.core.util.persistence.InMemoryPersistenceStore; +import io.siddhi.core.util.persistence.PersistenceStore; +import io.siddhi.extension.io.http.source.util.HttpTestUtil; +import io.siddhi.extension.map.xml.sinkmapper.XMLSinkMapper; +import io.siddhi.extension.map.xml.sourcemapper.XmlSourceMapper; +import org.testng.Assert; +import org.testng.annotations.Test; + +import java.net.URI; + +/** + * Tests http request source and http response source. + */ + +public class HttpSyncServiceResponseTestCase { + + @Test + public void testHTTPTextMappingXML() throws Exception { + + URI baseURI = URI.create(String.format("http://%s:%d", "localhost", 8010)); + PersistenceStore persistenceStore = new InMemoryPersistenceStore(); + + SiddhiManager siddhiManager = new SiddhiManager(); + siddhiManager.setPersistenceStore(persistenceStore); + siddhiManager.setExtension("xml-output-mapper", XMLSinkMapper.class); + siddhiManager.setExtension("xml-input-mapper", XmlSourceMapper.class); + String inStreamDefinition = "@Source(type = 'http-service', source.id='testsource', basic.auth" + + ".enabled='false',receiver.url='http://localhost:8010/TestHTTPRequestResponse/InputStream', @map" + + "(type='xml', @attributes(messageId='trp:messageId',param1='/event/param1'," + + "param2='/event/param2')))\n" + + "define stream InputStream (messageId string, param1 string, param2 string);\n" + + "@sink(type='http-service-response', source.id='testsource', message.id='{{messageId}}', " + + "@map(type='xml', @payload('{{param1}}')))\n" + + "define stream OutputStream (messageId string, param1 string);\n" + + "from InputStream\n" + + "select messageId, param1\n" + + "insert into OutputStream;"; + + SiddhiAppRuntime siddhiAppRuntime = siddhiManager.createSiddhiAppRuntime(inStreamDefinition); + siddhiAppRuntime.start(); + + String event1 = "\n" + + " param1\n" + + " param2\n" + + ""; + + + String response = HttpTestUtil.sendHttpEvent(event1, baseURI, "/TestHTTPRequestResponse/InputStream", + false, "application/xml"); + Assert.assertEquals(response, "param1"); + + siddhiAppRuntime.shutdown(); + } +} diff --git a/component/src/test/resources/testng.xml b/component/src/test/resources/testng.xml index 2ce63834..e355f56a 100644 --- a/component/src/test/resources/testng.xml +++ b/component/src/test/resources/testng.xml @@ -27,14 +27,18 @@ limitations under the License. + + + + diff --git a/coverage-report/pom.xml b/coverage-report/pom.xml index 02a285e0..2f70babd 100644 --- a/coverage-report/pom.xml +++ b/coverage-report/pom.xml @@ -21,7 +21,7 @@ siddhi-io-http-parent io.siddhi.extension.io.http - 2.0.9-SNAPSHOT + 2.1.0-SNAPSHOT ../pom.xml 4.0.0 diff --git a/docs/api/1.0.11.md b/docs/api/1.0.11.md deleted file mode 100644 index 6e8b83fd..00000000 --- a/docs/api/1.0.11.md +++ /dev/null @@ -1,755 +0,0 @@ -# API Docs - v1.0.11 - -## Sink - -### http *(Sink)* - -

This extension publish the HTTP events in any HTTP method POST, GET, PUT, DELETE via HTTP or https protocols. As the additional features this component can provide basic authentication as well as user can publish events using custom client truststore files when publishing events via https protocol. And also user can add any number of headers including HTTP_METHOD header for each event dynamically.

- -Syntax -``` -@sink(type="http", publisher.url="", basic.auth.username="", basic.auth.password="", https.truststore.file="", https.truststore.password="", headers="", method="", socket.idle.timeout="", chunk.disabled="", ssl.protocol="", parameters="", ciphers="", ssl.enabled.protocols="", client.enable.session.creation="", follow.redirect="", max.redirect.count="", tls.store.type="", proxy.host="", proxy.port="", proxy.username="", proxy.password="", client.bootstrap.configuration="", client.bootstrap.nodelay="", client.bootstrap.keepalive="", client.bootstrap.sendbuffersize="", client.bootstrap.recievebuffersize="", client.bootstrap.connect.timeout="", client.bootstrap.socket.reuse="", client.bootstrap.socket.timeout="", client.threadpool.configurations="", client.connection.pool.count="", client.max.active.connections.per.pool="", client.min.idle.connections.per.pool="", client.max.idle.connections.per.pool="", client.min.eviction.idle.time="", sender.thread.count="", event.group.executor.thread.size="", max.wait.for.client.connection.pool="", @map(...))) -``` - -QUERY PARAMETERS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
publisher.urlThe URL to which the outgoing events should be published via HTTP. This is a mandatory parameter and if this is not specified, an error is logged in the CLI. If user wants to enable SSL for the events, use https instead of http in the publisher.url.e.g., http://localhost:8080/endpoint, https://localhost:8080/endpointSTRINGNoNo
basic.auth.usernameThe username to be included in the authentication header of the basic authentication enabled events. It is required to specify both username and password to enable basic authentication. If one of the parameter is not given by user then an error is logged in the CLI. STRINGYesNo
basic.auth.passwordThe password to include in the authentication header of the basic authentication enabled events. It is required to specify both username and password to enable basic authentication. If one of the parameter is not given by user then an error is logged in the CLI. STRINGYesNo
https.truststore.fileThe file path to the location of the truststore of the client that sends the HTTP events through 'https' protocol. A custom client-truststore can be specified if required.${carbon.home}/resources/security/client-truststore.jksSTRINGYesNo
https.truststore.passwordThe password for the client-truststore. A custom password can be specified if required. If no custom password is specified and the protocol of URL is 'https' then, the system uses default password.wso2carbonSTRINGYesNo
headersThe headers that should be included as a HTTP request headers. There can be any number of headers concatenated on following format. header1:value1#header2:value2. User can include content-type header if he need to any specific type for payload if not system get the mapping type as the content-Type header (ie. @map(xml):application/xml,@map(json):application/json,@map(text):plain/text ) and if user does not include any mapping type then system gets the 'plain/text' as default Content-Type header. If user does not include Content-Length header then system calculate the bytes size of payload and include it as content-length header. STRINGYesNo
methodFor HTTP events, HTTP_METHOD header should be included as a request header. If the parameter is null then system uses 'POST' as a default header.POSTSTRINGYesNo
socket.idle.timeoutSocket timeout value in millisecond6000INTYesNo
chunk.disabledport: Port number of the remote servicefalseBOOLYesNo
ssl.protocolThe SSL protocol versionTLSSTRINGYesNo
parametersParameters other than basics such as ciphers,sslEnabledProtocols,client.enable.session.creation. Expected format of these parameters is as follows: "'ciphers:xxx','sslEnabledProtocols,client.enable:xxx'"nullSTRINGYesNo
ciphersList of ciphers to be used. This parameter should include under parameters Ex: 'ciphers:TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256'nullSTRINGYesNo
ssl.enabled.protocolsSSL/TLS protocols to be enabled. This parameter should be in camel case format(sslEnabledProtocols) under parameters. Ex 'sslEnabledProtocols:true'nullSTRINGYesNo
client.enable.session.creationEnable HTTP session creation.This parameter should include under parameters Ex: 'client.enable.session.creation:true'nullSTRINGYesNo
follow.redirectRedirect related enabled.trueBOOLYesNo
max.redirect.countMaximum redirect count.5INTYesNo
tls.store.typeTLS store type to be used.JKSSTRINGYesNo
proxy.hostProxy server hostnullSTRINGYesNo
proxy.portProxy server portnullSTRINGYesNo
proxy.usernameProxy server usernamenullSTRINGYesNo
proxy.passwordProxy server passwordnullSTRINGYesNo
client.bootstrap.configurationClient bootsrap configurations. Expected format of these parameters is as follows: "'client.bootstrap.nodelay:xxx','client.bootstrap.keepalive:xxx'"TODOSTRINGYesNo
client.bootstrap.nodelayHttp client no delay.trueBOOLYesNo
client.bootstrap.keepaliveHttp client keep alive.trueBOOLYesNo
client.bootstrap.sendbuffersizeHttp client send buffer size.1048576INTYesNo
client.bootstrap.recievebuffersizeHttp client receive buffer size.1048576INTYesNo
client.bootstrap.connect.timeoutHttp client connection timeout.15000INTYesNo
client.bootstrap.socket.reuseTo enable http socket reuse.falseBOOLYesNo
client.bootstrap.socket.timeoutHttp client socket timeout.15STRINGYesNo
client.threadpool.configurationsThread pool configuration. Expected format of these parameters is as follows: "'client.connection.pool.count:xxx','client.max.active.connections.per.pool:xxx'"TODOSTRINGYesNo
client.connection.pool.countConnection pool count.0INTYesNo
client.max.active.connections.per.poolActive connections per pool.-1INTYesNo
client.min.idle.connections.per.poolMinimum ideal connection per pool.0INTYesNo
client.max.idle.connections.per.poolMaximum ideal connection per pool.100INTYesNo
client.min.eviction.idle.timeMinimum eviction idle time.5 * 60 * 1000STRINGYesNo
sender.thread.countHttp sender thread count.20STRINGYesNo
event.group.executor.thread.sizeEvent group executor thread size.15STRINGYesNo
max.wait.for.client.connection.poolMaximum wait for client connection pool.60000STRINGYesNo
- -System Parameters - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Parameters
clientBootstrapBossGroupSizeproperty to configure number of boss threads, which accepts incoming connections until the ports are unbound. Once connection accepts successfully, boss thread passes the accepted channel to one of the worker threads.4Any integer
clientBootstrapWorkerGroupSizeproperty to configure number of worker threads, which performs non blocking read and write for one or more channels in non-blocking mode.8Any integer
trustStoreLocationThe default truststore file path.${carbon.home}/resources/security/client-truststore.jksPath to client-truststore.jks
trustStorePasswordThe default truststore password.wso2carbonTruststore password
- -Examples -EXAMPLE 1 -``` -@sink(type='http',publisher.url='http://localhost:8009/foo', method='{{method}}',headers='{{headers}}',client.bootstrap.configuration="'client.bootstrap.socket.timeout:20','client.bootstrap.worker.group.size:10'",client.pool.configuration="'client.connection.pool.count:10','client.max.active.connections.per.pool:1'" @map(type='xml' , @payload('{{payloadBody}}')))define stream FooStream (payloadBody String, method string, headers string); - -``` -

If it is xml mapping expected input should be in following format for FooStream:{<events> <event> <symbol>WSO2</symbol> <price>55.6</price> <volume>100</volume> </event></events>,POST,Content-Length:24#Content-Location:USA#Retry-After:120}Above event will generate output as below.~Output http event payload<events>
    <event>
        <symbol>WSO2</symbol>
        <price>55.6</price>
        <volume>100</volume>
    </event>
</events>
~Output http event headersContent-Length:24,Content-Location:'USA',Retry-After:120,Content-Type:'application/xml',HTTP_METHOD:'POST',~Output http event propertiesHTTP_METHOD:'POST',HOST:'localhost',PORT:8009PROTOCOL:'http'TO:'/foo'

- -## Source - -### http *(Source)* - -

The HTTP source receives POST requests via HTTP or HTTPS in format such as text, XML and JSON. If required, you can enable basic authentication to ensure that events are received only from users who are authorized to access the service.

- -Syntax -``` -@source(type="http", receiver.url="", basic.auth.enabled="", worker.count="", socket.idle.timeout="", ssl.verify.client="", ssl.protocol="", tls.store.type="", parameters="", ciphers="", ssl.enabled.protocols="", server.enable.session.creation="", server.supported.snimatchers="", server.suported.server.names="", request.size.validation.configuration="", request.size.validation="", request.size.validation.maximum.value="", request.size.validation.reject.status.code="", request.size.validation.reject.message="", request.size.validation.reject.message.content.type="", header.size.validation="", header.validation.maximum.request.line="", header.validation.maximum.size="", header.validation.maximum.chunk.size="", header.validation.reject.status.code="", header.validation.reject.message="", header.validation.reject.message.content.type="", server.bootstrap.configuration="", server.bootstrap.nodelay="", server.bootstrap.keepalive="", server.bootstrap.sendbuffersize="", server.bootstrap.recievebuffersize="", server.bootstrap.connect.timeout="", server.bootstrap.socket.reuse="", server.bootstrap.socket.timeout="", server.bootstrap.socket.backlog="", trace.log.enabled="", @map(...))) -``` - -QUERY PARAMETERS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
receiver.urlThe URL to which the events should be received. User can provide any valid url and if the url is not provided the system will use the following format http://0.0.0.0:9763/<appNAme>/<streamName>If the user want to use SSL the url should be given in following format https://localhost:8080/<streamName>http://0.0.0.0:9763//STRINGYesNo
basic.auth.enabledIf this is set to true, basic authentication is enabled for incoming events, and the credentials with which each event is sent are verified to ensure that the user is authorized to access the service. If basic authentication fails, the event is not authenticated and an authentication error is logged in the CLI. By default this values 'false' falseSTRINGYesNo
worker.countThe number of active worker threads to serve the incoming events. The value is 1 by default. This will ensure that the events are directed to the event stream in the same order in which they arrive. By increasing this value the performance might increase at the cost of loosing event ordering.1STRINGYesNo
socket.idle.timeoutIdle timeout for HTTP connection.120000INTYesNo
ssl.verify.clientThe type of client certificate verification.nullSTRINGYesNo
ssl.protocolssl/tls related optionsTLSSTRINGYesNo
tls.store.typeTLS store type.JKSSTRINGYesNo
parametersParameters other than basics such as ciphers,sslEnabledProtocols,client.enable.session.creation. Expected format of these parameters is as follows: "'ciphers:xxx','sslEnabledProtocols,client.enable:xxx'"nullSTRINGYesNo
ciphersList of ciphers to be used. This parameter should include under parameters Ex: 'ciphers:TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256'nullSTRINGYesNo
ssl.enabled.protocolsSSL/TLS protocols to be enabled. This parameter should be in camel case format(sslEnabledProtocols) under parameters. Ex 'sslEnabledProtocols:true'nullSTRINGYesNo
server.enable.session.creationEnable HTTP session creation.This parameter should include under parameters Ex: 'client.enable.session.creation:true'nullSTRINGYesNo
server.supported.snimatchersHttp SNIMatcher to be added. This parameter should include under parameters Ex: 'server.supported.snimatchers:SNIMatcher'nullSTRINGYesNo
server.suported.server.namesHttp supported servers. This parameter should include under parameters Ex: 'server.suported.server.names:server'nullSTRINGYesNo
request.size.validation.configurationParameters that responsible for validating the http request and request headers. Expected format of these parameters is as follows: "'request.size.validation:xxx','request.size.validation.maximum.value:xxx'"nullSTRINGYesNo
request.size.validationTo enable the request size validation.falseSTRINGYesNo
request.size.validation.maximum.valueIf request size is validated then maximum size.Integer.MAX_VALUESTRINGYesNo
request.size.validation.reject.status.codeIf request is exceed maximum size and request.size.validation is enabled then status code to be send as response.401STRINGYesNo
request.size.validation.reject.messageIf request is exceed maximum size and request.size.validation is enabled then status message to be send as response.Message is bigger than the valid sizeSTRINGYesNo
request.size.validation.reject.message.content.typeIf request is exceed maximum size and request.size.validation is enabled then content type to be send as response.plain/textSTRINGYesNo
header.size.validationTo enable the header size validation.falseSTRINGYesNo
header.validation.maximum.request.lineIf header header validation is enabled then the maximum request line.4096STRINGYesNo
header.validation.maximum.sizeIf header header validation is enabled then the maximum expected header size.8192STRINGYesNo
header.validation.maximum.chunk.sizeIf header header validation is enabled then the maximum expected chunk size.8192STRINGYesNo
header.validation.reject.status.code401If header is exceed maximum size and header.size.validation is enabled then status code to be send as response.STRINGYesNo
header.validation.reject.messageIf header is exceed maximum size and header.size.validation is enabled then message to be send as response.Message header is bigger than the valid sizeSTRINGYesNo
header.validation.reject.message.content.typeIf header is exceed maximum size and header.size.validation is enabled then content type to be send as response.plain/textSTRINGYesNo
server.bootstrap.configurationParameters that for bootstrap configurations of the server. Expected format of these parameters is as follows: "'ciphers:xxx','sslEnabledProtocols,client.enable:xxx'"nullOBJECTYesNo
server.bootstrap.nodelayHttp server no delay.trueBOOLYesNo
server.bootstrap.keepaliveHttp server keep alive.trueBOOLYesNo
server.bootstrap.sendbuffersizeHttp server send buffer size.1048576INTYesNo
server.bootstrap.recievebuffersizeHttp server receive buffer size.1048576INTYesNo
server.bootstrap.connect.timeoutHttp server connection timeout.15000INTYesNo
server.bootstrap.socket.reuseTo enable http socket reuse.falseBOOLYesNo
server.bootstrap.socket.timeoutHttp server socket timeout.15BOOLYesNo
server.bootstrap.socket.backlogTHttp server socket backlog.100BOOLYesNo
trace.log.enabledHttp traffic monitoring.falseBOOLYesNo
- -System Parameters - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Parameters
serverBootstrapBossGroupSizeproperty to configure number of boss threads, which accepts incoming connections until the ports are unbound. Once connection accepts successfully, boss thread passes the accepted channel to one of the worker threads.4Any integer
serverBootstrapWorkerGroupSizeproperty to configure number of worker threads, which performs non blocking read and write for one or more channels in non-blocking mode.8Any integer
defaultHostThe default host of the transport.0.0.0.0Any valid host
defaultHttpPortThe default port if the default scheme is 'http'.8280Any valid port
defaultHttpsPortThe default port if the default scheme is 'https'.8243Any valid port
defaultSchemeThe default protocol.httphttp
https
keyStoreLocationThe default keystore file path.${carbon.home}/resources/security/wso2carbon.jksPath to wso2carbon.jks file
keyStorePasswordThe default keystore password.wso2carbonString of keystore password
certPasswordThe default cert password.wso2carbonString of cert password
- -Examples -EXAMPLE 1 -``` -@source(type='http', receiver.url='http://localhost:9055/endpoints/RecPro', socketIdleTimeout='150000', parameters="'ciphers : TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256', 'sslEnabledProtocols:TLSv1.1,TLSv1.2'",request.size.validation.configuration="request.size.validation:true",server.bootstrap.configuration="server.bootstrap.socket.timeout:25" @map(type='xml')) -define stream FooStream (symbol string, price float, volume long); - -``` -

Above source listenerConfiguration performs a default XML input mapping. The expected input is as follows:<events>
    <event>
        <symbol>WSO2</symbol>
        <price>55.6</price>
        <volume>100</volume>
    </event>
</events>
If basic authentication is enabled via the basic.auth.enabled='true setting, each input event is also expected to contain the Authorization:'Basic encodeBase64(username:Password)' header.

- diff --git a/docs/api/1.0.12.md b/docs/api/1.0.12.md deleted file mode 100644 index 4aed2480..00000000 --- a/docs/api/1.0.12.md +++ /dev/null @@ -1,755 +0,0 @@ -# API Docs - v1.0.12 - -## Sink - -### http *(Sink)* - -

This extension publish the HTTP events in any HTTP method POST, GET, PUT, DELETE via HTTP or https protocols. As the additional features this component can provide basic authentication as well as user can publish events using custom client truststore files when publishing events via https protocol. And also user can add any number of headers including HTTP_METHOD header for each event dynamically.

- -Syntax -``` -@sink(type="http", publisher.url="", basic.auth.username="", basic.auth.password="", https.truststore.file="", https.truststore.password="", headers="", method="", socket.idle.timeout="", chunk.disabled="", ssl.protocol="", parameters="", ciphers="", ssl.enabled.protocols="", client.enable.session.creation="", follow.redirect="", max.redirect.count="", tls.store.type="", proxy.host="", proxy.port="", proxy.username="", proxy.password="", client.bootstrap.configuration="", client.bootstrap.nodelay="", client.bootstrap.keepalive="", client.bootstrap.sendbuffersize="", client.bootstrap.recievebuffersize="", client.bootstrap.connect.timeout="", client.bootstrap.socket.reuse="", client.bootstrap.socket.timeout="", client.threadpool.configurations="", client.connection.pool.count="", client.max.active.connections.per.pool="", client.min.idle.connections.per.pool="", client.max.idle.connections.per.pool="", client.min.eviction.idle.time="", sender.thread.count="", event.group.executor.thread.size="", max.wait.for.client.connection.pool="", @map(...))) -``` - -QUERY PARAMETERS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
publisher.urlThe URL to which the outgoing events should be published via HTTP. This is a mandatory parameter and if this is not specified, an error is logged in the CLI. If user wants to enable SSL for the events, use https instead of http in the publisher.url.e.g., http://localhost:8080/endpoint, https://localhost:8080/endpointSTRINGNoNo
basic.auth.usernameThe username to be included in the authentication header of the basic authentication enabled events. It is required to specify both username and password to enable basic authentication. If one of the parameter is not given by user then an error is logged in the CLI. STRINGYesNo
basic.auth.passwordThe password to include in the authentication header of the basic authentication enabled events. It is required to specify both username and password to enable basic authentication. If one of the parameter is not given by user then an error is logged in the CLI. STRINGYesNo
https.truststore.fileThe file path to the location of the truststore of the client that sends the HTTP events through 'https' protocol. A custom client-truststore can be specified if required.${carbon.home}/resources/security/client-truststore.jksSTRINGYesNo
https.truststore.passwordThe password for the client-truststore. A custom password can be specified if required. If no custom password is specified and the protocol of URL is 'https' then, the system uses default password.wso2carbonSTRINGYesNo
headersThe headers that should be included as a HTTP request headers. There can be any number of headers concatenated on following format. header1:value1#header2:value2. User can include content-type header if he need to any specific type for payload if not system get the mapping type as the content-Type header (ie. @map(xml):application/xml,@map(json):application/json,@map(text):plain/text ) and if user does not include any mapping type then system gets the 'plain/text' as default Content-Type header. If user does not include Content-Length header then system calculate the bytes size of payload and include it as content-length header. STRINGYesNo
methodFor HTTP events, HTTP_METHOD header should be included as a request header. If the parameter is null then system uses 'POST' as a default header.POSTSTRINGYesNo
socket.idle.timeoutSocket timeout value in millisecond6000INTYesNo
chunk.disabledport: Port number of the remote servicefalseBOOLYesNo
ssl.protocolThe SSL protocol versionTLSSTRINGYesNo
parametersParameters other than basics such as ciphers,sslEnabledProtocols,client.enable.session.creation. Expected format of these parameters is as follows: "'ciphers:xxx','sslEnabledProtocols,client.enable:xxx'"nullSTRINGYesNo
ciphersList of ciphers to be used. This parameter should include under parameters Ex: 'ciphers:TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256'nullSTRINGYesNo
ssl.enabled.protocolsSSL/TLS protocols to be enabled. This parameter should be in camel case format(sslEnabledProtocols) under parameters. Ex 'sslEnabledProtocols:true'nullSTRINGYesNo
client.enable.session.creationEnable HTTP session creation.This parameter should include under parameters Ex: 'client.enable.session.creation:true'nullSTRINGYesNo
follow.redirectRedirect related enabled.trueBOOLYesNo
max.redirect.countMaximum redirect count.5INTYesNo
tls.store.typeTLS store type to be used.JKSSTRINGYesNo
proxy.hostProxy server hostnullSTRINGYesNo
proxy.portProxy server portnullSTRINGYesNo
proxy.usernameProxy server usernamenullSTRINGYesNo
proxy.passwordProxy server passwordnullSTRINGYesNo
client.bootstrap.configurationClient bootsrap configurations. Expected format of these parameters is as follows: "'client.bootstrap.nodelay:xxx','client.bootstrap.keepalive:xxx'"TODOSTRINGYesNo
client.bootstrap.nodelayHttp client no delay.trueBOOLYesNo
client.bootstrap.keepaliveHttp client keep alive.trueBOOLYesNo
client.bootstrap.sendbuffersizeHttp client send buffer size.1048576INTYesNo
client.bootstrap.recievebuffersizeHttp client receive buffer size.1048576INTYesNo
client.bootstrap.connect.timeoutHttp client connection timeout.15000INTYesNo
client.bootstrap.socket.reuseTo enable http socket reuse.falseBOOLYesNo
client.bootstrap.socket.timeoutHttp client socket timeout.15STRINGYesNo
client.threadpool.configurationsThread pool configuration. Expected format of these parameters is as follows: "'client.connection.pool.count:xxx','client.max.active.connections.per.pool:xxx'"TODOSTRINGYesNo
client.connection.pool.countConnection pool count.0INTYesNo
client.max.active.connections.per.poolActive connections per pool.-1INTYesNo
client.min.idle.connections.per.poolMinimum ideal connection per pool.0INTYesNo
client.max.idle.connections.per.poolMaximum ideal connection per pool.100INTYesNo
client.min.eviction.idle.timeMinimum eviction idle time.5 * 60 * 1000STRINGYesNo
sender.thread.countHttp sender thread count.20STRINGYesNo
event.group.executor.thread.sizeEvent group executor thread size.15STRINGYesNo
max.wait.for.client.connection.poolMaximum wait for client connection pool.60000STRINGYesNo
- -System Parameters - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Parameters
clientBootstrapBossGroupSizeproperty to configure number of boss threads, which accepts incoming connections until the ports are unbound. Once connection accepts successfully, boss thread passes the accepted channel to one of the worker threads.4Any integer
clientBootstrapWorkerGroupSizeproperty to configure number of worker threads, which performs non blocking read and write for one or more channels in non-blocking mode.8Any integer
trustStoreLocationThe default truststore file path.${carbon.home}/resources/security/client-truststore.jksPath to client-truststore.jks
trustStorePasswordThe default truststore password.wso2carbonTruststore password
- -Examples -EXAMPLE 1 -``` -@sink(type='http',publisher.url='http://localhost:8009/foo', method='{{method}}',headers='{{headers}}',client.bootstrap.configuration="'client.bootstrap.socket.timeout:20','client.bootstrap.worker.group.size:10'",client.pool.configuration="'client.connection.pool.count:10','client.max.active.connections.per.pool:1'" @map(type='xml' , @payload('{{payloadBody}}')))define stream FooStream (payloadBody String, method string, headers string); - -``` -

If it is xml mapping expected input should be in following format for FooStream:{<events> <event> <symbol>WSO2</symbol> <price>55.6</price> <volume>100</volume> </event></events>,POST,Content-Length:24#Content-Location:USA#Retry-After:120}Above event will generate output as below.~Output http event payload<events>
    <event>
        <symbol>WSO2</symbol>
        <price>55.6</price>
        <volume>100</volume>
    </event>
</events>
~Output http event headersContent-Length:24,Content-Location:'USA',Retry-After:120,Content-Type:'application/xml',HTTP_METHOD:'POST',~Output http event propertiesHTTP_METHOD:'POST',HOST:'localhost',PORT:8009PROTOCOL:'http'TO:'/foo'

- -## Source - -### http *(Source)* - -

The HTTP source receives POST requests via HTTP or HTTPS in format such as text, XML and JSON. If required, you can enable basic authentication to ensure that events are received only from users who are authorized to access the service.

- -Syntax -``` -@source(type="http", receiver.url="", basic.auth.enabled="", worker.count="", socket.idle.timeout="", ssl.verify.client="", ssl.protocol="", tls.store.type="", parameters="", ciphers="", ssl.enabled.protocols="", server.enable.session.creation="", server.supported.snimatchers="", server.suported.server.names="", request.size.validation.configuration="", request.size.validation="", request.size.validation.maximum.value="", request.size.validation.reject.status.code="", request.size.validation.reject.message="", request.size.validation.reject.message.content.type="", header.size.validation="", header.validation.maximum.request.line="", header.validation.maximum.size="", header.validation.maximum.chunk.size="", header.validation.reject.status.code="", header.validation.reject.message="", header.validation.reject.message.content.type="", server.bootstrap.configuration="", server.bootstrap.nodelay="", server.bootstrap.keepalive="", server.bootstrap.sendbuffersize="", server.bootstrap.recievebuffersize="", server.bootstrap.connect.timeout="", server.bootstrap.socket.reuse="", server.bootstrap.socket.timeout="", server.bootstrap.socket.backlog="", trace.log.enabled="", @map(...))) -``` - -QUERY PARAMETERS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
receiver.urlThe URL to which the events should be received. User can provide any valid url and if the url is not provided the system will use the following format http://0.0.0.0:9763/<appNAme>/<streamName>If the user want to use SSL the url should be given in following format https://localhost:8080/<streamName>http://0.0.0.0:9763//STRINGYesNo
basic.auth.enabledIf this is set to true, basic authentication is enabled for incoming events, and the credentials with which each event is sent are verified to ensure that the user is authorized to access the service. If basic authentication fails, the event is not authenticated and an authentication error is logged in the CLI. By default this values 'false' falseSTRINGYesNo
worker.countThe number of active worker threads to serve the incoming events. The value is 1 by default. This will ensure that the events are directed to the event stream in the same order in which they arrive. By increasing this value the performance might increase at the cost of loosing event ordering.1STRINGYesNo
socket.idle.timeoutIdle timeout for HTTP connection.120000INTYesNo
ssl.verify.clientThe type of client certificate verification.nullSTRINGYesNo
ssl.protocolssl/tls related optionsTLSSTRINGYesNo
tls.store.typeTLS store type.JKSSTRINGYesNo
parametersParameters other than basics such as ciphers,sslEnabledProtocols,client.enable.session.creation. Expected format of these parameters is as follows: "'ciphers:xxx','sslEnabledProtocols,client.enable:xxx'"nullSTRINGYesNo
ciphersList of ciphers to be used. This parameter should include under parameters Ex: 'ciphers:TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256'nullSTRINGYesNo
ssl.enabled.protocolsSSL/TLS protocols to be enabled. This parameter should be in camel case format(sslEnabledProtocols) under parameters. Ex 'sslEnabledProtocols:true'nullSTRINGYesNo
server.enable.session.creationEnable HTTP session creation.This parameter should include under parameters Ex: 'client.enable.session.creation:true'nullSTRINGYesNo
server.supported.snimatchersHttp SNIMatcher to be added. This parameter should include under parameters Ex: 'server.supported.snimatchers:SNIMatcher'nullSTRINGYesNo
server.suported.server.namesHttp supported servers. This parameter should include under parameters Ex: 'server.suported.server.names:server'nullSTRINGYesNo
request.size.validation.configurationParameters that responsible for validating the http request and request headers. Expected format of these parameters is as follows: "'request.size.validation:xxx','request.size.validation.maximum.value:xxx'"nullSTRINGYesNo
request.size.validationTo enable the request size validation.falseSTRINGYesNo
request.size.validation.maximum.valueIf request size is validated then maximum size.Integer.MAX_VALUESTRINGYesNo
request.size.validation.reject.status.codeIf request is exceed maximum size and request.size.validation is enabled then status code to be send as response.401STRINGYesNo
request.size.validation.reject.messageIf request is exceed maximum size and request.size.validation is enabled then status message to be send as response.Message is bigger than the valid sizeSTRINGYesNo
request.size.validation.reject.message.content.typeIf request is exceed maximum size and request.size.validation is enabled then content type to be send as response.plain/textSTRINGYesNo
header.size.validationTo enable the header size validation.falseSTRINGYesNo
header.validation.maximum.request.lineIf header header validation is enabled then the maximum request line.4096STRINGYesNo
header.validation.maximum.sizeIf header header validation is enabled then the maximum expected header size.8192STRINGYesNo
header.validation.maximum.chunk.sizeIf header header validation is enabled then the maximum expected chunk size.8192STRINGYesNo
header.validation.reject.status.code401If header is exceed maximum size and header.size.validation is enabled then status code to be send as response.STRINGYesNo
header.validation.reject.messageIf header is exceed maximum size and header.size.validation is enabled then message to be send as response.Message header is bigger than the valid sizeSTRINGYesNo
header.validation.reject.message.content.typeIf header is exceed maximum size and header.size.validation is enabled then content type to be send as response.plain/textSTRINGYesNo
server.bootstrap.configurationParameters that for bootstrap configurations of the server. Expected format of these parameters is as follows: "'ciphers:xxx','sslEnabledProtocols,client.enable:xxx'"nullOBJECTYesNo
server.bootstrap.nodelayHttp server no delay.trueBOOLYesNo
server.bootstrap.keepaliveHttp server keep alive.trueBOOLYesNo
server.bootstrap.sendbuffersizeHttp server send buffer size.1048576INTYesNo
server.bootstrap.recievebuffersizeHttp server receive buffer size.1048576INTYesNo
server.bootstrap.connect.timeoutHttp server connection timeout.15000INTYesNo
server.bootstrap.socket.reuseTo enable http socket reuse.falseBOOLYesNo
server.bootstrap.socket.timeoutHttp server socket timeout.15BOOLYesNo
server.bootstrap.socket.backlogTHttp server socket backlog.100BOOLYesNo
trace.log.enabledHttp traffic monitoring.falseBOOLYesNo
- -System Parameters - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Parameters
serverBootstrapBossGroupSizeproperty to configure number of boss threads, which accepts incoming connections until the ports are unbound. Once connection accepts successfully, boss thread passes the accepted channel to one of the worker threads.4Any integer
serverBootstrapWorkerGroupSizeproperty to configure number of worker threads, which performs non blocking read and write for one or more channels in non-blocking mode.8Any integer
defaultHostThe default host of the transport.0.0.0.0Any valid host
defaultHttpPortThe default port if the default scheme is 'http'.8280Any valid port
defaultHttpsPortThe default port if the default scheme is 'https'.8243Any valid port
defaultSchemeThe default protocol.httphttp
https
keyStoreLocationThe default keystore file path.${carbon.home}/resources/security/wso2carbon.jksPath to wso2carbon.jks file
keyStorePasswordThe default keystore password.wso2carbonString of keystore password
certPasswordThe default cert password.wso2carbonString of cert password
- -Examples -EXAMPLE 1 -``` -@source(type='http', receiver.url='http://localhost:9055/endpoints/RecPro', socketIdleTimeout='150000', parameters="'ciphers : TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256', 'sslEnabledProtocols:TLSv1.1,TLSv1.2'",request.size.validation.configuration="request.size.validation:true",server.bootstrap.configuration="server.bootstrap.socket.timeout:25" @map(type='xml')) -define stream FooStream (symbol string, price float, volume long); - -``` -

Above source listenerConfiguration performs a default XML input mapping. The expected input is as follows:<events>
    <event>
        <symbol>WSO2</symbol>
        <price>55.6</price>
        <volume>100</volume>
    </event>
</events>
If basic authentication is enabled via the basic.auth.enabled='true setting, each input event is also expected to contain the Authorization:'Basic encodeBase64(username:Password)' header.

- diff --git a/docs/api/1.0.13.md b/docs/api/1.0.13.md deleted file mode 100644 index 8f26648a..00000000 --- a/docs/api/1.0.13.md +++ /dev/null @@ -1,755 +0,0 @@ -# API Docs - v1.0.13 - -## Sink - -### http *(Sink)* - -

This extension publish the HTTP events in any HTTP method POST, GET, PUT, DELETE via HTTP or https protocols. As the additional features this component can provide basic authentication as well as user can publish events using custom client truststore files when publishing events via https protocol. And also user can add any number of headers including HTTP_METHOD header for each event dynamically.

- -Syntax -``` -@sink(type="http", publisher.url="", basic.auth.username="", basic.auth.password="", https.truststore.file="", https.truststore.password="", headers="", method="", socket.idle.timeout="", chunk.disabled="", ssl.protocol="", parameters="", ciphers="", ssl.enabled.protocols="", client.enable.session.creation="", follow.redirect="", max.redirect.count="", tls.store.type="", proxy.host="", proxy.port="", proxy.username="", proxy.password="", client.bootstrap.configuration="", client.bootstrap.nodelay="", client.bootstrap.keepalive="", client.bootstrap.sendbuffersize="", client.bootstrap.recievebuffersize="", client.bootstrap.connect.timeout="", client.bootstrap.socket.reuse="", client.bootstrap.socket.timeout="", client.threadpool.configurations="", client.connection.pool.count="", client.max.active.connections.per.pool="", client.min.idle.connections.per.pool="", client.max.idle.connections.per.pool="", client.min.eviction.idle.time="", sender.thread.count="", event.group.executor.thread.size="", max.wait.for.client.connection.pool="", @map(...))) -``` - -QUERY PARAMETERS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
publisher.urlThe URL to which the outgoing events should be published via HTTP. This is a mandatory parameter and if this is not specified, an error is logged in the CLI. If user wants to enable SSL for the events, use https instead of http in the publisher.url.e.g., http://localhost:8080/endpoint, https://localhost:8080/endpointSTRINGNoNo
basic.auth.usernameThe username to be included in the authentication header of the basic authentication enabled events. It is required to specify both username and password to enable basic authentication. If one of the parameter is not given by user then an error is logged in the CLI. STRINGYesNo
basic.auth.passwordThe password to include in the authentication header of the basic authentication enabled events. It is required to specify both username and password to enable basic authentication. If one of the parameter is not given by user then an error is logged in the CLI. STRINGYesNo
https.truststore.fileThe file path to the location of the truststore of the client that sends the HTTP events through 'https' protocol. A custom client-truststore can be specified if required.${carbon.home}/resources/security/client-truststore.jksSTRINGYesNo
https.truststore.passwordThe password for the client-truststore. A custom password can be specified if required. If no custom password is specified and the protocol of URL is 'https' then, the system uses default password.wso2carbonSTRINGYesNo
headersThe headers that should be included as a HTTP request headers. There can be any number of headers concatenated on following format. header1:value1#header2:value2. User can include content-type header if he need to any specific type for payload if not system get the mapping type as the content-Type header (ie. @map(xml):application/xml,@map(json):application/json,@map(text):plain/text ) and if user does not include any mapping type then system gets the 'plain/text' as default Content-Type header. If user does not include Content-Length header then system calculate the bytes size of payload and include it as content-length header. STRINGYesNo
methodFor HTTP events, HTTP_METHOD header should be included as a request header. If the parameter is null then system uses 'POST' as a default header.POSTSTRINGYesNo
socket.idle.timeoutSocket timeout value in millisecond6000INTYesNo
chunk.disabledport: Port number of the remote servicefalseBOOLYesNo
ssl.protocolThe SSL protocol versionTLSSTRINGYesNo
parametersParameters other than basics such as ciphers,sslEnabledProtocols,client.enable.session.creation. Expected format of these parameters is as follows: "'ciphers:xxx','sslEnabledProtocols,client.enable:xxx'"nullSTRINGYesNo
ciphersList of ciphers to be used. This parameter should include under parameters Ex: 'ciphers:TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256'nullSTRINGYesNo
ssl.enabled.protocolsSSL/TLS protocols to be enabled. This parameter should be in camel case format(sslEnabledProtocols) under parameters. Ex 'sslEnabledProtocols:true'nullSTRINGYesNo
client.enable.session.creationEnable HTTP session creation.This parameter should include under parameters Ex: 'client.enable.session.creation:true'nullSTRINGYesNo
follow.redirectRedirect related enabled.trueBOOLYesNo
max.redirect.countMaximum redirect count.5INTYesNo
tls.store.typeTLS store type to be used.JKSSTRINGYesNo
proxy.hostProxy server hostnullSTRINGYesNo
proxy.portProxy server portnullSTRINGYesNo
proxy.usernameProxy server usernamenullSTRINGYesNo
proxy.passwordProxy server passwordnullSTRINGYesNo
client.bootstrap.configurationClient bootsrap configurations. Expected format of these parameters is as follows: "'client.bootstrap.nodelay:xxx','client.bootstrap.keepalive:xxx'"TODOSTRINGYesNo
client.bootstrap.nodelayHttp client no delay.trueBOOLYesNo
client.bootstrap.keepaliveHttp client keep alive.trueBOOLYesNo
client.bootstrap.sendbuffersizeHttp client send buffer size.1048576INTYesNo
client.bootstrap.recievebuffersizeHttp client receive buffer size.1048576INTYesNo
client.bootstrap.connect.timeoutHttp client connection timeout.15000INTYesNo
client.bootstrap.socket.reuseTo enable http socket reuse.falseBOOLYesNo
client.bootstrap.socket.timeoutHttp client socket timeout.15STRINGYesNo
client.threadpool.configurationsThread pool configuration. Expected format of these parameters is as follows: "'client.connection.pool.count:xxx','client.max.active.connections.per.pool:xxx'"TODOSTRINGYesNo
client.connection.pool.countConnection pool count.0INTYesNo
client.max.active.connections.per.poolActive connections per pool.-1INTYesNo
client.min.idle.connections.per.poolMinimum ideal connection per pool.0INTYesNo
client.max.idle.connections.per.poolMaximum ideal connection per pool.100INTYesNo
client.min.eviction.idle.timeMinimum eviction idle time.5 * 60 * 1000STRINGYesNo
sender.thread.countHttp sender thread count.20STRINGYesNo
event.group.executor.thread.sizeEvent group executor thread size.15STRINGYesNo
max.wait.for.client.connection.poolMaximum wait for client connection pool.60000STRINGYesNo
- -System Parameters - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Parameters
clientBootstrapBossGroupSizeproperty to configure number of boss threads, which accepts incoming connections until the ports are unbound. Once connection accepts successfully, boss thread passes the accepted channel to one of the worker threads.4Any integer
clientBootstrapWorkerGroupSizeproperty to configure number of worker threads, which performs non blocking read and write for one or more channels in non-blocking mode.8Any integer
trustStoreLocationThe default truststore file path.${carbon.home}/resources/security/client-truststore.jksPath to client-truststore.jks
trustStorePasswordThe default truststore password.wso2carbonTruststore password
- -Examples -EXAMPLE 1 -``` -@sink(type='http',publisher.url='http://localhost:8009/foo', method='{{method}}',headers='{{headers}}',client.bootstrap.configuration="'client.bootstrap.socket.timeout:20','client.bootstrap.worker.group.size:10'",client.pool.configuration="'client.connection.pool.count:10','client.max.active.connections.per.pool:1'" @map(type='xml' , @payload('{{payloadBody}}')))define stream FooStream (payloadBody String, method string, headers string); - -``` -

If it is xml mapping expected input should be in following format for FooStream:{<events> <event> <symbol>WSO2</symbol> <price>55.6</price> <volume>100</volume> </event></events>,POST,Content-Length:24#Content-Location:USA#Retry-After:120}Above event will generate output as below.~Output http event payload<events>
    <event>
        <symbol>WSO2</symbol>
        <price>55.6</price>
        <volume>100</volume>
    </event>
</events>
~Output http event headersContent-Length:24,Content-Location:'USA',Retry-After:120,Content-Type:'application/xml',HTTP_METHOD:'POST',~Output http event propertiesHTTP_METHOD:'POST',HOST:'localhost',PORT:8009PROTOCOL:'http'TO:'/foo'

- -## Source - -### http *(Source)* - -

The HTTP source receives POST requests via HTTP or HTTPS in format such as text, XML and JSON. If required, you can enable basic authentication to ensure that events are received only from users who are authorized to access the service.

- -Syntax -``` -@source(type="http", receiver.url="", basic.auth.enabled="", worker.count="", socket.idle.timeout="", ssl.verify.client="", ssl.protocol="", tls.store.type="", parameters="", ciphers="", ssl.enabled.protocols="", server.enable.session.creation="", server.supported.snimatchers="", server.suported.server.names="", request.size.validation.configuration="", request.size.validation="", request.size.validation.maximum.value="", request.size.validation.reject.status.code="", request.size.validation.reject.message="", request.size.validation.reject.message.content.type="", header.size.validation="", header.validation.maximum.request.line="", header.validation.maximum.size="", header.validation.maximum.chunk.size="", header.validation.reject.status.code="", header.validation.reject.message="", header.validation.reject.message.content.type="", server.bootstrap.configuration="", server.bootstrap.nodelay="", server.bootstrap.keepalive="", server.bootstrap.sendbuffersize="", server.bootstrap.recievebuffersize="", server.bootstrap.connect.timeout="", server.bootstrap.socket.reuse="", server.bootstrap.socket.timeout="", server.bootstrap.socket.backlog="", trace.log.enabled="", @map(...))) -``` - -QUERY PARAMETERS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
receiver.urlThe URL to which the events should be received. User can provide any valid url and if the url is not provided the system will use the following format http://0.0.0.0:9763/<appNAme>/<streamName>If the user want to use SSL the url should be given in following format https://localhost:8080/<streamName>http://0.0.0.0:9763//STRINGYesNo
basic.auth.enabledIf this is set to true, basic authentication is enabled for incoming events, and the credentials with which each event is sent are verified to ensure that the user is authorized to access the service. If basic authentication fails, the event is not authenticated and an authentication error is logged in the CLI. By default this values 'false' falseSTRINGYesNo
worker.countThe number of active worker threads to serve the incoming events. The value is 1 by default. This will ensure that the events are directed to the event stream in the same order in which they arrive. By increasing this value the performance might increase at the cost of loosing event ordering.1STRINGYesNo
socket.idle.timeoutIdle timeout for HTTP connection.120000INTYesNo
ssl.verify.clientThe type of client certificate verification.nullSTRINGYesNo
ssl.protocolssl/tls related optionsTLSSTRINGYesNo
tls.store.typeTLS store type.JKSSTRINGYesNo
parametersParameters other than basics such as ciphers,sslEnabledProtocols,client.enable.session.creation. Expected format of these parameters is as follows: "'ciphers:xxx','sslEnabledProtocols,client.enable:xxx'"nullSTRINGYesNo
ciphersList of ciphers to be used. This parameter should include under parameters Ex: 'ciphers:TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256'nullSTRINGYesNo
ssl.enabled.protocolsSSL/TLS protocols to be enabled. This parameter should be in camel case format(sslEnabledProtocols) under parameters. Ex 'sslEnabledProtocols:true'nullSTRINGYesNo
server.enable.session.creationEnable HTTP session creation.This parameter should include under parameters Ex: 'client.enable.session.creation:true'nullSTRINGYesNo
server.supported.snimatchersHttp SNIMatcher to be added. This parameter should include under parameters Ex: 'server.supported.snimatchers:SNIMatcher'nullSTRINGYesNo
server.suported.server.namesHttp supported servers. This parameter should include under parameters Ex: 'server.suported.server.names:server'nullSTRINGYesNo
request.size.validation.configurationParameters that responsible for validating the http request and request headers. Expected format of these parameters is as follows: "'request.size.validation:xxx','request.size.validation.maximum.value:xxx'"nullSTRINGYesNo
request.size.validationTo enable the request size validation.falseSTRINGYesNo
request.size.validation.maximum.valueIf request size is validated then maximum size.Integer.MAX_VALUESTRINGYesNo
request.size.validation.reject.status.codeIf request is exceed maximum size and request.size.validation is enabled then status code to be send as response.401STRINGYesNo
request.size.validation.reject.messageIf request is exceed maximum size and request.size.validation is enabled then status message to be send as response.Message is bigger than the valid sizeSTRINGYesNo
request.size.validation.reject.message.content.typeIf request is exceed maximum size and request.size.validation is enabled then content type to be send as response.plain/textSTRINGYesNo
header.size.validationTo enable the header size validation.falseSTRINGYesNo
header.validation.maximum.request.lineIf header header validation is enabled then the maximum request line.4096STRINGYesNo
header.validation.maximum.sizeIf header header validation is enabled then the maximum expected header size.8192STRINGYesNo
header.validation.maximum.chunk.sizeIf header header validation is enabled then the maximum expected chunk size.8192STRINGYesNo
header.validation.reject.status.code401If header is exceed maximum size and header.size.validation is enabled then status code to be send as response.STRINGYesNo
header.validation.reject.messageIf header is exceed maximum size and header.size.validation is enabled then message to be send as response.Message header is bigger than the valid sizeSTRINGYesNo
header.validation.reject.message.content.typeIf header is exceed maximum size and header.size.validation is enabled then content type to be send as response.plain/textSTRINGYesNo
server.bootstrap.configurationParameters that for bootstrap configurations of the server. Expected format of these parameters is as follows: "'ciphers:xxx','sslEnabledProtocols,client.enable:xxx'"nullOBJECTYesNo
server.bootstrap.nodelayHttp server no delay.trueBOOLYesNo
server.bootstrap.keepaliveHttp server keep alive.trueBOOLYesNo
server.bootstrap.sendbuffersizeHttp server send buffer size.1048576INTYesNo
server.bootstrap.recievebuffersizeHttp server receive buffer size.1048576INTYesNo
server.bootstrap.connect.timeoutHttp server connection timeout.15000INTYesNo
server.bootstrap.socket.reuseTo enable http socket reuse.falseBOOLYesNo
server.bootstrap.socket.timeoutHttp server socket timeout.15BOOLYesNo
server.bootstrap.socket.backlogTHttp server socket backlog.100BOOLYesNo
trace.log.enabledHttp traffic monitoring.falseBOOLYesNo
- -System Parameters - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Parameters
serverBootstrapBossGroupSizeproperty to configure number of boss threads, which accepts incoming connections until the ports are unbound. Once connection accepts successfully, boss thread passes the accepted channel to one of the worker threads.4Any integer
serverBootstrapWorkerGroupSizeproperty to configure number of worker threads, which performs non blocking read and write for one or more channels in non-blocking mode.8Any integer
defaultHostThe default host of the transport.0.0.0.0Any valid host
defaultHttpPortThe default port if the default scheme is 'http'.8280Any valid port
defaultHttpsPortThe default port if the default scheme is 'https'.8243Any valid port
defaultSchemeThe default protocol.httphttp
https
keyStoreLocationThe default keystore file path.${carbon.home}/resources/security/wso2carbon.jksPath to wso2carbon.jks file
keyStorePasswordThe default keystore password.wso2carbonString of keystore password
certPasswordThe default cert password.wso2carbonString of cert password
- -Examples -EXAMPLE 1 -``` -@source(type='http', receiver.url='http://localhost:9055/endpoints/RecPro', socketIdleTimeout='150000', parameters="'ciphers : TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256', 'sslEnabledProtocols:TLSv1.1,TLSv1.2'",request.size.validation.configuration="request.size.validation:true",server.bootstrap.configuration="server.bootstrap.socket.timeout:25" @map(type='xml')) -define stream FooStream (symbol string, price float, volume long); - -``` -

Above source listenerConfiguration performs a default XML input mapping. The expected input is as follows:<events>
    <event>
        <symbol>WSO2</symbol>
        <price>55.6</price>
        <volume>100</volume>
    </event>
</events>
If basic authentication is enabled via the basic.auth.enabled='true setting, each input event is also expected to contain the Authorization:'Basic encodeBase64(username:Password)' header.

- diff --git a/docs/api/1.0.14.md b/docs/api/1.0.14.md deleted file mode 100644 index 92d83e7f..00000000 --- a/docs/api/1.0.14.md +++ /dev/null @@ -1,755 +0,0 @@ -# API Docs - v1.0.14 - -## Sink - -### http *(Sink)* - -

This extension publish the HTTP events in any HTTP method POST, GET, PUT, DELETE via HTTP or https protocols. As the additional features this component can provide basic authentication as well as user can publish events using custom client truststore files when publishing events via https protocol. And also user can add any number of headers including HTTP_METHOD header for each event dynamically.

- -Syntax -``` -@sink(type="http", publisher.url="", basic.auth.username="", basic.auth.password="", https.truststore.file="", https.truststore.password="", headers="", method="", socket.idle.timeout="", chunk.disabled="", ssl.protocol="", parameters="", ciphers="", ssl.enabled.protocols="", client.enable.session.creation="", follow.redirect="", max.redirect.count="", tls.store.type="", proxy.host="", proxy.port="", proxy.username="", proxy.password="", client.bootstrap.configuration="", client.bootstrap.nodelay="", client.bootstrap.keepalive="", client.bootstrap.sendbuffersize="", client.bootstrap.recievebuffersize="", client.bootstrap.connect.timeout="", client.bootstrap.socket.reuse="", client.bootstrap.socket.timeout="", client.threadpool.configurations="", client.connection.pool.count="", client.max.active.connections.per.pool="", client.min.idle.connections.per.pool="", client.max.idle.connections.per.pool="", client.min.eviction.idle.time="", sender.thread.count="", event.group.executor.thread.size="", max.wait.for.client.connection.pool="", @map(...))) -``` - -QUERY PARAMETERS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
publisher.urlThe URL to which the outgoing events should be published via HTTP. This is a mandatory parameter and if this is not specified, an error is logged in the CLI. If user wants to enable SSL for the events, use https instead of http in the publisher.url.e.g., http://localhost:8080/endpoint, https://localhost:8080/endpointSTRINGNoNo
basic.auth.usernameThe username to be included in the authentication header of the basic authentication enabled events. It is required to specify both username and password to enable basic authentication. If one of the parameter is not given by user then an error is logged in the CLI. STRINGYesNo
basic.auth.passwordThe password to include in the authentication header of the basic authentication enabled events. It is required to specify both username and password to enable basic authentication. If one of the parameter is not given by user then an error is logged in the CLI. STRINGYesNo
https.truststore.fileThe file path to the location of the truststore of the client that sends the HTTP events through 'https' protocol. A custom client-truststore can be specified if required.${carbon.home}/resources/security/client-truststore.jksSTRINGYesNo
https.truststore.passwordThe password for the client-truststore. A custom password can be specified if required. If no custom password is specified and the protocol of URL is 'https' then, the system uses default password.wso2carbonSTRINGYesNo
headersThe headers that should be included as a HTTP request headers. There can be any number of headers concatenated on following format. header1:value1#header2:value2. User can include content-type header if he need to any specific type for payload if not system get the mapping type as the content-Type header (ie. @map(xml):application/xml,@map(json):application/json,@map(text):plain/text ) and if user does not include any mapping type then system gets the 'plain/text' as default Content-Type header. If user does not include Content-Length header then system calculate the bytes size of payload and include it as content-length header. STRINGYesNo
methodFor HTTP events, HTTP_METHOD header should be included as a request header. If the parameter is null then system uses 'POST' as a default header.POSTSTRINGYesNo
socket.idle.timeoutSocket timeout value in millisecond6000INTYesNo
chunk.disabledport: Port number of the remote servicefalseBOOLYesNo
ssl.protocolThe SSL protocol versionTLSSTRINGYesNo
parametersParameters other than basics such as ciphers,sslEnabledProtocols,client.enable.session.creation. Expected format of these parameters is as follows: "'ciphers:xxx','sslEnabledProtocols,client.enable:xxx'"nullSTRINGYesNo
ciphersList of ciphers to be used. This parameter should include under parameters Ex: 'ciphers:TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256'nullSTRINGYesNo
ssl.enabled.protocolsSSL/TLS protocols to be enabled. This parameter should be in camel case format(sslEnabledProtocols) under parameters. Ex 'sslEnabledProtocols:true'nullSTRINGYesNo
client.enable.session.creationEnable HTTP session creation.This parameter should include under parameters Ex: 'client.enable.session.creation:true'nullSTRINGYesNo
follow.redirectRedirect related enabled.trueBOOLYesNo
max.redirect.countMaximum redirect count.5INTYesNo
tls.store.typeTLS store type to be used.JKSSTRINGYesNo
proxy.hostProxy server hostnullSTRINGYesNo
proxy.portProxy server portnullSTRINGYesNo
proxy.usernameProxy server usernamenullSTRINGYesNo
proxy.passwordProxy server passwordnullSTRINGYesNo
client.bootstrap.configurationClient bootsrap configurations. Expected format of these parameters is as follows: "'client.bootstrap.nodelay:xxx','client.bootstrap.keepalive:xxx'"TODOSTRINGYesNo
client.bootstrap.nodelayHttp client no delay.trueBOOLYesNo
client.bootstrap.keepaliveHttp client keep alive.trueBOOLYesNo
client.bootstrap.sendbuffersizeHttp client send buffer size.1048576INTYesNo
client.bootstrap.recievebuffersizeHttp client receive buffer size.1048576INTYesNo
client.bootstrap.connect.timeoutHttp client connection timeout.15000INTYesNo
client.bootstrap.socket.reuseTo enable http socket reuse.falseBOOLYesNo
client.bootstrap.socket.timeoutHttp client socket timeout.15STRINGYesNo
client.threadpool.configurationsThread pool configuration. Expected format of these parameters is as follows: "'client.connection.pool.count:xxx','client.max.active.connections.per.pool:xxx'"TODOSTRINGYesNo
client.connection.pool.countConnection pool count.0INTYesNo
client.max.active.connections.per.poolActive connections per pool.-1INTYesNo
client.min.idle.connections.per.poolMinimum ideal connection per pool.0INTYesNo
client.max.idle.connections.per.poolMaximum ideal connection per pool.100INTYesNo
client.min.eviction.idle.timeMinimum eviction idle time.5 * 60 * 1000STRINGYesNo
sender.thread.countHttp sender thread count.20STRINGYesNo
event.group.executor.thread.sizeEvent group executor thread size.15STRINGYesNo
max.wait.for.client.connection.poolMaximum wait for client connection pool.60000STRINGYesNo
- -System Parameters - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Parameters
clientBootstrapBossGroupSizeproperty to configure number of boss threads, which accepts incoming connections until the ports are unbound. Once connection accepts successfully, boss thread passes the accepted channel to one of the worker threads.4Any integer
clientBootstrapWorkerGroupSizeproperty to configure number of worker threads, which performs non blocking read and write for one or more channels in non-blocking mode.8Any integer
trustStoreLocationThe default truststore file path.${carbon.home}/resources/security/client-truststore.jksPath to client-truststore.jks
trustStorePasswordThe default truststore password.wso2carbonTruststore password
- -Examples -EXAMPLE 1 -``` -@sink(type='http',publisher.url='http://localhost:8009/foo', method='{{method}}',headers='{{headers}}',client.bootstrap.configuration="'client.bootstrap.socket.timeout:20','client.bootstrap.worker.group.size:10'",client.pool.configuration="'client.connection.pool.count:10','client.max.active.connections.per.pool:1'" @map(type='xml' , @payload('{{payloadBody}}')))define stream FooStream (payloadBody String, method string, headers string); - -``` -

If it is xml mapping expected input should be in following format for FooStream:{<events> <event> <symbol>WSO2</symbol> <price>55.6</price> <volume>100</volume> </event></events>,POST,Content-Length:24#Content-Location:USA#Retry-After:120}Above event will generate output as below.~Output http event payload<events>
    <event>
        <symbol>WSO2</symbol>
        <price>55.6</price>
        <volume>100</volume>
    </event>
</events>
~Output http event headersContent-Length:24,Content-Location:'USA',Retry-After:120,Content-Type:'application/xml',HTTP_METHOD:'POST',~Output http event propertiesHTTP_METHOD:'POST',HOST:'localhost',PORT:8009PROTOCOL:'http'TO:'/foo'

- -## Source - -### http *(Source)* - -

The HTTP source receives POST requests via HTTP or HTTPS in format such as text, XML and JSON. If required, you can enable basic authentication to ensure that events are received only from users who are authorized to access the service.

- -Syntax -``` -@source(type="http", receiver.url="", basic.auth.enabled="", worker.count="", socket.idle.timeout="", ssl.verify.client="", ssl.protocol="", tls.store.type="", parameters="", ciphers="", ssl.enabled.protocols="", server.enable.session.creation="", server.supported.snimatchers="", server.suported.server.names="", request.size.validation.configuration="", request.size.validation="", request.size.validation.maximum.value="", request.size.validation.reject.status.code="", request.size.validation.reject.message="", request.size.validation.reject.message.content.type="", header.size.validation="", header.validation.maximum.request.line="", header.validation.maximum.size="", header.validation.maximum.chunk.size="", header.validation.reject.status.code="", header.validation.reject.message="", header.validation.reject.message.content.type="", server.bootstrap.configuration="", server.bootstrap.nodelay="", server.bootstrap.keepalive="", server.bootstrap.sendbuffersize="", server.bootstrap.recievebuffersize="", server.bootstrap.connect.timeout="", server.bootstrap.socket.reuse="", server.bootstrap.socket.timeout="", server.bootstrap.socket.backlog="", trace.log.enabled="", @map(...))) -``` - -QUERY PARAMETERS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
receiver.urlThe URL to which the events should be received. User can provide any valid url and if the url is not provided the system will use the following format http://0.0.0.0:9763/<appNAme>/<streamName>If the user want to use SSL the url should be given in following format https://localhost:8080/<streamName>http://0.0.0.0:9763//STRINGYesNo
basic.auth.enabledIf this is set to true, basic authentication is enabled for incoming events, and the credentials with which each event is sent are verified to ensure that the user is authorized to access the service. If basic authentication fails, the event is not authenticated and an authentication error is logged in the CLI. By default this values 'false' falseSTRINGYesNo
worker.countThe number of active worker threads to serve the incoming events. The value is 1 by default. This will ensure that the events are directed to the event stream in the same order in which they arrive. By increasing this value the performance might increase at the cost of loosing event ordering.1STRINGYesNo
socket.idle.timeoutIdle timeout for HTTP connection.120000INTYesNo
ssl.verify.clientThe type of client certificate verification.nullSTRINGYesNo
ssl.protocolssl/tls related optionsTLSSTRINGYesNo
tls.store.typeTLS store type.JKSSTRINGYesNo
parametersParameters other than basics such as ciphers,sslEnabledProtocols,client.enable.session.creation. Expected format of these parameters is as follows: "'ciphers:xxx','sslEnabledProtocols,client.enable:xxx'"nullSTRINGYesNo
ciphersList of ciphers to be used. This parameter should include under parameters Ex: 'ciphers:TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256'nullSTRINGYesNo
ssl.enabled.protocolsSSL/TLS protocols to be enabled. This parameter should be in camel case format(sslEnabledProtocols) under parameters. Ex 'sslEnabledProtocols:true'nullSTRINGYesNo
server.enable.session.creationEnable HTTP session creation.This parameter should include under parameters Ex: 'client.enable.session.creation:true'nullSTRINGYesNo
server.supported.snimatchersHttp SNIMatcher to be added. This parameter should include under parameters Ex: 'server.supported.snimatchers:SNIMatcher'nullSTRINGYesNo
server.suported.server.namesHttp supported servers. This parameter should include under parameters Ex: 'server.suported.server.names:server'nullSTRINGYesNo
request.size.validation.configurationParameters that responsible for validating the http request and request headers. Expected format of these parameters is as follows: "'request.size.validation:xxx','request.size.validation.maximum.value:xxx'"nullSTRINGYesNo
request.size.validationTo enable the request size validation.falseSTRINGYesNo
request.size.validation.maximum.valueIf request size is validated then maximum size.Integer.MAX_VALUESTRINGYesNo
request.size.validation.reject.status.codeIf request is exceed maximum size and request.size.validation is enabled then status code to be send as response.401STRINGYesNo
request.size.validation.reject.messageIf request is exceed maximum size and request.size.validation is enabled then status message to be send as response.Message is bigger than the valid sizeSTRINGYesNo
request.size.validation.reject.message.content.typeIf request is exceed maximum size and request.size.validation is enabled then content type to be send as response.plain/textSTRINGYesNo
header.size.validationTo enable the header size validation.falseSTRINGYesNo
header.validation.maximum.request.lineIf header header validation is enabled then the maximum request line.4096STRINGYesNo
header.validation.maximum.sizeIf header header validation is enabled then the maximum expected header size.8192STRINGYesNo
header.validation.maximum.chunk.sizeIf header header validation is enabled then the maximum expected chunk size.8192STRINGYesNo
header.validation.reject.status.code401If header is exceed maximum size and header.size.validation is enabled then status code to be send as response.STRINGYesNo
header.validation.reject.messageIf header is exceed maximum size and header.size.validation is enabled then message to be send as response.Message header is bigger than the valid sizeSTRINGYesNo
header.validation.reject.message.content.typeIf header is exceed maximum size and header.size.validation is enabled then content type to be send as response.plain/textSTRINGYesNo
server.bootstrap.configurationParameters that for bootstrap configurations of the server. Expected format of these parameters is as follows: "'ciphers:xxx','sslEnabledProtocols,client.enable:xxx'"nullOBJECTYesNo
server.bootstrap.nodelayHttp server no delay.trueBOOLYesNo
server.bootstrap.keepaliveHttp server keep alive.trueBOOLYesNo
server.bootstrap.sendbuffersizeHttp server send buffer size.1048576INTYesNo
server.bootstrap.recievebuffersizeHttp server receive buffer size.1048576INTYesNo
server.bootstrap.connect.timeoutHttp server connection timeout.15000INTYesNo
server.bootstrap.socket.reuseTo enable http socket reuse.falseBOOLYesNo
server.bootstrap.socket.timeoutHttp server socket timeout.15BOOLYesNo
server.bootstrap.socket.backlogTHttp server socket backlog.100BOOLYesNo
trace.log.enabledHttp traffic monitoring.falseBOOLYesNo
- -System Parameters - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Parameters
serverBootstrapBossGroupSizeproperty to configure number of boss threads, which accepts incoming connections until the ports are unbound. Once connection accepts successfully, boss thread passes the accepted channel to one of the worker threads.4Any integer
serverBootstrapWorkerGroupSizeproperty to configure number of worker threads, which performs non blocking read and write for one or more channels in non-blocking mode.8Any integer
defaultHostThe default host of the transport.0.0.0.0Any valid host
defaultHttpPortThe default port if the default scheme is 'http'.8280Any valid port
defaultHttpsPortThe default port if the default scheme is 'https'.8243Any valid port
defaultSchemeThe default protocol.httphttp
https
keyStoreLocationThe default keystore file path.${carbon.home}/resources/security/wso2carbon.jksPath to wso2carbon.jks file
keyStorePasswordThe default keystore password.wso2carbonString of keystore password
certPasswordThe default cert password.wso2carbonString of cert password
- -Examples -EXAMPLE 1 -``` -@source(type='http', receiver.url='http://localhost:9055/endpoints/RecPro', socketIdleTimeout='150000', parameters="'ciphers : TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256', 'sslEnabledProtocols:TLSv1.1,TLSv1.2'",request.size.validation.configuration="request.size.validation:true",server.bootstrap.configuration="server.bootstrap.socket.timeout:25" @map(type='xml')) -define stream FooStream (symbol string, price float, volume long); - -``` -

Above source listenerConfiguration performs a default XML input mapping. The expected input is as follows:<events>
    <event>
        <symbol>WSO2</symbol>
        <price>55.6</price>
        <volume>100</volume>
    </event>
</events>
If basic authentication is enabled via the basic.auth.enabled='true setting, each input event is also expected to contain the Authorization:'Basic encodeBase64(username:Password)' header.

- diff --git a/docs/api/1.0.15.md b/docs/api/1.0.15.md deleted file mode 100644 index 9c8141aa..00000000 --- a/docs/api/1.0.15.md +++ /dev/null @@ -1,755 +0,0 @@ -# API Docs - v1.0.15 - -## Sink - -### http *(Sink)* - -

This extension publish the HTTP events in any HTTP method POST, GET, PUT, DELETE via HTTP or https protocols. As the additional features this component can provide basic authentication as well as user can publish events using custom client truststore files when publishing events via https protocol. And also user can add any number of headers including HTTP_METHOD header for each event dynamically.

- -Syntax -``` -@sink(type="http", publisher.url="", basic.auth.username="", basic.auth.password="", https.truststore.file="", https.truststore.password="", headers="", method="", socket.idle.timeout="", chunk.disabled="", ssl.protocol="", parameters="", ciphers="", ssl.enabled.protocols="", client.enable.session.creation="", follow.redirect="", max.redirect.count="", tls.store.type="", proxy.host="", proxy.port="", proxy.username="", proxy.password="", client.bootstrap.configuration="", client.bootstrap.nodelay="", client.bootstrap.keepalive="", client.bootstrap.sendbuffersize="", client.bootstrap.recievebuffersize="", client.bootstrap.connect.timeout="", client.bootstrap.socket.reuse="", client.bootstrap.socket.timeout="", client.threadpool.configurations="", client.connection.pool.count="", client.max.active.connections.per.pool="", client.min.idle.connections.per.pool="", client.max.idle.connections.per.pool="", client.min.eviction.idle.time="", sender.thread.count="", event.group.executor.thread.size="", max.wait.for.client.connection.pool="", @map(...))) -``` - -QUERY PARAMETERS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
publisher.urlThe URL to which the outgoing events should be published via HTTP. This is a mandatory parameter and if this is not specified, an error is logged in the CLI. If user wants to enable SSL for the events, use https instead of http in the publisher.url.e.g., http://localhost:8080/endpoint, https://localhost:8080/endpointSTRINGNoNo
basic.auth.usernameThe username to be included in the authentication header of the basic authentication enabled events. It is required to specify both username and password to enable basic authentication. If one of the parameter is not given by user then an error is logged in the CLI. STRINGYesNo
basic.auth.passwordThe password to include in the authentication header of the basic authentication enabled events. It is required to specify both username and password to enable basic authentication. If one of the parameter is not given by user then an error is logged in the CLI. STRINGYesNo
https.truststore.fileThe file path to the location of the truststore of the client that sends the HTTP events through 'https' protocol. A custom client-truststore can be specified if required.${carbon.home}/resources/security/client-truststore.jksSTRINGYesNo
https.truststore.passwordThe password for the client-truststore. A custom password can be specified if required. If no custom password is specified and the protocol of URL is 'https' then, the system uses default password.wso2carbonSTRINGYesNo
headersThe headers that should be included as a HTTP request headers. There can be any number of headers concatenated on following format. header1:value1#header2:value2. User can include content-type header if he need to any specific type for payload if not system get the mapping type as the content-Type header (ie. @map(xml):application/xml,@map(json):application/json,@map(text):plain/text ) and if user does not include any mapping type then system gets the 'plain/text' as default Content-Type header. If user does not include Content-Length header then system calculate the bytes size of payload and include it as content-length header. STRINGYesNo
methodFor HTTP events, HTTP_METHOD header should be included as a request header. If the parameter is null then system uses 'POST' as a default header.POSTSTRINGYesNo
socket.idle.timeoutSocket timeout value in millisecond6000INTYesNo
chunk.disabledport: Port number of the remote servicefalseBOOLYesNo
ssl.protocolThe SSL protocol versionTLSSTRINGYesNo
parametersParameters other than basics such as ciphers,sslEnabledProtocols,client.enable.session.creation. Expected format of these parameters is as follows: "'ciphers:xxx','sslEnabledProtocols,client.enable:xxx'"nullSTRINGYesNo
ciphersList of ciphers to be used. This parameter should include under parameters Ex: 'ciphers:TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256'nullSTRINGYesNo
ssl.enabled.protocolsSSL/TLS protocols to be enabled. This parameter should be in camel case format(sslEnabledProtocols) under parameters. Ex 'sslEnabledProtocols:true'nullSTRINGYesNo
client.enable.session.creationEnable HTTP session creation.This parameter should include under parameters Ex: 'client.enable.session.creation:true'nullSTRINGYesNo
follow.redirectRedirect related enabled.trueBOOLYesNo
max.redirect.countMaximum redirect count.5INTYesNo
tls.store.typeTLS store type to be used.JKSSTRINGYesNo
proxy.hostProxy server hostnullSTRINGYesNo
proxy.portProxy server portnullSTRINGYesNo
proxy.usernameProxy server usernamenullSTRINGYesNo
proxy.passwordProxy server passwordnullSTRINGYesNo
client.bootstrap.configurationClient bootsrap configurations. Expected format of these parameters is as follows: "'client.bootstrap.nodelay:xxx','client.bootstrap.keepalive:xxx'"TODOSTRINGYesNo
client.bootstrap.nodelayHttp client no delay.trueBOOLYesNo
client.bootstrap.keepaliveHttp client keep alive.trueBOOLYesNo
client.bootstrap.sendbuffersizeHttp client send buffer size.1048576INTYesNo
client.bootstrap.recievebuffersizeHttp client receive buffer size.1048576INTYesNo
client.bootstrap.connect.timeoutHttp client connection timeout.15000INTYesNo
client.bootstrap.socket.reuseTo enable http socket reuse.falseBOOLYesNo
client.bootstrap.socket.timeoutHttp client socket timeout.15STRINGYesNo
client.threadpool.configurationsThread pool configuration. Expected format of these parameters is as follows: "'client.connection.pool.count:xxx','client.max.active.connections.per.pool:xxx'"TODOSTRINGYesNo
client.connection.pool.countConnection pool count.0INTYesNo
client.max.active.connections.per.poolActive connections per pool.-1INTYesNo
client.min.idle.connections.per.poolMinimum ideal connection per pool.0INTYesNo
client.max.idle.connections.per.poolMaximum ideal connection per pool.100INTYesNo
client.min.eviction.idle.timeMinimum eviction idle time.5 * 60 * 1000STRINGYesNo
sender.thread.countHttp sender thread count.20STRINGYesNo
event.group.executor.thread.sizeEvent group executor thread size.15STRINGYesNo
max.wait.for.client.connection.poolMaximum wait for client connection pool.60000STRINGYesNo
- -System Parameters - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Parameters
clientBootstrapBossGroupSizeproperty to configure number of boss threads, which accepts incoming connections until the ports are unbound. Once connection accepts successfully, boss thread passes the accepted channel to one of the worker threads.4Any integer
clientBootstrapWorkerGroupSizeproperty to configure number of worker threads, which performs non blocking read and write for one or more channels in non-blocking mode.8Any integer
trustStoreLocationThe default truststore file path.${carbon.home}/resources/security/client-truststore.jksPath to client-truststore.jks
trustStorePasswordThe default truststore password.wso2carbonTruststore password
- -Examples -EXAMPLE 1 -``` -@sink(type='http',publisher.url='http://localhost:8009/foo', method='{{method}}',headers='{{headers}}',client.bootstrap.configuration="'client.bootstrap.socket.timeout:20','client.bootstrap.worker.group.size:10'",client.pool.configuration="'client.connection.pool.count:10','client.max.active.connections.per.pool:1'" @map(type='xml' , @payload('{{payloadBody}}')))define stream FooStream (payloadBody String, method string, headers string); - -``` -

If it is xml mapping expected input should be in following format for FooStream:{<events> <event> <symbol>WSO2</symbol> <price>55.6</price> <volume>100</volume> </event></events>,POST,Content-Length:24#Content-Location:USA#Retry-After:120}Above event will generate output as below.~Output http event payload<events>
    <event>
        <symbol>WSO2</symbol>
        <price>55.6</price>
        <volume>100</volume>
    </event>
</events>
~Output http event headersContent-Length:24,Content-Location:'USA',Retry-After:120,Content-Type:'application/xml',HTTP_METHOD:'POST',~Output http event propertiesHTTP_METHOD:'POST',HOST:'localhost',PORT:8009PROTOCOL:'http'TO:'/foo'

- -## Source - -### http *(Source)* - -

The HTTP source receives POST requests via HTTP or HTTPS in format such as text, XML and JSON. If required, you can enable basic authentication to ensure that events are received only from users who are authorized to access the service.

- -Syntax -``` -@source(type="http", receiver.url="", basic.auth.enabled="", worker.count="", socket.idle.timeout="", ssl.verify.client="", ssl.protocol="", tls.store.type="", parameters="", ciphers="", ssl.enabled.protocols="", server.enable.session.creation="", server.supported.snimatchers="", server.suported.server.names="", request.size.validation.configuration="", request.size.validation="", request.size.validation.maximum.value="", request.size.validation.reject.status.code="", request.size.validation.reject.message="", request.size.validation.reject.message.content.type="", header.size.validation="", header.validation.maximum.request.line="", header.validation.maximum.size="", header.validation.maximum.chunk.size="", header.validation.reject.status.code="", header.validation.reject.message="", header.validation.reject.message.content.type="", server.bootstrap.configuration="", server.bootstrap.nodelay="", server.bootstrap.keepalive="", server.bootstrap.sendbuffersize="", server.bootstrap.recievebuffersize="", server.bootstrap.connect.timeout="", server.bootstrap.socket.reuse="", server.bootstrap.socket.timeout="", server.bootstrap.socket.backlog="", trace.log.enabled="", @map(...))) -``` - -QUERY PARAMETERS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
receiver.urlThe URL to which the events should be received. User can provide any valid url and if the url is not provided the system will use the following format http://0.0.0.0:9763/<appNAme>/<streamName>If the user want to use SSL the url should be given in following format https://localhost:8080/<streamName>http://0.0.0.0:9763//STRINGYesNo
basic.auth.enabledIf this is set to true, basic authentication is enabled for incoming events, and the credentials with which each event is sent are verified to ensure that the user is authorized to access the service. If basic authentication fails, the event is not authenticated and an authentication error is logged in the CLI. By default this values 'false' falseSTRINGYesNo
worker.countThe number of active worker threads to serve the incoming events. The value is 1 by default. This will ensure that the events are directed to the event stream in the same order in which they arrive. By increasing this value the performance might increase at the cost of loosing event ordering.1STRINGYesNo
socket.idle.timeoutIdle timeout for HTTP connection.120000INTYesNo
ssl.verify.clientThe type of client certificate verification.nullSTRINGYesNo
ssl.protocolssl/tls related optionsTLSSTRINGYesNo
tls.store.typeTLS store type.JKSSTRINGYesNo
parametersParameters other than basics such as ciphers,sslEnabledProtocols,client.enable.session.creation. Expected format of these parameters is as follows: "'ciphers:xxx','sslEnabledProtocols,client.enable:xxx'"nullSTRINGYesNo
ciphersList of ciphers to be used. This parameter should include under parameters Ex: 'ciphers:TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256'nullSTRINGYesNo
ssl.enabled.protocolsSSL/TLS protocols to be enabled. This parameter should be in camel case format(sslEnabledProtocols) under parameters. Ex 'sslEnabledProtocols:true'nullSTRINGYesNo
server.enable.session.creationEnable HTTP session creation.This parameter should include under parameters Ex: 'client.enable.session.creation:true'nullSTRINGYesNo
server.supported.snimatchersHttp SNIMatcher to be added. This parameter should include under parameters Ex: 'server.supported.snimatchers:SNIMatcher'nullSTRINGYesNo
server.suported.server.namesHttp supported servers. This parameter should include under parameters Ex: 'server.suported.server.names:server'nullSTRINGYesNo
request.size.validation.configurationParameters that responsible for validating the http request and request headers. Expected format of these parameters is as follows: "'request.size.validation:xxx','request.size.validation.maximum.value:xxx'"nullSTRINGYesNo
request.size.validationTo enable the request size validation.falseSTRINGYesNo
request.size.validation.maximum.valueIf request size is validated then maximum size.Integer.MAX_VALUESTRINGYesNo
request.size.validation.reject.status.codeIf request is exceed maximum size and request.size.validation is enabled then status code to be send as response.401STRINGYesNo
request.size.validation.reject.messageIf request is exceed maximum size and request.size.validation is enabled then status message to be send as response.Message is bigger than the valid sizeSTRINGYesNo
request.size.validation.reject.message.content.typeIf request is exceed maximum size and request.size.validation is enabled then content type to be send as response.plain/textSTRINGYesNo
header.size.validationTo enable the header size validation.falseSTRINGYesNo
header.validation.maximum.request.lineIf header header validation is enabled then the maximum request line.4096STRINGYesNo
header.validation.maximum.sizeIf header header validation is enabled then the maximum expected header size.8192STRINGYesNo
header.validation.maximum.chunk.sizeIf header header validation is enabled then the maximum expected chunk size.8192STRINGYesNo
header.validation.reject.status.code401If header is exceed maximum size and header.size.validation is enabled then status code to be send as response.STRINGYesNo
header.validation.reject.messageIf header is exceed maximum size and header.size.validation is enabled then message to be send as response.Message header is bigger than the valid sizeSTRINGYesNo
header.validation.reject.message.content.typeIf header is exceed maximum size and header.size.validation is enabled then content type to be send as response.plain/textSTRINGYesNo
server.bootstrap.configurationParameters that for bootstrap configurations of the server. Expected format of these parameters is as follows: "'ciphers:xxx','sslEnabledProtocols,client.enable:xxx'"nullOBJECTYesNo
server.bootstrap.nodelayHttp server no delay.trueBOOLYesNo
server.bootstrap.keepaliveHttp server keep alive.trueBOOLYesNo
server.bootstrap.sendbuffersizeHttp server send buffer size.1048576INTYesNo
server.bootstrap.recievebuffersizeHttp server receive buffer size.1048576INTYesNo
server.bootstrap.connect.timeoutHttp server connection timeout.15000INTYesNo
server.bootstrap.socket.reuseTo enable http socket reuse.falseBOOLYesNo
server.bootstrap.socket.timeoutHttp server socket timeout.15BOOLYesNo
server.bootstrap.socket.backlogTHttp server socket backlog.100BOOLYesNo
trace.log.enabledHttp traffic monitoring.falseBOOLYesNo
- -System Parameters - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Parameters
serverBootstrapBossGroupSizeproperty to configure number of boss threads, which accepts incoming connections until the ports are unbound. Once connection accepts successfully, boss thread passes the accepted channel to one of the worker threads.4Any integer
serverBootstrapWorkerGroupSizeproperty to configure number of worker threads, which performs non blocking read and write for one or more channels in non-blocking mode.8Any integer
defaultHostThe default host of the transport.0.0.0.0Any valid host
defaultHttpPortThe default port if the default scheme is 'http'.8280Any valid port
defaultHttpsPortThe default port if the default scheme is 'https'.8243Any valid port
defaultSchemeThe default protocol.httphttp
https
keyStoreLocationThe default keystore file path.${carbon.home}/resources/security/wso2carbon.jksPath to wso2carbon.jks file
keyStorePasswordThe default keystore password.wso2carbonString of keystore password
certPasswordThe default cert password.wso2carbonString of cert password
- -Examples -EXAMPLE 1 -``` -@source(type='http', receiver.url='http://localhost:9055/endpoints/RecPro', socketIdleTimeout='150000', parameters="'ciphers : TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256', 'sslEnabledProtocols:TLSv1.1,TLSv1.2'",request.size.validation.configuration="request.size.validation:true",server.bootstrap.configuration="server.bootstrap.socket.timeout:25" @map(type='xml')) -define stream FooStream (symbol string, price float, volume long); - -``` -

Above source listenerConfiguration performs a default XML input mapping. The expected input is as follows:<events>
    <event>
        <symbol>WSO2</symbol>
        <price>55.6</price>
        <volume>100</volume>
    </event>
</events>
If basic authentication is enabled via the basic.auth.enabled='true setting, each input event is also expected to contain the Authorization:'Basic encodeBase64(username:Password)' header.

- diff --git a/docs/api/1.0.16.md b/docs/api/1.0.16.md deleted file mode 100644 index a5c17345..00000000 --- a/docs/api/1.0.16.md +++ /dev/null @@ -1,755 +0,0 @@ -# API Docs - v1.0.16 - -## Sink - -### http *(Sink)* - -

This extension publish the HTTP events in any HTTP method POST, GET, PUT, DELETE via HTTP or https protocols. As the additional features this component can provide basic authentication as well as user can publish events using custom client truststore files when publishing events via https protocol. And also user can add any number of headers including HTTP_METHOD header for each event dynamically.

- -Syntax -``` -@sink(type="http", publisher.url="", basic.auth.username="", basic.auth.password="", https.truststore.file="", https.truststore.password="", headers="", method="", socket.idle.timeout="", chunk.disabled="", ssl.protocol="", parameters="", ciphers="", ssl.enabled.protocols="", client.enable.session.creation="", follow.redirect="", max.redirect.count="", tls.store.type="", proxy.host="", proxy.port="", proxy.username="", proxy.password="", client.bootstrap.configuration="", client.bootstrap.nodelay="", client.bootstrap.keepalive="", client.bootstrap.sendbuffersize="", client.bootstrap.recievebuffersize="", client.bootstrap.connect.timeout="", client.bootstrap.socket.reuse="", client.bootstrap.socket.timeout="", client.threadpool.configurations="", client.connection.pool.count="", client.max.active.connections.per.pool="", client.min.idle.connections.per.pool="", client.max.idle.connections.per.pool="", client.min.eviction.idle.time="", sender.thread.count="", event.group.executor.thread.size="", max.wait.for.client.connection.pool="", @map(...))) -``` - -QUERY PARAMETERS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
publisher.urlThe URL to which the outgoing events should be published via HTTP. This is a mandatory parameter and if this is not specified, an error is logged in the CLI. If user wants to enable SSL for the events, use https instead of http in the publisher.url.e.g., http://localhost:8080/endpoint, https://localhost:8080/endpointSTRINGNoNo
basic.auth.usernameThe username to be included in the authentication header of the basic authentication enabled events. It is required to specify both username and password to enable basic authentication. If one of the parameter is not given by user then an error is logged in the CLI. STRINGYesNo
basic.auth.passwordThe password to include in the authentication header of the basic authentication enabled events. It is required to specify both username and password to enable basic authentication. If one of the parameter is not given by user then an error is logged in the CLI. STRINGYesNo
https.truststore.fileThe file path to the location of the truststore of the client that sends the HTTP events through 'https' protocol. A custom client-truststore can be specified if required.${carbon.home}/resources/security/client-truststore.jksSTRINGYesNo
https.truststore.passwordThe password for the client-truststore. A custom password can be specified if required. If no custom password is specified and the protocol of URL is 'https' then, the system uses default password.wso2carbonSTRINGYesNo
headersThe headers that should be included as a HTTP request headers. There can be any number of headers concatenated on following format. header1:value1#header2:value2. User can include content-type header if he need to any specific type for payload if not system get the mapping type as the content-Type header (ie. @map(xml):application/xml,@map(json):application/json,@map(text):plain/text ) and if user does not include any mapping type then system gets the 'plain/text' as default Content-Type header. If user does not include Content-Length header then system calculate the bytes size of payload and include it as content-length header. STRINGYesNo
methodFor HTTP events, HTTP_METHOD header should be included as a request header. If the parameter is null then system uses 'POST' as a default header.POSTSTRINGYesNo
socket.idle.timeoutSocket timeout value in millisecond6000INTYesNo
chunk.disabledport: Port number of the remote servicefalseBOOLYesNo
ssl.protocolThe SSL protocol versionTLSSTRINGYesNo
parametersParameters other than basics such as ciphers,sslEnabledProtocols,client.enable.session.creation. Expected format of these parameters is as follows: "'ciphers:xxx','sslEnabledProtocols,client.enable:xxx'"nullSTRINGYesNo
ciphersList of ciphers to be used. This parameter should include under parameters Ex: 'ciphers:TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256'nullSTRINGYesNo
ssl.enabled.protocolsSSL/TLS protocols to be enabled. This parameter should be in camel case format(sslEnabledProtocols) under parameters. Ex 'sslEnabledProtocols:true'nullSTRINGYesNo
client.enable.session.creationEnable HTTP session creation.This parameter should include under parameters Ex: 'client.enable.session.creation:true'nullSTRINGYesNo
follow.redirectRedirect related enabled.trueBOOLYesNo
max.redirect.countMaximum redirect count.5INTYesNo
tls.store.typeTLS store type to be used.JKSSTRINGYesNo
proxy.hostProxy server hostnullSTRINGYesNo
proxy.portProxy server portnullSTRINGYesNo
proxy.usernameProxy server usernamenullSTRINGYesNo
proxy.passwordProxy server passwordnullSTRINGYesNo
client.bootstrap.configurationClient bootsrap configurations. Expected format of these parameters is as follows: "'client.bootstrap.nodelay:xxx','client.bootstrap.keepalive:xxx'"TODOSTRINGYesNo
client.bootstrap.nodelayHttp client no delay.trueBOOLYesNo
client.bootstrap.keepaliveHttp client keep alive.trueBOOLYesNo
client.bootstrap.sendbuffersizeHttp client send buffer size.1048576INTYesNo
client.bootstrap.recievebuffersizeHttp client receive buffer size.1048576INTYesNo
client.bootstrap.connect.timeoutHttp client connection timeout.15000INTYesNo
client.bootstrap.socket.reuseTo enable http socket reuse.falseBOOLYesNo
client.bootstrap.socket.timeoutHttp client socket timeout.15STRINGYesNo
client.threadpool.configurationsThread pool configuration. Expected format of these parameters is as follows: "'client.connection.pool.count:xxx','client.max.active.connections.per.pool:xxx'"TODOSTRINGYesNo
client.connection.pool.countConnection pool count.0INTYesNo
client.max.active.connections.per.poolActive connections per pool.-1INTYesNo
client.min.idle.connections.per.poolMinimum ideal connection per pool.0INTYesNo
client.max.idle.connections.per.poolMaximum ideal connection per pool.100INTYesNo
client.min.eviction.idle.timeMinimum eviction idle time.5 * 60 * 1000STRINGYesNo
sender.thread.countHttp sender thread count.20STRINGYesNo
event.group.executor.thread.sizeEvent group executor thread size.15STRINGYesNo
max.wait.for.client.connection.poolMaximum wait for client connection pool.60000STRINGYesNo
- -System Parameters - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Parameters
clientBootstrapBossGroupSizeproperty to configure number of boss threads, which accepts incoming connections until the ports are unbound. Once connection accepts successfully, boss thread passes the accepted channel to one of the worker threads.4Any integer
clientBootstrapWorkerGroupSizeproperty to configure number of worker threads, which performs non blocking read and write for one or more channels in non-blocking mode.8Any integer
trustStoreLocationThe default truststore file path.${carbon.home}/resources/security/client-truststore.jksPath to client-truststore.jks
trustStorePasswordThe default truststore password.wso2carbonTruststore password
- -Examples -EXAMPLE 1 -``` -@sink(type='http',publisher.url='http://localhost:8009/foo', method='{{method}}',headers='{{headers}}',client.bootstrap.configuration="'client.bootstrap.socket.timeout:20','client.bootstrap.worker.group.size:10'",client.pool.configuration="'client.connection.pool.count:10','client.max.active.connections.per.pool:1'" @map(type='xml' , @payload('{{payloadBody}}')))define stream FooStream (payloadBody String, method string, headers string); - -``` -

If it is xml mapping expected input should be in following format for FooStream:{<events> <event> <symbol>WSO2</symbol> <price>55.6</price> <volume>100</volume> </event></events>,POST,Content-Length:24#Content-Location:USA#Retry-After:120}Above event will generate output as below.~Output http event payload<events>
    <event>
        <symbol>WSO2</symbol>
        <price>55.6</price>
        <volume>100</volume>
    </event>
</events>
~Output http event headersContent-Length:24,Content-Location:'USA',Retry-After:120,Content-Type:'application/xml',HTTP_METHOD:'POST',~Output http event propertiesHTTP_METHOD:'POST',HOST:'localhost',PORT:8009PROTOCOL:'http'TO:'/foo'

- -## Source - -### http *(Source)* - -

The HTTP source receives POST requests via HTTP or HTTPS in format such as text, XML and JSON. If required, you can enable basic authentication to ensure that events are received only from users who are authorized to access the service.

- -Syntax -``` -@source(type="http", receiver.url="", basic.auth.enabled="", worker.count="", socket.idle.timeout="", ssl.verify.client="", ssl.protocol="", tls.store.type="", parameters="", ciphers="", ssl.enabled.protocols="", server.enable.session.creation="", server.supported.snimatchers="", server.suported.server.names="", request.size.validation.configuration="", request.size.validation="", request.size.validation.maximum.value="", request.size.validation.reject.status.code="", request.size.validation.reject.message="", request.size.validation.reject.message.content.type="", header.size.validation="", header.validation.maximum.request.line="", header.validation.maximum.size="", header.validation.maximum.chunk.size="", header.validation.reject.status.code="", header.validation.reject.message="", header.validation.reject.message.content.type="", server.bootstrap.configuration="", server.bootstrap.nodelay="", server.bootstrap.keepalive="", server.bootstrap.sendbuffersize="", server.bootstrap.recievebuffersize="", server.bootstrap.connect.timeout="", server.bootstrap.socket.reuse="", server.bootstrap.socket.timeout="", server.bootstrap.socket.backlog="", trace.log.enabled="", @map(...))) -``` - -QUERY PARAMETERS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
receiver.urlThe URL to which the events should be received. User can provide any valid url and if the url is not provided the system will use the following format http://0.0.0.0:9763/<appNAme>/<streamName>If the user want to use SSL the url should be given in following format https://localhost:8080/<streamName>http://0.0.0.0:9763//STRINGYesNo
basic.auth.enabledIf this is set to true, basic authentication is enabled for incoming events, and the credentials with which each event is sent are verified to ensure that the user is authorized to access the service. If basic authentication fails, the event is not authenticated and an authentication error is logged in the CLI. By default this values 'false' falseSTRINGYesNo
worker.countThe number of active worker threads to serve the incoming events. The value is 1 by default. This will ensure that the events are directed to the event stream in the same order in which they arrive. By increasing this value the performance might increase at the cost of loosing event ordering.1STRINGYesNo
socket.idle.timeoutIdle timeout for HTTP connection.120000INTYesNo
ssl.verify.clientThe type of client certificate verification.nullSTRINGYesNo
ssl.protocolssl/tls related optionsTLSSTRINGYesNo
tls.store.typeTLS store type.JKSSTRINGYesNo
parametersParameters other than basics such as ciphers,sslEnabledProtocols,client.enable.session.creation. Expected format of these parameters is as follows: "'ciphers:xxx','sslEnabledProtocols,client.enable:xxx'"nullSTRINGYesNo
ciphersList of ciphers to be used. This parameter should include under parameters Ex: 'ciphers:TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256'nullSTRINGYesNo
ssl.enabled.protocolsSSL/TLS protocols to be enabled. This parameter should be in camel case format(sslEnabledProtocols) under parameters. Ex 'sslEnabledProtocols:true'nullSTRINGYesNo
server.enable.session.creationEnable HTTP session creation.This parameter should include under parameters Ex: 'client.enable.session.creation:true'nullSTRINGYesNo
server.supported.snimatchersHttp SNIMatcher to be added. This parameter should include under parameters Ex: 'server.supported.snimatchers:SNIMatcher'nullSTRINGYesNo
server.suported.server.namesHttp supported servers. This parameter should include under parameters Ex: 'server.suported.server.names:server'nullSTRINGYesNo
request.size.validation.configurationParameters that responsible for validating the http request and request headers. Expected format of these parameters is as follows: "'request.size.validation:xxx','request.size.validation.maximum.value:xxx'"nullSTRINGYesNo
request.size.validationTo enable the request size validation.falseSTRINGYesNo
request.size.validation.maximum.valueIf request size is validated then maximum size.Integer.MAX_VALUESTRINGYesNo
request.size.validation.reject.status.codeIf request is exceed maximum size and request.size.validation is enabled then status code to be send as response.401STRINGYesNo
request.size.validation.reject.messageIf request is exceed maximum size and request.size.validation is enabled then status message to be send as response.Message is bigger than the valid sizeSTRINGYesNo
request.size.validation.reject.message.content.typeIf request is exceed maximum size and request.size.validation is enabled then content type to be send as response.plain/textSTRINGYesNo
header.size.validationTo enable the header size validation.falseSTRINGYesNo
header.validation.maximum.request.lineIf header header validation is enabled then the maximum request line.4096STRINGYesNo
header.validation.maximum.sizeIf header header validation is enabled then the maximum expected header size.8192STRINGYesNo
header.validation.maximum.chunk.sizeIf header header validation is enabled then the maximum expected chunk size.8192STRINGYesNo
header.validation.reject.status.code401If header is exceed maximum size and header.size.validation is enabled then status code to be send as response.STRINGYesNo
header.validation.reject.messageIf header is exceed maximum size and header.size.validation is enabled then message to be send as response.Message header is bigger than the valid sizeSTRINGYesNo
header.validation.reject.message.content.typeIf header is exceed maximum size and header.size.validation is enabled then content type to be send as response.plain/textSTRINGYesNo
server.bootstrap.configurationParameters that for bootstrap configurations of the server. Expected format of these parameters is as follows: "'ciphers:xxx','sslEnabledProtocols,client.enable:xxx'"nullOBJECTYesNo
server.bootstrap.nodelayHttp server no delay.trueBOOLYesNo
server.bootstrap.keepaliveHttp server keep alive.trueBOOLYesNo
server.bootstrap.sendbuffersizeHttp server send buffer size.1048576INTYesNo
server.bootstrap.recievebuffersizeHttp server receive buffer size.1048576INTYesNo
server.bootstrap.connect.timeoutHttp server connection timeout.15000INTYesNo
server.bootstrap.socket.reuseTo enable http socket reuse.falseBOOLYesNo
server.bootstrap.socket.timeoutHttp server socket timeout.15BOOLYesNo
server.bootstrap.socket.backlogTHttp server socket backlog.100BOOLYesNo
trace.log.enabledHttp traffic monitoring.falseBOOLYesNo
- -System Parameters - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Parameters
serverBootstrapBossGroupSizeproperty to configure number of boss threads, which accepts incoming connections until the ports are unbound. Once connection accepts successfully, boss thread passes the accepted channel to one of the worker threads.4Any integer
serverBootstrapWorkerGroupSizeproperty to configure number of worker threads, which performs non blocking read and write for one or more channels in non-blocking mode.8Any integer
defaultHostThe default host of the transport.0.0.0.0Any valid host
defaultHttpPortThe default port if the default scheme is 'http'.8280Any valid port
defaultHttpsPortThe default port if the default scheme is 'https'.8243Any valid port
defaultSchemeThe default protocol.httphttp
https
keyStoreLocationThe default keystore file path.${carbon.home}/resources/security/wso2carbon.jksPath to wso2carbon.jks file
keyStorePasswordThe default keystore password.wso2carbonString of keystore password
certPasswordThe default cert password.wso2carbonString of cert password
- -Examples -EXAMPLE 1 -``` -@source(type='http', receiver.url='http://localhost:9055/endpoints/RecPro', socketIdleTimeout='150000', parameters="'ciphers : TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256', 'sslEnabledProtocols:TLSv1.1,TLSv1.2'",request.size.validation.configuration="request.size.validation:true",server.bootstrap.configuration="server.bootstrap.socket.timeout:25" @map(type='xml')) -define stream FooStream (symbol string, price float, volume long); - -``` -

Above source listenerConfiguration performs a default XML input mapping. The expected input is as follows:<events>
    <event>
        <symbol>WSO2</symbol>
        <price>55.6</price>
        <volume>100</volume>
    </event>
</events>
If basic authentication is enabled via the basic.auth.enabled='true setting, each input event is also expected to contain the Authorization:'Basic encodeBase64(username:Password)' header.

- diff --git a/docs/api/1.0.17.md b/docs/api/1.0.17.md deleted file mode 100644 index 75df24ad..00000000 --- a/docs/api/1.0.17.md +++ /dev/null @@ -1,755 +0,0 @@ -# API Docs - v1.0.17 - -## Sink - -### http *(Sink)* - -

This extension publish the HTTP events in any HTTP method POST, GET, PUT, DELETE via HTTP or https protocols. As the additional features this component can provide basic authentication as well as user can publish events using custom client truststore files when publishing events via https protocol. And also user can add any number of headers including HTTP_METHOD header for each event dynamically.

- -Syntax -``` -@sink(type="http", publisher.url="", basic.auth.username="", basic.auth.password="", https.truststore.file="", https.truststore.password="", headers="", method="", socket.idle.timeout="", chunk.disabled="", ssl.protocol="", parameters="", ciphers="", ssl.enabled.protocols="", client.enable.session.creation="", follow.redirect="", max.redirect.count="", tls.store.type="", proxy.host="", proxy.port="", proxy.username="", proxy.password="", client.bootstrap.configuration="", client.bootstrap.nodelay="", client.bootstrap.keepalive="", client.bootstrap.sendbuffersize="", client.bootstrap.recievebuffersize="", client.bootstrap.connect.timeout="", client.bootstrap.socket.reuse="", client.bootstrap.socket.timeout="", client.threadpool.configurations="", client.connection.pool.count="", client.max.active.connections.per.pool="", client.min.idle.connections.per.pool="", client.max.idle.connections.per.pool="", client.min.eviction.idle.time="", sender.thread.count="", event.group.executor.thread.size="", max.wait.for.client.connection.pool="", @map(...))) -``` - -QUERY PARAMETERS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
publisher.urlThe URL to which the outgoing events should be published via HTTP. This is a mandatory parameter and if this is not specified, an error is logged in the CLI. If user wants to enable SSL for the events, use https instead of http in the publisher.url.e.g., http://localhost:8080/endpoint, https://localhost:8080/endpointSTRINGNoNo
basic.auth.usernameThe username to be included in the authentication header of the basic authentication enabled events. It is required to specify both username and password to enable basic authentication. If one of the parameter is not given by user then an error is logged in the CLI. STRINGYesNo
basic.auth.passwordThe password to include in the authentication header of the basic authentication enabled events. It is required to specify both username and password to enable basic authentication. If one of the parameter is not given by user then an error is logged in the CLI. STRINGYesNo
https.truststore.fileThe file path to the location of the truststore of the client that sends the HTTP events through 'https' protocol. A custom client-truststore can be specified if required.${carbon.home}/resources/security/client-truststore.jksSTRINGYesNo
https.truststore.passwordThe password for the client-truststore. A custom password can be specified if required. If no custom password is specified and the protocol of URL is 'https' then, the system uses default password.wso2carbonSTRINGYesNo
headersThe headers that should be included as a HTTP request headers. There can be any number of headers concatenated on following format. header1:value1#header2:value2. User can include content-type header if he need to any specific type for payload if not system get the mapping type as the content-Type header (ie. @map(xml):application/xml,@map(json):application/json,@map(text):plain/text ) and if user does not include any mapping type then system gets the 'plain/text' as default Content-Type header. If user does not include Content-Length header then system calculate the bytes size of payload and include it as content-length header. STRINGYesNo
methodFor HTTP events, HTTP_METHOD header should be included as a request header. If the parameter is null then system uses 'POST' as a default header.POSTSTRINGYesNo
socket.idle.timeoutSocket timeout value in millisecond6000INTYesNo
chunk.disabledport: Port number of the remote servicefalseBOOLYesNo
ssl.protocolThe SSL protocol versionTLSSTRINGYesNo
parametersParameters other than basics such as ciphers,sslEnabledProtocols,client.enable.session.creation. Expected format of these parameters is as follows: "'ciphers:xxx','sslEnabledProtocols,client.enable:xxx'"nullSTRINGYesNo
ciphersList of ciphers to be used. This parameter should include under parameters Ex: 'ciphers:TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256'nullSTRINGYesNo
ssl.enabled.protocolsSSL/TLS protocols to be enabled. This parameter should be in camel case format(sslEnabledProtocols) under parameters. Ex 'sslEnabledProtocols:true'nullSTRINGYesNo
client.enable.session.creationEnable HTTP session creation.This parameter should include under parameters Ex: 'client.enable.session.creation:true'nullSTRINGYesNo
follow.redirectRedirect related enabled.trueBOOLYesNo
max.redirect.countMaximum redirect count.5INTYesNo
tls.store.typeTLS store type to be used.JKSSTRINGYesNo
proxy.hostProxy server hostnullSTRINGYesNo
proxy.portProxy server portnullSTRINGYesNo
proxy.usernameProxy server usernamenullSTRINGYesNo
proxy.passwordProxy server passwordnullSTRINGYesNo
client.bootstrap.configurationClient bootsrap configurations. Expected format of these parameters is as follows: "'client.bootstrap.nodelay:xxx','client.bootstrap.keepalive:xxx'"TODOSTRINGYesNo
client.bootstrap.nodelayHttp client no delay.trueBOOLYesNo
client.bootstrap.keepaliveHttp client keep alive.trueBOOLYesNo
client.bootstrap.sendbuffersizeHttp client send buffer size.1048576INTYesNo
client.bootstrap.recievebuffersizeHttp client receive buffer size.1048576INTYesNo
client.bootstrap.connect.timeoutHttp client connection timeout.15000INTYesNo
client.bootstrap.socket.reuseTo enable http socket reuse.falseBOOLYesNo
client.bootstrap.socket.timeoutHttp client socket timeout.15STRINGYesNo
client.threadpool.configurationsThread pool configuration. Expected format of these parameters is as follows: "'client.connection.pool.count:xxx','client.max.active.connections.per.pool:xxx'"TODOSTRINGYesNo
client.connection.pool.countConnection pool count.0INTYesNo
client.max.active.connections.per.poolActive connections per pool.-1INTYesNo
client.min.idle.connections.per.poolMinimum ideal connection per pool.0INTYesNo
client.max.idle.connections.per.poolMaximum ideal connection per pool.100INTYesNo
client.min.eviction.idle.timeMinimum eviction idle time.5 * 60 * 1000STRINGYesNo
sender.thread.countHttp sender thread count.20STRINGYesNo
event.group.executor.thread.sizeEvent group executor thread size.15STRINGYesNo
max.wait.for.client.connection.poolMaximum wait for client connection pool.60000STRINGYesNo
- -System Parameters - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Parameters
clientBootstrapBossGroupSizeproperty to configure number of boss threads, which accepts incoming connections until the ports are unbound. Once connection accepts successfully, boss thread passes the accepted channel to one of the worker threads.4Any integer
clientBootstrapWorkerGroupSizeproperty to configure number of worker threads, which performs non blocking read and write for one or more channels in non-blocking mode.8Any integer
trustStoreLocationThe default truststore file path.${carbon.home}/resources/security/client-truststore.jksPath to client-truststore.jks
trustStorePasswordThe default truststore password.wso2carbonTruststore password
- -Examples -EXAMPLE 1 -``` -@sink(type='http',publisher.url='http://localhost:8009/foo', method='{{method}}',headers='{{headers}}',client.bootstrap.configuration="'client.bootstrap.socket.timeout:20','client.bootstrap.worker.group.size:10'",client.pool.configuration="'client.connection.pool.count:10','client.max.active.connections.per.pool:1'" @map(type='xml' , @payload('{{payloadBody}}')))define stream FooStream (payloadBody String, method string, headers string); - -``` -

If it is xml mapping expected input should be in following format for FooStream:{<events> <event> <symbol>WSO2</symbol> <price>55.6</price> <volume>100</volume> </event></events>,POST,Content-Length:24#Content-Location:USA#Retry-After:120}Above event will generate output as below.~Output http event payload<events>
    <event>
        <symbol>WSO2</symbol>
        <price>55.6</price>
        <volume>100</volume>
    </event>
</events>
~Output http event headersContent-Length:24,Content-Location:'USA',Retry-After:120,Content-Type:'application/xml',HTTP_METHOD:'POST',~Output http event propertiesHTTP_METHOD:'POST',HOST:'localhost',PORT:8009PROTOCOL:'http'TO:'/foo'

- -## Source - -### http *(Source)* - -

The HTTP source receives POST requests via HTTP or HTTPS in format such as text, XML and JSON. If required, you can enable basic authentication to ensure that events are received only from users who are authorized to access the service.

- -Syntax -``` -@source(type="http", receiver.url="", basic.auth.enabled="", worker.count="", socket.idle.timeout="", ssl.verify.client="", ssl.protocol="", tls.store.type="", parameters="", ciphers="", ssl.enabled.protocols="", server.enable.session.creation="", server.supported.snimatchers="", server.suported.server.names="", request.size.validation.configuration="", request.size.validation="", request.size.validation.maximum.value="", request.size.validation.reject.status.code="", request.size.validation.reject.message="", request.size.validation.reject.message.content.type="", header.size.validation="", header.validation.maximum.request.line="", header.validation.maximum.size="", header.validation.maximum.chunk.size="", header.validation.reject.status.code="", header.validation.reject.message="", header.validation.reject.message.content.type="", server.bootstrap.configuration="", server.bootstrap.nodelay="", server.bootstrap.keepalive="", server.bootstrap.sendbuffersize="", server.bootstrap.recievebuffersize="", server.bootstrap.connect.timeout="", server.bootstrap.socket.reuse="", server.bootstrap.socket.timeout="", server.bootstrap.socket.backlog="", trace.log.enabled="", @map(...))) -``` - -QUERY PARAMETERS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
receiver.urlThe URL to which the events should be received. User can provide any valid url and if the url is not provided the system will use the following format http://0.0.0.0:9763/<appNAme>/<streamName>If the user want to use SSL the url should be given in following format https://localhost:8080/<streamName>http://0.0.0.0:9763//STRINGYesNo
basic.auth.enabledIf this is set to true, basic authentication is enabled for incoming events, and the credentials with which each event is sent are verified to ensure that the user is authorized to access the service. If basic authentication fails, the event is not authenticated and an authentication error is logged in the CLI. By default this values 'false' falseSTRINGYesNo
worker.countThe number of active worker threads to serve the incoming events. The value is 1 by default. This will ensure that the events are directed to the event stream in the same order in which they arrive. By increasing this value the performance might increase at the cost of loosing event ordering.1STRINGYesNo
socket.idle.timeoutIdle timeout for HTTP connection.120000INTYesNo
ssl.verify.clientThe type of client certificate verification.nullSTRINGYesNo
ssl.protocolssl/tls related optionsTLSSTRINGYesNo
tls.store.typeTLS store type.JKSSTRINGYesNo
parametersParameters other than basics such as ciphers,sslEnabledProtocols,client.enable.session.creation. Expected format of these parameters is as follows: "'ciphers:xxx','sslEnabledProtocols,client.enable:xxx'"nullSTRINGYesNo
ciphersList of ciphers to be used. This parameter should include under parameters Ex: 'ciphers:TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256'nullSTRINGYesNo
ssl.enabled.protocolsSSL/TLS protocols to be enabled. This parameter should be in camel case format(sslEnabledProtocols) under parameters. Ex 'sslEnabledProtocols:true'nullSTRINGYesNo
server.enable.session.creationEnable HTTP session creation.This parameter should include under parameters Ex: 'client.enable.session.creation:true'nullSTRINGYesNo
server.supported.snimatchersHttp SNIMatcher to be added. This parameter should include under parameters Ex: 'server.supported.snimatchers:SNIMatcher'nullSTRINGYesNo
server.suported.server.namesHttp supported servers. This parameter should include under parameters Ex: 'server.suported.server.names:server'nullSTRINGYesNo
request.size.validation.configurationParameters that responsible for validating the http request and request headers. Expected format of these parameters is as follows: "'request.size.validation:xxx','request.size.validation.maximum.value:xxx'"nullSTRINGYesNo
request.size.validationTo enable the request size validation.falseSTRINGYesNo
request.size.validation.maximum.valueIf request size is validated then maximum size.Integer.MAX_VALUESTRINGYesNo
request.size.validation.reject.status.codeIf request is exceed maximum size and request.size.validation is enabled then status code to be send as response.401STRINGYesNo
request.size.validation.reject.messageIf request is exceed maximum size and request.size.validation is enabled then status message to be send as response.Message is bigger than the valid sizeSTRINGYesNo
request.size.validation.reject.message.content.typeIf request is exceed maximum size and request.size.validation is enabled then content type to be send as response.plain/textSTRINGYesNo
header.size.validationTo enable the header size validation.falseSTRINGYesNo
header.validation.maximum.request.lineIf header header validation is enabled then the maximum request line.4096STRINGYesNo
header.validation.maximum.sizeIf header header validation is enabled then the maximum expected header size.8192STRINGYesNo
header.validation.maximum.chunk.sizeIf header header validation is enabled then the maximum expected chunk size.8192STRINGYesNo
header.validation.reject.status.code401If header is exceed maximum size and header.size.validation is enabled then status code to be send as response.STRINGYesNo
header.validation.reject.messageIf header is exceed maximum size and header.size.validation is enabled then message to be send as response.Message header is bigger than the valid sizeSTRINGYesNo
header.validation.reject.message.content.typeIf header is exceed maximum size and header.size.validation is enabled then content type to be send as response.plain/textSTRINGYesNo
server.bootstrap.configurationParameters that for bootstrap configurations of the server. Expected format of these parameters is as follows: "'ciphers:xxx','sslEnabledProtocols,client.enable:xxx'"nullOBJECTYesNo
server.bootstrap.nodelayHttp server no delay.trueBOOLYesNo
server.bootstrap.keepaliveHttp server keep alive.trueBOOLYesNo
server.bootstrap.sendbuffersizeHttp server send buffer size.1048576INTYesNo
server.bootstrap.recievebuffersizeHttp server receive buffer size.1048576INTYesNo
server.bootstrap.connect.timeoutHttp server connection timeout.15000INTYesNo
server.bootstrap.socket.reuseTo enable http socket reuse.falseBOOLYesNo
server.bootstrap.socket.timeoutHttp server socket timeout.15BOOLYesNo
server.bootstrap.socket.backlogTHttp server socket backlog.100BOOLYesNo
trace.log.enabledHttp traffic monitoring.falseBOOLYesNo
- -System Parameters - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Parameters
serverBootstrapBossGroupSizeproperty to configure number of boss threads, which accepts incoming connections until the ports are unbound. Once connection accepts successfully, boss thread passes the accepted channel to one of the worker threads.4Any integer
serverBootstrapWorkerGroupSizeproperty to configure number of worker threads, which performs non blocking read and write for one or more channels in non-blocking mode.8Any integer
defaultHostThe default host of the transport.0.0.0.0Any valid host
defaultHttpPortThe default port if the default scheme is 'http'.8280Any valid port
defaultHttpsPortThe default port if the default scheme is 'https'.8243Any valid port
defaultSchemeThe default protocol.httphttp
https
keyStoreLocationThe default keystore file path.${carbon.home}/resources/security/wso2carbon.jksPath to wso2carbon.jks file
keyStorePasswordThe default keystore password.wso2carbonString of keystore password
certPasswordThe default cert password.wso2carbonString of cert password
- -Examples -EXAMPLE 1 -``` -@source(type='http', receiver.url='http://localhost:9055/endpoints/RecPro', socketIdleTimeout='150000', parameters="'ciphers : TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256', 'sslEnabledProtocols:TLSv1.1,TLSv1.2'",request.size.validation.configuration="request.size.validation:true",server.bootstrap.configuration="server.bootstrap.socket.timeout:25" @map(type='xml')) -define stream FooStream (symbol string, price float, volume long); - -``` -

Above source listenerConfiguration performs a default XML input mapping. The expected input is as follows:<events>
    <event>
        <symbol>WSO2</symbol>
        <price>55.6</price>
        <volume>100</volume>
    </event>
</events>
If basic authentication is enabled via the basic.auth.enabled='true setting, each input event is also expected to contain the Authorization:'Basic encodeBase64(username:Password)' header.

- diff --git a/docs/api/1.0.19.md b/docs/api/1.0.19.md deleted file mode 100644 index 8cfbe9f1..00000000 --- a/docs/api/1.0.19.md +++ /dev/null @@ -1,755 +0,0 @@ -# API Docs - v1.0.19 - -## Sink - -### http *(Sink)* - -

This extension publish the HTTP events in any HTTP method POST, GET, PUT, DELETE via HTTP or https protocols. As the additional features this component can provide basic authentication as well as user can publish events using custom client truststore files when publishing events via https protocol. And also user can add any number of headers including HTTP_METHOD header for each event dynamically.

- -Syntax -``` -@sink(type="http", publisher.url="", basic.auth.username="", basic.auth.password="", https.truststore.file="", https.truststore.password="", headers="", method="", socket.idle.timeout="", chunk.disabled="", ssl.protocol="", parameters="", ciphers="", ssl.enabled.protocols="", client.enable.session.creation="", follow.redirect="", max.redirect.count="", tls.store.type="", proxy.host="", proxy.port="", proxy.username="", proxy.password="", client.bootstrap.configuration="", client.bootstrap.nodelay="", client.bootstrap.keepalive="", client.bootstrap.sendbuffersize="", client.bootstrap.recievebuffersize="", client.bootstrap.connect.timeout="", client.bootstrap.socket.reuse="", client.bootstrap.socket.timeout="", client.threadpool.configurations="", client.connection.pool.count="", client.max.active.connections.per.pool="", client.min.idle.connections.per.pool="", client.max.idle.connections.per.pool="", client.min.eviction.idle.time="", sender.thread.count="", event.group.executor.thread.size="", max.wait.for.client.connection.pool="", @map(...))) -``` - -QUERY PARAMETERS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
publisher.urlThe URL to which the outgoing events should be published via HTTP. This is a mandatory parameter and if this is not specified, an error is logged in the CLI. If user wants to enable SSL for the events, use https instead of http in the publisher.url.e.g., http://localhost:8080/endpoint, https://localhost:8080/endpointSTRINGNoNo
basic.auth.usernameThe username to be included in the authentication header of the basic authentication enabled events. It is required to specify both username and password to enable basic authentication. If one of the parameter is not given by user then an error is logged in the CLI. STRINGYesNo
basic.auth.passwordThe password to include in the authentication header of the basic authentication enabled events. It is required to specify both username and password to enable basic authentication. If one of the parameter is not given by user then an error is logged in the CLI. STRINGYesNo
https.truststore.fileThe file path to the location of the truststore of the client that sends the HTTP events through 'https' protocol. A custom client-truststore can be specified if required.${carbon.home}/resources/security/client-truststore.jksSTRINGYesNo
https.truststore.passwordThe password for the client-truststore. A custom password can be specified if required. If no custom password is specified and the protocol of URL is 'https' then, the system uses default password.wso2carbonSTRINGYesNo
headersThe headers that should be included as a HTTP request headers. There can be any number of headers concatenated on following format. "'header1:value1','header2:value2'". User can include content-type header if he need to any specific type for payload if not system get the mapping type as the content-Type header (ie. @map(xml):application/xml,@map(json):application/json,@map(text):plain/text ) and if user does not include any mapping type then system gets the 'plain/text' as default Content-Type header. If user does not include Content-Length header then system calculate the bytes size of payload and include it as content-length header. STRINGYesNo
methodFor HTTP events, HTTP_METHOD header should be included as a request header. If the parameter is null then system uses 'POST' as a default header.POSTSTRINGYesNo
socket.idle.timeoutSocket timeout value in millisecond6000INTYesNo
chunk.disabledport: Port number of the remote servicefalseBOOLYesNo
ssl.protocolThe SSL protocol versionTLSSTRINGYesNo
parametersParameters other than basics such as ciphers,sslEnabledProtocols,client.enable.session.creation. Expected format of these parameters is as follows: "'ciphers:xxx','sslEnabledProtocols,client.enable:xxx'"nullSTRINGYesNo
ciphersList of ciphers to be used. This parameter should include under parameters Ex: 'ciphers:TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256'nullSTRINGYesNo
ssl.enabled.protocolsSSL/TLS protocols to be enabled. This parameter should be in camel case format(sslEnabledProtocols) under parameters. Ex 'sslEnabledProtocols:true'nullSTRINGYesNo
client.enable.session.creationEnable HTTP session creation.This parameter should include under parameters Ex: 'client.enable.session.creation:true'nullSTRINGYesNo
follow.redirectRedirect related enabled.trueBOOLYesNo
max.redirect.countMaximum redirect count.5INTYesNo
tls.store.typeTLS store type to be used.JKSSTRINGYesNo
proxy.hostProxy server hostnullSTRINGYesNo
proxy.portProxy server portnullSTRINGYesNo
proxy.usernameProxy server usernamenullSTRINGYesNo
proxy.passwordProxy server passwordnullSTRINGYesNo
client.bootstrap.configurationClient bootsrap configurations. Expected format of these parameters is as follows: "'client.bootstrap.nodelay:xxx','client.bootstrap.keepalive:xxx'"TODOSTRINGYesNo
client.bootstrap.nodelayHttp client no delay.trueBOOLYesNo
client.bootstrap.keepaliveHttp client keep alive.trueBOOLYesNo
client.bootstrap.sendbuffersizeHttp client send buffer size.1048576INTYesNo
client.bootstrap.recievebuffersizeHttp client receive buffer size.1048576INTYesNo
client.bootstrap.connect.timeoutHttp client connection timeout.15000INTYesNo
client.bootstrap.socket.reuseTo enable http socket reuse.falseBOOLYesNo
client.bootstrap.socket.timeoutHttp client socket timeout.15STRINGYesNo
client.threadpool.configurationsThread pool configuration. Expected format of these parameters is as follows: "'client.connection.pool.count:xxx','client.max.active.connections.per.pool:xxx'"TODOSTRINGYesNo
client.connection.pool.countConnection pool count.0INTYesNo
client.max.active.connections.per.poolActive connections per pool.-1INTYesNo
client.min.idle.connections.per.poolMinimum ideal connection per pool.0INTYesNo
client.max.idle.connections.per.poolMaximum ideal connection per pool.100INTYesNo
client.min.eviction.idle.timeMinimum eviction idle time.5 * 60 * 1000STRINGYesNo
sender.thread.countHttp sender thread count.20STRINGYesNo
event.group.executor.thread.sizeEvent group executor thread size.15STRINGYesNo
max.wait.for.client.connection.poolMaximum wait for client connection pool.60000STRINGYesNo
- -System Parameters - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Parameters
clientBootstrapBossGroupSizeproperty to configure number of boss threads, which accepts incoming connections until the ports are unbound. Once connection accepts successfully, boss thread passes the accepted channel to one of the worker threads.4Any integer
clientBootstrapWorkerGroupSizeproperty to configure number of worker threads, which performs non blocking read and write for one or more channels in non-blocking mode.8Any integer
trustStoreLocationThe default truststore file path.${carbon.home}/resources/security/client-truststore.jksPath to client-truststore.jks
trustStorePasswordThe default truststore password.wso2carbonTruststore password
- -Examples -EXAMPLE 1 -``` -@sink(type='http',publisher.url='http://localhost:8009/foo', method='{{method}}',headers="'content-type:xml','content-length:94'",client.bootstrap.configuration="'client.bootstrap.socket.timeout:20','client.bootstrap.worker.group.size:10'",client.pool.configuration="'client.connection.pool.count:10','client.max.active.connections.per.pool:1'" @map(type='xml' , @payload('{{payloadBody}}')))define stream FooStream (payloadBody String, method string, headers string); - -``` -

If it is xml mapping expected input should be in following format for FooStream:{<events> <event> <symbol>WSO2</symbol> <price>55.6</price> <volume>100</volume> </event></events>,POST,Content-Length:24#Content-Location:USA#Retry-After:120}Above event will generate output as below.~Output http event payload<events>
    <event>
        <symbol>WSO2</symbol>
        <price>55.6</price>
        <volume>100</volume>
    </event>
</events>
~Output http event headersContent-Length:24,Content-Location:'USA',Retry-After:120,Content-Type:'application/xml',HTTP_METHOD:'POST',~Output http event propertiesHTTP_METHOD:'POST',HOST:'localhost',PORT:8009PROTOCOL:'http'TO:'/foo'

- -## Source - -### http *(Source)* - -

The HTTP source receives POST requests via HTTP or HTTPS in format such as text, XML and JSON. If required, you can enable basic authentication to ensure that events are received only from users who are authorized to access the service.

- -Syntax -``` -@source(type="http", receiver.url="", basic.auth.enabled="", worker.count="", socket.idle.timeout="", ssl.verify.client="", ssl.protocol="", tls.store.type="", parameters="", ciphers="", ssl.enabled.protocols="", server.enable.session.creation="", server.supported.snimatchers="", server.suported.server.names="", request.size.validation.configuration="", request.size.validation="", request.size.validation.maximum.value="", request.size.validation.reject.status.code="", request.size.validation.reject.message="", request.size.validation.reject.message.content.type="", header.size.validation="", header.validation.maximum.request.line="", header.validation.maximum.size="", header.validation.maximum.chunk.size="", header.validation.reject.status.code="", header.validation.reject.message="", header.validation.reject.message.content.type="", server.bootstrap.configuration="", server.bootstrap.nodelay="", server.bootstrap.keepalive="", server.bootstrap.sendbuffersize="", server.bootstrap.recievebuffersize="", server.bootstrap.connect.timeout="", server.bootstrap.socket.reuse="", server.bootstrap.socket.timeout="", server.bootstrap.socket.backlog="", trace.log.enabled="", @map(...))) -``` - -QUERY PARAMETERS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
receiver.urlThe URL to which the events should be received. User can provide any valid url and if the url is not provided the system will use the following format http://0.0.0.0:9763/<appNAme>/<streamName>If the user want to use SSL the url should be given in following format https://localhost:8080/<streamName>http://0.0.0.0:9763//STRINGYesNo
basic.auth.enabledIf this is set to true, basic authentication is enabled for incoming events, and the credentials with which each event is sent are verified to ensure that the user is authorized to access the service. If basic authentication fails, the event is not authenticated and an authentication error is logged in the CLI. By default this values 'false' falseSTRINGYesNo
worker.countThe number of active worker threads to serve the incoming events. The value is 1 by default. This will ensure that the events are directed to the event stream in the same order in which they arrive. By increasing this value the performance might increase at the cost of loosing event ordering.1STRINGYesNo
socket.idle.timeoutIdle timeout for HTTP connection.120000INTYesNo
ssl.verify.clientThe type of client certificate verification.nullSTRINGYesNo
ssl.protocolssl/tls related optionsTLSSTRINGYesNo
tls.store.typeTLS store type.JKSSTRINGYesNo
parametersParameters other than basics such as ciphers,sslEnabledProtocols,client.enable.session.creation. Expected format of these parameters is as follows: "'ciphers:xxx','sslEnabledProtocols,client.enable:xxx'"nullSTRINGYesNo
ciphersList of ciphers to be used. This parameter should include under parameters Ex: 'ciphers:TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256'nullSTRINGYesNo
ssl.enabled.protocolsSSL/TLS protocols to be enabled. This parameter should be in camel case format(sslEnabledProtocols) under parameters. Ex 'sslEnabledProtocols:true'nullSTRINGYesNo
server.enable.session.creationEnable HTTP session creation.This parameter should include under parameters Ex: 'client.enable.session.creation:true'nullSTRINGYesNo
server.supported.snimatchersHttp SNIMatcher to be added. This parameter should include under parameters Ex: 'server.supported.snimatchers:SNIMatcher'nullSTRINGYesNo
server.suported.server.namesHttp supported servers. This parameter should include under parameters Ex: 'server.suported.server.names:server'nullSTRINGYesNo
request.size.validation.configurationParameters that responsible for validating the http request and request headers. Expected format of these parameters is as follows: "'request.size.validation:xxx','request.size.validation.maximum.value:xxx'"nullSTRINGYesNo
request.size.validationTo enable the request size validation.falseSTRINGYesNo
request.size.validation.maximum.valueIf request size is validated then maximum size.Integer.MAX_VALUESTRINGYesNo
request.size.validation.reject.status.codeIf request is exceed maximum size and request.size.validation is enabled then status code to be send as response.401STRINGYesNo
request.size.validation.reject.messageIf request is exceed maximum size and request.size.validation is enabled then status message to be send as response.Message is bigger than the valid sizeSTRINGYesNo
request.size.validation.reject.message.content.typeIf request is exceed maximum size and request.size.validation is enabled then content type to be send as response.plain/textSTRINGYesNo
header.size.validationTo enable the header size validation.falseSTRINGYesNo
header.validation.maximum.request.lineIf header header validation is enabled then the maximum request line.4096STRINGYesNo
header.validation.maximum.sizeIf header header validation is enabled then the maximum expected header size.8192STRINGYesNo
header.validation.maximum.chunk.sizeIf header header validation is enabled then the maximum expected chunk size.8192STRINGYesNo
header.validation.reject.status.code401If header is exceed maximum size and header.size.validation is enabled then status code to be send as response.STRINGYesNo
header.validation.reject.messageIf header is exceed maximum size and header.size.validation is enabled then message to be send as response.Message header is bigger than the valid sizeSTRINGYesNo
header.validation.reject.message.content.typeIf header is exceed maximum size and header.size.validation is enabled then content type to be send as response.plain/textSTRINGYesNo
server.bootstrap.configurationParameters that for bootstrap configurations of the server. Expected format of these parameters is as follows: "'ciphers:xxx','sslEnabledProtocols,client.enable:xxx'"nullOBJECTYesNo
server.bootstrap.nodelayHttp server no delay.trueBOOLYesNo
server.bootstrap.keepaliveHttp server keep alive.trueBOOLYesNo
server.bootstrap.sendbuffersizeHttp server send buffer size.1048576INTYesNo
server.bootstrap.recievebuffersizeHttp server receive buffer size.1048576INTYesNo
server.bootstrap.connect.timeoutHttp server connection timeout.15000INTYesNo
server.bootstrap.socket.reuseTo enable http socket reuse.falseBOOLYesNo
server.bootstrap.socket.timeoutHttp server socket timeout.15BOOLYesNo
server.bootstrap.socket.backlogTHttp server socket backlog.100BOOLYesNo
trace.log.enabledHttp traffic monitoring.falseBOOLYesNo
- -System Parameters - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Parameters
serverBootstrapBossGroupSizeproperty to configure number of boss threads, which accepts incoming connections until the ports are unbound. Once connection accepts successfully, boss thread passes the accepted channel to one of the worker threads.4Any integer
serverBootstrapWorkerGroupSizeproperty to configure number of worker threads, which performs non blocking read and write for one or more channels in non-blocking mode.8Any integer
defaultHostThe default host of the transport.0.0.0.0Any valid host
defaultHttpPortThe default port if the default scheme is 'http'.8280Any valid port
defaultHttpsPortThe default port if the default scheme is 'https'.8243Any valid port
defaultSchemeThe default protocol.httphttp
https
keyStoreLocationThe default keystore file path.${carbon.home}/resources/security/wso2carbon.jksPath to wso2carbon.jks file
keyStorePasswordThe default keystore password.wso2carbonString of keystore password
certPasswordThe default cert password.wso2carbonString of cert password
- -Examples -EXAMPLE 1 -``` -@source(type='http', receiver.url='http://localhost:9055/endpoints/RecPro', socketIdleTimeout='150000', parameters="'ciphers : TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256', 'sslEnabledProtocols:TLSv1.1,TLSv1.2'",request.size.validation.configuration="request.size.validation:true",server.bootstrap.configuration="server.bootstrap.socket.timeout:25" @map(type='xml')) -define stream FooStream (symbol string, price float, volume long); - -``` -

Above source listenerConfiguration performs a default XML input mapping. The expected input is as follows:<events>
    <event>
        <symbol>WSO2</symbol>
        <price>55.6</price>
        <volume>100</volume>
    </event>
</events>
If basic authentication is enabled via the basic.auth.enabled='true setting, each input event is also expected to contain the Authorization:'Basic encodeBase64(username:Password)' header.

- diff --git a/docs/api/1.0.20.md b/docs/api/1.0.20.md deleted file mode 100644 index 541b91b0..00000000 --- a/docs/api/1.0.20.md +++ /dev/null @@ -1,767 +0,0 @@ -# API Docs - v1.0.20 - -## Sink - -### http *(Sink)* - -

This extension publish the HTTP events in any HTTP method POST, GET, PUT, DELETE via HTTP or https protocols. As the additional features this component can provide basic authentication as well as user can publish events using custom client truststore files when publishing events via https protocol. And also user can add any number of headers including HTTP_METHOD header for each event dynamically.

- -Syntax -``` -@sink(type="http", publisher.url="", basic.auth.username="", basic.auth.password="", https.truststore.file="", https.truststore.password="", headers="", method="", socket.idle.timeout="", chunk.disabled="", ssl.protocol="", parameters="", ciphers="", ssl.enabled.protocols="", client.enable.session.creation="", follow.redirect="", max.redirect.count="", tls.store.type="", proxy.host="", proxy.port="", proxy.username="", proxy.password="", client.bootstrap.configuration="", client.bootstrap.nodelay="", client.bootstrap.keepalive="", client.bootstrap.sendbuffersize="", client.bootstrap.recievebuffersize="", client.bootstrap.connect.timeout="", client.bootstrap.socket.reuse="", client.bootstrap.socket.timeout="", client.threadpool.configurations="", client.connection.pool.count="", client.max.active.connections.per.pool="", client.min.idle.connections.per.pool="", client.max.idle.connections.per.pool="", client.min.eviction.idle.time="", sender.thread.count="", event.group.executor.thread.size="", max.wait.for.client.connection.pool="", @map(...))) -``` - -QUERY PARAMETERS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
publisher.urlThe URL to which the outgoing events should be published via HTTP. This is a mandatory parameter and if this is not specified, an error is logged in the CLI. If user wants to enable SSL for the events, use https instead of http in the publisher.url.e.g., http://localhost:8080/endpoint, https://localhost:8080/endpointSTRINGNoNo
basic.auth.usernameThe username to be included in the authentication header of the basic authentication enabled events. It is required to specify both username and password to enable basic authentication. If one of the parameter is not given by user then an error is logged in the CLI. STRINGYesNo
basic.auth.passwordThe password to include in the authentication header of the basic authentication enabled events. It is required to specify both username and password to enable basic authentication. If one of the parameter is not given by user then an error is logged in the CLI. STRINGYesNo
https.truststore.fileThe file path to the location of the truststore of the client that sends the HTTP events through 'https' protocol. A custom client-truststore can be specified if required.${carbon.home}/resources/security/client-truststore.jksSTRINGYesNo
https.truststore.passwordThe password for the client-truststore. A custom password can be specified if required. If no custom password is specified and the protocol of URL is 'https' then, the system uses default password.wso2carbonSTRINGYesNo
headersThe headers that should be included as a HTTP request headers. There can be any number of headers concatenated on following format. "'header1:value1','header2:value2'". User can include content-type header if he need to any specific type for payload if not system get the mapping type as the content-Type header (ie. @map(xml):application/xml,@map(json):application/json,@map(text):plain/text ) and if user does not include any mapping type then system gets the 'plain/text' as default Content-Type header. If user does not include Content-Length header then system calculate the bytes size of payload and include it as content-length header. STRINGYesNo
methodFor HTTP events, HTTP_METHOD header should be included as a request header. If the parameter is null then system uses 'POST' as a default header.POSTSTRINGYesNo
socket.idle.timeoutSocket timeout value in millisecond6000INTYesNo
chunk.disabledport: Port number of the remote servicefalseBOOLYesNo
ssl.protocolThe SSL protocol versionTLSSTRINGYesNo
parametersParameters other than basics such as ciphers,sslEnabledProtocols,client.enable.session.creation. Expected format of these parameters is as follows: "'ciphers:xxx','sslEnabledProtocols,client.enable:xxx'"nullSTRINGYesNo
ciphersList of ciphers to be used. This parameter should include under parameters Ex: 'ciphers:TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256'nullSTRINGYesNo
ssl.enabled.protocolsSSL/TLS protocols to be enabled. This parameter should be in camel case format(sslEnabledProtocols) under parameters. Ex 'sslEnabledProtocols:true'nullSTRINGYesNo
client.enable.session.creationEnable HTTP session creation.This parameter should include under parameters Ex: 'client.enable.session.creation:true'nullSTRINGYesNo
follow.redirectRedirect related enabled.trueBOOLYesNo
max.redirect.countMaximum redirect count.5INTYesNo
tls.store.typeTLS store type to be used.JKSSTRINGYesNo
proxy.hostProxy server hostnullSTRINGYesNo
proxy.portProxy server portnullSTRINGYesNo
proxy.usernameProxy server usernamenullSTRINGYesNo
proxy.passwordProxy server passwordnullSTRINGYesNo
client.bootstrap.configurationClient bootsrap configurations. Expected format of these parameters is as follows: "'client.bootstrap.nodelay:xxx','client.bootstrap.keepalive:xxx'"TODOSTRINGYesNo
client.bootstrap.nodelayHttp client no delay.trueBOOLYesNo
client.bootstrap.keepaliveHttp client keep alive.trueBOOLYesNo
client.bootstrap.sendbuffersizeHttp client send buffer size.1048576INTYesNo
client.bootstrap.recievebuffersizeHttp client receive buffer size.1048576INTYesNo
client.bootstrap.connect.timeoutHttp client connection timeout.15000INTYesNo
client.bootstrap.socket.reuseTo enable http socket reuse.falseBOOLYesNo
client.bootstrap.socket.timeoutHttp client socket timeout.15STRINGYesNo
client.threadpool.configurationsThread pool configuration. Expected format of these parameters is as follows: "'client.connection.pool.count:xxx','client.max.active.connections.per.pool:xxx'"TODOSTRINGYesNo
client.connection.pool.countConnection pool count.0INTYesNo
client.max.active.connections.per.poolActive connections per pool.-1INTYesNo
client.min.idle.connections.per.poolMinimum ideal connection per pool.0INTYesNo
client.max.idle.connections.per.poolMaximum ideal connection per pool.100INTYesNo
client.min.eviction.idle.timeMinimum eviction idle time.5 * 60 * 1000STRINGYesNo
sender.thread.countHttp sender thread count.20STRINGYesNo
event.group.executor.thread.sizeEvent group executor thread size.15STRINGYesNo
max.wait.for.client.connection.poolMaximum wait for client connection pool.60000STRINGYesNo
- -System Parameters - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Parameters
clientBootstrapBossGroupSizeproperty to configure number of boss threads, which accepts incoming connections until the ports are unbound. Once connection accepts successfully, boss thread passes the accepted channel to one of the worker threads.Number of available processorsAny integer
clientBootstrapWorkerGroupSizeproperty to configure number of worker threads, which performs non blocking read and write for one or more channels in non-blocking mode.(Number of available processors)*2Any integer
clientBootstrapClientGroupSizeproperty to configure number of client threads, which performs non blocking read and write for one or more channels in non-blocking mode.(Number of available processors)*2Any integer
trustStoreLocationThe default truststore file path.${carbon.home}/resources/security/client-truststore.jksPath to client-truststore.jks
trustStorePasswordThe default truststore password.wso2carbonTruststore password
- -Examples -EXAMPLE 1 -``` -@sink(type='http',publisher.url='http://localhost:8009/foo', method='{{method}}',headers="'content-type:xml','content-length:94'",client.bootstrap.configuration="'client.bootstrap.socket.timeout:20','client.bootstrap.worker.group.size:10'",client.pool.configuration="'client.connection.pool.count:10','client.max.active.connections.per.pool:1'" @map(type='xml' , @payload('{{payloadBody}}')))define stream FooStream (payloadBody String, method string, headers string); - -``` -

If it is xml mapping expected input should be in following format for FooStream:{<events> <event> <symbol>WSO2</symbol> <price>55.6</price> <volume>100</volume> </event></events>,POST,Content-Length:24#Content-Location:USA#Retry-After:120}Above event will generate output as below.~Output http event payload<events>
    <event>
        <symbol>WSO2</symbol>
        <price>55.6</price>
        <volume>100</volume>
    </event>
</events>
~Output http event headersContent-Length:24,Content-Location:'USA',Retry-After:120,Content-Type:'application/xml',HTTP_METHOD:'POST',~Output http event propertiesHTTP_METHOD:'POST',HOST:'localhost',PORT:8009PROTOCOL:'http'TO:'/foo'

- -## Source - -### http *(Source)* - -

The HTTP source receives POST requests via HTTP or HTTPS in format such as text, XML and JSON. If required, you can enable basic authentication to ensure that events are received only from users who are authorized to access the service.

- -Syntax -``` -@source(type="http", receiver.url="", basic.auth.enabled="", worker.count="", socket.idle.timeout="", ssl.verify.client="", ssl.protocol="", tls.store.type="", parameters="", ciphers="", ssl.enabled.protocols="", server.enable.session.creation="", server.supported.snimatchers="", server.suported.server.names="", request.size.validation.configuration="", request.size.validation="", request.size.validation.maximum.value="", request.size.validation.reject.status.code="", request.size.validation.reject.message="", request.size.validation.reject.message.content.type="", header.size.validation="", header.validation.maximum.request.line="", header.validation.maximum.size="", header.validation.maximum.chunk.size="", header.validation.reject.status.code="", header.validation.reject.message="", header.validation.reject.message.content.type="", server.bootstrap.configuration="", server.bootstrap.nodelay="", server.bootstrap.keepalive="", server.bootstrap.sendbuffersize="", server.bootstrap.recievebuffersize="", server.bootstrap.connect.timeout="", server.bootstrap.socket.reuse="", server.bootstrap.socket.timeout="", server.bootstrap.socket.backlog="", trace.log.enabled="", @map(...))) -``` - -QUERY PARAMETERS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
receiver.urlThe URL to which the events should be received. User can provide any valid url and if the url is not provided the system will use the following format http://0.0.0.0:9763/<appNAme>/<streamName>If the user want to use SSL the url should be given in following format https://localhost:8080/<streamName>http://0.0.0.0:9763//STRINGYesNo
basic.auth.enabledIf this is set to true, basic authentication is enabled for incoming events, and the credentials with which each event is sent are verified to ensure that the user is authorized to access the service. If basic authentication fails, the event is not authenticated and an authentication error is logged in the CLI. By default this values 'false' falseSTRINGYesNo
worker.countThe number of active worker threads to serve the incoming events. The value is 1 by default. This will ensure that the events are directed to the event stream in the same order in which they arrive. By increasing this value the performance might increase at the cost of loosing event ordering.1STRINGYesNo
socket.idle.timeoutIdle timeout for HTTP connection.120000INTYesNo
ssl.verify.clientThe type of client certificate verification.nullSTRINGYesNo
ssl.protocolssl/tls related optionsTLSSTRINGYesNo
tls.store.typeTLS store type.JKSSTRINGYesNo
parametersParameters other than basics such as ciphers,sslEnabledProtocols,client.enable.session.creation. Expected format of these parameters is as follows: "'ciphers:xxx','sslEnabledProtocols,client.enable:xxx'"nullSTRINGYesNo
ciphersList of ciphers to be used. This parameter should include under parameters Ex: 'ciphers:TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256'nullSTRINGYesNo
ssl.enabled.protocolsSSL/TLS protocols to be enabled. This parameter should be in camel case format(sslEnabledProtocols) under parameters. Ex 'sslEnabledProtocols:true'nullSTRINGYesNo
server.enable.session.creationEnable HTTP session creation.This parameter should include under parameters Ex: 'client.enable.session.creation:true'nullSTRINGYesNo
server.supported.snimatchersHttp SNIMatcher to be added. This parameter should include under parameters Ex: 'server.supported.snimatchers:SNIMatcher'nullSTRINGYesNo
server.suported.server.namesHttp supported servers. This parameter should include under parameters Ex: 'server.suported.server.names:server'nullSTRINGYesNo
request.size.validation.configurationParameters that responsible for validating the http request and request headers. Expected format of these parameters is as follows: "'request.size.validation:xxx','request.size.validation.maximum.value:xxx'"nullSTRINGYesNo
request.size.validationTo enable the request size validation.falseSTRINGYesNo
request.size.validation.maximum.valueIf request size is validated then maximum size.Integer.MAX_VALUESTRINGYesNo
request.size.validation.reject.status.codeIf request is exceed maximum size and request.size.validation is enabled then status code to be send as response.401STRINGYesNo
request.size.validation.reject.messageIf request is exceed maximum size and request.size.validation is enabled then status message to be send as response.Message is bigger than the valid sizeSTRINGYesNo
request.size.validation.reject.message.content.typeIf request is exceed maximum size and request.size.validation is enabled then content type to be send as response.plain/textSTRINGYesNo
header.size.validationTo enable the header size validation.falseSTRINGYesNo
header.validation.maximum.request.lineIf header header validation is enabled then the maximum request line.4096STRINGYesNo
header.validation.maximum.sizeIf header header validation is enabled then the maximum expected header size.8192STRINGYesNo
header.validation.maximum.chunk.sizeIf header header validation is enabled then the maximum expected chunk size.8192STRINGYesNo
header.validation.reject.status.code401If header is exceed maximum size and header.size.validation is enabled then status code to be send as response.STRINGYesNo
header.validation.reject.messageIf header is exceed maximum size and header.size.validation is enabled then message to be send as response.Message header is bigger than the valid sizeSTRINGYesNo
header.validation.reject.message.content.typeIf header is exceed maximum size and header.size.validation is enabled then content type to be send as response.plain/textSTRINGYesNo
server.bootstrap.configurationParameters that for bootstrap configurations of the server. Expected format of these parameters is as follows: "'ciphers:xxx','sslEnabledProtocols,client.enable:xxx'"nullOBJECTYesNo
server.bootstrap.nodelayHttp server no delay.trueBOOLYesNo
server.bootstrap.keepaliveHttp server keep alive.trueBOOLYesNo
server.bootstrap.sendbuffersizeHttp server send buffer size.1048576INTYesNo
server.bootstrap.recievebuffersizeHttp server receive buffer size.1048576INTYesNo
server.bootstrap.connect.timeoutHttp server connection timeout.15000INTYesNo
server.bootstrap.socket.reuseTo enable http socket reuse.falseBOOLYesNo
server.bootstrap.socket.timeoutHttp server socket timeout.15BOOLYesNo
server.bootstrap.socket.backlogTHttp server socket backlog.100BOOLYesNo
trace.log.enabledHttp traffic monitoring.falseBOOLYesNo
- -System Parameters - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Parameters
serverBootstrapBossGroupSizeproperty to configure number of boss threads, which accepts incoming connections until the ports are unbound. Once connection accepts successfully, boss thread passes the accepted channel to one of the worker threads.Number of available processorsAny integer
serverBootstrapWorkerGroupSizeproperty to configure number of worker threads, which performs non blocking read and write for one or more channels in non-blocking mode.(Number of available processors)*2Any integer
serverBootstrapClientGroupSizeproperty to configure number of client threads, which performs non blocking read and write for one or more channels in non-blocking mode.(Number of available processors)*2Any integer
defaultHostThe default host of the transport.0.0.0.0Any valid host
defaultHttpPortThe default port if the default scheme is 'http'.8280Any valid port
defaultHttpsPortThe default port if the default scheme is 'https'.8243Any valid port
defaultSchemeThe default protocol.httphttp
https
keyStoreLocationThe default keystore file path.${carbon.home}/resources/security/wso2carbon.jksPath to wso2carbon.jks file
keyStorePasswordThe default keystore password.wso2carbonString of keystore password
certPasswordThe default cert password.wso2carbonString of cert password
- -Examples -EXAMPLE 1 -``` -@source(type='http', receiver.url='http://localhost:9055/endpoints/RecPro', socketIdleTimeout='150000', parameters="'ciphers : TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256', 'sslEnabledProtocols:TLSv1.1,TLSv1.2'",request.size.validation.configuration="request.size.validation:true",server.bootstrap.configuration="server.bootstrap.socket.timeout:25" @map(type='xml')) -define stream FooStream (symbol string, price float, volume long); - -``` -

Above source listenerConfiguration performs a default XML input mapping. The expected input is as follows:<events>
    <event>
        <symbol>WSO2</symbol>
        <price>55.6</price>
        <volume>100</volume>
    </event>
</events>
If basic authentication is enabled via the basic.auth.enabled='true setting, each input event is also expected to contain the Authorization:'Basic encodeBase64(username:Password)' header.

- diff --git a/docs/api/1.0.21.md b/docs/api/1.0.21.md deleted file mode 100644 index 538a79ce..00000000 --- a/docs/api/1.0.21.md +++ /dev/null @@ -1,1224 +0,0 @@ -# API Docs - v1.0.21 - -## Sink - -### http *(Sink)* - -

This extension publish the HTTP events in any HTTP method POST, GET, PUT, DELETE via HTTP or https protocols. As the additional features this component can provide basic authentication as well as user can publish events using custom client truststore files when publishing events via https protocol. And also user can add any number of headers including HTTP_METHOD header for each event dynamically.

- -Syntax -``` -@sink(type="http", publisher.url="", basic.auth.username="", basic.auth.password="", https.truststore.file="", https.truststore.password="", headers="", method="", socket.idle.timeout="", chunk.disabled="", ssl.protocol="", parameters="", ciphers="", ssl.enabled.protocols="", client.enable.session.creation="", follow.redirect="", max.redirect.count="", tls.store.type="", proxy.host="", proxy.port="", proxy.username="", proxy.password="", client.bootstrap.configuration="", client.bootstrap.nodelay="", client.bootstrap.keepalive="", client.bootstrap.sendbuffersize="", client.bootstrap.recievebuffersize="", client.bootstrap.connect.timeout="", client.bootstrap.socket.reuse="", client.bootstrap.socket.timeout="", client.threadpool.configurations="", client.connection.pool.count="", client.max.active.connections.per.pool="", client.min.idle.connections.per.pool="", client.max.idle.connections.per.pool="", client.min.eviction.idle.time="", sender.thread.count="", event.group.executor.thread.size="", max.wait.for.client.connection.pool="", @map(...))) -``` - -QUERY PARAMETERS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
publisher.urlThe URL to which the outgoing events should be published via HTTP. This is a mandatory parameter and if this is not specified, an error is logged in the CLI. If user wants to enable SSL for the events, use https instead of http in the publisher.url.e.g., http://localhost:8080/endpoint, https://localhost:8080/endpointSTRINGNoNo
basic.auth.usernameThe username to be included in the authentication header of the basic authentication enabled events. It is required to specify both username and password to enable basic authentication. If one of the parameter is not given by user then an error is logged in the CLI. STRINGYesNo
basic.auth.passwordThe password to include in the authentication header of the basic authentication enabled events. It is required to specify both username and password to enable basic authentication. If one of the parameter is not given by user then an error is logged in the CLI. STRINGYesNo
https.truststore.fileThe file path to the location of the truststore of the client that sends the HTTP events through 'https' protocol. A custom client-truststore can be specified if required.${carbon.home}/resources/security/client-truststore.jksSTRINGYesNo
https.truststore.passwordThe password for the client-truststore. A custom password can be specified if required. If no custom password is specified and the protocol of URL is 'https' then, the system uses default password.wso2carbonSTRINGYesNo
headersThe headers that should be included as a HTTP request headers. There can be any number of headers concatenated on following format. "'header1:value1','header2:value2'". User can include content-type header if he need to any specific type for payload if not system get the mapping type as the content-Type header (ie. @map(xml):application/xml,@map(json):application/json,@map(text):plain/text ) and if user does not include any mapping type then system gets the 'plain/text' as default Content-Type header. If user does not include Content-Length header then system calculate the bytes size of payload and include it as content-length header. STRINGYesNo
methodFor HTTP events, HTTP_METHOD header should be included as a request header. If the parameter is null then system uses 'POST' as a default header.POSTSTRINGYesNo
socket.idle.timeoutSocket timeout value in millisecond6000INTYesNo
chunk.disabledport: Port number of the remote servicefalseBOOLYesNo
ssl.protocolThe SSL protocol versionTLSSTRINGYesNo
parametersParameters other than basics such as ciphers,sslEnabledProtocols,client.enable.session.creation. Expected format of these parameters is as follows: "'ciphers:xxx','sslEnabledProtocols,client.enable:xxx'"nullSTRINGYesNo
ciphersList of ciphers to be used. This parameter should include under parameters Ex: 'ciphers:TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256'nullSTRINGYesNo
ssl.enabled.protocolsSSL/TLS protocols to be enabled. This parameter should be in camel case format(sslEnabledProtocols) under parameters. Ex 'sslEnabledProtocols:true'nullSTRINGYesNo
client.enable.session.creationEnable HTTP session creation.This parameter should include under parameters Ex: 'client.enable.session.creation:true'nullSTRINGYesNo
follow.redirectRedirect related enabled.trueBOOLYesNo
max.redirect.countMaximum redirect count.5INTYesNo
tls.store.typeTLS store type to be used.JKSSTRINGYesNo
proxy.hostProxy server hostnullSTRINGYesNo
proxy.portProxy server portnullSTRINGYesNo
proxy.usernameProxy server usernamenullSTRINGYesNo
proxy.passwordProxy server passwordnullSTRINGYesNo
client.bootstrap.configurationClient bootsrap configurations. Expected format of these parameters is as follows: "'client.bootstrap.nodelay:xxx','client.bootstrap.keepalive:xxx'"TODOSTRINGYesNo
client.bootstrap.nodelayHttp client no delay.trueBOOLYesNo
client.bootstrap.keepaliveHttp client keep alive.trueBOOLYesNo
client.bootstrap.sendbuffersizeHttp client send buffer size.1048576INTYesNo
client.bootstrap.recievebuffersizeHttp client receive buffer size.1048576INTYesNo
client.bootstrap.connect.timeoutHttp client connection timeout.15000INTYesNo
client.bootstrap.socket.reuseTo enable http socket reuse.falseBOOLYesNo
client.bootstrap.socket.timeoutHttp client socket timeout.15STRINGYesNo
client.threadpool.configurationsThread pool configuration. Expected format of these parameters is as follows: "'client.connection.pool.count:xxx','client.max.active.connections.per.pool:xxx'"TODOSTRINGYesNo
client.connection.pool.countConnection pool count.0INTYesNo
client.max.active.connections.per.poolActive connections per pool.-1INTYesNo
client.min.idle.connections.per.poolMinimum ideal connection per pool.0INTYesNo
client.max.idle.connections.per.poolMaximum ideal connection per pool.100INTYesNo
client.min.eviction.idle.timeMinimum eviction idle time.5 * 60 * 1000STRINGYesNo
sender.thread.countHttp sender thread count.20STRINGYesNo
event.group.executor.thread.sizeEvent group executor thread size.15STRINGYesNo
max.wait.for.client.connection.poolMaximum wait for client connection pool.60000STRINGYesNo
- -System Parameters - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Parameters
clientBootstrapBossGroupSizeproperty to configure number of boss threads, which accepts incoming connections until the ports are unbound. Once connection accepts successfully, boss thread passes the accepted channel to one of the worker threads.Number of available processorsAny integer
clientBootstrapWorkerGroupSizeproperty to configure number of worker threads, which performs non blocking read and write for one or more channels in non-blocking mode.(Number of available processors)*2Any integer
clientBootstrapClientGroupSizeproperty to configure number of client threads, which performs non blocking read and write for one or more channels in non-blocking mode.(Number of available processors)*2Any integer
trustStoreLocationThe default truststore file path.${carbon.home}/resources/security/client-truststore.jksPath to client-truststore.jks
trustStorePasswordThe default truststore password.wso2carbonTruststore password
- -Examples -EXAMPLE 1 -``` -@sink(type='http',publisher.url='http://localhost:8009/foo', method='{{method}}',headers="'content-type:xml','content-length:94'",client.bootstrap.configuration="'client.bootstrap.socket.timeout:20','client.bootstrap.worker.group.size:10'",client.pool.configuration="'client.connection.pool.count:10','client.max.active.connections.per.pool:1'" @map(type='xml' , @payload('{{payloadBody}}')))define stream FooStream (payloadBody String, method string, headers string); - -``` -

If it is xml mapping expected input should be in following format for FooStream:{<events> <event> <symbol>WSO2</symbol> <price>55.6</price> <volume>100</volume> </event></events>,POST,Content-Length:24#Content-Location:USA#Retry-After:120}Above event will generate output as below.~Output http event payload<events>
    <event>
        <symbol>WSO2</symbol>
        <price>55.6</price>
        <volume>100</volume>
    </event>
</events>
~Output http event headersContent-Length:24,Content-Location:'USA',Retry-After:120,Content-Type:'application/xml',HTTP_METHOD:'POST',~Output http event propertiesHTTP_METHOD:'POST',HOST:'localhost',PORT:8009PROTOCOL:'http'TO:'/foo'

- -### http-response *(Sink)* - -

This extension send the response to the http-sync source having the same source.id. user can add any number of response headers for each event dynamically.

- -Syntax -``` -@sink(type="http-response", source.id="", message.id="", headers="", @map(...))) -``` - -QUERY PARAMETERS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
source.idIdentifier of the source.STRINGNoNo
message.idIdentifier of the message.STRINGNoYes
headersThe headers that should be included as HTTP response headers. There can be any number of headers concatenated on following format. "'header1:value1','header2:value2'" User can include content-type header if he/she need to have any specific type for payload. If not system get the mapping type as the content-Type header (ie. @map(xml):application/xml, @map(json):application/json, @map(text):plain/text) and if user does not include any mapping type then system gets the 'plain/text' as default Content-Type header. If user does not include Content-Length header then system calculate the bytes size of payload and include it as content-length header. STRINGYesNo
- -Examples -EXAMPLE 1 -``` -@sink(type='http-sync',source.id='sampleSourceId',message.id='{{messageId}}',headers="'content-type:json','content-length:94'"@map(type='json' , @payload('{{payloadBody}}')))define stream FooStream (payloadBody String, messageId string, headers string); - -``` -

If it is json mapping expected input should be in following format for FooStream:{{"events":
    {"event":
        "symbol":WSO2,
        "price":55.6,
        "volume":100,
    }
},0cf708b1-7eae-440b-a93e-e72f801b486a,Content-Length:24#Content-Location:USA}Above event will generate response for the matching source message as below.~Output http event payload{"events":
    {"event":
        "symbol":WSO2,
        "price":55.6,
        "volume":100,
    }
}
~Output http event headersContent-Length:24,Content-Location:'USA',Content-Type:'application/json',

- -## Source - -### http *(Source)* - -

The HTTP source receives POST requests via HTTP or HTTPS in format such as text, XML and JSON. If required, you can enable basic authentication to ensure that events are received only from users who are authorized to access the service.

- -Syntax -``` -@source(type="http", receiver.url="", basic.auth.enabled="", worker.count="", socket.idle.timeout="", ssl.verify.client="", ssl.protocol="", tls.store.type="", parameters="", ciphers="", ssl.enabled.protocols="", server.enable.session.creation="", server.supported.snimatchers="", server.suported.server.names="", request.size.validation.configuration="", request.size.validation="", request.size.validation.maximum.value="", request.size.validation.reject.status.code="", request.size.validation.reject.message="", request.size.validation.reject.message.content.type="", header.size.validation="", header.validation.maximum.request.line="", header.validation.maximum.size="", header.validation.maximum.chunk.size="", header.validation.reject.status.code="", header.validation.reject.message="", header.validation.reject.message.content.type="", server.bootstrap.configuration="", server.bootstrap.nodelay="", server.bootstrap.keepalive="", server.bootstrap.sendbuffersize="", server.bootstrap.recievebuffersize="", server.bootstrap.connect.timeout="", server.bootstrap.socket.reuse="", server.bootstrap.socket.timeout="", server.bootstrap.socket.backlog="", trace.log.enabled="", @map(...))) -``` - -QUERY PARAMETERS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
receiver.urlThe URL to which the events should be received. User can provide any valid url and if the url is not provided the system will use the following format http://0.0.0.0:9763/<appNAme>/<streamName>If the user want to use SSL the url should be given in following format https://localhost:8080/<streamName>http://0.0.0.0:9763//STRINGYesNo
basic.auth.enabledIf this is set to true, basic authentication is enabled for incoming events, and the credentials with which each event is sent are verified to ensure that the user is authorized to access the service. If basic authentication fails, the event is not authenticated and an authentication error is logged in the CLI. By default this values 'false' falseSTRINGYesNo
worker.countThe number of active worker threads to serve the incoming events. The value is 1 by default. This will ensure that the events are directed to the event stream in the same order in which they arrive. By increasing this value the performance might increase at the cost of loosing event ordering.1STRINGYesNo
socket.idle.timeoutIdle timeout for HTTP connection.120000INTYesNo
ssl.verify.clientThe type of client certificate verification.nullSTRINGYesNo
ssl.protocolssl/tls related optionsTLSSTRINGYesNo
tls.store.typeTLS store type.JKSSTRINGYesNo
parametersParameters other than basics such as ciphers,sslEnabledProtocols,client.enable.session.creation. Expected format of these parameters is as follows: "'ciphers:xxx','sslEnabledProtocols,client.enable:xxx'"nullSTRINGYesNo
ciphersList of ciphers to be used. This parameter should include under parameters Ex: 'ciphers:TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256'nullSTRINGYesNo
ssl.enabled.protocolsSSL/TLS protocols to be enabled. This parameter should be in camel case format(sslEnabledProtocols) under parameters. Ex 'sslEnabledProtocols:true'nullSTRINGYesNo
server.enable.session.creationEnable HTTP session creation.This parameter should include under parameters Ex: 'client.enable.session.creation:true'nullSTRINGYesNo
server.supported.snimatchersHttp SNIMatcher to be added. This parameter should include under parameters Ex: 'server.supported.snimatchers:SNIMatcher'nullSTRINGYesNo
server.suported.server.namesHttp supported servers. This parameter should include under parameters Ex: 'server.suported.server.names:server'nullSTRINGYesNo
request.size.validation.configurationParameters that responsible for validating the http request and request headers. Expected format of these parameters is as follows: "'request.size.validation:xxx','request.size.validation.maximum.value:xxx'"nullSTRINGYesNo
request.size.validationTo enable the request size validation.falseSTRINGYesNo
request.size.validation.maximum.valueIf request size is validated then maximum size.Integer.MAX_VALUESTRINGYesNo
request.size.validation.reject.status.codeIf request is exceed maximum size and request.size.validation is enabled then status code to be send as response.401STRINGYesNo
request.size.validation.reject.messageIf request is exceed maximum size and request.size.validation is enabled then status message to be send as response.Message is bigger than the valid sizeSTRINGYesNo
request.size.validation.reject.message.content.typeIf request is exceed maximum size and request.size.validation is enabled then content type to be send as response.plain/textSTRINGYesNo
header.size.validationTo enable the header size validation.falseSTRINGYesNo
header.validation.maximum.request.lineIf header header validation is enabled then the maximum request line.4096STRINGYesNo
header.validation.maximum.sizeIf header header validation is enabled then the maximum expected header size.8192STRINGYesNo
header.validation.maximum.chunk.sizeIf header header validation is enabled then the maximum expected chunk size.8192STRINGYesNo
header.validation.reject.status.code401If header is exceed maximum size and header.size.validation is enabled then status code to be send as response.STRINGYesNo
header.validation.reject.messageIf header is exceed maximum size and header.size.validation is enabled then message to be send as response.Message header is bigger than the valid sizeSTRINGYesNo
header.validation.reject.message.content.typeIf header is exceed maximum size and header.size.validation is enabled then content type to be send as response.plain/textSTRINGYesNo
server.bootstrap.configurationParameters that for bootstrap configurations of the server. Expected format of these parameters is as follows: "'ciphers:xxx','sslEnabledProtocols,client.enable:xxx'"nullOBJECTYesNo
server.bootstrap.nodelayHttp server no delay.trueBOOLYesNo
server.bootstrap.keepaliveHttp server keep alive.trueBOOLYesNo
server.bootstrap.sendbuffersizeHttp server send buffer size.1048576INTYesNo
server.bootstrap.recievebuffersizeHttp server receive buffer size.1048576INTYesNo
server.bootstrap.connect.timeoutHttp server connection timeout.15000INTYesNo
server.bootstrap.socket.reuseTo enable http socket reuse.falseBOOLYesNo
server.bootstrap.socket.timeoutHttp server socket timeout.15BOOLYesNo
server.bootstrap.socket.backlogTHttp server socket backlog.100BOOLYesNo
trace.log.enabledHttp traffic monitoring.falseBOOLYesNo
- -System Parameters - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Parameters
serverBootstrapBossGroupSizeproperty to configure number of boss threads, which accepts incoming connections until the ports are unbound. Once connection accepts successfully, boss thread passes the accepted channel to one of the worker threads.Number of available processorsAny integer
serverBootstrapWorkerGroupSizeproperty to configure number of worker threads, which performs non blocking read and write for one or more channels in non-blocking mode.(Number of available processors)*2Any integer
serverBootstrapClientGroupSizeproperty to configure number of client threads, which performs non blocking read and write for one or more channels in non-blocking mode.(Number of available processors)*2Any integer
defaultHostThe default host of the transport.0.0.0.0Any valid host
defaultHttpPortThe default port if the default scheme is 'http'.8280Any valid port
defaultHttpsPortThe default port if the default scheme is 'https'.8243Any valid port
defaultSchemeThe default protocol.httphttp
https
keyStoreLocationThe default keystore file path.${carbon.home}/resources/security/wso2carbon.jksPath to wso2carbon.jks file
keyStorePasswordThe default keystore password.wso2carbonString of keystore password
certPasswordThe default cert password.wso2carbonString of cert password
- -Examples -EXAMPLE 1 -``` -@source(type='http', receiver.url='http://localhost:9055/endpoints/RecPro', socketIdleTimeout='150000', parameters="'ciphers : TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256', 'sslEnabledProtocols:TLSv1.1,TLSv1.2'",request.size.validation.configuration="request.size.validation:true",server.bootstrap.configuration="server.bootstrap.socket.timeout:25" @map(type='xml')) -define stream FooStream (symbol string, price float, volume long); - -``` -

Above source listenerConfiguration performs a default XML input mapping. The expected input is as follows:<events>
    <event>
        <symbol>WSO2</symbol>
        <price>55.6</price>
        <volume>100</volume>
    </event>
</events>
If basic authentication is enabled via the basic.auth.enabled='true setting, each input event is also expected to contain the Authorization:'Basic encodeBase64(username:Password)' header.

- -### http-request *(Source)* - -

The HTTP source receives POST requests via HTTP or HTTPS in format such as text, XML and JSON. If required, you can enable basic authentication to ensure that events are received only from users who are authorized to access the service.

- -Syntax -``` -@source(type="http-request", receiver.url="", source.id="", connection.timeout="", basic.auth.enabled="", worker.count="", socket.idle.timeout="", ssl.verify.client="", ssl.protocol="", tls.store.type="", parameters="", ciphers="", ssl.enabled.protocols="", server.enable.session.creation="", server.supported.snimatchers="", server.suported.server.names="", request.size.validation.configuration="", request.size.validation="", request.size.validation.maximum.value="", request.size.validation.reject.status.code="", request.size.validation.reject.message="", request.size.validation.reject.message.content.type="", header.size.validation="", header.validation.maximum.request.line="", header.validation.maximum.size="", header.validation.maximum.chunk.size="", header.validation.reject.status.code="", header.validation.reject.message="", header.validation.reject.message.content.type="", server.bootstrap.configuration="", server.bootstrap.nodelay="", server.bootstrap.keepalive="", server.bootstrap.sendbuffersize="", server.bootstrap.recievebuffersize="", server.bootstrap.connect.timeout="", server.bootstrap.socket.reuse="", server.bootstrap.socket.timeout="", server.bootstrap.socket.backlog="", trace.log.enabled="", @map(...))) -``` - -QUERY PARAMETERS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
receiver.urlThe URL to which the events should be received. User can provide any valid url and if the url is not provided the system will use the following format http://0.0.0.0:9763/<appNAme>/<streamName>If the user want to use SSL the url should be given in following format https://localhost:8080/<streamName>http://0.0.0.0:9763//STRINGYesNo
source.idIdentifier need to map the source to sink.STRINGNoNo
connection.timeoutConnection timeout in milliseconds. If the mapped http-response sink does not get a correlated message, after this timeout value, a timeout response is sent120000INTYesNo
basic.auth.enabledIf this is set to true, basic authentication is enabled for incoming events, and the credentials with which each event is sent are verified to ensure that the user is authorized to access the service. If basic authentication fails, the event is not authenticated and an authentication error is logged in the CLI. By default this values 'false' falseSTRINGYesNo
worker.countThe number of active worker threads to serve the incoming events. The value is 1 by default. This will ensure that the events are directed to the event stream in the same order in which they arrive. By increasing this value the performance might increase at the cost of loosing event ordering.1STRINGYesNo
socket.idle.timeoutIdle timeout for HTTP connection.120000INTYesNo
ssl.verify.clientThe type of client certificate verification.nullSTRINGYesNo
ssl.protocolssl/tls related optionsTLSSTRINGYesNo
tls.store.typeTLS store type.JKSSTRINGYesNo
parametersParameters other than basics such as ciphers,sslEnabledProtocols,client.enable.session.creation. Expected format of these parameters is as follows: "'ciphers:xxx','sslEnabledProtocols,client.enable:xxx'"nullSTRINGYesNo
ciphersList of ciphers to be used. This parameter should include under parameters Ex: 'ciphers:TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256'nullSTRINGYesNo
ssl.enabled.protocolsSSL/TLS protocols to be enabled. This parameter should be in camel case format(sslEnabledProtocols) under parameters. Ex 'sslEnabledProtocols:true'nullSTRINGYesNo
server.enable.session.creationEnable HTTP session creation.This parameter should include under parameters Ex: 'client.enable.session.creation:true'nullSTRINGYesNo
server.supported.snimatchersHttp SNIMatcher to be added. This parameter should include under parameters Ex: 'server.supported.snimatchers:SNIMatcher'nullSTRINGYesNo
server.suported.server.namesHttp supported servers. This parameter should include under parameters Ex: 'server.suported.server.names:server'nullSTRINGYesNo
request.size.validation.configurationParameters that responsible for validating the http request and request headers. Expected format of these parameters is as follows: "'request.size.validation:xxx','request.size.validation.maximum.value:xxx'"nullSTRINGYesNo
request.size.validationTo enable the request size validation.falseSTRINGYesNo
request.size.validation.maximum.valueIf request size is validated then maximum size.Integer.MAX_VALUESTRINGYesNo
request.size.validation.reject.status.codeIf request is exceed maximum size and request.size.validation is enabled then status code to be send as response.401STRINGYesNo
request.size.validation.reject.messageIf request is exceed maximum size and request.size.validation is enabled then status message to be send as response.Message is bigger than the valid sizeSTRINGYesNo
request.size.validation.reject.message.content.typeIf request is exceed maximum size and request.size.validation is enabled then content type to be send as response.plain/textSTRINGYesNo
header.size.validationTo enable the header size validation.falseSTRINGYesNo
header.validation.maximum.request.lineIf header header validation is enabled then the maximum request line.4096STRINGYesNo
header.validation.maximum.sizeIf header header validation is enabled then the maximum expected header size.8192STRINGYesNo
header.validation.maximum.chunk.sizeIf header header validation is enabled then the maximum expected chunk size.8192STRINGYesNo
header.validation.reject.status.code401If header is exceed maximum size and header.size.validation is enabled then status code to be send as response.STRINGYesNo
header.validation.reject.messageIf header is exceed maximum size and header.size.validation is enabled then message to be send as response.Message header is bigger than the valid sizeSTRINGYesNo
header.validation.reject.message.content.typeIf header is exceed maximum size and header.size.validation is enabled then content type to be send as response.plain/textSTRINGYesNo
server.bootstrap.configurationParameters that for bootstrap configurations of the server. Expected format of these parameters is as follows: "'ciphers:xxx','sslEnabledProtocols,client.enable:xxx'"nullOBJECTYesNo
server.bootstrap.nodelayHttp server no delay.trueBOOLYesNo
server.bootstrap.keepaliveHttp server keep alive.trueBOOLYesNo
server.bootstrap.sendbuffersizeHttp server send buffer size.1048576INTYesNo
server.bootstrap.recievebuffersizeHttp server receive buffer size.1048576INTYesNo
server.bootstrap.connect.timeoutHttp server connection timeout.15000INTYesNo
server.bootstrap.socket.reuseTo enable http socket reuse.falseBOOLYesNo
server.bootstrap.socket.timeoutHttp server socket timeout.15BOOLYesNo
server.bootstrap.socket.backlogTHttp server socket backlog.100BOOLYesNo
trace.log.enabledHttp traffic monitoring.falseBOOLYesNo
- -System Parameters - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Parameters
serverBootstrapBossGroupSizeproperty to configure number of boss threads, which accepts incoming connections until the ports are unbound. Once connection accepts successfully, boss thread passes the accepted channel to one of the worker threads.Number of available processorsAny integer
serverBootstrapWorkerGroupSizeproperty to configure number of worker threads, which performs non blocking read and write for one or more channels in non-blocking mode.(Number of available processors)*2Any integer
serverBootstrapClientGroupSizeproperty to configure number of client threads, which performs non blocking read and write for one or more channels in non-blocking mode.(Number of available processors)*2Any integer
defaultHostThe default host of the transport.0.0.0.0Any valid host
defaultHttpPortThe default port if the default scheme is 'http'.8280Any valid port
defaultHttpsPortThe default port if the default scheme is 'https'.8243Any valid port
defaultSchemeThe default protocol.httphttp
https
keyStoreLocationThe default keystore file path.${carbon.home}/resources/security/wso2carbon.jksPath to wso2carbon.jks file
keyStorePasswordThe default keystore password.wso2carbonString of keystore password
certPasswordThe default cert password.wso2carbonString of cert password
- -Examples -EXAMPLE 1 -``` -@source(type='http-sync', source.id='samplesourceid, receiver.url='http://localhost:9055/endpoints/RecPro', socketIdleTimeout='150000', parameters="'ciphers : TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256', 'sslEnabledProtocols:TLSv1.1,TLSv1.2'",request.size.validation.configuration="request.size.validation:true",server.bootstrap.configuration="server.bootstrap.socket.timeout:25" @map(type='json @attributes(messageId='trp:messageId',symbol='$.events.event.symbol',price='$.events.event.price',volume='$.events.event.volume'))) -define stream FooStream (messageId string, symbol string, price float, volume long); - -``` -

The expected input is as follows:{"events":
    {"event":
        "symbol":WSO2,
        "price":55.6,
        "volume":100,
    }
}
If basic authentication is enabled via the basic.auth.enabled='true setting, each input event is also expected to contain the Authorization:'Basic encodeBase64(username:Password)' header.

- diff --git a/docs/api/1.0.22.md b/docs/api/1.0.22.md deleted file mode 100644 index 0fa3b635..00000000 --- a/docs/api/1.0.22.md +++ /dev/null @@ -1,1224 +0,0 @@ -# API Docs - v1.0.22 - -## Sink - -### http *(Sink)* - -

This extension publish the HTTP events in any HTTP method POST, GET, PUT, DELETE via HTTP or https protocols. As the additional features this component can provide basic authentication as well as user can publish events using custom client truststore files when publishing events via https protocol. And also user can add any number of headers including HTTP_METHOD header for each event dynamically.

- -Syntax -``` -@sink(type="http", publisher.url="", basic.auth.username="", basic.auth.password="", https.truststore.file="", https.truststore.password="", headers="", method="", socket.idle.timeout="", chunk.disabled="", ssl.protocol="", parameters="", ciphers="", ssl.enabled.protocols="", client.enable.session.creation="", follow.redirect="", max.redirect.count="", tls.store.type="", proxy.host="", proxy.port="", proxy.username="", proxy.password="", client.bootstrap.configuration="", client.bootstrap.nodelay="", client.bootstrap.keepalive="", client.bootstrap.sendbuffersize="", client.bootstrap.recievebuffersize="", client.bootstrap.connect.timeout="", client.bootstrap.socket.reuse="", client.bootstrap.socket.timeout="", client.threadpool.configurations="", client.connection.pool.count="", client.max.active.connections.per.pool="", client.min.idle.connections.per.pool="", client.max.idle.connections.per.pool="", client.min.eviction.idle.time="", sender.thread.count="", event.group.executor.thread.size="", max.wait.for.client.connection.pool="", @map(...))) -``` - -QUERY PARAMETERS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
publisher.urlThe URL to which the outgoing events should be published via HTTP. This is a mandatory parameter and if this is not specified, an error is logged in the CLI. If user wants to enable SSL for the events, use https instead of http in the publisher.url.e.g., http://localhost:8080/endpoint, https://localhost:8080/endpointSTRINGNoNo
basic.auth.usernameThe username to be included in the authentication header of the basic authentication enabled events. It is required to specify both username and password to enable basic authentication. If one of the parameter is not given by user then an error is logged in the CLI. STRINGYesNo
basic.auth.passwordThe password to include in the authentication header of the basic authentication enabled events. It is required to specify both username and password to enable basic authentication. If one of the parameter is not given by user then an error is logged in the CLI. STRINGYesNo
https.truststore.fileThe file path to the location of the truststore of the client that sends the HTTP events through 'https' protocol. A custom client-truststore can be specified if required.${carbon.home}/resources/security/client-truststore.jksSTRINGYesNo
https.truststore.passwordThe password for the client-truststore. A custom password can be specified if required. If no custom password is specified and the protocol of URL is 'https' then, the system uses default password.wso2carbonSTRINGYesNo
headersThe headers that should be included as a HTTP request headers. There can be any number of headers concatenated on following format. "'header1:value1','header2:value2'". User can include content-type header if he need to any specific type for payload if not system get the mapping type as the content-Type header (ie. @map(xml):application/xml,@map(json):application/json,@map(text):plain/text ) and if user does not include any mapping type then system gets the 'plain/text' as default Content-Type header. If user does not include Content-Length header then system calculate the bytes size of payload and include it as content-length header. STRINGYesNo
methodFor HTTP events, HTTP_METHOD header should be included as a request header. If the parameter is null then system uses 'POST' as a default header.POSTSTRINGYesNo
socket.idle.timeoutSocket timeout value in millisecond6000INTYesNo
chunk.disabledport: Port number of the remote servicefalseBOOLYesNo
ssl.protocolThe SSL protocol versionTLSSTRINGYesNo
parametersParameters other than basics such as ciphers,sslEnabledProtocols,client.enable.session.creation. Expected format of these parameters is as follows: "'ciphers:xxx','sslEnabledProtocols,client.enable:xxx'"nullSTRINGYesNo
ciphersList of ciphers to be used. This parameter should include under parameters Ex: 'ciphers:TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256'nullSTRINGYesNo
ssl.enabled.protocolsSSL/TLS protocols to be enabled. This parameter should be in camel case format(sslEnabledProtocols) under parameters. Ex 'sslEnabledProtocols:true'nullSTRINGYesNo
client.enable.session.creationEnable HTTP session creation.This parameter should include under parameters Ex: 'client.enable.session.creation:true'nullSTRINGYesNo
follow.redirectRedirect related enabled.trueBOOLYesNo
max.redirect.countMaximum redirect count.5INTYesNo
tls.store.typeTLS store type to be used.JKSSTRINGYesNo
proxy.hostProxy server hostnullSTRINGYesNo
proxy.portProxy server portnullSTRINGYesNo
proxy.usernameProxy server usernamenullSTRINGYesNo
proxy.passwordProxy server passwordnullSTRINGYesNo
client.bootstrap.configurationClient bootsrap configurations. Expected format of these parameters is as follows: "'client.bootstrap.nodelay:xxx','client.bootstrap.keepalive:xxx'"TODOSTRINGYesNo
client.bootstrap.nodelayHttp client no delay.trueBOOLYesNo
client.bootstrap.keepaliveHttp client keep alive.trueBOOLYesNo
client.bootstrap.sendbuffersizeHttp client send buffer size.1048576INTYesNo
client.bootstrap.recievebuffersizeHttp client receive buffer size.1048576INTYesNo
client.bootstrap.connect.timeoutHttp client connection timeout.15000INTYesNo
client.bootstrap.socket.reuseTo enable http socket reuse.falseBOOLYesNo
client.bootstrap.socket.timeoutHttp client socket timeout.15STRINGYesNo
client.threadpool.configurationsThread pool configuration. Expected format of these parameters is as follows: "'client.connection.pool.count:xxx','client.max.active.connections.per.pool:xxx'"TODOSTRINGYesNo
client.connection.pool.countConnection pool count.0INTYesNo
client.max.active.connections.per.poolActive connections per pool.-1INTYesNo
client.min.idle.connections.per.poolMinimum ideal connection per pool.0INTYesNo
client.max.idle.connections.per.poolMaximum ideal connection per pool.100INTYesNo
client.min.eviction.idle.timeMinimum eviction idle time.5 * 60 * 1000STRINGYesNo
sender.thread.countHttp sender thread count.20STRINGYesNo
event.group.executor.thread.sizeEvent group executor thread size.15STRINGYesNo
max.wait.for.client.connection.poolMaximum wait for client connection pool.60000STRINGYesNo
- -System Parameters - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Parameters
clientBootstrapBossGroupSizeproperty to configure number of boss threads, which accepts incoming connections until the ports are unbound. Once connection accepts successfully, boss thread passes the accepted channel to one of the worker threads.Number of available processorsAny integer
clientBootstrapWorkerGroupSizeproperty to configure number of worker threads, which performs non blocking read and write for one or more channels in non-blocking mode.(Number of available processors)*2Any integer
clientBootstrapClientGroupSizeproperty to configure number of client threads, which performs non blocking read and write for one or more channels in non-blocking mode.(Number of available processors)*2Any integer
trustStoreLocationThe default truststore file path.${carbon.home}/resources/security/client-truststore.jksPath to client-truststore.jks
trustStorePasswordThe default truststore password.wso2carbonTruststore password
- -Examples -EXAMPLE 1 -``` -@sink(type='http',publisher.url='http://localhost:8009/foo', method='{{method}}',headers="'content-type:xml','content-length:94'",client.bootstrap.configuration="'client.bootstrap.socket.timeout:20','client.bootstrap.worker.group.size:10'",client.pool.configuration="'client.connection.pool.count:10','client.max.active.connections.per.pool:1'" @map(type='xml' , @payload('{{payloadBody}}')))define stream FooStream (payloadBody String, method string, headers string); - -``` -

If it is xml mapping expected input should be in following format for FooStream:{<events> <event> <symbol>WSO2</symbol> <price>55.6</price> <volume>100</volume> </event></events>,POST,Content-Length:24#Content-Location:USA#Retry-After:120}Above event will generate output as below.~Output http event payload<events>
    <event>
        <symbol>WSO2</symbol>
        <price>55.6</price>
        <volume>100</volume>
    </event>
</events>
~Output http event headersContent-Length:24,Content-Location:'USA',Retry-After:120,Content-Type:'application/xml',HTTP_METHOD:'POST',~Output http event propertiesHTTP_METHOD:'POST',HOST:'localhost',PORT:8009PROTOCOL:'http'TO:'/foo'

- -### http-response *(Sink)* - -

This extension send the response to the http-sync source having the same source.id. user can add any number of response headers for each event dynamically.

- -Syntax -``` -@sink(type="http-response", source.id="", message.id="", headers="", @map(...))) -``` - -QUERY PARAMETERS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
source.idIdentifier of the source.STRINGNoNo
message.idIdentifier of the message.STRINGNoYes
headersThe headers that should be included as HTTP response headers. There can be any number of headers concatenated on following format. "'header1:value1','header2:value2'" User can include content-type header if he/she need to have any specific type for payload. If not system get the mapping type as the content-Type header (ie. @map(xml):application/xml, @map(json):application/json, @map(text):plain/text) and if user does not include any mapping type then system gets the 'plain/text' as default Content-Type header. If user does not include Content-Length header then system calculate the bytes size of payload and include it as content-length header. STRINGYesNo
- -Examples -EXAMPLE 1 -``` -@sink(type='http-sync',source.id='sampleSourceId',message.id='{{messageId}}',headers="'content-type:json','content-length:94'"@map(type='json' , @payload('{{payloadBody}}')))define stream FooStream (payloadBody String, messageId string, headers string); - -``` -

If it is json mapping expected input should be in following format for FooStream:{{"events":
    {"event":
        "symbol":WSO2,
        "price":55.6,
        "volume":100,
    }
},0cf708b1-7eae-440b-a93e-e72f801b486a,Content-Length:24#Content-Location:USA}Above event will generate response for the matching source message as below.~Output http event payload{"events":
    {"event":
        "symbol":WSO2,
        "price":55.6,
        "volume":100,
    }
}
~Output http event headersContent-Length:24,Content-Location:'USA',Content-Type:'application/json',

- -## Source - -### http *(Source)* - -

The HTTP source receives POST requests via HTTP or HTTPS in format such as text, XML and JSON. If required, you can enable basic authentication to ensure that events are received only from users who are authorized to access the service.

- -Syntax -``` -@source(type="http", receiver.url="", basic.auth.enabled="", worker.count="", socket.idle.timeout="", ssl.verify.client="", ssl.protocol="", tls.store.type="", parameters="", ciphers="", ssl.enabled.protocols="", server.enable.session.creation="", server.supported.snimatchers="", server.suported.server.names="", request.size.validation.configuration="", request.size.validation="", request.size.validation.maximum.value="", request.size.validation.reject.status.code="", request.size.validation.reject.message="", request.size.validation.reject.message.content.type="", header.size.validation="", header.validation.maximum.request.line="", header.validation.maximum.size="", header.validation.maximum.chunk.size="", header.validation.reject.status.code="", header.validation.reject.message="", header.validation.reject.message.content.type="", server.bootstrap.configuration="", server.bootstrap.nodelay="", server.bootstrap.keepalive="", server.bootstrap.sendbuffersize="", server.bootstrap.recievebuffersize="", server.bootstrap.connect.timeout="", server.bootstrap.socket.reuse="", server.bootstrap.socket.timeout="", server.bootstrap.socket.backlog="", trace.log.enabled="", @map(...))) -``` - -QUERY PARAMETERS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
receiver.urlThe URL to which the events should be received. User can provide any valid url and if the url is not provided the system will use the following format http://0.0.0.0:9763/<appNAme>/<streamName>If the user want to use SSL the url should be given in following format https://localhost:8080/<streamName>http://0.0.0.0:9763//STRINGYesNo
basic.auth.enabledIf this is set to true, basic authentication is enabled for incoming events, and the credentials with which each event is sent are verified to ensure that the user is authorized to access the service. If basic authentication fails, the event is not authenticated and an authentication error is logged in the CLI. By default this values 'false' falseSTRINGYesNo
worker.countThe number of active worker threads to serve the incoming events. The value is 1 by default. This will ensure that the events are directed to the event stream in the same order in which they arrive. By increasing this value the performance might increase at the cost of loosing event ordering.1STRINGYesNo
socket.idle.timeoutIdle timeout for HTTP connection.120000INTYesNo
ssl.verify.clientThe type of client certificate verification.nullSTRINGYesNo
ssl.protocolssl/tls related optionsTLSSTRINGYesNo
tls.store.typeTLS store type.JKSSTRINGYesNo
parametersParameters other than basics such as ciphers,sslEnabledProtocols,client.enable.session.creation. Expected format of these parameters is as follows: "'ciphers:xxx','sslEnabledProtocols,client.enable:xxx'"nullSTRINGYesNo
ciphersList of ciphers to be used. This parameter should include under parameters Ex: 'ciphers:TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256'nullSTRINGYesNo
ssl.enabled.protocolsSSL/TLS protocols to be enabled. This parameter should be in camel case format(sslEnabledProtocols) under parameters. Ex 'sslEnabledProtocols:true'nullSTRINGYesNo
server.enable.session.creationEnable HTTP session creation.This parameter should include under parameters Ex: 'client.enable.session.creation:true'nullSTRINGYesNo
server.supported.snimatchersHttp SNIMatcher to be added. This parameter should include under parameters Ex: 'server.supported.snimatchers:SNIMatcher'nullSTRINGYesNo
server.suported.server.namesHttp supported servers. This parameter should include under parameters Ex: 'server.suported.server.names:server'nullSTRINGYesNo
request.size.validation.configurationParameters that responsible for validating the http request and request headers. Expected format of these parameters is as follows: "'request.size.validation:xxx','request.size.validation.maximum.value:xxx'"nullSTRINGYesNo
request.size.validationTo enable the request size validation.falseSTRINGYesNo
request.size.validation.maximum.valueIf request size is validated then maximum size.Integer.MAX_VALUESTRINGYesNo
request.size.validation.reject.status.codeIf request is exceed maximum size and request.size.validation is enabled then status code to be send as response.401STRINGYesNo
request.size.validation.reject.messageIf request is exceed maximum size and request.size.validation is enabled then status message to be send as response.Message is bigger than the valid sizeSTRINGYesNo
request.size.validation.reject.message.content.typeIf request is exceed maximum size and request.size.validation is enabled then content type to be send as response.plain/textSTRINGYesNo
header.size.validationTo enable the header size validation.falseSTRINGYesNo
header.validation.maximum.request.lineIf header header validation is enabled then the maximum request line.4096STRINGYesNo
header.validation.maximum.sizeIf header header validation is enabled then the maximum expected header size.8192STRINGYesNo
header.validation.maximum.chunk.sizeIf header header validation is enabled then the maximum expected chunk size.8192STRINGYesNo
header.validation.reject.status.code401If header is exceed maximum size and header.size.validation is enabled then status code to be send as response.STRINGYesNo
header.validation.reject.messageIf header is exceed maximum size and header.size.validation is enabled then message to be send as response.Message header is bigger than the valid sizeSTRINGYesNo
header.validation.reject.message.content.typeIf header is exceed maximum size and header.size.validation is enabled then content type to be send as response.plain/textSTRINGYesNo
server.bootstrap.configurationParameters that for bootstrap configurations of the server. Expected format of these parameters is as follows: "'ciphers:xxx','sslEnabledProtocols,client.enable:xxx'"nullOBJECTYesNo
server.bootstrap.nodelayHttp server no delay.trueBOOLYesNo
server.bootstrap.keepaliveHttp server keep alive.trueBOOLYesNo
server.bootstrap.sendbuffersizeHttp server send buffer size.1048576INTYesNo
server.bootstrap.recievebuffersizeHttp server receive buffer size.1048576INTYesNo
server.bootstrap.connect.timeoutHttp server connection timeout.15000INTYesNo
server.bootstrap.socket.reuseTo enable http socket reuse.falseBOOLYesNo
server.bootstrap.socket.timeoutHttp server socket timeout.15BOOLYesNo
server.bootstrap.socket.backlogTHttp server socket backlog.100BOOLYesNo
trace.log.enabledHttp traffic monitoring.falseBOOLYesNo
- -System Parameters - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Parameters
serverBootstrapBossGroupSizeproperty to configure number of boss threads, which accepts incoming connections until the ports are unbound. Once connection accepts successfully, boss thread passes the accepted channel to one of the worker threads.Number of available processorsAny integer
serverBootstrapWorkerGroupSizeproperty to configure number of worker threads, which performs non blocking read and write for one or more channels in non-blocking mode.(Number of available processors)*2Any integer
serverBootstrapClientGroupSizeproperty to configure number of client threads, which performs non blocking read and write for one or more channels in non-blocking mode.(Number of available processors)*2Any integer
defaultHostThe default host of the transport.0.0.0.0Any valid host
defaultHttpPortThe default port if the default scheme is 'http'.8280Any valid port
defaultHttpsPortThe default port if the default scheme is 'https'.8243Any valid port
defaultSchemeThe default protocol.httphttp
https
keyStoreLocationThe default keystore file path.${carbon.home}/resources/security/wso2carbon.jksPath to wso2carbon.jks file
keyStorePasswordThe default keystore password.wso2carbonString of keystore password
certPasswordThe default cert password.wso2carbonString of cert password
- -Examples -EXAMPLE 1 -``` -@source(type='http', receiver.url='http://localhost:9055/endpoints/RecPro', socketIdleTimeout='150000', parameters="'ciphers : TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256', 'sslEnabledProtocols:TLSv1.1,TLSv1.2'",request.size.validation.configuration="request.size.validation:true",server.bootstrap.configuration="server.bootstrap.socket.timeout:25" @map(type='xml')) -define stream FooStream (symbol string, price float, volume long); - -``` -

Above source listenerConfiguration performs a default XML input mapping. The expected input is as follows:<events>
    <event>
        <symbol>WSO2</symbol>
        <price>55.6</price>
        <volume>100</volume>
    </event>
</events>
If basic authentication is enabled via the basic.auth.enabled='true setting, each input event is also expected to contain the Authorization:'Basic encodeBase64(username:Password)' header.

- -### http-request *(Source)* - -

The HTTP source receives POST requests via HTTP or HTTPS in format such as text, XML and JSON. If required, you can enable basic authentication to ensure that events are received only from users who are authorized to access the service.

- -Syntax -``` -@source(type="http-request", receiver.url="", source.id="", connection.timeout="", basic.auth.enabled="", worker.count="", socket.idle.timeout="", ssl.verify.client="", ssl.protocol="", tls.store.type="", parameters="", ciphers="", ssl.enabled.protocols="", server.enable.session.creation="", server.supported.snimatchers="", server.suported.server.names="", request.size.validation.configuration="", request.size.validation="", request.size.validation.maximum.value="", request.size.validation.reject.status.code="", request.size.validation.reject.message="", request.size.validation.reject.message.content.type="", header.size.validation="", header.validation.maximum.request.line="", header.validation.maximum.size="", header.validation.maximum.chunk.size="", header.validation.reject.status.code="", header.validation.reject.message="", header.validation.reject.message.content.type="", server.bootstrap.configuration="", server.bootstrap.nodelay="", server.bootstrap.keepalive="", server.bootstrap.sendbuffersize="", server.bootstrap.recievebuffersize="", server.bootstrap.connect.timeout="", server.bootstrap.socket.reuse="", server.bootstrap.socket.timeout="", server.bootstrap.socket.backlog="", trace.log.enabled="", @map(...))) -``` - -QUERY PARAMETERS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
receiver.urlThe URL to which the events should be received. User can provide any valid url and if the url is not provided the system will use the following format http://0.0.0.0:9763/<appNAme>/<streamName>If the user want to use SSL the url should be given in following format https://localhost:8080/<streamName>http://0.0.0.0:9763//STRINGYesNo
source.idIdentifier need to map the source to sink.STRINGNoNo
connection.timeoutConnection timeout in milliseconds. If the mapped http-response sink does not get a correlated message, after this timeout value, a timeout response is sent120000INTYesNo
basic.auth.enabledIf this is set to true, basic authentication is enabled for incoming events, and the credentials with which each event is sent are verified to ensure that the user is authorized to access the service. If basic authentication fails, the event is not authenticated and an authentication error is logged in the CLI. By default this values 'false' falseSTRINGYesNo
worker.countThe number of active worker threads to serve the incoming events. The value is 1 by default. This will ensure that the events are directed to the event stream in the same order in which they arrive. By increasing this value the performance might increase at the cost of loosing event ordering.1STRINGYesNo
socket.idle.timeoutIdle timeout for HTTP connection.120000INTYesNo
ssl.verify.clientThe type of client certificate verification.nullSTRINGYesNo
ssl.protocolssl/tls related optionsTLSSTRINGYesNo
tls.store.typeTLS store type.JKSSTRINGYesNo
parametersParameters other than basics such as ciphers,sslEnabledProtocols,client.enable.session.creation. Expected format of these parameters is as follows: "'ciphers:xxx','sslEnabledProtocols,client.enable:xxx'"nullSTRINGYesNo
ciphersList of ciphers to be used. This parameter should include under parameters Ex: 'ciphers:TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256'nullSTRINGYesNo
ssl.enabled.protocolsSSL/TLS protocols to be enabled. This parameter should be in camel case format(sslEnabledProtocols) under parameters. Ex 'sslEnabledProtocols:true'nullSTRINGYesNo
server.enable.session.creationEnable HTTP session creation.This parameter should include under parameters Ex: 'client.enable.session.creation:true'nullSTRINGYesNo
server.supported.snimatchersHttp SNIMatcher to be added. This parameter should include under parameters Ex: 'server.supported.snimatchers:SNIMatcher'nullSTRINGYesNo
server.suported.server.namesHttp supported servers. This parameter should include under parameters Ex: 'server.suported.server.names:server'nullSTRINGYesNo
request.size.validation.configurationParameters that responsible for validating the http request and request headers. Expected format of these parameters is as follows: "'request.size.validation:xxx','request.size.validation.maximum.value:xxx'"nullSTRINGYesNo
request.size.validationTo enable the request size validation.falseSTRINGYesNo
request.size.validation.maximum.valueIf request size is validated then maximum size.Integer.MAX_VALUESTRINGYesNo
request.size.validation.reject.status.codeIf request is exceed maximum size and request.size.validation is enabled then status code to be send as response.401STRINGYesNo
request.size.validation.reject.messageIf request is exceed maximum size and request.size.validation is enabled then status message to be send as response.Message is bigger than the valid sizeSTRINGYesNo
request.size.validation.reject.message.content.typeIf request is exceed maximum size and request.size.validation is enabled then content type to be send as response.plain/textSTRINGYesNo
header.size.validationTo enable the header size validation.falseSTRINGYesNo
header.validation.maximum.request.lineIf header header validation is enabled then the maximum request line.4096STRINGYesNo
header.validation.maximum.sizeIf header header validation is enabled then the maximum expected header size.8192STRINGYesNo
header.validation.maximum.chunk.sizeIf header header validation is enabled then the maximum expected chunk size.8192STRINGYesNo
header.validation.reject.status.code401If header is exceed maximum size and header.size.validation is enabled then status code to be send as response.STRINGYesNo
header.validation.reject.messageIf header is exceed maximum size and header.size.validation is enabled then message to be send as response.Message header is bigger than the valid sizeSTRINGYesNo
header.validation.reject.message.content.typeIf header is exceed maximum size and header.size.validation is enabled then content type to be send as response.plain/textSTRINGYesNo
server.bootstrap.configurationParameters that for bootstrap configurations of the server. Expected format of these parameters is as follows: "'ciphers:xxx','sslEnabledProtocols,client.enable:xxx'"nullOBJECTYesNo
server.bootstrap.nodelayHttp server no delay.trueBOOLYesNo
server.bootstrap.keepaliveHttp server keep alive.trueBOOLYesNo
server.bootstrap.sendbuffersizeHttp server send buffer size.1048576INTYesNo
server.bootstrap.recievebuffersizeHttp server receive buffer size.1048576INTYesNo
server.bootstrap.connect.timeoutHttp server connection timeout.15000INTYesNo
server.bootstrap.socket.reuseTo enable http socket reuse.falseBOOLYesNo
server.bootstrap.socket.timeoutHttp server socket timeout.15BOOLYesNo
server.bootstrap.socket.backlogTHttp server socket backlog.100BOOLYesNo
trace.log.enabledHttp traffic monitoring.falseBOOLYesNo
- -System Parameters - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Parameters
serverBootstrapBossGroupSizeproperty to configure number of boss threads, which accepts incoming connections until the ports are unbound. Once connection accepts successfully, boss thread passes the accepted channel to one of the worker threads.Number of available processorsAny integer
serverBootstrapWorkerGroupSizeproperty to configure number of worker threads, which performs non blocking read and write for one or more channels in non-blocking mode.(Number of available processors)*2Any integer
serverBootstrapClientGroupSizeproperty to configure number of client threads, which performs non blocking read and write for one or more channels in non-blocking mode.(Number of available processors)*2Any integer
defaultHostThe default host of the transport.0.0.0.0Any valid host
defaultHttpPortThe default port if the default scheme is 'http'.8280Any valid port
defaultHttpsPortThe default port if the default scheme is 'https'.8243Any valid port
defaultSchemeThe default protocol.httphttp
https
keyStoreLocationThe default keystore file path.${carbon.home}/resources/security/wso2carbon.jksPath to wso2carbon.jks file
keyStorePasswordThe default keystore password.wso2carbonString of keystore password
certPasswordThe default cert password.wso2carbonString of cert password
- -Examples -EXAMPLE 1 -``` -@source(type='http-sync', source.id='samplesourceid, receiver.url='http://localhost:9055/endpoints/RecPro', socketIdleTimeout='150000', parameters="'ciphers : TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256', 'sslEnabledProtocols:TLSv1.1,TLSv1.2'",request.size.validation.configuration="request.size.validation:true",server.bootstrap.configuration="server.bootstrap.socket.timeout:25" @map(type='json @attributes(messageId='trp:messageId',symbol='$.events.event.symbol',price='$.events.event.price',volume='$.events.event.volume'))) -define stream FooStream (messageId string, symbol string, price float, volume long); - -``` -

The expected input is as follows:{"events":
    {"event":
        "symbol":WSO2,
        "price":55.6,
        "volume":100,
    }
}
If basic authentication is enabled via the basic.auth.enabled='true setting, each input event is also expected to contain the Authorization:'Basic encodeBase64(username:Password)' header.

- diff --git a/docs/api/1.0.24.md b/docs/api/1.0.24.md deleted file mode 100644 index 34b826fb..00000000 --- a/docs/api/1.0.24.md +++ /dev/null @@ -1,1226 +0,0 @@ -# API Docs - v1.0.24 - -## Sink - -### http *(Sink)* - -

This extension publish the HTTP events in any HTTP method POST, GET, PUT, DELETE via HTTP or https protocols. As the additional features this component can provide basic authentication as well as user can publish events using custom client truststore files when publishing events via https protocol. And also user can add any number of headers including HTTP_METHOD header for each event dynamically.

- -Syntax -``` -@sink(type="http", publisher.url="", basic.auth.username="", basic.auth.password="", https.truststore.file="", https.truststore.password="", headers="", method="", socket.idle.timeout="", chunk.disabled="", ssl.protocol="", parameters="", ciphers="", ssl.enabled.protocols="", client.enable.session.creation="", follow.redirect="", max.redirect.count="", tls.store.type="", proxy.host="", proxy.port="", proxy.username="", proxy.password="", client.bootstrap.configuration="", client.bootstrap.nodelay="", client.bootstrap.keepalive="", client.bootstrap.sendbuffersize="", client.bootstrap.recievebuffersize="", client.bootstrap.connect.timeout="", client.bootstrap.socket.reuse="", client.bootstrap.socket.timeout="", client.threadpool.configurations="", client.connection.pool.count="", client.max.active.connections.per.pool="", client.min.idle.connections.per.pool="", client.max.idle.connections.per.pool="", client.min.eviction.idle.time="", sender.thread.count="", event.group.executor.thread.size="", max.wait.for.client.connection.pool="", @map(...))) -``` - -QUERY PARAMETERS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
publisher.urlThe URL to which the outgoing events should be published via HTTP. This is a mandatory parameter and if this is not specified, an error is logged in the CLI. If user wants to enable SSL for the events, use https instead of http in the publisher.url.e.g., http://localhost:8080/endpoint, https://localhost:8080/endpointSTRINGNoNo
basic.auth.usernameThe username to be included in the authentication header of the basic authentication enabled events. It is required to specify both username and password to enable basic authentication. If one of the parameter is not given by user then an error is logged in the CLI. STRINGYesNo
basic.auth.passwordThe password to include in the authentication header of the basic authentication enabled events. It is required to specify both username and password to enable basic authentication. If one of the parameter is not given by user then an error is logged in the CLI. STRINGYesNo
https.truststore.fileThe file path to the location of the truststore of the client that sends the HTTP events through 'https' protocol. A custom client-truststore can be specified if required.${carbon.home}/resources/security/client-truststore.jksSTRINGYesNo
https.truststore.passwordThe password for the client-truststore. A custom password can be specified if required. If no custom password is specified and the protocol of URL is 'https' then, the system uses default password.wso2carbonSTRINGYesNo
headersThe headers that should be included as a HTTP request headers. There can be any number of headers concatenated on following format. "'header1:value1','header2:value2'". User can include content-type header if he need to any specific type for payload if not system get the mapping type as the content-Type header (ie. @map(xml):application/xml,@map(json):application/json,@map(text):plain/text ) and if user does not include any mapping type then system gets the 'plain/text' as default Content-Type header. If user does not include Content-Length header then system calculate the bytes size of payload and include it as content-length header. STRINGYesNo
methodFor HTTP events, HTTP_METHOD header should be included as a request header. If the parameter is null then system uses 'POST' as a default header.POSTSTRINGYesNo
socket.idle.timeoutSocket timeout value in millisecond6000INTYesNo
chunk.disabledport: Port number of the remote servicefalseBOOLYesNo
ssl.protocolThe SSL protocol versionTLSSTRINGYesNo
parametersParameters other than basics such as ciphers,sslEnabledProtocols,client.enable.session.creation. Expected format of these parameters is as follows: "'ciphers:xxx','sslEnabledProtocols,client.enable:xxx'"nullSTRINGYesNo
ciphersList of ciphers to be used. This parameter should include under parameters Ex: 'ciphers:TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256'nullSTRINGYesNo
ssl.enabled.protocolsSSL/TLS protocols to be enabled. This parameter should be in camel case format(sslEnabledProtocols) under parameters. Ex 'sslEnabledProtocols:true'nullSTRINGYesNo
client.enable.session.creationEnable HTTP session creation.This parameter should include under parameters Ex: 'client.enable.session.creation:true'nullSTRINGYesNo
follow.redirectRedirect related enabled.trueBOOLYesNo
max.redirect.countMaximum redirect count.5INTYesNo
tls.store.typeTLS store type to be used.JKSSTRINGYesNo
proxy.hostProxy server hostnullSTRINGYesNo
proxy.portProxy server portnullSTRINGYesNo
proxy.usernameProxy server usernamenullSTRINGYesNo
proxy.passwordProxy server passwordnullSTRINGYesNo
client.bootstrap.configurationClient bootsrap configurations. Expected format of these parameters is as follows: "'client.bootstrap.nodelay:xxx','client.bootstrap.keepalive:xxx'"TODOSTRINGYesNo
client.bootstrap.nodelayHttp client no delay.trueBOOLYesNo
client.bootstrap.keepaliveHttp client keep alive.trueBOOLYesNo
client.bootstrap.sendbuffersizeHttp client send buffer size.1048576INTYesNo
client.bootstrap.recievebuffersizeHttp client receive buffer size.1048576INTYesNo
client.bootstrap.connect.timeoutHttp client connection timeout.15000INTYesNo
client.bootstrap.socket.reuseTo enable http socket reuse.falseBOOLYesNo
client.bootstrap.socket.timeoutHttp client socket timeout.15STRINGYesNo
client.threadpool.configurationsThread pool configuration. Expected format of these parameters is as follows: "'client.connection.pool.count:xxx','client.max.active.connections.per.pool:xxx'"TODOSTRINGYesNo
client.connection.pool.countConnection pool count.0INTYesNo
client.max.active.connections.per.poolActive connections per pool.-1INTYesNo
client.min.idle.connections.per.poolMinimum ideal connection per pool.0INTYesNo
client.max.idle.connections.per.poolMaximum ideal connection per pool.100INTYesNo
client.min.eviction.idle.timeMinimum eviction idle time.5 * 60 * 1000STRINGYesNo
sender.thread.countHttp sender thread count.20STRINGYesNo
event.group.executor.thread.sizeEvent group executor thread size.15STRINGYesNo
max.wait.for.client.connection.poolMaximum wait for client connection pool.60000STRINGYesNo
- -System Parameters - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Parameters
clientBootstrapBossGroupSizeproperty to configure number of boss threads, which accepts incoming connections until the ports are unbound. Once connection accepts successfully, boss thread passes the accepted channel to one of the worker threads.Number of available processorsAny integer
clientBootstrapWorkerGroupSizeproperty to configure number of worker threads, which performs non blocking read and write for one or more channels in non-blocking mode.(Number of available processors)*2Any integer
clientBootstrapClientGroupSizeproperty to configure number of client threads, which performs non blocking read and write for one or more channels in non-blocking mode.(Number of available processors)*2Any integer
trustStoreLocationThe default truststore file path.${carbon.home}/resources/security/client-truststore.jksPath to client-truststore.jks
trustStorePasswordThe default truststore password.wso2carbonTruststore password
- -Examples -EXAMPLE 1 -``` -@sink(type='http',publisher.url='http://localhost:8009/foo', method='{{method}}',headers="'content-type:xml','content-length:94'", client.bootstrap.configuration="'client.bootstrap.socket.timeout:20', 'client.bootstrap.worker.group.size:10'", client.pool.configuration="'client.connection.pool.count:10','client.max.active.connections.per.pool:1'", @map(type='xml', @payload('{{payloadBody}}'))) -define stream FooStream (payloadBody String, method string, headers string); - -``` -

If it is xml mapping expected input should be in following format for FooStream:
{
<events>
    <event>
        <symbol>WSO2</symbol>
        <price>55.6</price>
        <volume>100</volume>
    </event>
</events>,
POST,
Content-Length:24#Content-Location:USA#Retry-After:120
}

Above event will generate output as below.
~Output http event payload
<events>
    <event>
        <symbol>WSO2</symbol>
        <price>55.6</price>
        <volume>100</volume>
    </event>
</events>

~Output http event headers
Content-Length:24,
Content-Location:'USA',
Retry-After:120,
Content-Type:'application/xml',
HTTP_METHOD:'POST',

~Output http event properties
HTTP_METHOD:'POST',
HOST:'localhost',
PORT:8009,
PROTOCOL:'http',
TO:'/foo'

- -### http-response *(Sink)* - -

HTTP response sink is correlated with the The HTTP request source, through a unique source.id, and it send a response to the HTTP request source having the same source.id. The response message can be formatted in text, XML or JSON and can be sent with appropriate headers.

- -Syntax -``` -@sink(type="http-response", source.id="", message.id="", headers="", @map(...))) -``` - -QUERY PARAMETERS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
source.idIdentifier of the source.STRINGNoNo
message.idIdentifier of the message.STRINGNoYes
headersThe headers that should be included as HTTP response headers. There can be any number of headers concatenated on following format. "'header1:value1','header2:value2'" User can include content-type header if he/she need to have any specific type for payload. If not system get the mapping type as the content-Type header (ie.@map(xml):application/xml, @map(json):application/json, @map(text):plain/text) and if user does not include any mapping type then system gets the plain/text as default Content-Type header. If user does not include Content-Length header then system calculate the bytes size of payload and include it as content-length header. STRINGYesNo
- -Examples -EXAMPLE 1 -``` -@sink(type='http-response', source.id='sampleSourceId', message.id='{{messageId}}', headers="'content-type:json','content-length:94'"@map(type='json', @payload('{{payloadBody}}'))) -define stream FooStream (payloadBody String, messageId string, headers string); - -``` -

If it is json mapping expected input should be in following format for FooStream:
{
{"events":
    {"event":
        "symbol":WSO2,
        "price":55.6,
        "volume":100,
    }
},
0cf708b1-7eae-440b-a93e-e72f801b486a,
Content-Length:24#Content-Location:USA
}

Above event will generate response for the matching source message as below.

~Output http event payload
{"events":
    {"event":
        "symbol":WSO2,
        "price":55.6,
        "volume":100,
    }
}

~Output http event headers
Content-Length:24,
Content-Location:'USA',
Content-Type:'application/json'

- -## Source - -### http *(Source)* - -

The HTTP source receives POST requests via HTTP or HTTPS in format such as text, XML and JSON. If required, you can enable basic authentication to ensure that events are received only from users who are authorized to access the service.

- -Syntax -``` -@source(type="http", receiver.url="", basic.auth.enabled="", worker.count="", socket.idle.timeout="", ssl.verify.client="", ssl.protocol="", tls.store.type="", parameters="", ciphers="", ssl.enabled.protocols="", server.enable.session.creation="", server.supported.snimatchers="", server.suported.server.names="", request.size.validation.configuration="", request.size.validation="", request.size.validation.maximum.value="", request.size.validation.reject.status.code="", request.size.validation.reject.message="", request.size.validation.reject.message.content.type="", header.size.validation="", header.validation.maximum.request.line="", header.validation.maximum.size="", header.validation.maximum.chunk.size="", header.validation.reject.status.code="", header.validation.reject.message="", header.validation.reject.message.content.type="", server.bootstrap.configuration="", server.bootstrap.nodelay="", server.bootstrap.keepalive="", server.bootstrap.sendbuffersize="", server.bootstrap.recievebuffersize="", server.bootstrap.connect.timeout="", server.bootstrap.socket.reuse="", server.bootstrap.socket.timeout="", server.bootstrap.socket.backlog="", trace.log.enabled="", @map(...))) -``` - -QUERY PARAMETERS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
receiver.urlThe URL to which the events should be received. User can provide any valid url and if the url is not provided the system will use the following format http://0.0.0.0:9763/<appNAme>/<streamName>If the user want to use SSL the url should be given in following format https://localhost:8080/<streamName>http://0.0.0.0:9763//STRINGYesNo
basic.auth.enabledIf this is set to true, basic authentication is enabled for incoming events, and the credentials with which each event is sent are verified to ensure that the user is authorized to access the service. If basic authentication fails, the event is not authenticated and an authentication error is logged in the CLI. By default this values 'false' falseSTRINGYesNo
worker.countThe number of active worker threads to serve the incoming events. The value is 1 by default. This will ensure that the events are directed to the event stream in the same order in which they arrive. By increasing this value the performance might increase at the cost of loosing event ordering.1STRINGYesNo
socket.idle.timeoutIdle timeout for HTTP connection.120000INTYesNo
ssl.verify.clientThe type of client certificate verification.nullSTRINGYesNo
ssl.protocolssl/tls related optionsTLSSTRINGYesNo
tls.store.typeTLS store type.JKSSTRINGYesNo
parametersParameters other than basics such as ciphers,sslEnabledProtocols,client.enable.session.creation. Expected format of these parameters is as follows: "'ciphers:xxx','sslEnabledProtocols,client.enable:xxx'"nullSTRINGYesNo
ciphersList of ciphers to be used. This parameter should include under parameters Ex: 'ciphers:TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256'nullSTRINGYesNo
ssl.enabled.protocolsSSL/TLS protocols to be enabled. This parameter should be in camel case format(sslEnabledProtocols) under parameters. Ex 'sslEnabledProtocols:true'nullSTRINGYesNo
server.enable.session.creationEnable HTTP session creation.This parameter should include under parameters Ex: 'client.enable.session.creation:true'nullSTRINGYesNo
server.supported.snimatchersHttp SNIMatcher to be added. This parameter should include under parameters Ex: 'server.supported.snimatchers:SNIMatcher'nullSTRINGYesNo
server.suported.server.namesHttp supported servers. This parameter should include under parameters Ex: 'server.suported.server.names:server'nullSTRINGYesNo
request.size.validation.configurationParameters that responsible for validating the http request and request headers. Expected format of these parameters is as follows: "'request.size.validation:xxx','request.size.validation.maximum.value:xxx'"nullSTRINGYesNo
request.size.validationTo enable the request size validation.falseSTRINGYesNo
request.size.validation.maximum.valueIf request size is validated then maximum size.Integer.MAX_VALUESTRINGYesNo
request.size.validation.reject.status.codeIf request is exceed maximum size and request.size.validation is enabled then status code to be send as response.401STRINGYesNo
request.size.validation.reject.messageIf request is exceed maximum size and request.size.validation is enabled then status message to be send as response.Message is bigger than the valid sizeSTRINGYesNo
request.size.validation.reject.message.content.typeIf request is exceed maximum size and request.size.validation is enabled then content type to be send as response.plain/textSTRINGYesNo
header.size.validationTo enable the header size validation.falseSTRINGYesNo
header.validation.maximum.request.lineIf header header validation is enabled then the maximum request line.4096STRINGYesNo
header.validation.maximum.sizeIf header header validation is enabled then the maximum expected header size.8192STRINGYesNo
header.validation.maximum.chunk.sizeIf header header validation is enabled then the maximum expected chunk size.8192STRINGYesNo
header.validation.reject.status.code401If header is exceed maximum size and header.size.validation is enabled then status code to be send as response.STRINGYesNo
header.validation.reject.messageIf header is exceed maximum size and header.size.validation is enabled then message to be send as response.Message header is bigger than the valid sizeSTRINGYesNo
header.validation.reject.message.content.typeIf header is exceed maximum size and header.size.validation is enabled then content type to be send as response.plain/textSTRINGYesNo
server.bootstrap.configurationParameters that for bootstrap configurations of the server. Expected format of these parameters is as follows: "'ciphers:xxx','sslEnabledProtocols,client.enable:xxx'"nullOBJECTYesNo
server.bootstrap.nodelayHttp server no delay.trueBOOLYesNo
server.bootstrap.keepaliveHttp server keep alive.trueBOOLYesNo
server.bootstrap.sendbuffersizeHttp server send buffer size.1048576INTYesNo
server.bootstrap.recievebuffersizeHttp server receive buffer size.1048576INTYesNo
server.bootstrap.connect.timeoutHttp server connection timeout.15000INTYesNo
server.bootstrap.socket.reuseTo enable http socket reuse.falseBOOLYesNo
server.bootstrap.socket.timeoutHttp server socket timeout.15BOOLYesNo
server.bootstrap.socket.backlogTHttp server socket backlog.100BOOLYesNo
trace.log.enabledHttp traffic monitoring.falseBOOLYesNo
- -System Parameters - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Parameters
serverBootstrapBossGroupSizeproperty to configure number of boss threads, which accepts incoming connections until the ports are unbound. Once connection accepts successfully, boss thread passes the accepted channel to one of the worker threads.Number of available processorsAny integer
serverBootstrapWorkerGroupSizeproperty to configure number of worker threads, which performs non blocking read and write for one or more channels in non-blocking mode.(Number of available processors)*2Any integer
serverBootstrapClientGroupSizeproperty to configure number of client threads, which performs non blocking read and write for one or more channels in non-blocking mode.(Number of available processors)*2Any integer
defaultHostThe default host of the transport.0.0.0.0Any valid host
defaultHttpPortThe default port if the default scheme is 'http'.8280Any valid port
defaultHttpsPortThe default port if the default scheme is 'https'.8243Any valid port
defaultSchemeThe default protocol.httphttp
https
keyStoreLocationThe default keystore file path.${carbon.home}/resources/security/wso2carbon.jksPath to wso2carbon.jks file
keyStorePasswordThe default keystore password.wso2carbonString of keystore password
certPasswordThe default cert password.wso2carbonString of cert password
- -Examples -EXAMPLE 1 -``` -@source(type='http', receiver.url='http://localhost:9055/endpoints/RecPro', socketIdleTimeout='150000', parameters="'ciphers : TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256', 'sslEnabledProtocols:TLSv1.1,TLSv1.2'",request.size.validation.configuration="request.size.validation:true",server.bootstrap.configuration="server.bootstrap.socket.timeout:25" @map(type='xml')) -define stream FooStream (symbol string, price float, volume long); - -``` -

Above source listenerConfiguration performs a default XML input mapping. The expected input is as follows:
<events>
    <event>
        <symbol>WSO2</symbol>
        <price>55.6</price>
        <volume>100</volume>
    </event>
</events>
If basic authentication is enabled via the basic.auth.enabled='true setting, each input event is also expected to contain the Authorization:'Basic encodeBase64(username:Password)' header.

- -### http-request *(Source)* - -

The HTTP request is correlated with the HTTP response sink, through a unique source.id, and for each POST requests it receives via HTTP or HTTPS in format such as text, XML and JSON it sends the response via the HTTP response sink. The individual request and response messages are correlated at the sink using the message.id of the events. If required, you can enable basic authentication at the source to ensure that events are received only from users who are authorized to access the service.

- -Syntax -``` -@source(type="http-request", receiver.url="", source.id="", connection.timeout="", basic.auth.enabled="", worker.count="", socket.idle.timeout="", ssl.verify.client="", ssl.protocol="", tls.store.type="", parameters="", ciphers="", ssl.enabled.protocols="", server.enable.session.creation="", server.supported.snimatchers="", server.suported.server.names="", request.size.validation.configuration="", request.size.validation="", request.size.validation.maximum.value="", request.size.validation.reject.status.code="", request.size.validation.reject.message="", request.size.validation.reject.message.content.type="", header.size.validation="", header.validation.maximum.request.line="", header.validation.maximum.size="", header.validation.maximum.chunk.size="", header.validation.reject.status.code="", header.validation.reject.message="", header.validation.reject.message.content.type="", server.bootstrap.configuration="", server.bootstrap.nodelay="", server.bootstrap.keepalive="", server.bootstrap.sendbuffersize="", server.bootstrap.recievebuffersize="", server.bootstrap.connect.timeout="", server.bootstrap.socket.reuse="", server.bootstrap.socket.timeout="", server.bootstrap.socket.backlog="", trace.log.enabled="", @map(...))) -``` - -QUERY PARAMETERS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
receiver.urlThe URL to which the events should be received. User can provide any valid url and if the url is not provided the system will use the following format http://0.0.0.0:9763/<appNAme>/<streamName>If the user want to use SSL the url should be given in following format https://localhost:8080/<streamName>http://0.0.0.0:9763//STRINGYesNo
source.idIdentifier need to map the source to sink.STRINGNoNo
connection.timeoutConnection timeout in milliseconds. If the mapped http-response sink does not get a correlated message, after this timeout value, a timeout response is sent120000INTYesNo
basic.auth.enabledIf this is set to true, basic authentication is enabled for incoming events, and the credentials with which each event is sent are verified to ensure that the user is authorized to access the service. If basic authentication fails, the event is not authenticated and an authentication error is logged in the CLI. By default this values 'false' falseSTRINGYesNo
worker.countThe number of active worker threads to serve the incoming events. The value is 1 by default. This will ensure that the events are directed to the event stream in the same order in which they arrive. By increasing this value the performance might increase at the cost of loosing event ordering.1STRINGYesNo
socket.idle.timeoutIdle timeout for HTTP connection.120000INTYesNo
ssl.verify.clientThe type of client certificate verification.nullSTRINGYesNo
ssl.protocolssl/tls related optionsTLSSTRINGYesNo
tls.store.typeTLS store type.JKSSTRINGYesNo
parametersParameters other than basics such as ciphers,sslEnabledProtocols,client.enable.session.creation. Expected format of these parameters is as follows: "'ciphers:xxx','sslEnabledProtocols,client.enable:xxx'"nullSTRINGYesNo
ciphersList of ciphers to be used. This parameter should include under parameters Ex: 'ciphers:TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256'nullSTRINGYesNo
ssl.enabled.protocolsSSL/TLS protocols to be enabled. This parameter should be in camel case format(sslEnabledProtocols) under parameters. Ex 'sslEnabledProtocols:true'nullSTRINGYesNo
server.enable.session.creationEnable HTTP session creation.This parameter should include under parameters Ex: 'client.enable.session.creation:true'nullSTRINGYesNo
server.supported.snimatchersHttp SNIMatcher to be added. This parameter should include under parameters Ex: 'server.supported.snimatchers:SNIMatcher'nullSTRINGYesNo
server.suported.server.namesHttp supported servers. This parameter should include under parameters Ex: 'server.suported.server.names:server'nullSTRINGYesNo
request.size.validation.configurationParameters that responsible for validating the http request and request headers. Expected format of these parameters is as follows: "'request.size.validation:xxx','request.size.validation.maximum.value:xxx'"nullSTRINGYesNo
request.size.validationTo enable the request size validation.falseSTRINGYesNo
request.size.validation.maximum.valueIf request size is validated then maximum size.Integer.MAX_VALUESTRINGYesNo
request.size.validation.reject.status.codeIf request is exceed maximum size and request.size.validation is enabled then status code to be send as response.401STRINGYesNo
request.size.validation.reject.messageIf request is exceed maximum size and request.size.validation is enabled then status message to be send as response.Message is bigger than the valid sizeSTRINGYesNo
request.size.validation.reject.message.content.typeIf request is exceed maximum size and request.size.validation is enabled then content type to be send as response.plain/textSTRINGYesNo
header.size.validationTo enable the header size validation.falseSTRINGYesNo
header.validation.maximum.request.lineIf header header validation is enabled then the maximum request line.4096STRINGYesNo
header.validation.maximum.sizeIf header header validation is enabled then the maximum expected header size.8192STRINGYesNo
header.validation.maximum.chunk.sizeIf header header validation is enabled then the maximum expected chunk size.8192STRINGYesNo
header.validation.reject.status.code401If header is exceed maximum size and header.size.validation is enabled then status code to be send as response.STRINGYesNo
header.validation.reject.messageIf header is exceed maximum size and header.size.validation is enabled then message to be send as response.Message header is bigger than the valid sizeSTRINGYesNo
header.validation.reject.message.content.typeIf header is exceed maximum size and header.size.validation is enabled then content type to be send as response.plain/textSTRINGYesNo
server.bootstrap.configurationParameters that for bootstrap configurations of the server. Expected format of these parameters is as follows: "'ciphers:xxx','sslEnabledProtocols,client.enable:xxx'"nullOBJECTYesNo
server.bootstrap.nodelayHttp server no delay.trueBOOLYesNo
server.bootstrap.keepaliveHttp server keep alive.trueBOOLYesNo
server.bootstrap.sendbuffersizeHttp server send buffer size.1048576INTYesNo
server.bootstrap.recievebuffersizeHttp server receive buffer size.1048576INTYesNo
server.bootstrap.connect.timeoutHttp server connection timeout.15000INTYesNo
server.bootstrap.socket.reuseTo enable http socket reuse.falseBOOLYesNo
server.bootstrap.socket.timeoutHttp server socket timeout.15BOOLYesNo
server.bootstrap.socket.backlogTHttp server socket backlog.100BOOLYesNo
trace.log.enabledHttp traffic monitoring.falseBOOLYesNo
- -System Parameters - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Parameters
serverBootstrapBossGroupSizeproperty to configure number of boss threads, which accepts incoming connections until the ports are unbound. Once connection accepts successfully, boss thread passes the accepted channel to one of the worker threads.Number of available processorsAny integer
serverBootstrapWorkerGroupSizeproperty to configure number of worker threads, which performs non blocking read and write for one or more channels in non-blocking mode.(Number of available processors)*2Any integer
serverBootstrapClientGroupSizeproperty to configure number of client threads, which performs non blocking read and write for one or more channels in non-blocking mode.(Number of available processors)*2Any integer
defaultHostThe default host of the transport.0.0.0.0Any valid host
defaultHttpPortThe default port if the default scheme is 'http'.8280Any valid port
defaultHttpsPortThe default port if the default scheme is 'https'.8243Any valid port
defaultSchemeThe default protocol.httphttp
https
keyStoreLocationThe default keystore file path.${carbon.home}/resources/security/wso2carbon.jksPath to wso2carbon.jks file
keyStorePasswordThe default keystore password.wso2carbonString of keystore password
certPasswordThe default cert password.wso2carbonString of cert password
- -Examples -EXAMPLE 1 -``` -@source(type='http-request', source.id='sampleSourceId, receiver.url='http://localhost:9055/endpoints/RecPro', connection.timeout='150000', parameters="'ciphers : TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256', 'sslEnabledProtocols:TLSv1.1,TLSv1.2'", request.size.validation.configuration="request.size.validation:true", server.bootstrap.configuration="server.bootstrap.socket.timeout:25", @map(type='json, @attributes(messageId='trp:messageId', symbol='$.events.event.symbol', price='$.events.event.price', volume='$.events.event.volume'))) -define stream FooStream (messageId string, symbol string, price float, volume long); - -``` -

The expected input is as follows:
{"events":
    {"event":
        "symbol":WSO2,
        "price":55.6,
        "volume":100,
    }
}
If basic authentication is enabled via the basic.auth.enabled='true setting, each input event is also expected to contain the Authorization:'Basic encodeBase64(username:Password)' header.

- diff --git a/docs/api/1.0.25.md b/docs/api/1.0.25.md deleted file mode 100644 index fda68de4..00000000 --- a/docs/api/1.0.25.md +++ /dev/null @@ -1,1226 +0,0 @@ -# API Docs - v1.0.25 - -## Sink - -### http *(Sink)* - -

This extension publish the HTTP events in any HTTP method POST, GET, PUT, DELETE via HTTP or https protocols. As the additional features this component can provide basic authentication as well as user can publish events using custom client truststore files when publishing events via https protocol. And also user can add any number of headers including HTTP_METHOD header for each event dynamically.
Following content types will be set by default according to the type of sink mapper used.
You can override them by setting the new content types in headers.
     - TEXT : text/plain
     - XML : application/xml
     - JSON : application/json
     - KEYVALUE : application/x-www-form-urlencoded

- -Syntax -``` -@sink(type="http", publisher.url="", basic.auth.username="", basic.auth.password="", https.truststore.file="", https.truststore.password="", headers="", method="", socket.idle.timeout="", chunk.disabled="", ssl.protocol="", parameters="", ciphers="", ssl.enabled.protocols="", client.enable.session.creation="", follow.redirect="", max.redirect.count="", tls.store.type="", proxy.host="", proxy.port="", proxy.username="", proxy.password="", client.bootstrap.configuration="", client.bootstrap.nodelay="", client.bootstrap.keepalive="", client.bootstrap.sendbuffersize="", client.bootstrap.recievebuffersize="", client.bootstrap.connect.timeout="", client.bootstrap.socket.reuse="", client.bootstrap.socket.timeout="", client.threadpool.configurations="", client.connection.pool.count="", client.max.active.connections.per.pool="", client.min.idle.connections.per.pool="", client.max.idle.connections.per.pool="", client.min.eviction.idle.time="", sender.thread.count="", event.group.executor.thread.size="", max.wait.for.client.connection.pool="", @map(...))) -``` - -QUERY PARAMETERS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
publisher.urlThe URL to which the outgoing events should be published via HTTP. This is a mandatory parameter and if this is not specified, an error is logged in the CLI. If user wants to enable SSL for the events, use https instead of http in the publisher.url.e.g., http://localhost:8080/endpoint, https://localhost:8080/endpointSTRINGNoNo
basic.auth.usernameThe username to be included in the authentication header of the basic authentication enabled events. It is required to specify both username and password to enable basic authentication. If one of the parameter is not given by user then an error is logged in the CLI. STRINGYesNo
basic.auth.passwordThe password to include in the authentication header of the basic authentication enabled events. It is required to specify both username and password to enable basic authentication. If one of the parameter is not given by user then an error is logged in the CLI. STRINGYesNo
https.truststore.fileThe file path to the location of the truststore of the client that sends the HTTP events through 'https' protocol. A custom client-truststore can be specified if required.${carbon.home}/resources/security/client-truststore.jksSTRINGYesNo
https.truststore.passwordThe password for the client-truststore. A custom password can be specified if required. If no custom password is specified and the protocol of URL is 'https' then, the system uses default password.wso2carbonSTRINGYesNo
headersThe headers that should be included as a HTTP request headers. There can be any number of headers concatenated on following format. "'header1:value1','header2:value2'". User can include content-type header if he need to any specific type for payload if not system get the mapping type as the content-Type header (ie. @map(xml):application/xml,@map(json):application/json,@map(text):plain/text ) and if user does not include any mapping type then system gets the 'plain/text' as default Content-Type header. If user does not include Content-Length header then system calculate the bytes size of payload and include it as content-length header. STRINGYesNo
methodFor HTTP events, HTTP_METHOD header should be included as a request header. If the parameter is null then system uses 'POST' as a default header.POSTSTRINGYesNo
socket.idle.timeoutSocket timeout value in millisecond6000INTYesNo
chunk.disabledport: Port number of the remote servicefalseBOOLYesNo
ssl.protocolThe SSL protocol versionTLSSTRINGYesNo
parametersParameters other than basics such as ciphers,sslEnabledProtocols,client.enable.session.creation. Expected format of these parameters is as follows: "'ciphers:xxx','sslEnabledProtocols,client.enable:xxx'"nullSTRINGYesNo
ciphersList of ciphers to be used. This parameter should include under parameters Ex: 'ciphers:TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256'nullSTRINGYesNo
ssl.enabled.protocolsSSL/TLS protocols to be enabled. This parameter should be in camel case format(sslEnabledProtocols) under parameters. Ex 'sslEnabledProtocols:true'nullSTRINGYesNo
client.enable.session.creationEnable HTTP session creation.This parameter should include under parameters Ex: 'client.enable.session.creation:true'nullSTRINGYesNo
follow.redirectRedirect related enabled.trueBOOLYesNo
max.redirect.countMaximum redirect count.5INTYesNo
tls.store.typeTLS store type to be used.JKSSTRINGYesNo
proxy.hostProxy server hostnullSTRINGYesNo
proxy.portProxy server portnullSTRINGYesNo
proxy.usernameProxy server usernamenullSTRINGYesNo
proxy.passwordProxy server passwordnullSTRINGYesNo
client.bootstrap.configurationClient bootsrap configurations. Expected format of these parameters is as follows: "'client.bootstrap.nodelay:xxx','client.bootstrap.keepalive:xxx'"TODOSTRINGYesNo
client.bootstrap.nodelayHttp client no delay.trueBOOLYesNo
client.bootstrap.keepaliveHttp client keep alive.trueBOOLYesNo
client.bootstrap.sendbuffersizeHttp client send buffer size.1048576INTYesNo
client.bootstrap.recievebuffersizeHttp client receive buffer size.1048576INTYesNo
client.bootstrap.connect.timeoutHttp client connection timeout.15000INTYesNo
client.bootstrap.socket.reuseTo enable http socket reuse.falseBOOLYesNo
client.bootstrap.socket.timeoutHttp client socket timeout.15STRINGYesNo
client.threadpool.configurationsThread pool configuration. Expected format of these parameters is as follows: "'client.connection.pool.count:xxx','client.max.active.connections.per.pool:xxx'"TODOSTRINGYesNo
client.connection.pool.countConnection pool count.0INTYesNo
client.max.active.connections.per.poolActive connections per pool.-1INTYesNo
client.min.idle.connections.per.poolMinimum ideal connection per pool.0INTYesNo
client.max.idle.connections.per.poolMaximum ideal connection per pool.100INTYesNo
client.min.eviction.idle.timeMinimum eviction idle time.5 * 60 * 1000STRINGYesNo
sender.thread.countHttp sender thread count.20STRINGYesNo
event.group.executor.thread.sizeEvent group executor thread size.15STRINGYesNo
max.wait.for.client.connection.poolMaximum wait for client connection pool.60000STRINGYesNo
- -System Parameters - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Parameters
clientBootstrapBossGroupSizeproperty to configure number of boss threads, which accepts incoming connections until the ports are unbound. Once connection accepts successfully, boss thread passes the accepted channel to one of the worker threads.Number of available processorsAny integer
clientBootstrapWorkerGroupSizeproperty to configure number of worker threads, which performs non blocking read and write for one or more channels in non-blocking mode.(Number of available processors)*2Any integer
clientBootstrapClientGroupSizeproperty to configure number of client threads, which performs non blocking read and write for one or more channels in non-blocking mode.(Number of available processors)*2Any integer
trustStoreLocationThe default truststore file path.${carbon.home}/resources/security/client-truststore.jksPath to client-truststore.jks
trustStorePasswordThe default truststore password.wso2carbonTruststore password
- -Examples -EXAMPLE 1 -``` -@sink(type='http',publisher.url='http://localhost:8009/foo', method='{{method}}',headers="'content-type:xml','content-length:94'", client.bootstrap.configuration="'client.bootstrap.socket.timeout:20', 'client.bootstrap.worker.group.size:10'", client.pool.configuration="'client.connection.pool.count:10','client.max.active.connections.per.pool:1'", @map(type='xml', @payload('{{payloadBody}}'))) -define stream FooStream (payloadBody String, method string, headers string); - -``` -

If it is xml mapping expected input should be in following format for FooStream:
{
<events>
    <event>
        <symbol>WSO2</symbol>
        <price>55.6</price>
        <volume>100</volume>
    </event>
</events>,
POST,
Content-Length:24#Content-Location:USA#Retry-After:120
}

Above event will generate output as below.
~Output http event payload
<events>
    <event>
        <symbol>WSO2</symbol>
        <price>55.6</price>
        <volume>100</volume>
    </event>
</events>

~Output http event headers
Content-Length:24,
Content-Location:'USA',
Retry-After:120,
Content-Type:'application/xml',
HTTP_METHOD:'POST',

~Output http event properties
HTTP_METHOD:'POST',
HOST:'localhost',
PORT:8009,
PROTOCOL:'http',
TO:'/foo'

- -### http-response *(Sink)* - -

HTTP response sink is correlated with the The HTTP request source, through a unique source.id, and it send a response to the HTTP request source having the same source.id. The response message can be formatted in text, XML or JSON and can be sent with appropriate headers.

- -Syntax -``` -@sink(type="http-response", source.id="", message.id="", headers="", @map(...))) -``` - -QUERY PARAMETERS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
source.idIdentifier of the source.STRINGNoNo
message.idIdentifier of the message.STRINGNoYes
headersThe headers that should be included as HTTP response headers. There can be any number of headers concatenated on following format. "'header1:value1','header2:value2'" User can include content-type header if he/she need to have any specific type for payload. If not system get the mapping type as the content-Type header (ie.@map(xml):application/xml, @map(json):application/json, @map(text):plain/text) and if user does not include any mapping type then system gets the plain/text as default Content-Type header. If user does not include Content-Length header then system calculate the bytes size of payload and include it as content-length header. STRINGYesNo
- -Examples -EXAMPLE 1 -``` -@sink(type='http-response', source.id='sampleSourceId', message.id='{{messageId}}', headers="'content-type:json','content-length:94'"@map(type='json', @payload('{{payloadBody}}'))) -define stream FooStream (payloadBody String, messageId string, headers string); - -``` -

If it is json mapping expected input should be in following format for FooStream:
{
{"events":
    {"event":
        "symbol":WSO2,
        "price":55.6,
        "volume":100,
    }
},
0cf708b1-7eae-440b-a93e-e72f801b486a,
Content-Length:24#Content-Location:USA
}

Above event will generate response for the matching source message as below.

~Output http event payload
{"events":
    {"event":
        "symbol":WSO2,
        "price":55.6,
        "volume":100,
    }
}

~Output http event headers
Content-Length:24,
Content-Location:'USA',
Content-Type:'application/json'

- -## Source - -### http *(Source)* - -

The HTTP source receives POST requests via HTTP or HTTPS in format such as text, XML and JSON. If required, you can enable basic authentication to ensure that events are received only from users who are authorized to access the service.

- -Syntax -``` -@source(type="http", receiver.url="", basic.auth.enabled="", worker.count="", socket.idle.timeout="", ssl.verify.client="", ssl.protocol="", tls.store.type="", parameters="", ciphers="", ssl.enabled.protocols="", server.enable.session.creation="", server.supported.snimatchers="", server.suported.server.names="", request.size.validation.configuration="", request.size.validation="", request.size.validation.maximum.value="", request.size.validation.reject.status.code="", request.size.validation.reject.message="", request.size.validation.reject.message.content.type="", header.size.validation="", header.validation.maximum.request.line="", header.validation.maximum.size="", header.validation.maximum.chunk.size="", header.validation.reject.status.code="", header.validation.reject.message="", header.validation.reject.message.content.type="", server.bootstrap.configuration="", server.bootstrap.nodelay="", server.bootstrap.keepalive="", server.bootstrap.sendbuffersize="", server.bootstrap.recievebuffersize="", server.bootstrap.connect.timeout="", server.bootstrap.socket.reuse="", server.bootstrap.socket.timeout="", server.bootstrap.socket.backlog="", trace.log.enabled="", @map(...))) -``` - -QUERY PARAMETERS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
receiver.urlThe URL to which the events should be received. User can provide any valid url and if the url is not provided the system will use the following format http://0.0.0.0:9763/<appNAme>/<streamName>If the user want to use SSL the url should be given in following format https://localhost:8080/<streamName>http://0.0.0.0:9763//STRINGYesNo
basic.auth.enabledIf this is set to true, basic authentication is enabled for incoming events, and the credentials with which each event is sent are verified to ensure that the user is authorized to access the service. If basic authentication fails, the event is not authenticated and an authentication error is logged in the CLI. By default this values 'false' falseSTRINGYesNo
worker.countThe number of active worker threads to serve the incoming events. The value is 1 by default. This will ensure that the events are directed to the event stream in the same order in which they arrive. By increasing this value the performance might increase at the cost of loosing event ordering.1STRINGYesNo
socket.idle.timeoutIdle timeout for HTTP connection.120000INTYesNo
ssl.verify.clientThe type of client certificate verification.nullSTRINGYesNo
ssl.protocolssl/tls related optionsTLSSTRINGYesNo
tls.store.typeTLS store type.JKSSTRINGYesNo
parametersParameters other than basics such as ciphers,sslEnabledProtocols,client.enable.session.creation. Expected format of these parameters is as follows: "'ciphers:xxx','sslEnabledProtocols,client.enable:xxx'"nullSTRINGYesNo
ciphersList of ciphers to be used. This parameter should include under parameters Ex: 'ciphers:TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256'nullSTRINGYesNo
ssl.enabled.protocolsSSL/TLS protocols to be enabled. This parameter should be in camel case format(sslEnabledProtocols) under parameters. Ex 'sslEnabledProtocols:true'nullSTRINGYesNo
server.enable.session.creationEnable HTTP session creation.This parameter should include under parameters Ex: 'client.enable.session.creation:true'nullSTRINGYesNo
server.supported.snimatchersHttp SNIMatcher to be added. This parameter should include under parameters Ex: 'server.supported.snimatchers:SNIMatcher'nullSTRINGYesNo
server.suported.server.namesHttp supported servers. This parameter should include under parameters Ex: 'server.suported.server.names:server'nullSTRINGYesNo
request.size.validation.configurationParameters that responsible for validating the http request and request headers. Expected format of these parameters is as follows: "'request.size.validation:xxx','request.size.validation.maximum.value:xxx'"nullSTRINGYesNo
request.size.validationTo enable the request size validation.falseSTRINGYesNo
request.size.validation.maximum.valueIf request size is validated then maximum size.Integer.MAX_VALUESTRINGYesNo
request.size.validation.reject.status.codeIf request is exceed maximum size and request.size.validation is enabled then status code to be send as response.401STRINGYesNo
request.size.validation.reject.messageIf request is exceed maximum size and request.size.validation is enabled then status message to be send as response.Message is bigger than the valid sizeSTRINGYesNo
request.size.validation.reject.message.content.typeIf request is exceed maximum size and request.size.validation is enabled then content type to be send as response.plain/textSTRINGYesNo
header.size.validationTo enable the header size validation.falseSTRINGYesNo
header.validation.maximum.request.lineIf header header validation is enabled then the maximum request line.4096STRINGYesNo
header.validation.maximum.sizeIf header header validation is enabled then the maximum expected header size.8192STRINGYesNo
header.validation.maximum.chunk.sizeIf header header validation is enabled then the maximum expected chunk size.8192STRINGYesNo
header.validation.reject.status.code401If header is exceed maximum size and header.size.validation is enabled then status code to be send as response.STRINGYesNo
header.validation.reject.messageIf header is exceed maximum size and header.size.validation is enabled then message to be send as response.Message header is bigger than the valid sizeSTRINGYesNo
header.validation.reject.message.content.typeIf header is exceed maximum size and header.size.validation is enabled then content type to be send as response.plain/textSTRINGYesNo
server.bootstrap.configurationParameters that for bootstrap configurations of the server. Expected format of these parameters is as follows: "'ciphers:xxx','sslEnabledProtocols,client.enable:xxx'"nullOBJECTYesNo
server.bootstrap.nodelayHttp server no delay.trueBOOLYesNo
server.bootstrap.keepaliveHttp server keep alive.trueBOOLYesNo
server.bootstrap.sendbuffersizeHttp server send buffer size.1048576INTYesNo
server.bootstrap.recievebuffersizeHttp server receive buffer size.1048576INTYesNo
server.bootstrap.connect.timeoutHttp server connection timeout.15000INTYesNo
server.bootstrap.socket.reuseTo enable http socket reuse.falseBOOLYesNo
server.bootstrap.socket.timeoutHttp server socket timeout.15BOOLYesNo
server.bootstrap.socket.backlogTHttp server socket backlog.100BOOLYesNo
trace.log.enabledHttp traffic monitoring.falseBOOLYesNo
- -System Parameters - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Parameters
serverBootstrapBossGroupSizeproperty to configure number of boss threads, which accepts incoming connections until the ports are unbound. Once connection accepts successfully, boss thread passes the accepted channel to one of the worker threads.Number of available processorsAny integer
serverBootstrapWorkerGroupSizeproperty to configure number of worker threads, which performs non blocking read and write for one or more channels in non-blocking mode.(Number of available processors)*2Any integer
serverBootstrapClientGroupSizeproperty to configure number of client threads, which performs non blocking read and write for one or more channels in non-blocking mode.(Number of available processors)*2Any integer
defaultHostThe default host of the transport.0.0.0.0Any valid host
defaultHttpPortThe default port if the default scheme is 'http'.8280Any valid port
defaultHttpsPortThe default port if the default scheme is 'https'.8243Any valid port
defaultSchemeThe default protocol.httphttp
https
keyStoreLocationThe default keystore file path.${carbon.home}/resources/security/wso2carbon.jksPath to wso2carbon.jks file
keyStorePasswordThe default keystore password.wso2carbonString of keystore password
certPasswordThe default cert password.wso2carbonString of cert password
- -Examples -EXAMPLE 1 -``` -@source(type='http', receiver.url='http://localhost:9055/endpoints/RecPro', socketIdleTimeout='150000', parameters="'ciphers : TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256', 'sslEnabledProtocols:TLSv1.1,TLSv1.2'",request.size.validation.configuration="request.size.validation:true",server.bootstrap.configuration="server.bootstrap.socket.timeout:25" @map(type='xml')) -define stream FooStream (symbol string, price float, volume long); - -``` -

Above source listenerConfiguration performs a default XML input mapping. The expected input is as follows:
<events>
    <event>
        <symbol>WSO2</symbol>
        <price>55.6</price>
        <volume>100</volume>
    </event>
</events>
If basic authentication is enabled via the basic.auth.enabled='true setting, each input event is also expected to contain the Authorization:'Basic encodeBase64(username:Password)' header.

- -### http-request *(Source)* - -

The HTTP request is correlated with the HTTP response sink, through a unique source.id, and for each POST requests it receives via HTTP or HTTPS in format such as text, XML and JSON it sends the response via the HTTP response sink. The individual request and response messages are correlated at the sink using the message.id of the events. If required, you can enable basic authentication at the source to ensure that events are received only from users who are authorized to access the service.

- -Syntax -``` -@source(type="http-request", receiver.url="", source.id="", connection.timeout="", basic.auth.enabled="", worker.count="", socket.idle.timeout="", ssl.verify.client="", ssl.protocol="", tls.store.type="", parameters="", ciphers="", ssl.enabled.protocols="", server.enable.session.creation="", server.supported.snimatchers="", server.suported.server.names="", request.size.validation.configuration="", request.size.validation="", request.size.validation.maximum.value="", request.size.validation.reject.status.code="", request.size.validation.reject.message="", request.size.validation.reject.message.content.type="", header.size.validation="", header.validation.maximum.request.line="", header.validation.maximum.size="", header.validation.maximum.chunk.size="", header.validation.reject.status.code="", header.validation.reject.message="", header.validation.reject.message.content.type="", server.bootstrap.configuration="", server.bootstrap.nodelay="", server.bootstrap.keepalive="", server.bootstrap.sendbuffersize="", server.bootstrap.recievebuffersize="", server.bootstrap.connect.timeout="", server.bootstrap.socket.reuse="", server.bootstrap.socket.timeout="", server.bootstrap.socket.backlog="", trace.log.enabled="", @map(...))) -``` - -QUERY PARAMETERS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
receiver.urlThe URL to which the events should be received. User can provide any valid url and if the url is not provided the system will use the following format http://0.0.0.0:9763/<appNAme>/<streamName>If the user want to use SSL the url should be given in following format https://localhost:8080/<streamName>http://0.0.0.0:9763//STRINGYesNo
source.idIdentifier need to map the source to sink.STRINGNoNo
connection.timeoutConnection timeout in milliseconds. If the mapped http-response sink does not get a correlated message, after this timeout value, a timeout response is sent120000INTYesNo
basic.auth.enabledIf this is set to true, basic authentication is enabled for incoming events, and the credentials with which each event is sent are verified to ensure that the user is authorized to access the service. If basic authentication fails, the event is not authenticated and an authentication error is logged in the CLI. By default this values 'false' falseSTRINGYesNo
worker.countThe number of active worker threads to serve the incoming events. The value is 1 by default. This will ensure that the events are directed to the event stream in the same order in which they arrive. By increasing this value the performance might increase at the cost of loosing event ordering.1STRINGYesNo
socket.idle.timeoutIdle timeout for HTTP connection.120000INTYesNo
ssl.verify.clientThe type of client certificate verification.nullSTRINGYesNo
ssl.protocolssl/tls related optionsTLSSTRINGYesNo
tls.store.typeTLS store type.JKSSTRINGYesNo
parametersParameters other than basics such as ciphers,sslEnabledProtocols,client.enable.session.creation. Expected format of these parameters is as follows: "'ciphers:xxx','sslEnabledProtocols,client.enable:xxx'"nullSTRINGYesNo
ciphersList of ciphers to be used. This parameter should include under parameters Ex: 'ciphers:TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256'nullSTRINGYesNo
ssl.enabled.protocolsSSL/TLS protocols to be enabled. This parameter should be in camel case format(sslEnabledProtocols) under parameters. Ex 'sslEnabledProtocols:true'nullSTRINGYesNo
server.enable.session.creationEnable HTTP session creation.This parameter should include under parameters Ex: 'client.enable.session.creation:true'nullSTRINGYesNo
server.supported.snimatchersHttp SNIMatcher to be added. This parameter should include under parameters Ex: 'server.supported.snimatchers:SNIMatcher'nullSTRINGYesNo
server.suported.server.namesHttp supported servers. This parameter should include under parameters Ex: 'server.suported.server.names:server'nullSTRINGYesNo
request.size.validation.configurationParameters that responsible for validating the http request and request headers. Expected format of these parameters is as follows: "'request.size.validation:xxx','request.size.validation.maximum.value:xxx'"nullSTRINGYesNo
request.size.validationTo enable the request size validation.falseSTRINGYesNo
request.size.validation.maximum.valueIf request size is validated then maximum size.Integer.MAX_VALUESTRINGYesNo
request.size.validation.reject.status.codeIf request is exceed maximum size and request.size.validation is enabled then status code to be send as response.401STRINGYesNo
request.size.validation.reject.messageIf request is exceed maximum size and request.size.validation is enabled then status message to be send as response.Message is bigger than the valid sizeSTRINGYesNo
request.size.validation.reject.message.content.typeIf request is exceed maximum size and request.size.validation is enabled then content type to be send as response.plain/textSTRINGYesNo
header.size.validationTo enable the header size validation.falseSTRINGYesNo
header.validation.maximum.request.lineIf header header validation is enabled then the maximum request line.4096STRINGYesNo
header.validation.maximum.sizeIf header header validation is enabled then the maximum expected header size.8192STRINGYesNo
header.validation.maximum.chunk.sizeIf header header validation is enabled then the maximum expected chunk size.8192STRINGYesNo
header.validation.reject.status.code401If header is exceed maximum size and header.size.validation is enabled then status code to be send as response.STRINGYesNo
header.validation.reject.messageIf header is exceed maximum size and header.size.validation is enabled then message to be send as response.Message header is bigger than the valid sizeSTRINGYesNo
header.validation.reject.message.content.typeIf header is exceed maximum size and header.size.validation is enabled then content type to be send as response.plain/textSTRINGYesNo
server.bootstrap.configurationParameters that for bootstrap configurations of the server. Expected format of these parameters is as follows: "'ciphers:xxx','sslEnabledProtocols,client.enable:xxx'"nullOBJECTYesNo
server.bootstrap.nodelayHttp server no delay.trueBOOLYesNo
server.bootstrap.keepaliveHttp server keep alive.trueBOOLYesNo
server.bootstrap.sendbuffersizeHttp server send buffer size.1048576INTYesNo
server.bootstrap.recievebuffersizeHttp server receive buffer size.1048576INTYesNo
server.bootstrap.connect.timeoutHttp server connection timeout.15000INTYesNo
server.bootstrap.socket.reuseTo enable http socket reuse.falseBOOLYesNo
server.bootstrap.socket.timeoutHttp server socket timeout.15BOOLYesNo
server.bootstrap.socket.backlogTHttp server socket backlog.100BOOLYesNo
trace.log.enabledHttp traffic monitoring.falseBOOLYesNo
- -System Parameters - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Parameters
serverBootstrapBossGroupSizeproperty to configure number of boss threads, which accepts incoming connections until the ports are unbound. Once connection accepts successfully, boss thread passes the accepted channel to one of the worker threads.Number of available processorsAny integer
serverBootstrapWorkerGroupSizeproperty to configure number of worker threads, which performs non blocking read and write for one or more channels in non-blocking mode.(Number of available processors)*2Any integer
serverBootstrapClientGroupSizeproperty to configure number of client threads, which performs non blocking read and write for one or more channels in non-blocking mode.(Number of available processors)*2Any integer
defaultHostThe default host of the transport.0.0.0.0Any valid host
defaultHttpPortThe default port if the default scheme is 'http'.8280Any valid port
defaultHttpsPortThe default port if the default scheme is 'https'.8243Any valid port
defaultSchemeThe default protocol.httphttp
https
keyStoreLocationThe default keystore file path.${carbon.home}/resources/security/wso2carbon.jksPath to wso2carbon.jks file
keyStorePasswordThe default keystore password.wso2carbonString of keystore password
certPasswordThe default cert password.wso2carbonString of cert password
- -Examples -EXAMPLE 1 -``` -@source(type='http-request', source.id='sampleSourceId, receiver.url='http://localhost:9055/endpoints/RecPro', connection.timeout='150000', parameters="'ciphers : TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256', 'sslEnabledProtocols:TLSv1.1,TLSv1.2'", request.size.validation.configuration="request.size.validation:true", server.bootstrap.configuration="server.bootstrap.socket.timeout:25", @map(type='json, @attributes(messageId='trp:messageId', symbol='$.events.event.symbol', price='$.events.event.price', volume='$.events.event.volume'))) -define stream FooStream (messageId string, symbol string, price float, volume long); - -``` -

The expected input is as follows:
{"events":
    {"event":
        "symbol":WSO2,
        "price":55.6,
        "volume":100,
    }
}
If basic authentication is enabled via the basic.auth.enabled='true setting, each input event is also expected to contain the Authorization:'Basic encodeBase64(username:Password)' header.

- diff --git a/docs/api/1.0.26.md b/docs/api/1.0.26.md deleted file mode 100644 index eddd992b..00000000 --- a/docs/api/1.0.26.md +++ /dev/null @@ -1,1226 +0,0 @@ -# API Docs - v1.0.26 - -## Sink - -### http *(Sink)* - -

This extension publish the HTTP events in any HTTP method POST, GET, PUT, DELETE via HTTP or https protocols. As the additional features this component can provide basic authentication as well as user can publish events using custom client truststore files when publishing events via https protocol. And also user can add any number of headers including HTTP_METHOD header for each event dynamically.
Following content types will be set by default according to the type of sink mapper used.
You can override them by setting the new content types in headers.
     - TEXT : text/plain
     - XML : application/xml
     - JSON : application/json
     - KEYVALUE : application/x-www-form-urlencoded

- -Syntax -``` -@sink(type="http", publisher.url="", basic.auth.username="", basic.auth.password="", https.truststore.file="", https.truststore.password="", headers="", method="", socket.idle.timeout="", chunk.disabled="", ssl.protocol="", parameters="", ciphers="", ssl.enabled.protocols="", client.enable.session.creation="", follow.redirect="", max.redirect.count="", tls.store.type="", proxy.host="", proxy.port="", proxy.username="", proxy.password="", client.bootstrap.configuration="", client.bootstrap.nodelay="", client.bootstrap.keepalive="", client.bootstrap.sendbuffersize="", client.bootstrap.recievebuffersize="", client.bootstrap.connect.timeout="", client.bootstrap.socket.reuse="", client.bootstrap.socket.timeout="", client.threadpool.configurations="", client.connection.pool.count="", client.max.active.connections.per.pool="", client.min.idle.connections.per.pool="", client.max.idle.connections.per.pool="", client.min.eviction.idle.time="", sender.thread.count="", event.group.executor.thread.size="", max.wait.for.client.connection.pool="", @map(...))) -``` - -QUERY PARAMETERS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
publisher.urlThe URL to which the outgoing events should be published via HTTP. This is a mandatory parameter and if this is not specified, an error is logged in the CLI. If user wants to enable SSL for the events, use https instead of http in the publisher.url.e.g., http://localhost:8080/endpoint, https://localhost:8080/endpointSTRINGNoNo
basic.auth.usernameThe username to be included in the authentication header of the basic authentication enabled events. It is required to specify both username and password to enable basic authentication. If one of the parameter is not given by user then an error is logged in the CLI. STRINGYesNo
basic.auth.passwordThe password to include in the authentication header of the basic authentication enabled events. It is required to specify both username and password to enable basic authentication. If one of the parameter is not given by user then an error is logged in the CLI. STRINGYesNo
https.truststore.fileThe file path to the location of the truststore of the client that sends the HTTP events through 'https' protocol. A custom client-truststore can be specified if required.${carbon.home}/resources/security/client-truststore.jksSTRINGYesNo
https.truststore.passwordThe password for the client-truststore. A custom password can be specified if required. If no custom password is specified and the protocol of URL is 'https' then, the system uses default password.wso2carbonSTRINGYesNo
headersThe headers that should be included as a HTTP request headers. There can be any number of headers concatenated on following format. "'header1:value1','header2:value2'". User can include content-type header if he need to any specific type for payload if not system get the mapping type as the content-Type header (ie. @map(xml):application/xml,@map(json):application/json,@map(text):plain/text ) and if user does not include any mapping type then system gets the 'plain/text' as default Content-Type header. If user does not include Content-Length header then system calculate the bytes size of payload and include it as content-length header. STRINGYesNo
methodFor HTTP events, HTTP_METHOD header should be included as a request header. If the parameter is null then system uses 'POST' as a default header.POSTSTRINGYesNo
socket.idle.timeoutSocket timeout value in millisecond6000INTYesNo
chunk.disabledport: Port number of the remote servicefalseBOOLYesNo
ssl.protocolThe SSL protocol versionTLSSTRINGYesNo
parametersParameters other than basics such as ciphers,sslEnabledProtocols,client.enable.session.creation. Expected format of these parameters is as follows: "'ciphers:xxx','sslEnabledProtocols,client.enable:xxx'"nullSTRINGYesNo
ciphersList of ciphers to be used. This parameter should include under parameters Ex: 'ciphers:TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256'nullSTRINGYesNo
ssl.enabled.protocolsSSL/TLS protocols to be enabled. This parameter should be in camel case format(sslEnabledProtocols) under parameters. Ex 'sslEnabledProtocols:true'nullSTRINGYesNo
client.enable.session.creationEnable HTTP session creation.This parameter should include under parameters Ex: 'client.enable.session.creation:true'nullSTRINGYesNo
follow.redirectRedirect related enabled.trueBOOLYesNo
max.redirect.countMaximum redirect count.5INTYesNo
tls.store.typeTLS store type to be used.JKSSTRINGYesNo
proxy.hostProxy server hostnullSTRINGYesNo
proxy.portProxy server portnullSTRINGYesNo
proxy.usernameProxy server usernamenullSTRINGYesNo
proxy.passwordProxy server passwordnullSTRINGYesNo
client.bootstrap.configurationClient bootsrap configurations. Expected format of these parameters is as follows: "'client.bootstrap.nodelay:xxx','client.bootstrap.keepalive:xxx'"TODOSTRINGYesNo
client.bootstrap.nodelayHttp client no delay.trueBOOLYesNo
client.bootstrap.keepaliveHttp client keep alive.trueBOOLYesNo
client.bootstrap.sendbuffersizeHttp client send buffer size.1048576INTYesNo
client.bootstrap.recievebuffersizeHttp client receive buffer size.1048576INTYesNo
client.bootstrap.connect.timeoutHttp client connection timeout.15000INTYesNo
client.bootstrap.socket.reuseTo enable http socket reuse.falseBOOLYesNo
client.bootstrap.socket.timeoutHttp client socket timeout.15STRINGYesNo
client.threadpool.configurationsThread pool configuration. Expected format of these parameters is as follows: "'client.connection.pool.count:xxx','client.max.active.connections.per.pool:xxx'"TODOSTRINGYesNo
client.connection.pool.countConnection pool count.0INTYesNo
client.max.active.connections.per.poolActive connections per pool.-1INTYesNo
client.min.idle.connections.per.poolMinimum ideal connection per pool.0INTYesNo
client.max.idle.connections.per.poolMaximum ideal connection per pool.100INTYesNo
client.min.eviction.idle.timeMinimum eviction idle time.5 * 60 * 1000STRINGYesNo
sender.thread.countHttp sender thread count.20STRINGYesNo
event.group.executor.thread.sizeEvent group executor thread size.15STRINGYesNo
max.wait.for.client.connection.poolMaximum wait for client connection pool.60000STRINGYesNo
- -System Parameters - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Parameters
clientBootstrapBossGroupSizeproperty to configure number of boss threads, which accepts incoming connections until the ports are unbound. Once connection accepts successfully, boss thread passes the accepted channel to one of the worker threads.Number of available processorsAny integer
clientBootstrapWorkerGroupSizeproperty to configure number of worker threads, which performs non blocking read and write for one or more channels in non-blocking mode.(Number of available processors)*2Any integer
clientBootstrapClientGroupSizeproperty to configure number of client threads, which performs non blocking read and write for one or more channels in non-blocking mode.(Number of available processors)*2Any integer
trustStoreLocationThe default truststore file path.${carbon.home}/resources/security/client-truststore.jksPath to client-truststore.jks
trustStorePasswordThe default truststore password.wso2carbonTruststore password
- -Examples -EXAMPLE 1 -``` -@sink(type='http',publisher.url='http://localhost:8009/foo', method='{{method}}',headers="'content-type:xml','content-length:94'", client.bootstrap.configuration="'client.bootstrap.socket.timeout:20', 'client.bootstrap.worker.group.size:10'", client.pool.configuration="'client.connection.pool.count:10','client.max.active.connections.per.pool:1'", @map(type='xml', @payload('{{payloadBody}}'))) -define stream FooStream (payloadBody String, method string, headers string); - -``` -

If it is xml mapping expected input should be in following format for FooStream:
{
<events>
    <event>
        <symbol>WSO2</symbol>
        <price>55.6</price>
        <volume>100</volume>
    </event>
</events>,
POST,
Content-Length:24#Content-Location:USA#Retry-After:120
}

Above event will generate output as below.
~Output http event payload
<events>
    <event>
        <symbol>WSO2</symbol>
        <price>55.6</price>
        <volume>100</volume>
    </event>
</events>

~Output http event headers
Content-Length:24,
Content-Location:'USA',
Retry-After:120,
Content-Type:'application/xml',
HTTP_METHOD:'POST',

~Output http event properties
HTTP_METHOD:'POST',
HOST:'localhost',
PORT:8009,
PROTOCOL:'http',
TO:'/foo'

- -### http-response *(Sink)* - -

HTTP response sink is correlated with the The HTTP request source, through a unique source.id, and it send a response to the HTTP request source having the same source.id. The response message can be formatted in text, XML or JSON and can be sent with appropriate headers.

- -Syntax -``` -@sink(type="http-response", source.id="", message.id="", headers="", @map(...))) -``` - -QUERY PARAMETERS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
source.idIdentifier of the source.STRINGNoNo
message.idIdentifier of the message.STRINGNoYes
headersThe headers that should be included as HTTP response headers. There can be any number of headers concatenated on following format. "'header1:value1','header2:value2'" User can include content-type header if he/she need to have any specific type for payload. If not system get the mapping type as the content-Type header (ie.@map(xml):application/xml, @map(json):application/json, @map(text):plain/text) and if user does not include any mapping type then system gets the plain/text as default Content-Type header. If user does not include Content-Length header then system calculate the bytes size of payload and include it as content-length header. STRINGYesNo
- -Examples -EXAMPLE 1 -``` -@sink(type='http-response', source.id='sampleSourceId', message.id='{{messageId}}', headers="'content-type:json','content-length:94'"@map(type='json', @payload('{{payloadBody}}'))) -define stream FooStream (payloadBody String, messageId string, headers string); - -``` -

If it is json mapping expected input should be in following format for FooStream:
{
{"events":
    {"event":
        "symbol":WSO2,
        "price":55.6,
        "volume":100,
    }
},
0cf708b1-7eae-440b-a93e-e72f801b486a,
Content-Length:24#Content-Location:USA
}

Above event will generate response for the matching source message as below.

~Output http event payload
{"events":
    {"event":
        "symbol":WSO2,
        "price":55.6,
        "volume":100,
    }
}

~Output http event headers
Content-Length:24,
Content-Location:'USA',
Content-Type:'application/json'

- -## Source - -### http *(Source)* - -

The HTTP source receives POST requests via HTTP or HTTPS in format such as text, XML and JSON. If required, you can enable basic authentication to ensure that events are received only from users who are authorized to access the service.

- -Syntax -``` -@source(type="http", receiver.url="", basic.auth.enabled="", worker.count="", socket.idle.timeout="", ssl.verify.client="", ssl.protocol="", tls.store.type="", parameters="", ciphers="", ssl.enabled.protocols="", server.enable.session.creation="", server.supported.snimatchers="", server.suported.server.names="", request.size.validation.configuration="", request.size.validation="", request.size.validation.maximum.value="", request.size.validation.reject.status.code="", request.size.validation.reject.message="", request.size.validation.reject.message.content.type="", header.size.validation="", header.validation.maximum.request.line="", header.validation.maximum.size="", header.validation.maximum.chunk.size="", header.validation.reject.status.code="", header.validation.reject.message="", header.validation.reject.message.content.type="", server.bootstrap.configuration="", server.bootstrap.nodelay="", server.bootstrap.keepalive="", server.bootstrap.sendbuffersize="", server.bootstrap.recievebuffersize="", server.bootstrap.connect.timeout="", server.bootstrap.socket.reuse="", server.bootstrap.socket.timeout="", server.bootstrap.socket.backlog="", trace.log.enabled="", @map(...))) -``` - -QUERY PARAMETERS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
receiver.urlThe URL to which the events should be received. User can provide any valid url and if the url is not provided the system will use the following format http://0.0.0.0:9763/<appNAme>/<streamName>If the user want to use SSL the url should be given in following format https://localhost:8080/<streamName>http://0.0.0.0:9763//STRINGYesNo
basic.auth.enabledIf this is set to true, basic authentication is enabled for incoming events, and the credentials with which each event is sent are verified to ensure that the user is authorized to access the service. If basic authentication fails, the event is not authenticated and an authentication error is logged in the CLI. By default this values 'false' falseSTRINGYesNo
worker.countThe number of active worker threads to serve the incoming events. The value is 1 by default. This will ensure that the events are directed to the event stream in the same order in which they arrive. By increasing this value the performance might increase at the cost of loosing event ordering.1STRINGYesNo
socket.idle.timeoutIdle timeout for HTTP connection.120000INTYesNo
ssl.verify.clientThe type of client certificate verification.nullSTRINGYesNo
ssl.protocolssl/tls related optionsTLSSTRINGYesNo
tls.store.typeTLS store type.JKSSTRINGYesNo
parametersParameters other than basics such as ciphers,sslEnabledProtocols,client.enable.session.creation. Expected format of these parameters is as follows: "'ciphers:xxx','sslEnabledProtocols,client.enable:xxx'"nullSTRINGYesNo
ciphersList of ciphers to be used. This parameter should include under parameters Ex: 'ciphers:TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256'nullSTRINGYesNo
ssl.enabled.protocolsSSL/TLS protocols to be enabled. This parameter should be in camel case format(sslEnabledProtocols) under parameters. Ex 'sslEnabledProtocols:true'nullSTRINGYesNo
server.enable.session.creationEnable HTTP session creation.This parameter should include under parameters Ex: 'client.enable.session.creation:true'nullSTRINGYesNo
server.supported.snimatchersHttp SNIMatcher to be added. This parameter should include under parameters Ex: 'server.supported.snimatchers:SNIMatcher'nullSTRINGYesNo
server.suported.server.namesHttp supported servers. This parameter should include under parameters Ex: 'server.suported.server.names:server'nullSTRINGYesNo
request.size.validation.configurationParameters that responsible for validating the http request and request headers. Expected format of these parameters is as follows: "'request.size.validation:xxx','request.size.validation.maximum.value:xxx'"nullSTRINGYesNo
request.size.validationTo enable the request size validation.falseSTRINGYesNo
request.size.validation.maximum.valueIf request size is validated then maximum size.Integer.MAX_VALUESTRINGYesNo
request.size.validation.reject.status.codeIf request is exceed maximum size and request.size.validation is enabled then status code to be send as response.401STRINGYesNo
request.size.validation.reject.messageIf request is exceed maximum size and request.size.validation is enabled then status message to be send as response.Message is bigger than the valid sizeSTRINGYesNo
request.size.validation.reject.message.content.typeIf request is exceed maximum size and request.size.validation is enabled then content type to be send as response.plain/textSTRINGYesNo
header.size.validationTo enable the header size validation.falseSTRINGYesNo
header.validation.maximum.request.lineIf header header validation is enabled then the maximum request line.4096STRINGYesNo
header.validation.maximum.sizeIf header header validation is enabled then the maximum expected header size.8192STRINGYesNo
header.validation.maximum.chunk.sizeIf header header validation is enabled then the maximum expected chunk size.8192STRINGYesNo
header.validation.reject.status.code401If header is exceed maximum size and header.size.validation is enabled then status code to be send as response.STRINGYesNo
header.validation.reject.messageIf header is exceed maximum size and header.size.validation is enabled then message to be send as response.Message header is bigger than the valid sizeSTRINGYesNo
header.validation.reject.message.content.typeIf header is exceed maximum size and header.size.validation is enabled then content type to be send as response.plain/textSTRINGYesNo
server.bootstrap.configurationParameters that for bootstrap configurations of the server. Expected format of these parameters is as follows: "'ciphers:xxx','sslEnabledProtocols,client.enable:xxx'"nullOBJECTYesNo
server.bootstrap.nodelayHttp server no delay.trueBOOLYesNo
server.bootstrap.keepaliveHttp server keep alive.trueBOOLYesNo
server.bootstrap.sendbuffersizeHttp server send buffer size.1048576INTYesNo
server.bootstrap.recievebuffersizeHttp server receive buffer size.1048576INTYesNo
server.bootstrap.connect.timeoutHttp server connection timeout.15000INTYesNo
server.bootstrap.socket.reuseTo enable http socket reuse.falseBOOLYesNo
server.bootstrap.socket.timeoutHttp server socket timeout.15BOOLYesNo
server.bootstrap.socket.backlogTHttp server socket backlog.100BOOLYesNo
trace.log.enabledHttp traffic monitoring.falseBOOLYesNo
- -System Parameters - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Parameters
serverBootstrapBossGroupSizeproperty to configure number of boss threads, which accepts incoming connections until the ports are unbound. Once connection accepts successfully, boss thread passes the accepted channel to one of the worker threads.Number of available processorsAny integer
serverBootstrapWorkerGroupSizeproperty to configure number of worker threads, which performs non blocking read and write for one or more channels in non-blocking mode.(Number of available processors)*2Any integer
serverBootstrapClientGroupSizeproperty to configure number of client threads, which performs non blocking read and write for one or more channels in non-blocking mode.(Number of available processors)*2Any integer
defaultHostThe default host of the transport.0.0.0.0Any valid host
defaultHttpPortThe default port if the default scheme is 'http'.8280Any valid port
defaultHttpsPortThe default port if the default scheme is 'https'.8243Any valid port
defaultSchemeThe default protocol.httphttp
https
keyStoreLocationThe default keystore file path.${carbon.home}/resources/security/wso2carbon.jksPath to wso2carbon.jks file
keyStorePasswordThe default keystore password.wso2carbonString of keystore password
certPasswordThe default cert password.wso2carbonString of cert password
- -Examples -EXAMPLE 1 -``` -@source(type='http', receiver.url='http://localhost:9055/endpoints/RecPro', socketIdleTimeout='150000', parameters="'ciphers : TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256', 'sslEnabledProtocols:TLSv1.1,TLSv1.2'",request.size.validation.configuration="request.size.validation:true",server.bootstrap.configuration="server.bootstrap.socket.timeout:25" @map(type='xml')) -define stream FooStream (symbol string, price float, volume long); - -``` -

Above source listenerConfiguration performs a default XML input mapping. The expected input is as follows:
<events>
    <event>
        <symbol>WSO2</symbol>
        <price>55.6</price>
        <volume>100</volume>
    </event>
</events>
If basic authentication is enabled via the basic.auth.enabled='true setting, each input event is also expected to contain the Authorization:'Basic encodeBase64(username:Password)' header.

- -### http-request *(Source)* - -

The HTTP request is correlated with the HTTP response sink, through a unique source.id, and for each POST requests it receives via HTTP or HTTPS in format such as text, XML and JSON it sends the response via the HTTP response sink. The individual request and response messages are correlated at the sink using the message.id of the events. If required, you can enable basic authentication at the source to ensure that events are received only from users who are authorized to access the service.

- -Syntax -``` -@source(type="http-request", receiver.url="", source.id="", connection.timeout="", basic.auth.enabled="", worker.count="", socket.idle.timeout="", ssl.verify.client="", ssl.protocol="", tls.store.type="", parameters="", ciphers="", ssl.enabled.protocols="", server.enable.session.creation="", server.supported.snimatchers="", server.suported.server.names="", request.size.validation.configuration="", request.size.validation="", request.size.validation.maximum.value="", request.size.validation.reject.status.code="", request.size.validation.reject.message="", request.size.validation.reject.message.content.type="", header.size.validation="", header.validation.maximum.request.line="", header.validation.maximum.size="", header.validation.maximum.chunk.size="", header.validation.reject.status.code="", header.validation.reject.message="", header.validation.reject.message.content.type="", server.bootstrap.configuration="", server.bootstrap.nodelay="", server.bootstrap.keepalive="", server.bootstrap.sendbuffersize="", server.bootstrap.recievebuffersize="", server.bootstrap.connect.timeout="", server.bootstrap.socket.reuse="", server.bootstrap.socket.timeout="", server.bootstrap.socket.backlog="", trace.log.enabled="", @map(...))) -``` - -QUERY PARAMETERS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
receiver.urlThe URL to which the events should be received. User can provide any valid url and if the url is not provided the system will use the following format http://0.0.0.0:9763/<appNAme>/<streamName>If the user want to use SSL the url should be given in following format https://localhost:8080/<streamName>http://0.0.0.0:9763//STRINGYesNo
source.idIdentifier need to map the source to sink.STRINGNoNo
connection.timeoutConnection timeout in milliseconds. If the mapped http-response sink does not get a correlated message, after this timeout value, a timeout response is sent120000INTYesNo
basic.auth.enabledIf this is set to true, basic authentication is enabled for incoming events, and the credentials with which each event is sent are verified to ensure that the user is authorized to access the service. If basic authentication fails, the event is not authenticated and an authentication error is logged in the CLI. By default this values 'false' falseSTRINGYesNo
worker.countThe number of active worker threads to serve the incoming events. The value is 1 by default. This will ensure that the events are directed to the event stream in the same order in which they arrive. By increasing this value the performance might increase at the cost of loosing event ordering.1STRINGYesNo
socket.idle.timeoutIdle timeout for HTTP connection.120000INTYesNo
ssl.verify.clientThe type of client certificate verification.nullSTRINGYesNo
ssl.protocolssl/tls related optionsTLSSTRINGYesNo
tls.store.typeTLS store type.JKSSTRINGYesNo
parametersParameters other than basics such as ciphers,sslEnabledProtocols,client.enable.session.creation. Expected format of these parameters is as follows: "'ciphers:xxx','sslEnabledProtocols,client.enable:xxx'"nullSTRINGYesNo
ciphersList of ciphers to be used. This parameter should include under parameters Ex: 'ciphers:TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256'nullSTRINGYesNo
ssl.enabled.protocolsSSL/TLS protocols to be enabled. This parameter should be in camel case format(sslEnabledProtocols) under parameters. Ex 'sslEnabledProtocols:true'nullSTRINGYesNo
server.enable.session.creationEnable HTTP session creation.This parameter should include under parameters Ex: 'client.enable.session.creation:true'nullSTRINGYesNo
server.supported.snimatchersHttp SNIMatcher to be added. This parameter should include under parameters Ex: 'server.supported.snimatchers:SNIMatcher'nullSTRINGYesNo
server.suported.server.namesHttp supported servers. This parameter should include under parameters Ex: 'server.suported.server.names:server'nullSTRINGYesNo
request.size.validation.configurationParameters that responsible for validating the http request and request headers. Expected format of these parameters is as follows: "'request.size.validation:xxx','request.size.validation.maximum.value:xxx'"nullSTRINGYesNo
request.size.validationTo enable the request size validation.falseSTRINGYesNo
request.size.validation.maximum.valueIf request size is validated then maximum size.Integer.MAX_VALUESTRINGYesNo
request.size.validation.reject.status.codeIf request is exceed maximum size and request.size.validation is enabled then status code to be send as response.401STRINGYesNo
request.size.validation.reject.messageIf request is exceed maximum size and request.size.validation is enabled then status message to be send as response.Message is bigger than the valid sizeSTRINGYesNo
request.size.validation.reject.message.content.typeIf request is exceed maximum size and request.size.validation is enabled then content type to be send as response.plain/textSTRINGYesNo
header.size.validationTo enable the header size validation.falseSTRINGYesNo
header.validation.maximum.request.lineIf header header validation is enabled then the maximum request line.4096STRINGYesNo
header.validation.maximum.sizeIf header header validation is enabled then the maximum expected header size.8192STRINGYesNo
header.validation.maximum.chunk.sizeIf header header validation is enabled then the maximum expected chunk size.8192STRINGYesNo
header.validation.reject.status.code401If header is exceed maximum size and header.size.validation is enabled then status code to be send as response.STRINGYesNo
header.validation.reject.messageIf header is exceed maximum size and header.size.validation is enabled then message to be send as response.Message header is bigger than the valid sizeSTRINGYesNo
header.validation.reject.message.content.typeIf header is exceed maximum size and header.size.validation is enabled then content type to be send as response.plain/textSTRINGYesNo
server.bootstrap.configurationParameters that for bootstrap configurations of the server. Expected format of these parameters is as follows: "'ciphers:xxx','sslEnabledProtocols,client.enable:xxx'"nullOBJECTYesNo
server.bootstrap.nodelayHttp server no delay.trueBOOLYesNo
server.bootstrap.keepaliveHttp server keep alive.trueBOOLYesNo
server.bootstrap.sendbuffersizeHttp server send buffer size.1048576INTYesNo
server.bootstrap.recievebuffersizeHttp server receive buffer size.1048576INTYesNo
server.bootstrap.connect.timeoutHttp server connection timeout.15000INTYesNo
server.bootstrap.socket.reuseTo enable http socket reuse.falseBOOLYesNo
server.bootstrap.socket.timeoutHttp server socket timeout.15BOOLYesNo
server.bootstrap.socket.backlogTHttp server socket backlog.100BOOLYesNo
trace.log.enabledHttp traffic monitoring.falseBOOLYesNo
- -System Parameters - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Parameters
serverBootstrapBossGroupSizeproperty to configure number of boss threads, which accepts incoming connections until the ports are unbound. Once connection accepts successfully, boss thread passes the accepted channel to one of the worker threads.Number of available processorsAny integer
serverBootstrapWorkerGroupSizeproperty to configure number of worker threads, which performs non blocking read and write for one or more channels in non-blocking mode.(Number of available processors)*2Any integer
serverBootstrapClientGroupSizeproperty to configure number of client threads, which performs non blocking read and write for one or more channels in non-blocking mode.(Number of available processors)*2Any integer
defaultHostThe default host of the transport.0.0.0.0Any valid host
defaultHttpPortThe default port if the default scheme is 'http'.8280Any valid port
defaultHttpsPortThe default port if the default scheme is 'https'.8243Any valid port
defaultSchemeThe default protocol.httphttp
https
keyStoreLocationThe default keystore file path.${carbon.home}/resources/security/wso2carbon.jksPath to wso2carbon.jks file
keyStorePasswordThe default keystore password.wso2carbonString of keystore password
certPasswordThe default cert password.wso2carbonString of cert password
- -Examples -EXAMPLE 1 -``` -@source(type='http-request', source.id='sampleSourceId, receiver.url='http://localhost:9055/endpoints/RecPro', connection.timeout='150000', parameters="'ciphers : TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256', 'sslEnabledProtocols:TLSv1.1,TLSv1.2'", request.size.validation.configuration="request.size.validation:true", server.bootstrap.configuration="server.bootstrap.socket.timeout:25", @map(type='json, @attributes(messageId='trp:messageId', symbol='$.events.event.symbol', price='$.events.event.price', volume='$.events.event.volume'))) -define stream FooStream (messageId string, symbol string, price float, volume long); - -``` -

The expected input is as follows:
{"events":
    {"event":
        "symbol":WSO2,
        "price":55.6,
        "volume":100,
    }
}
If basic authentication is enabled via the basic.auth.enabled='true setting, each input event is also expected to contain the Authorization:'Basic encodeBase64(username:Password)' header.

- diff --git a/docs/api/1.0.27.md b/docs/api/1.0.27.md deleted file mode 100644 index 1a206761..00000000 --- a/docs/api/1.0.27.md +++ /dev/null @@ -1,1226 +0,0 @@ -# API Docs - v1.0.27 - -## Sink - -### http *(Sink)* - -

This extension publish the HTTP events in any HTTP method POST, GET, PUT, DELETE via HTTP or https protocols. As the additional features this component can provide basic authentication as well as user can publish events using custom client truststore files when publishing events via https protocol. And also user can add any number of headers including HTTP_METHOD header for each event dynamically.
Following content types will be set by default according to the type of sink mapper used.
You can override them by setting the new content types in headers.
     - TEXT : text/plain
     - XML : application/xml
     - JSON : application/json
     - KEYVALUE : application/x-www-form-urlencoded

- -Syntax -``` -@sink(type="http", publisher.url="", basic.auth.username="", basic.auth.password="", https.truststore.file="", https.truststore.password="", headers="", method="", socket.idle.timeout="", chunk.disabled="", ssl.protocol="", parameters="", ciphers="", ssl.enabled.protocols="", client.enable.session.creation="", follow.redirect="", max.redirect.count="", tls.store.type="", proxy.host="", proxy.port="", proxy.username="", proxy.password="", client.bootstrap.configuration="", client.bootstrap.nodelay="", client.bootstrap.keepalive="", client.bootstrap.sendbuffersize="", client.bootstrap.recievebuffersize="", client.bootstrap.connect.timeout="", client.bootstrap.socket.reuse="", client.bootstrap.socket.timeout="", client.threadpool.configurations="", client.connection.pool.count="", client.max.active.connections.per.pool="", client.min.idle.connections.per.pool="", client.max.idle.connections.per.pool="", client.min.eviction.idle.time="", sender.thread.count="", event.group.executor.thread.size="", max.wait.for.client.connection.pool="", @map(...))) -``` - -QUERY PARAMETERS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
publisher.urlThe URL to which the outgoing events should be published via HTTP. This is a mandatory parameter and if this is not specified, an error is logged in the CLI. If user wants to enable SSL for the events, use https instead of http in the publisher.url.e.g., http://localhost:8080/endpoint, https://localhost:8080/endpointSTRINGNoNo
basic.auth.usernameThe username to be included in the authentication header of the basic authentication enabled events. It is required to specify both username and password to enable basic authentication. If one of the parameter is not given by user then an error is logged in the CLI. STRINGYesNo
basic.auth.passwordThe password to include in the authentication header of the basic authentication enabled events. It is required to specify both username and password to enable basic authentication. If one of the parameter is not given by user then an error is logged in the CLI. STRINGYesNo
https.truststore.fileThe file path to the location of the truststore of the client that sends the HTTP events through 'https' protocol. A custom client-truststore can be specified if required.${carbon.home}/resources/security/client-truststore.jksSTRINGYesNo
https.truststore.passwordThe password for the client-truststore. A custom password can be specified if required. If no custom password is specified and the protocol of URL is 'https' then, the system uses default password.wso2carbonSTRINGYesNo
headersThe headers that should be included as HTTP request headers.
There can be any number of headers concatenated in following format. "'header1:value1','header2:value2'". User can include Content-Type header if he needs to use a specific content-type for the payload. Or else, system decides the Content-Type by considering the type of sink mapper, in following way.
 - @map(xml):application/xml
 - @map(json):application/json
 - @map(text):plain/text )
 - if user does not include any mapping type then the system gets 'plain/text' as default Content-Type header.
Note that providing content-length as a header is not supported. The size of the payload will be automatically calculated and included in the content-length header.
STRINGYesNo
methodFor HTTP events, HTTP_METHOD header should be included as a request header. If the parameter is null then system uses 'POST' as a default header.POSTSTRINGYesNo
socket.idle.timeoutSocket timeout value in millisecond6000INTYesNo
chunk.disabledport: Port number of the remote servicefalseBOOLYesNo
ssl.protocolThe SSL protocol versionTLSSTRINGYesNo
parametersParameters other than basics such as ciphers,sslEnabledProtocols,client.enable.session.creation. Expected format of these parameters is as follows: "'ciphers:xxx','sslEnabledProtocols,client.enable:xxx'"nullSTRINGYesNo
ciphersList of ciphers to be used. This parameter should include under parameters Ex: 'ciphers:TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256'nullSTRINGYesNo
ssl.enabled.protocolsSSL/TLS protocols to be enabled. This parameter should be in camel case format(sslEnabledProtocols) under parameters. Ex 'sslEnabledProtocols:true'nullSTRINGYesNo
client.enable.session.creationEnable HTTP session creation.This parameter should include under parameters Ex: 'client.enable.session.creation:true'nullSTRINGYesNo
follow.redirectRedirect related enabled.trueBOOLYesNo
max.redirect.countMaximum redirect count.5INTYesNo
tls.store.typeTLS store type to be used.JKSSTRINGYesNo
proxy.hostProxy server hostnullSTRINGYesNo
proxy.portProxy server portnullSTRINGYesNo
proxy.usernameProxy server usernamenullSTRINGYesNo
proxy.passwordProxy server passwordnullSTRINGYesNo
client.bootstrap.configurationClient bootsrap configurations. Expected format of these parameters is as follows: "'client.bootstrap.nodelay:xxx','client.bootstrap.keepalive:xxx'"TODOSTRINGYesNo
client.bootstrap.nodelayHttp client no delay.trueBOOLYesNo
client.bootstrap.keepaliveHttp client keep alive.trueBOOLYesNo
client.bootstrap.sendbuffersizeHttp client send buffer size.1048576INTYesNo
client.bootstrap.recievebuffersizeHttp client receive buffer size.1048576INTYesNo
client.bootstrap.connect.timeoutHttp client connection timeout.15000INTYesNo
client.bootstrap.socket.reuseTo enable http socket reuse.falseBOOLYesNo
client.bootstrap.socket.timeoutHttp client socket timeout.15STRINGYesNo
client.threadpool.configurationsThread pool configuration. Expected format of these parameters is as follows: "'client.connection.pool.count:xxx','client.max.active.connections.per.pool:xxx'"TODOSTRINGYesNo
client.connection.pool.countConnection pool count.0INTYesNo
client.max.active.connections.per.poolActive connections per pool.-1INTYesNo
client.min.idle.connections.per.poolMinimum ideal connection per pool.0INTYesNo
client.max.idle.connections.per.poolMaximum ideal connection per pool.100INTYesNo
client.min.eviction.idle.timeMinimum eviction idle time.5 * 60 * 1000STRINGYesNo
sender.thread.countHttp sender thread count.20STRINGYesNo
event.group.executor.thread.sizeEvent group executor thread size.15STRINGYesNo
max.wait.for.client.connection.poolMaximum wait for client connection pool.60000STRINGYesNo
- -System Parameters - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Parameters
clientBootstrapBossGroupSizeproperty to configure number of boss threads, which accepts incoming connections until the ports are unbound. Once connection accepts successfully, boss thread passes the accepted channel to one of the worker threads.Number of available processorsAny integer
clientBootstrapWorkerGroupSizeproperty to configure number of worker threads, which performs non blocking read and write for one or more channels in non-blocking mode.(Number of available processors)*2Any integer
clientBootstrapClientGroupSizeproperty to configure number of client threads, which performs non blocking read and write for one or more channels in non-blocking mode.(Number of available processors)*2Any integer
trustStoreLocationThe default truststore file path.${carbon.home}/resources/security/client-truststore.jksPath to client-truststore.jks
trustStorePasswordThe default truststore password.wso2carbonTruststore password
- -Examples -EXAMPLE 1 -``` -@sink(type='http',publisher.url='http://localhost:8009/foo', method='{{method}}',headers="'content-type:xml','content-length:94'", client.bootstrap.configuration="'client.bootstrap.socket.timeout:20', 'client.bootstrap.worker.group.size:10'", client.pool.configuration="'client.connection.pool.count:10','client.max.active.connections.per.pool:1'", @map(type='xml', @payload('{{payloadBody}}'))) -define stream FooStream (payloadBody String, method string, headers string); - -``` -

If it is xml mapping expected input should be in following format for FooStream:
{
<events>
    <event>
        <symbol>WSO2</symbol>
        <price>55.6</price>
        <volume>100</volume>
    </event>
</events>,
POST,
Content-Length:24#Content-Location:USA#Retry-After:120
}

Above event will generate output as below.
~Output http event payload
<events>
    <event>
        <symbol>WSO2</symbol>
        <price>55.6</price>
        <volume>100</volume>
    </event>
</events>

~Output http event headers
Content-Length:24,
Content-Location:'USA',
Retry-After:120,
Content-Type:'application/xml',
HTTP_METHOD:'POST',

~Output http event properties
HTTP_METHOD:'POST',
HOST:'localhost',
PORT:8009,
PROTOCOL:'http',
TO:'/foo'

- -### http-response *(Sink)* - -

HTTP response sink is correlated with the The HTTP request source, through a unique source.id, and it send a response to the HTTP request source having the same source.id. The response message can be formatted in text, XML or JSON and can be sent with appropriate headers.

- -Syntax -``` -@sink(type="http-response", source.id="", message.id="", headers="", @map(...))) -``` - -QUERY PARAMETERS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
source.idIdentifier of the source.STRINGNoNo
message.idIdentifier of the message.STRINGNoYes
headersThe headers that should be included as HTTP response headers. There can be any number of headers concatenated on following format. "'header1:value1','header2:value2'" User can include content-type header if he/she need to have any specific type for payload. If not system get the mapping type as the content-Type header (ie.@map(xml):application/xml, @map(json):application/json, @map(text):plain/text) and if user does not include any mapping type then system gets the plain/text as default Content-Type header. If user does not include Content-Length header then system calculate the bytes size of payload and include it as content-length header. STRINGYesNo
- -Examples -EXAMPLE 1 -``` -@sink(type='http-response', source.id='sampleSourceId', message.id='{{messageId}}', headers="'content-type:json','content-length:94'"@map(type='json', @payload('{{payloadBody}}'))) -define stream FooStream (payloadBody String, messageId string, headers string); - -``` -

If it is json mapping expected input should be in following format for FooStream:
{
{"events":
    {"event":
        "symbol":WSO2,
        "price":55.6,
        "volume":100,
    }
},
0cf708b1-7eae-440b-a93e-e72f801b486a,
Content-Length:24#Content-Location:USA
}

Above event will generate response for the matching source message as below.

~Output http event payload
{"events":
    {"event":
        "symbol":WSO2,
        "price":55.6,
        "volume":100,
    }
}

~Output http event headers
Content-Length:24,
Content-Location:'USA',
Content-Type:'application/json'

- -## Source - -### http *(Source)* - -

The HTTP source receives POST requests via HTTP or HTTPS in format such as text, XML and JSON. If required, you can enable basic authentication to ensure that events are received only from users who are authorized to access the service.

- -Syntax -``` -@source(type="http", receiver.url="", basic.auth.enabled="", worker.count="", socket.idle.timeout="", ssl.verify.client="", ssl.protocol="", tls.store.type="", parameters="", ciphers="", ssl.enabled.protocols="", server.enable.session.creation="", server.supported.snimatchers="", server.suported.server.names="", request.size.validation.configuration="", request.size.validation="", request.size.validation.maximum.value="", request.size.validation.reject.status.code="", request.size.validation.reject.message="", request.size.validation.reject.message.content.type="", header.size.validation="", header.validation.maximum.request.line="", header.validation.maximum.size="", header.validation.maximum.chunk.size="", header.validation.reject.status.code="", header.validation.reject.message="", header.validation.reject.message.content.type="", server.bootstrap.configuration="", server.bootstrap.nodelay="", server.bootstrap.keepalive="", server.bootstrap.sendbuffersize="", server.bootstrap.recievebuffersize="", server.bootstrap.connect.timeout="", server.bootstrap.socket.reuse="", server.bootstrap.socket.timeout="", server.bootstrap.socket.backlog="", trace.log.enabled="", @map(...))) -``` - -QUERY PARAMETERS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
receiver.urlThe URL to which the events should be received. User can provide any valid url and if the url is not provided the system will use the following format http://0.0.0.0:9763/<appNAme>/<streamName>If the user want to use SSL the url should be given in following format https://localhost:8080/<streamName>http://0.0.0.0:9763//STRINGYesNo
basic.auth.enabledIf this is set to true, basic authentication is enabled for incoming events, and the credentials with which each event is sent are verified to ensure that the user is authorized to access the service. If basic authentication fails, the event is not authenticated and an authentication error is logged in the CLI. By default this values 'false' falseSTRINGYesNo
worker.countThe number of active worker threads to serve the incoming events. The value is 1 by default. This will ensure that the events are directed to the event stream in the same order in which they arrive. By increasing this value the performance might increase at the cost of loosing event ordering.1STRINGYesNo
socket.idle.timeoutIdle timeout for HTTP connection.120000INTYesNo
ssl.verify.clientThe type of client certificate verification.nullSTRINGYesNo
ssl.protocolssl/tls related optionsTLSSTRINGYesNo
tls.store.typeTLS store type.JKSSTRINGYesNo
parametersParameters other than basics such as ciphers,sslEnabledProtocols,client.enable.session.creation. Expected format of these parameters is as follows: "'ciphers:xxx','sslEnabledProtocols,client.enable:xxx'"nullSTRINGYesNo
ciphersList of ciphers to be used. This parameter should include under parameters Ex: 'ciphers:TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256'nullSTRINGYesNo
ssl.enabled.protocolsSSL/TLS protocols to be enabled. This parameter should be in camel case format(sslEnabledProtocols) under parameters. Ex 'sslEnabledProtocols:true'nullSTRINGYesNo
server.enable.session.creationEnable HTTP session creation.This parameter should include under parameters Ex: 'client.enable.session.creation:true'nullSTRINGYesNo
server.supported.snimatchersHttp SNIMatcher to be added. This parameter should include under parameters Ex: 'server.supported.snimatchers:SNIMatcher'nullSTRINGYesNo
server.suported.server.namesHttp supported servers. This parameter should include under parameters Ex: 'server.suported.server.names:server'nullSTRINGYesNo
request.size.validation.configurationParameters that responsible for validating the http request and request headers. Expected format of these parameters is as follows: "'request.size.validation:xxx','request.size.validation.maximum.value:xxx'"nullSTRINGYesNo
request.size.validationTo enable the request size validation.falseSTRINGYesNo
request.size.validation.maximum.valueIf request size is validated then maximum size.Integer.MAX_VALUESTRINGYesNo
request.size.validation.reject.status.codeIf request is exceed maximum size and request.size.validation is enabled then status code to be send as response.401STRINGYesNo
request.size.validation.reject.messageIf request is exceed maximum size and request.size.validation is enabled then status message to be send as response.Message is bigger than the valid sizeSTRINGYesNo
request.size.validation.reject.message.content.typeIf request is exceed maximum size and request.size.validation is enabled then content type to be send as response.plain/textSTRINGYesNo
header.size.validationTo enable the header size validation.falseSTRINGYesNo
header.validation.maximum.request.lineIf header header validation is enabled then the maximum request line.4096STRINGYesNo
header.validation.maximum.sizeIf header header validation is enabled then the maximum expected header size.8192STRINGYesNo
header.validation.maximum.chunk.sizeIf header header validation is enabled then the maximum expected chunk size.8192STRINGYesNo
header.validation.reject.status.code401If header is exceed maximum size and header.size.validation is enabled then status code to be send as response.STRINGYesNo
header.validation.reject.messageIf header is exceed maximum size and header.size.validation is enabled then message to be send as response.Message header is bigger than the valid sizeSTRINGYesNo
header.validation.reject.message.content.typeIf header is exceed maximum size and header.size.validation is enabled then content type to be send as response.plain/textSTRINGYesNo
server.bootstrap.configurationParameters that for bootstrap configurations of the server. Expected format of these parameters is as follows: "'ciphers:xxx','sslEnabledProtocols,client.enable:xxx'"nullOBJECTYesNo
server.bootstrap.nodelayHttp server no delay.trueBOOLYesNo
server.bootstrap.keepaliveHttp server keep alive.trueBOOLYesNo
server.bootstrap.sendbuffersizeHttp server send buffer size.1048576INTYesNo
server.bootstrap.recievebuffersizeHttp server receive buffer size.1048576INTYesNo
server.bootstrap.connect.timeoutHttp server connection timeout.15000INTYesNo
server.bootstrap.socket.reuseTo enable http socket reuse.falseBOOLYesNo
server.bootstrap.socket.timeoutHttp server socket timeout.15BOOLYesNo
server.bootstrap.socket.backlogTHttp server socket backlog.100BOOLYesNo
trace.log.enabledHttp traffic monitoring.falseBOOLYesNo
- -System Parameters - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Parameters
serverBootstrapBossGroupSizeproperty to configure number of boss threads, which accepts incoming connections until the ports are unbound. Once connection accepts successfully, boss thread passes the accepted channel to one of the worker threads.Number of available processorsAny integer
serverBootstrapWorkerGroupSizeproperty to configure number of worker threads, which performs non blocking read and write for one or more channels in non-blocking mode.(Number of available processors)*2Any integer
serverBootstrapClientGroupSizeproperty to configure number of client threads, which performs non blocking read and write for one or more channels in non-blocking mode.(Number of available processors)*2Any integer
defaultHostThe default host of the transport.0.0.0.0Any valid host
defaultHttpPortThe default port if the default scheme is 'http'.8280Any valid port
defaultHttpsPortThe default port if the default scheme is 'https'.8243Any valid port
defaultSchemeThe default protocol.httphttp
https
keyStoreLocationThe default keystore file path.${carbon.home}/resources/security/wso2carbon.jksPath to wso2carbon.jks file
keyStorePasswordThe default keystore password.wso2carbonString of keystore password
certPasswordThe default cert password.wso2carbonString of cert password
- -Examples -EXAMPLE 1 -``` -@source(type='http', receiver.url='http://localhost:9055/endpoints/RecPro', socketIdleTimeout='150000', parameters="'ciphers : TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256', 'sslEnabledProtocols:TLSv1.1,TLSv1.2'",request.size.validation.configuration="request.size.validation:true",server.bootstrap.configuration="server.bootstrap.socket.timeout:25" @map(type='xml')) -define stream FooStream (symbol string, price float, volume long); - -``` -

Above source listenerConfiguration performs a default XML input mapping. The expected input is as follows:
<events>
    <event>
        <symbol>WSO2</symbol>
        <price>55.6</price>
        <volume>100</volume>
    </event>
</events>
If basic authentication is enabled via the basic.auth.enabled='true setting, each input event is also expected to contain the Authorization:'Basic encodeBase64(username:Password)' header.

- -### http-request *(Source)* - -

The HTTP request is correlated with the HTTP response sink, through a unique source.id, and for each POST requests it receives via HTTP or HTTPS in format such as text, XML and JSON it sends the response via the HTTP response sink. The individual request and response messages are correlated at the sink using the message.id of the events. If required, you can enable basic authentication at the source to ensure that events are received only from users who are authorized to access the service.

- -Syntax -``` -@source(type="http-request", receiver.url="", source.id="", connection.timeout="", basic.auth.enabled="", worker.count="", socket.idle.timeout="", ssl.verify.client="", ssl.protocol="", tls.store.type="", parameters="", ciphers="", ssl.enabled.protocols="", server.enable.session.creation="", server.supported.snimatchers="", server.suported.server.names="", request.size.validation.configuration="", request.size.validation="", request.size.validation.maximum.value="", request.size.validation.reject.status.code="", request.size.validation.reject.message="", request.size.validation.reject.message.content.type="", header.size.validation="", header.validation.maximum.request.line="", header.validation.maximum.size="", header.validation.maximum.chunk.size="", header.validation.reject.status.code="", header.validation.reject.message="", header.validation.reject.message.content.type="", server.bootstrap.configuration="", server.bootstrap.nodelay="", server.bootstrap.keepalive="", server.bootstrap.sendbuffersize="", server.bootstrap.recievebuffersize="", server.bootstrap.connect.timeout="", server.bootstrap.socket.reuse="", server.bootstrap.socket.timeout="", server.bootstrap.socket.backlog="", trace.log.enabled="", @map(...))) -``` - -QUERY PARAMETERS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
receiver.urlThe URL to which the events should be received. User can provide any valid url and if the url is not provided the system will use the following format http://0.0.0.0:9763/<appNAme>/<streamName>If the user want to use SSL the url should be given in following format https://localhost:8080/<streamName>http://0.0.0.0:9763//STRINGYesNo
source.idIdentifier need to map the source to sink.STRINGNoNo
connection.timeoutConnection timeout in milliseconds. If the mapped http-response sink does not get a correlated message, after this timeout value, a timeout response is sent120000INTYesNo
basic.auth.enabledIf this is set to true, basic authentication is enabled for incoming events, and the credentials with which each event is sent are verified to ensure that the user is authorized to access the service. If basic authentication fails, the event is not authenticated and an authentication error is logged in the CLI. By default this values 'false' falseSTRINGYesNo
worker.countThe number of active worker threads to serve the incoming events. The value is 1 by default. This will ensure that the events are directed to the event stream in the same order in which they arrive. By increasing this value the performance might increase at the cost of loosing event ordering.1STRINGYesNo
socket.idle.timeoutIdle timeout for HTTP connection.120000INTYesNo
ssl.verify.clientThe type of client certificate verification.nullSTRINGYesNo
ssl.protocolssl/tls related optionsTLSSTRINGYesNo
tls.store.typeTLS store type.JKSSTRINGYesNo
parametersParameters other than basics such as ciphers,sslEnabledProtocols,client.enable.session.creation. Expected format of these parameters is as follows: "'ciphers:xxx','sslEnabledProtocols,client.enable:xxx'"nullSTRINGYesNo
ciphersList of ciphers to be used. This parameter should include under parameters Ex: 'ciphers:TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256'nullSTRINGYesNo
ssl.enabled.protocolsSSL/TLS protocols to be enabled. This parameter should be in camel case format(sslEnabledProtocols) under parameters. Ex 'sslEnabledProtocols:true'nullSTRINGYesNo
server.enable.session.creationEnable HTTP session creation.This parameter should include under parameters Ex: 'client.enable.session.creation:true'nullSTRINGYesNo
server.supported.snimatchersHttp SNIMatcher to be added. This parameter should include under parameters Ex: 'server.supported.snimatchers:SNIMatcher'nullSTRINGYesNo
server.suported.server.namesHttp supported servers. This parameter should include under parameters Ex: 'server.suported.server.names:server'nullSTRINGYesNo
request.size.validation.configurationParameters that responsible for validating the http request and request headers. Expected format of these parameters is as follows: "'request.size.validation:xxx','request.size.validation.maximum.value:xxx'"nullSTRINGYesNo
request.size.validationTo enable the request size validation.falseSTRINGYesNo
request.size.validation.maximum.valueIf request size is validated then maximum size.Integer.MAX_VALUESTRINGYesNo
request.size.validation.reject.status.codeIf request is exceed maximum size and request.size.validation is enabled then status code to be send as response.401STRINGYesNo
request.size.validation.reject.messageIf request is exceed maximum size and request.size.validation is enabled then status message to be send as response.Message is bigger than the valid sizeSTRINGYesNo
request.size.validation.reject.message.content.typeIf request is exceed maximum size and request.size.validation is enabled then content type to be send as response.plain/textSTRINGYesNo
header.size.validationTo enable the header size validation.falseSTRINGYesNo
header.validation.maximum.request.lineIf header header validation is enabled then the maximum request line.4096STRINGYesNo
header.validation.maximum.sizeIf header header validation is enabled then the maximum expected header size.8192STRINGYesNo
header.validation.maximum.chunk.sizeIf header header validation is enabled then the maximum expected chunk size.8192STRINGYesNo
header.validation.reject.status.code401If header is exceed maximum size and header.size.validation is enabled then status code to be send as response.STRINGYesNo
header.validation.reject.messageIf header is exceed maximum size and header.size.validation is enabled then message to be send as response.Message header is bigger than the valid sizeSTRINGYesNo
header.validation.reject.message.content.typeIf header is exceed maximum size and header.size.validation is enabled then content type to be send as response.plain/textSTRINGYesNo
server.bootstrap.configurationParameters that for bootstrap configurations of the server. Expected format of these parameters is as follows: "'ciphers:xxx','sslEnabledProtocols,client.enable:xxx'"nullOBJECTYesNo
server.bootstrap.nodelayHttp server no delay.trueBOOLYesNo
server.bootstrap.keepaliveHttp server keep alive.trueBOOLYesNo
server.bootstrap.sendbuffersizeHttp server send buffer size.1048576INTYesNo
server.bootstrap.recievebuffersizeHttp server receive buffer size.1048576INTYesNo
server.bootstrap.connect.timeoutHttp server connection timeout.15000INTYesNo
server.bootstrap.socket.reuseTo enable http socket reuse.falseBOOLYesNo
server.bootstrap.socket.timeoutHttp server socket timeout.15BOOLYesNo
server.bootstrap.socket.backlogTHttp server socket backlog.100BOOLYesNo
trace.log.enabledHttp traffic monitoring.falseBOOLYesNo
- -System Parameters - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Parameters
serverBootstrapBossGroupSizeproperty to configure number of boss threads, which accepts incoming connections until the ports are unbound. Once connection accepts successfully, boss thread passes the accepted channel to one of the worker threads.Number of available processorsAny integer
serverBootstrapWorkerGroupSizeproperty to configure number of worker threads, which performs non blocking read and write for one or more channels in non-blocking mode.(Number of available processors)*2Any integer
serverBootstrapClientGroupSizeproperty to configure number of client threads, which performs non blocking read and write for one or more channels in non-blocking mode.(Number of available processors)*2Any integer
defaultHostThe default host of the transport.0.0.0.0Any valid host
defaultHttpPortThe default port if the default scheme is 'http'.8280Any valid port
defaultHttpsPortThe default port if the default scheme is 'https'.8243Any valid port
defaultSchemeThe default protocol.httphttp
https
keyStoreLocationThe default keystore file path.${carbon.home}/resources/security/wso2carbon.jksPath to wso2carbon.jks file
keyStorePasswordThe default keystore password.wso2carbonString of keystore password
certPasswordThe default cert password.wso2carbonString of cert password
- -Examples -EXAMPLE 1 -``` -@source(type='http-request', source.id='sampleSourceId, receiver.url='http://localhost:9055/endpoints/RecPro', connection.timeout='150000', parameters="'ciphers : TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256', 'sslEnabledProtocols:TLSv1.1,TLSv1.2'", request.size.validation.configuration="request.size.validation:true", server.bootstrap.configuration="server.bootstrap.socket.timeout:25", @map(type='json, @attributes(messageId='trp:messageId', symbol='$.events.event.symbol', price='$.events.event.price', volume='$.events.event.volume'))) -define stream FooStream (messageId string, symbol string, price float, volume long); - -``` -

The expected input is as follows:
{"events":
    {"event":
        "symbol":WSO2,
        "price":55.6,
        "volume":100,
    }
}
If basic authentication is enabled via the basic.auth.enabled='true setting, each input event is also expected to contain the Authorization:'Basic encodeBase64(username:Password)' header.

- diff --git a/docs/api/1.0.28.md b/docs/api/1.0.28.md deleted file mode 100644 index 26faad3c..00000000 --- a/docs/api/1.0.28.md +++ /dev/null @@ -1,1226 +0,0 @@ -# API Docs - v1.0.28 - -## Sink - -### http *(Sink)* - -

This extension publish the HTTP events in any HTTP method POST, GET, PUT, DELETE via HTTP or https protocols. As the additional features this component can provide basic authentication as well as user can publish events using custom client truststore files when publishing events via https protocol. And also user can add any number of headers including HTTP_METHOD header for each event dynamically.
Following content types will be set by default according to the type of sink mapper used.
You can override them by setting the new content types in headers.
     - TEXT : text/plain
     - XML : application/xml
     - JSON : application/json
     - KEYVALUE : application/x-www-form-urlencoded

- -Syntax -``` -@sink(type="http", publisher.url="", basic.auth.username="", basic.auth.password="", https.truststore.file="", https.truststore.password="", headers="", method="", socket.idle.timeout="", chunk.disabled="", ssl.protocol="", parameters="", ciphers="", ssl.enabled.protocols="", client.enable.session.creation="", follow.redirect="", max.redirect.count="", tls.store.type="", proxy.host="", proxy.port="", proxy.username="", proxy.password="", client.bootstrap.configuration="", client.bootstrap.nodelay="", client.bootstrap.keepalive="", client.bootstrap.sendbuffersize="", client.bootstrap.recievebuffersize="", client.bootstrap.connect.timeout="", client.bootstrap.socket.reuse="", client.bootstrap.socket.timeout="", client.threadpool.configurations="", client.connection.pool.count="", client.max.active.connections.per.pool="", client.min.idle.connections.per.pool="", client.max.idle.connections.per.pool="", client.min.eviction.idle.time="", sender.thread.count="", event.group.executor.thread.size="", max.wait.for.client.connection.pool="", @map(...))) -``` - -QUERY PARAMETERS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
publisher.urlThe URL to which the outgoing events should be published via HTTP. This is a mandatory parameter and if this is not specified, an error is logged in the CLI. If user wants to enable SSL for the events, use https instead of http in the publisher.url.e.g., http://localhost:8080/endpoint, https://localhost:8080/endpointSTRINGNoNo
basic.auth.usernameThe username to be included in the authentication header of the basic authentication enabled events. It is required to specify both username and password to enable basic authentication. If one of the parameter is not given by user then an error is logged in the CLI. STRINGYesNo
basic.auth.passwordThe password to include in the authentication header of the basic authentication enabled events. It is required to specify both username and password to enable basic authentication. If one of the parameter is not given by user then an error is logged in the CLI. STRINGYesNo
https.truststore.fileThe file path to the location of the truststore of the client that sends the HTTP events through 'https' protocol. A custom client-truststore can be specified if required.${carbon.home}/resources/security/client-truststore.jksSTRINGYesNo
https.truststore.passwordThe password for the client-truststore. A custom password can be specified if required. If no custom password is specified and the protocol of URL is 'https' then, the system uses default password.wso2carbonSTRINGYesNo
headersThe headers that should be included as HTTP request headers.
There can be any number of headers concatenated in following format. "'header1:value1','header2:value2'". User can include Content-Type header if he needs to use a specific content-type for the payload. Or else, system decides the Content-Type by considering the type of sink mapper, in following way.
 - @map(xml):application/xml
 - @map(json):application/json
 - @map(text):plain/text )
 - if user does not include any mapping type then the system gets 'plain/text' as default Content-Type header.
Note that providing content-length as a header is not supported. The size of the payload will be automatically calculated and included in the content-length header.
STRINGYesNo
methodFor HTTP events, HTTP_METHOD header should be included as a request header. If the parameter is null then system uses 'POST' as a default header.POSTSTRINGYesNo
socket.idle.timeoutSocket timeout value in millisecond6000INTYesNo
chunk.disabledport: Port number of the remote servicefalseBOOLYesNo
ssl.protocolThe SSL protocol versionTLSSTRINGYesNo
parametersParameters other than basics such as ciphers,sslEnabledProtocols,client.enable.session.creation. Expected format of these parameters is as follows: "'ciphers:xxx','sslEnabledProtocols,client.enable:xxx'"nullSTRINGYesNo
ciphersList of ciphers to be used. This parameter should include under parameters Ex: 'ciphers:TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256'nullSTRINGYesNo
ssl.enabled.protocolsSSL/TLS protocols to be enabled. This parameter should be in camel case format(sslEnabledProtocols) under parameters. Ex 'sslEnabledProtocols:true'nullSTRINGYesNo
client.enable.session.creationEnable HTTP session creation.This parameter should include under parameters Ex: 'client.enable.session.creation:true'nullSTRINGYesNo
follow.redirectRedirect related enabled.trueBOOLYesNo
max.redirect.countMaximum redirect count.5INTYesNo
tls.store.typeTLS store type to be used.JKSSTRINGYesNo
proxy.hostProxy server hostnullSTRINGYesNo
proxy.portProxy server portnullSTRINGYesNo
proxy.usernameProxy server usernamenullSTRINGYesNo
proxy.passwordProxy server passwordnullSTRINGYesNo
client.bootstrap.configurationClient bootsrap configurations. Expected format of these parameters is as follows: "'client.bootstrap.nodelay:xxx','client.bootstrap.keepalive:xxx'"TODOSTRINGYesNo
client.bootstrap.nodelayHttp client no delay.trueBOOLYesNo
client.bootstrap.keepaliveHttp client keep alive.trueBOOLYesNo
client.bootstrap.sendbuffersizeHttp client send buffer size.1048576INTYesNo
client.bootstrap.recievebuffersizeHttp client receive buffer size.1048576INTYesNo
client.bootstrap.connect.timeoutHttp client connection timeout.15000INTYesNo
client.bootstrap.socket.reuseTo enable http socket reuse.falseBOOLYesNo
client.bootstrap.socket.timeoutHttp client socket timeout.15STRINGYesNo
client.threadpool.configurationsThread pool configuration. Expected format of these parameters is as follows: "'client.connection.pool.count:xxx','client.max.active.connections.per.pool:xxx'"TODOSTRINGYesNo
client.connection.pool.countConnection pool count.0INTYesNo
client.max.active.connections.per.poolActive connections per pool.-1INTYesNo
client.min.idle.connections.per.poolMinimum ideal connection per pool.0INTYesNo
client.max.idle.connections.per.poolMaximum ideal connection per pool.100INTYesNo
client.min.eviction.idle.timeMinimum eviction idle time.5 * 60 * 1000STRINGYesNo
sender.thread.countHttp sender thread count.20STRINGYesNo
event.group.executor.thread.sizeEvent group executor thread size.15STRINGYesNo
max.wait.for.client.connection.poolMaximum wait for client connection pool.60000STRINGYesNo
- -System Parameters - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Parameters
clientBootstrapBossGroupSizeproperty to configure number of boss threads, which accepts incoming connections until the ports are unbound. Once connection accepts successfully, boss thread passes the accepted channel to one of the worker threads.Number of available processorsAny integer
clientBootstrapWorkerGroupSizeproperty to configure number of worker threads, which performs non blocking read and write for one or more channels in non-blocking mode.(Number of available processors)*2Any integer
clientBootstrapClientGroupSizeproperty to configure number of client threads, which performs non blocking read and write for one or more channels in non-blocking mode.(Number of available processors)*2Any integer
trustStoreLocationThe default truststore file path.${carbon.home}/resources/security/client-truststore.jksPath to client-truststore.jks
trustStorePasswordThe default truststore password.wso2carbonTruststore password
- -Examples -EXAMPLE 1 -``` -@sink(type='http',publisher.url='http://localhost:8009/foo', method='{{method}}',headers="'content-type:xml','content-length:94'", client.bootstrap.configuration="'client.bootstrap.socket.timeout:20', 'client.bootstrap.worker.group.size:10'", client.pool.configuration="'client.connection.pool.count:10','client.max.active.connections.per.pool:1'", @map(type='xml', @payload('{{payloadBody}}'))) -define stream FooStream (payloadBody String, method string, headers string); - -``` -

If it is xml mapping expected input should be in following format for FooStream:
{
<events>
    <event>
        <symbol>WSO2</symbol>
        <price>55.6</price>
        <volume>100</volume>
    </event>
</events>,
POST,
Content-Length:24#Content-Location:USA#Retry-After:120
}

Above event will generate output as below.
~Output http event payload
<events>
    <event>
        <symbol>WSO2</symbol>
        <price>55.6</price>
        <volume>100</volume>
    </event>
</events>

~Output http event headers
Content-Length:24,
Content-Location:'USA',
Retry-After:120,
Content-Type:'application/xml',
HTTP_METHOD:'POST',

~Output http event properties
HTTP_METHOD:'POST',
HOST:'localhost',
PORT:8009,
PROTOCOL:'http',
TO:'/foo'

- -### http-response *(Sink)* - -

HTTP response sink is correlated with the The HTTP request source, through a unique source.id, and it send a response to the HTTP request source having the same source.id. The response message can be formatted in text, XML or JSON and can be sent with appropriate headers.

- -Syntax -``` -@sink(type="http-response", source.id="", message.id="", headers="", @map(...))) -``` - -QUERY PARAMETERS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
source.idIdentifier of the source.STRINGNoNo
message.idIdentifier of the message.STRINGNoYes
headersThe headers that should be included as HTTP response headers. There can be any number of headers concatenated on following format. "'header1:value1','header2:value2'" User can include content-type header if he/she need to have any specific type for payload. If not system get the mapping type as the content-Type header (ie.@map(xml):application/xml, @map(json):application/json, @map(text):plain/text) and if user does not include any mapping type then system gets the plain/text as default Content-Type header. If user does not include Content-Length header then system calculate the bytes size of payload and include it as content-length header. STRINGYesNo
- -Examples -EXAMPLE 1 -``` -@sink(type='http-response', source.id='sampleSourceId', message.id='{{messageId}}', headers="'content-type:json','content-length:94'"@map(type='json', @payload('{{payloadBody}}'))) -define stream FooStream (payloadBody String, messageId string, headers string); - -``` -

If it is json mapping expected input should be in following format for FooStream:
{
{"events":
    {"event":
        "symbol":WSO2,
        "price":55.6,
        "volume":100,
    }
},
0cf708b1-7eae-440b-a93e-e72f801b486a,
Content-Length:24#Content-Location:USA
}

Above event will generate response for the matching source message as below.

~Output http event payload
{"events":
    {"event":
        "symbol":WSO2,
        "price":55.6,
        "volume":100,
    }
}

~Output http event headers
Content-Length:24,
Content-Location:'USA',
Content-Type:'application/json'

- -## Source - -### http *(Source)* - -

The HTTP source receives POST requests via HTTP or HTTPS in format such as text, XML and JSON. If required, you can enable basic authentication to ensure that events are received only from users who are authorized to access the service.

- -Syntax -``` -@source(type="http", receiver.url="", basic.auth.enabled="", worker.count="", socket.idle.timeout="", ssl.verify.client="", ssl.protocol="", tls.store.type="", parameters="", ciphers="", ssl.enabled.protocols="", server.enable.session.creation="", server.supported.snimatchers="", server.suported.server.names="", request.size.validation.configuration="", request.size.validation="", request.size.validation.maximum.value="", request.size.validation.reject.status.code="", request.size.validation.reject.message="", request.size.validation.reject.message.content.type="", header.size.validation="", header.validation.maximum.request.line="", header.validation.maximum.size="", header.validation.maximum.chunk.size="", header.validation.reject.status.code="", header.validation.reject.message="", header.validation.reject.message.content.type="", server.bootstrap.configuration="", server.bootstrap.nodelay="", server.bootstrap.keepalive="", server.bootstrap.sendbuffersize="", server.bootstrap.recievebuffersize="", server.bootstrap.connect.timeout="", server.bootstrap.socket.reuse="", server.bootstrap.socket.timeout="", server.bootstrap.socket.backlog="", trace.log.enabled="", @map(...))) -``` - -QUERY PARAMETERS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
receiver.urlThe URL to which the events should be received. User can provide any valid url and if the url is not provided the system will use the following format http://0.0.0.0:9763/<appNAme>/<streamName>If the user want to use SSL the url should be given in following format https://localhost:8080/<streamName>http://0.0.0.0:9763//STRINGYesNo
basic.auth.enabledIf this is set to true, basic authentication is enabled for incoming events, and the credentials with which each event is sent are verified to ensure that the user is authorized to access the service. If basic authentication fails, the event is not authenticated and an authentication error is logged in the CLI. By default this values 'false' falseSTRINGYesNo
worker.countThe number of active worker threads to serve the incoming events. The value is 1 by default. This will ensure that the events are directed to the event stream in the same order in which they arrive. By increasing this value the performance might increase at the cost of loosing event ordering.1STRINGYesNo
socket.idle.timeoutIdle timeout for HTTP connection.120000INTYesNo
ssl.verify.clientThe type of client certificate verification.nullSTRINGYesNo
ssl.protocolssl/tls related optionsTLSSTRINGYesNo
tls.store.typeTLS store type.JKSSTRINGYesNo
parametersParameters other than basics such as ciphers,sslEnabledProtocols,client.enable.session.creation. Expected format of these parameters is as follows: "'ciphers:xxx','sslEnabledProtocols,client.enable:xxx'"nullSTRINGYesNo
ciphersList of ciphers to be used. This parameter should include under parameters Ex: 'ciphers:TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256'nullSTRINGYesNo
ssl.enabled.protocolsSSL/TLS protocols to be enabled. This parameter should be in camel case format(sslEnabledProtocols) under parameters. Ex 'sslEnabledProtocols:true'nullSTRINGYesNo
server.enable.session.creationEnable HTTP session creation.This parameter should include under parameters Ex: 'client.enable.session.creation:true'nullSTRINGYesNo
server.supported.snimatchersHttp SNIMatcher to be added. This parameter should include under parameters Ex: 'server.supported.snimatchers:SNIMatcher'nullSTRINGYesNo
server.suported.server.namesHttp supported servers. This parameter should include under parameters Ex: 'server.suported.server.names:server'nullSTRINGYesNo
request.size.validation.configurationParameters that responsible for validating the http request and request headers. Expected format of these parameters is as follows: "'request.size.validation:xxx','request.size.validation.maximum.value:xxx'"nullSTRINGYesNo
request.size.validationTo enable the request size validation.falseSTRINGYesNo
request.size.validation.maximum.valueIf request size is validated then maximum size.Integer.MAX_VALUESTRINGYesNo
request.size.validation.reject.status.codeIf request is exceed maximum size and request.size.validation is enabled then status code to be send as response.401STRINGYesNo
request.size.validation.reject.messageIf request is exceed maximum size and request.size.validation is enabled then status message to be send as response.Message is bigger than the valid sizeSTRINGYesNo
request.size.validation.reject.message.content.typeIf request is exceed maximum size and request.size.validation is enabled then content type to be send as response.plain/textSTRINGYesNo
header.size.validationTo enable the header size validation.falseSTRINGYesNo
header.validation.maximum.request.lineIf header header validation is enabled then the maximum request line.4096STRINGYesNo
header.validation.maximum.sizeIf header header validation is enabled then the maximum expected header size.8192STRINGYesNo
header.validation.maximum.chunk.sizeIf header header validation is enabled then the maximum expected chunk size.8192STRINGYesNo
header.validation.reject.status.code401If header is exceed maximum size and header.size.validation is enabled then status code to be send as response.STRINGYesNo
header.validation.reject.messageIf header is exceed maximum size and header.size.validation is enabled then message to be send as response.Message header is bigger than the valid sizeSTRINGYesNo
header.validation.reject.message.content.typeIf header is exceed maximum size and header.size.validation is enabled then content type to be send as response.plain/textSTRINGYesNo
server.bootstrap.configurationParameters that for bootstrap configurations of the server. Expected format of these parameters is as follows: "'ciphers:xxx','sslEnabledProtocols,client.enable:xxx'"nullOBJECTYesNo
server.bootstrap.nodelayHttp server no delay.trueBOOLYesNo
server.bootstrap.keepaliveHttp server keep alive.trueBOOLYesNo
server.bootstrap.sendbuffersizeHttp server send buffer size.1048576INTYesNo
server.bootstrap.recievebuffersizeHttp server receive buffer size.1048576INTYesNo
server.bootstrap.connect.timeoutHttp server connection timeout.15000INTYesNo
server.bootstrap.socket.reuseTo enable http socket reuse.falseBOOLYesNo
server.bootstrap.socket.timeoutHttp server socket timeout.15BOOLYesNo
server.bootstrap.socket.backlogTHttp server socket backlog.100BOOLYesNo
trace.log.enabledHttp traffic monitoring.falseBOOLYesNo
- -System Parameters - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Parameters
serverBootstrapBossGroupSizeproperty to configure number of boss threads, which accepts incoming connections until the ports are unbound. Once connection accepts successfully, boss thread passes the accepted channel to one of the worker threads.Number of available processorsAny integer
serverBootstrapWorkerGroupSizeproperty to configure number of worker threads, which performs non blocking read and write for one or more channels in non-blocking mode.(Number of available processors)*2Any integer
serverBootstrapClientGroupSizeproperty to configure number of client threads, which performs non blocking read and write for one or more channels in non-blocking mode.(Number of available processors)*2Any integer
defaultHostThe default host of the transport.0.0.0.0Any valid host
defaultHttpPortThe default port if the default scheme is 'http'.8280Any valid port
defaultHttpsPortThe default port if the default scheme is 'https'.8243Any valid port
defaultSchemeThe default protocol.httphttp
https
keyStoreLocationThe default keystore file path.${carbon.home}/resources/security/wso2carbon.jksPath to wso2carbon.jks file
keyStorePasswordThe default keystore password.wso2carbonString of keystore password
certPasswordThe default cert password.wso2carbonString of cert password
- -Examples -EXAMPLE 1 -``` -@source(type='http', receiver.url='http://localhost:9055/endpoints/RecPro', socketIdleTimeout='150000', parameters="'ciphers : TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256', 'sslEnabledProtocols:TLSv1.1,TLSv1.2'",request.size.validation.configuration="request.size.validation:true",server.bootstrap.configuration="server.bootstrap.socket.timeout:25" @map(type='xml')) -define stream FooStream (symbol string, price float, volume long); - -``` -

Above source listenerConfiguration performs a default XML input mapping. The expected input is as follows:
<events>
    <event>
        <symbol>WSO2</symbol>
        <price>55.6</price>
        <volume>100</volume>
    </event>
</events>
If basic authentication is enabled via the basic.auth.enabled='true setting, each input event is also expected to contain the Authorization:'Basic encodeBase64(username:Password)' header.

- -### http-request *(Source)* - -

The HTTP request is correlated with the HTTP response sink, through a unique source.id, and for each POST requests it receives via HTTP or HTTPS in format such as text, XML and JSON it sends the response via the HTTP response sink. The individual request and response messages are correlated at the sink using the message.id of the events. If required, you can enable basic authentication at the source to ensure that events are received only from users who are authorized to access the service.

- -Syntax -``` -@source(type="http-request", receiver.url="", source.id="", connection.timeout="", basic.auth.enabled="", worker.count="", socket.idle.timeout="", ssl.verify.client="", ssl.protocol="", tls.store.type="", parameters="", ciphers="", ssl.enabled.protocols="", server.enable.session.creation="", server.supported.snimatchers="", server.suported.server.names="", request.size.validation.configuration="", request.size.validation="", request.size.validation.maximum.value="", request.size.validation.reject.status.code="", request.size.validation.reject.message="", request.size.validation.reject.message.content.type="", header.size.validation="", header.validation.maximum.request.line="", header.validation.maximum.size="", header.validation.maximum.chunk.size="", header.validation.reject.status.code="", header.validation.reject.message="", header.validation.reject.message.content.type="", server.bootstrap.configuration="", server.bootstrap.nodelay="", server.bootstrap.keepalive="", server.bootstrap.sendbuffersize="", server.bootstrap.recievebuffersize="", server.bootstrap.connect.timeout="", server.bootstrap.socket.reuse="", server.bootstrap.socket.timeout="", server.bootstrap.socket.backlog="", trace.log.enabled="", @map(...))) -``` - -QUERY PARAMETERS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
receiver.urlThe URL to which the events should be received. User can provide any valid url and if the url is not provided the system will use the following format http://0.0.0.0:9763/<appNAme>/<streamName>If the user want to use SSL the url should be given in following format https://localhost:8080/<streamName>http://0.0.0.0:9763//STRINGYesNo
source.idIdentifier need to map the source to sink.STRINGNoNo
connection.timeoutConnection timeout in milliseconds. If the mapped http-response sink does not get a correlated message, after this timeout value, a timeout response is sent120000INTYesNo
basic.auth.enabledIf this is set to true, basic authentication is enabled for incoming events, and the credentials with which each event is sent are verified to ensure that the user is authorized to access the service. If basic authentication fails, the event is not authenticated and an authentication error is logged in the CLI. By default this values 'false' falseSTRINGYesNo
worker.countThe number of active worker threads to serve the incoming events. The value is 1 by default. This will ensure that the events are directed to the event stream in the same order in which they arrive. By increasing this value the performance might increase at the cost of loosing event ordering.1STRINGYesNo
socket.idle.timeoutIdle timeout for HTTP connection.120000INTYesNo
ssl.verify.clientThe type of client certificate verification.nullSTRINGYesNo
ssl.protocolssl/tls related optionsTLSSTRINGYesNo
tls.store.typeTLS store type.JKSSTRINGYesNo
parametersParameters other than basics such as ciphers,sslEnabledProtocols,client.enable.session.creation. Expected format of these parameters is as follows: "'ciphers:xxx','sslEnabledProtocols,client.enable:xxx'"nullSTRINGYesNo
ciphersList of ciphers to be used. This parameter should include under parameters Ex: 'ciphers:TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256'nullSTRINGYesNo
ssl.enabled.protocolsSSL/TLS protocols to be enabled. This parameter should be in camel case format(sslEnabledProtocols) under parameters. Ex 'sslEnabledProtocols:true'nullSTRINGYesNo
server.enable.session.creationEnable HTTP session creation.This parameter should include under parameters Ex: 'client.enable.session.creation:true'nullSTRINGYesNo
server.supported.snimatchersHttp SNIMatcher to be added. This parameter should include under parameters Ex: 'server.supported.snimatchers:SNIMatcher'nullSTRINGYesNo
server.suported.server.namesHttp supported servers. This parameter should include under parameters Ex: 'server.suported.server.names:server'nullSTRINGYesNo
request.size.validation.configurationParameters that responsible for validating the http request and request headers. Expected format of these parameters is as follows: "'request.size.validation:xxx','request.size.validation.maximum.value:xxx'"nullSTRINGYesNo
request.size.validationTo enable the request size validation.falseSTRINGYesNo
request.size.validation.maximum.valueIf request size is validated then maximum size.Integer.MAX_VALUESTRINGYesNo
request.size.validation.reject.status.codeIf request is exceed maximum size and request.size.validation is enabled then status code to be send as response.401STRINGYesNo
request.size.validation.reject.messageIf request is exceed maximum size and request.size.validation is enabled then status message to be send as response.Message is bigger than the valid sizeSTRINGYesNo
request.size.validation.reject.message.content.typeIf request is exceed maximum size and request.size.validation is enabled then content type to be send as response.plain/textSTRINGYesNo
header.size.validationTo enable the header size validation.falseSTRINGYesNo
header.validation.maximum.request.lineIf header header validation is enabled then the maximum request line.4096STRINGYesNo
header.validation.maximum.sizeIf header header validation is enabled then the maximum expected header size.8192STRINGYesNo
header.validation.maximum.chunk.sizeIf header header validation is enabled then the maximum expected chunk size.8192STRINGYesNo
header.validation.reject.status.code401If header is exceed maximum size and header.size.validation is enabled then status code to be send as response.STRINGYesNo
header.validation.reject.messageIf header is exceed maximum size and header.size.validation is enabled then message to be send as response.Message header is bigger than the valid sizeSTRINGYesNo
header.validation.reject.message.content.typeIf header is exceed maximum size and header.size.validation is enabled then content type to be send as response.plain/textSTRINGYesNo
server.bootstrap.configurationParameters that for bootstrap configurations of the server. Expected format of these parameters is as follows: "'ciphers:xxx','sslEnabledProtocols,client.enable:xxx'"nullOBJECTYesNo
server.bootstrap.nodelayHttp server no delay.trueBOOLYesNo
server.bootstrap.keepaliveHttp server keep alive.trueBOOLYesNo
server.bootstrap.sendbuffersizeHttp server send buffer size.1048576INTYesNo
server.bootstrap.recievebuffersizeHttp server receive buffer size.1048576INTYesNo
server.bootstrap.connect.timeoutHttp server connection timeout.15000INTYesNo
server.bootstrap.socket.reuseTo enable http socket reuse.falseBOOLYesNo
server.bootstrap.socket.timeoutHttp server socket timeout.15BOOLYesNo
server.bootstrap.socket.backlogTHttp server socket backlog.100BOOLYesNo
trace.log.enabledHttp traffic monitoring.falseBOOLYesNo
- -System Parameters - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Parameters
serverBootstrapBossGroupSizeproperty to configure number of boss threads, which accepts incoming connections until the ports are unbound. Once connection accepts successfully, boss thread passes the accepted channel to one of the worker threads.Number of available processorsAny integer
serverBootstrapWorkerGroupSizeproperty to configure number of worker threads, which performs non blocking read and write for one or more channels in non-blocking mode.(Number of available processors)*2Any integer
serverBootstrapClientGroupSizeproperty to configure number of client threads, which performs non blocking read and write for one or more channels in non-blocking mode.(Number of available processors)*2Any integer
defaultHostThe default host of the transport.0.0.0.0Any valid host
defaultHttpPortThe default port if the default scheme is 'http'.8280Any valid port
defaultHttpsPortThe default port if the default scheme is 'https'.8243Any valid port
defaultSchemeThe default protocol.httphttp
https
keyStoreLocationThe default keystore file path.${carbon.home}/resources/security/wso2carbon.jksPath to wso2carbon.jks file
keyStorePasswordThe default keystore password.wso2carbonString of keystore password
certPasswordThe default cert password.wso2carbonString of cert password
- -Examples -EXAMPLE 1 -``` -@source(type='http-request', source.id='sampleSourceId, receiver.url='http://localhost:9055/endpoints/RecPro', connection.timeout='150000', parameters="'ciphers : TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256', 'sslEnabledProtocols:TLSv1.1,TLSv1.2'", request.size.validation.configuration="request.size.validation:true", server.bootstrap.configuration="server.bootstrap.socket.timeout:25", @map(type='json, @attributes(messageId='trp:messageId', symbol='$.events.event.symbol', price='$.events.event.price', volume='$.events.event.volume'))) -define stream FooStream (messageId string, symbol string, price float, volume long); - -``` -

The expected input is as follows:
{"events":
    {"event":
        "symbol":WSO2,
        "price":55.6,
        "volume":100,
    }
}
If basic authentication is enabled via the basic.auth.enabled='true setting, each input event is also expected to contain the Authorization:'Basic encodeBase64(username:Password)' header.

- diff --git a/docs/api/1.0.30.md b/docs/api/1.0.30.md deleted file mode 100644 index fddb4655..00000000 --- a/docs/api/1.0.30.md +++ /dev/null @@ -1,1226 +0,0 @@ -# API Docs - v1.0.30 - -## Sink - -### http *(Sink)* - -

This extension publish the HTTP events in any HTTP method POST, GET, PUT, DELETE via HTTP or https protocols. As the additional features this component can provide basic authentication as well as user can publish events using custom client truststore files when publishing events via https protocol. And also user can add any number of headers including HTTP_METHOD header for each event dynamically.
Following content types will be set by default according to the type of sink mapper used.
You can override them by setting the new content types in headers.
     - TEXT : text/plain
     - XML : application/xml
     - JSON : application/json
     - KEYVALUE : application/x-www-form-urlencoded

- -Syntax -``` -@sink(type="http", publisher.url="", basic.auth.username="", basic.auth.password="", https.truststore.file="", https.truststore.password="", headers="", method="", socket.idle.timeout="", chunk.disabled="", ssl.protocol="", parameters="", ciphers="", ssl.enabled.protocols="", client.enable.session.creation="", follow.redirect="", max.redirect.count="", tls.store.type="", proxy.host="", proxy.port="", proxy.username="", proxy.password="", client.bootstrap.configuration="", client.bootstrap.nodelay="", client.bootstrap.keepalive="", client.bootstrap.sendbuffersize="", client.bootstrap.recievebuffersize="", client.bootstrap.connect.timeout="", client.bootstrap.socket.reuse="", client.bootstrap.socket.timeout="", client.threadpool.configurations="", client.connection.pool.count="", client.max.active.connections.per.pool="", client.min.idle.connections.per.pool="", client.max.idle.connections.per.pool="", client.min.eviction.idle.time="", sender.thread.count="", event.group.executor.thread.size="", max.wait.for.client.connection.pool="", @map(...))) -``` - -QUERY PARAMETERS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
publisher.urlThe URL to which the outgoing events should be published via HTTP. This is a mandatory parameter and if this is not specified, an error is logged in the CLI. If user wants to enable SSL for the events, use https instead of http in the publisher.url.e.g., http://localhost:8080/endpoint, https://localhost:8080/endpointSTRINGNoNo
basic.auth.usernameThe username to be included in the authentication header of the basic authentication enabled events. It is required to specify both username and password to enable basic authentication. If one of the parameter is not given by user then an error is logged in the CLI. STRINGYesNo
basic.auth.passwordThe password to include in the authentication header of the basic authentication enabled events. It is required to specify both username and password to enable basic authentication. If one of the parameter is not given by user then an error is logged in the CLI. STRINGYesNo
https.truststore.fileThe file path to the location of the truststore of the client that sends the HTTP events through 'https' protocol. A custom client-truststore can be specified if required.${carbon.home}/resources/security/client-truststore.jksSTRINGYesNo
https.truststore.passwordThe password for the client-truststore. A custom password can be specified if required. If no custom password is specified and the protocol of URL is 'https' then, the system uses default password.wso2carbonSTRINGYesNo
headersThe headers that should be included as HTTP request headers.
There can be any number of headers concatenated in following format. "'header1:value1','header2:value2'". User can include Content-Type header if he needs to use a specific content-type for the payload. Or else, system decides the Content-Type by considering the type of sink mapper, in following way.
 - @map(xml):application/xml
 - @map(json):application/json
 - @map(text):plain/text )
 - if user does not include any mapping type then the system gets 'plain/text' as default Content-Type header.
Note that providing content-length as a header is not supported. The size of the payload will be automatically calculated and included in the content-length header.
STRINGYesNo
methodFor HTTP events, HTTP_METHOD header should be included as a request header. If the parameter is null then system uses 'POST' as a default header.POSTSTRINGYesNo
socket.idle.timeoutSocket timeout value in millisecond6000INTYesNo
chunk.disabledport: Port number of the remote servicefalseBOOLYesNo
ssl.protocolThe SSL protocol versionTLSSTRINGYesNo
parametersParameters other than basics such as ciphers,sslEnabledProtocols,client.enable.session.creation. Expected format of these parameters is as follows: "'ciphers:xxx','sslEnabledProtocols,client.enable:xxx'"nullSTRINGYesNo
ciphersList of ciphers to be used. This parameter should include under parameters Ex: 'ciphers:TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256'nullSTRINGYesNo
ssl.enabled.protocolsSSL/TLS protocols to be enabled. This parameter should be in camel case format(sslEnabledProtocols) under parameters. Ex 'sslEnabledProtocols:true'nullSTRINGYesNo
client.enable.session.creationEnable HTTP session creation.This parameter should include under parameters Ex: 'client.enable.session.creation:true'nullSTRINGYesNo
follow.redirectRedirect related enabled.trueBOOLYesNo
max.redirect.countMaximum redirect count.5INTYesNo
tls.store.typeTLS store type to be used.JKSSTRINGYesNo
proxy.hostProxy server hostnullSTRINGYesNo
proxy.portProxy server portnullSTRINGYesNo
proxy.usernameProxy server usernamenullSTRINGYesNo
proxy.passwordProxy server passwordnullSTRINGYesNo
client.bootstrap.configurationClient bootsrap configurations. Expected format of these parameters is as follows: "'client.bootstrap.nodelay:xxx','client.bootstrap.keepalive:xxx'"TODOSTRINGYesNo
client.bootstrap.nodelayHttp client no delay.trueBOOLYesNo
client.bootstrap.keepaliveHttp client keep alive.trueBOOLYesNo
client.bootstrap.sendbuffersizeHttp client send buffer size.1048576INTYesNo
client.bootstrap.recievebuffersizeHttp client receive buffer size.1048576INTYesNo
client.bootstrap.connect.timeoutHttp client connection timeout.15000INTYesNo
client.bootstrap.socket.reuseTo enable http socket reuse.falseBOOLYesNo
client.bootstrap.socket.timeoutHttp client socket timeout.15STRINGYesNo
client.threadpool.configurationsThread pool configuration. Expected format of these parameters is as follows: "'client.connection.pool.count:xxx','client.max.active.connections.per.pool:xxx'"TODOSTRINGYesNo
client.connection.pool.countConnection pool count.0INTYesNo
client.max.active.connections.per.poolActive connections per pool.-1INTYesNo
client.min.idle.connections.per.poolMinimum ideal connection per pool.0INTYesNo
client.max.idle.connections.per.poolMaximum ideal connection per pool.100INTYesNo
client.min.eviction.idle.timeMinimum eviction idle time.5 * 60 * 1000STRINGYesNo
sender.thread.countHttp sender thread count.20STRINGYesNo
event.group.executor.thread.sizeEvent group executor thread size.15STRINGYesNo
max.wait.for.client.connection.poolMaximum wait for client connection pool.60000STRINGYesNo
- -System Parameters - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Parameters
clientBootstrapBossGroupSizeproperty to configure number of boss threads, which accepts incoming connections until the ports are unbound. Once connection accepts successfully, boss thread passes the accepted channel to one of the worker threads.Number of available processorsAny integer
clientBootstrapWorkerGroupSizeproperty to configure number of worker threads, which performs non blocking read and write for one or more channels in non-blocking mode.(Number of available processors)*2Any integer
clientBootstrapClientGroupSizeproperty to configure number of client threads, which performs non blocking read and write for one or more channels in non-blocking mode.(Number of available processors)*2Any integer
trustStoreLocationThe default truststore file path.${carbon.home}/resources/security/client-truststore.jksPath to client-truststore.jks
trustStorePasswordThe default truststore password.wso2carbonTruststore password
- -Examples -EXAMPLE 1 -``` -@sink(type='http',publisher.url='http://localhost:8009/foo', method='{{method}}',headers="'content-type:xml','content-length:94'", client.bootstrap.configuration="'client.bootstrap.socket.timeout:20', 'client.bootstrap.worker.group.size:10'", client.pool.configuration="'client.connection.pool.count:10','client.max.active.connections.per.pool:1'", @map(type='xml', @payload('{{payloadBody}}'))) -define stream FooStream (payloadBody String, method string, headers string); - -``` -

If it is xml mapping expected input should be in following format for FooStream:
{
<events>
    <event>
        <symbol>WSO2</symbol>
        <price>55.6</price>
        <volume>100</volume>
    </event>
</events>,
POST,
Content-Length:24#Content-Location:USA#Retry-After:120
}

Above event will generate output as below.
~Output http event payload
<events>
    <event>
        <symbol>WSO2</symbol>
        <price>55.6</price>
        <volume>100</volume>
    </event>
</events>

~Output http event headers
Content-Length:24,
Content-Location:'USA',
Retry-After:120,
Content-Type:'application/xml',
HTTP_METHOD:'POST',

~Output http event properties
HTTP_METHOD:'POST',
HOST:'localhost',
PORT:8009,
PROTOCOL:'http',
TO:'/foo'

- -### http-response *(Sink)* - -

HTTP response sink is correlated with the The HTTP request source, through a unique source.id, and it send a response to the HTTP request source having the same source.id. The response message can be formatted in text, XML or JSON and can be sent with appropriate headers.

- -Syntax -``` -@sink(type="http-response", source.id="", message.id="", headers="", @map(...))) -``` - -QUERY PARAMETERS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
source.idIdentifier of the source.STRINGNoNo
message.idIdentifier of the message.STRINGNoYes
headersThe headers that should be included as HTTP response headers. There can be any number of headers concatenated on following format. "'header1:value1','header2:value2'" User can include content-type header if he/she need to have any specific type for payload. If not system get the mapping type as the content-Type header (ie.@map(xml):application/xml, @map(json):application/json, @map(text):plain/text) and if user does not include any mapping type then system gets the plain/text as default Content-Type header. If user does not include Content-Length header then system calculate the bytes size of payload and include it as content-length header. STRINGYesNo
- -Examples -EXAMPLE 1 -``` -@sink(type='http-response', source.id='sampleSourceId', message.id='{{messageId}}', headers="'content-type:json','content-length:94'"@map(type='json', @payload('{{payloadBody}}'))) -define stream FooStream (payloadBody String, messageId string, headers string); - -``` -

If it is json mapping expected input should be in following format for FooStream:
{
{"events":
    {"event":
        "symbol":WSO2,
        "price":55.6,
        "volume":100,
    }
},
0cf708b1-7eae-440b-a93e-e72f801b486a,
Content-Length:24#Content-Location:USA
}

Above event will generate response for the matching source message as below.

~Output http event payload
{"events":
    {"event":
        "symbol":WSO2,
        "price":55.6,
        "volume":100,
    }
}

~Output http event headers
Content-Length:24,
Content-Location:'USA',
Content-Type:'application/json'

- -## Source - -### http *(Source)* - -

The HTTP source receives POST requests via HTTP or HTTPS in format such as text, XML and JSON. In WSO2 SP, if required, you can enable basic authentication to ensure that events are received only from users who are authorized to access the service.

- -Syntax -``` -@source(type="http", receiver.url="", basic.auth.enabled="", worker.count="", socket.idle.timeout="", ssl.verify.client="", ssl.protocol="", tls.store.type="", parameters="", ciphers="", ssl.enabled.protocols="", server.enable.session.creation="", server.supported.snimatchers="", server.suported.server.names="", request.size.validation.configuration="", request.size.validation="", request.size.validation.maximum.value="", request.size.validation.reject.status.code="", request.size.validation.reject.message="", request.size.validation.reject.message.content.type="", header.size.validation="", header.validation.maximum.request.line="", header.validation.maximum.size="", header.validation.maximum.chunk.size="", header.validation.reject.status.code="", header.validation.reject.message="", header.validation.reject.message.content.type="", server.bootstrap.configuration="", server.bootstrap.nodelay="", server.bootstrap.keepalive="", server.bootstrap.sendbuffersize="", server.bootstrap.recievebuffersize="", server.bootstrap.connect.timeout="", server.bootstrap.socket.reuse="", server.bootstrap.socket.timeout="", server.bootstrap.socket.backlog="", trace.log.enabled="", @map(...))) -``` - -QUERY PARAMETERS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
receiver.urlThe URL to which the events should be received. User can provide any valid url and if the url is not provided the system will use the following format http://0.0.0.0:9763/<appNAme>/<streamName>If the user want to use SSL the url should be given in following format https://localhost:8080/<streamName>http://0.0.0.0:9763//STRINGYesNo
basic.auth.enabledThis works only in WSO2 SP. If this is set to true, basic authentication is enabled for incoming events, and the credentials with which each event is sent are verified to ensure that the user is authorized to access the service. If basic authentication fails, the event is not authenticated and an authentication error is logged in the CLI.falseSTRINGYesNo
worker.countThe number of active worker threads to serve the incoming events. The value is 1 by default. This will ensure that the events are directed to the event stream in the same order in which they arrive. By increasing this value the performance might increase at the cost of loosing event ordering.1STRINGYesNo
socket.idle.timeoutIdle timeout for HTTP connection.120000INTYesNo
ssl.verify.clientThe type of client certificate verification.nullSTRINGYesNo
ssl.protocolssl/tls related optionsTLSSTRINGYesNo
tls.store.typeTLS store type.JKSSTRINGYesNo
parametersParameters other than basics such as ciphers,sslEnabledProtocols,client.enable.session.creation. Expected format of these parameters is as follows: "'ciphers:xxx','sslEnabledProtocols,client.enable:xxx'"nullSTRINGYesNo
ciphersList of ciphers to be used. This parameter should include under parameters Ex: 'ciphers:TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256'nullSTRINGYesNo
ssl.enabled.protocolsSSL/TLS protocols to be enabled. This parameter should be in camel case format(sslEnabledProtocols) under parameters. Ex 'sslEnabledProtocols:true'nullSTRINGYesNo
server.enable.session.creationEnable HTTP session creation.This parameter should include under parameters Ex: 'client.enable.session.creation:true'nullSTRINGYesNo
server.supported.snimatchersHttp SNIMatcher to be added. This parameter should include under parameters Ex: 'server.supported.snimatchers:SNIMatcher'nullSTRINGYesNo
server.suported.server.namesHttp supported servers. This parameter should include under parameters Ex: 'server.suported.server.names:server'nullSTRINGYesNo
request.size.validation.configurationParameters that responsible for validating the http request and request headers. Expected format of these parameters is as follows: "'request.size.validation:xxx','request.size.validation.maximum.value:xxx'"nullSTRINGYesNo
request.size.validationTo enable the request size validation.falseSTRINGYesNo
request.size.validation.maximum.valueIf request size is validated then maximum size.Integer.MAX_VALUESTRINGYesNo
request.size.validation.reject.status.codeIf request is exceed maximum size and request.size.validation is enabled then status code to be send as response.401STRINGYesNo
request.size.validation.reject.messageIf request is exceed maximum size and request.size.validation is enabled then status message to be send as response.Message is bigger than the valid sizeSTRINGYesNo
request.size.validation.reject.message.content.typeIf request is exceed maximum size and request.size.validation is enabled then content type to be send as response.plain/textSTRINGYesNo
header.size.validationTo enable the header size validation.falseSTRINGYesNo
header.validation.maximum.request.lineIf header header validation is enabled then the maximum request line.4096STRINGYesNo
header.validation.maximum.sizeIf header header validation is enabled then the maximum expected header size.8192STRINGYesNo
header.validation.maximum.chunk.sizeIf header header validation is enabled then the maximum expected chunk size.8192STRINGYesNo
header.validation.reject.status.code401If header is exceed maximum size and header.size.validation is enabled then status code to be send as response.STRINGYesNo
header.validation.reject.messageIf header is exceed maximum size and header.size.validation is enabled then message to be send as response.Message header is bigger than the valid sizeSTRINGYesNo
header.validation.reject.message.content.typeIf header is exceed maximum size and header.size.validation is enabled then content type to be send as response.plain/textSTRINGYesNo
server.bootstrap.configurationParameters that for bootstrap configurations of the server. Expected format of these parameters is as follows: "'ciphers:xxx','sslEnabledProtocols,client.enable:xxx'"nullOBJECTYesNo
server.bootstrap.nodelayHttp server no delay.trueBOOLYesNo
server.bootstrap.keepaliveHttp server keep alive.trueBOOLYesNo
server.bootstrap.sendbuffersizeHttp server send buffer size.1048576INTYesNo
server.bootstrap.recievebuffersizeHttp server receive buffer size.1048576INTYesNo
server.bootstrap.connect.timeoutHttp server connection timeout.15000INTYesNo
server.bootstrap.socket.reuseTo enable http socket reuse.falseBOOLYesNo
server.bootstrap.socket.timeoutHttp server socket timeout.15BOOLYesNo
server.bootstrap.socket.backlogTHttp server socket backlog.100BOOLYesNo
trace.log.enabledHttp traffic monitoring.falseBOOLYesNo
- -System Parameters - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Parameters
serverBootstrapBossGroupSizeproperty to configure number of boss threads, which accepts incoming connections until the ports are unbound. Once connection accepts successfully, boss thread passes the accepted channel to one of the worker threads.Number of available processorsAny integer
serverBootstrapWorkerGroupSizeproperty to configure number of worker threads, which performs non blocking read and write for one or more channels in non-blocking mode.(Number of available processors)*2Any integer
serverBootstrapClientGroupSizeproperty to configure number of client threads, which performs non blocking read and write for one or more channels in non-blocking mode.(Number of available processors)*2Any integer
defaultHostThe default host of the transport.0.0.0.0Any valid host
defaultHttpPortThe default port if the default scheme is 'http'.8280Any valid port
defaultHttpsPortThe default port if the default scheme is 'https'.8243Any valid port
defaultSchemeThe default protocol.httphttp
https
keyStoreLocationThe default keystore file path.${carbon.home}/resources/security/wso2carbon.jksPath to wso2carbon.jks file
keyStorePasswordThe default keystore password.wso2carbonString of keystore password
certPasswordThe default cert password.wso2carbonString of cert password
- -Examples -EXAMPLE 1 -``` -@source(type='http', receiver.url='http://localhost:9055/endpoints/RecPro', socketIdleTimeout='150000', parameters="'ciphers : TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256', 'sslEnabledProtocols:TLSv1.1,TLSv1.2'",request.size.validation.configuration="request.size.validation:true",server.bootstrap.configuration="server.bootstrap.socket.timeout:25" @map(type='xml')) -define stream FooStream (symbol string, price float, volume long); - -``` -

Above source listenerConfiguration performs a default XML input mapping. The expected input is as follows:
<events>
    <event>
        <symbol>WSO2</symbol>
        <price>55.6</price>
        <volume>100</volume>
    </event>
</events>
If basic authentication is enabled via the basic.auth.enabled='true setting, each input event is also expected to contain the Authorization:'Basic encodeBase64(username:Password)' header.

- -### http-request *(Source)* - -

The HTTP request is correlated with the HTTP response sink, through a unique source.id, and for each POST requests it receives via HTTP or HTTPS in format such as text, XML and JSON it sends the response via the HTTP response sink. The individual request and response messages are correlated at the sink using the message.id of the events. If required, you can enable basic authentication at the source to ensure that events are received only from users who are authorized to access the service.

- -Syntax -``` -@source(type="http-request", receiver.url="", source.id="", connection.timeout="", basic.auth.enabled="", worker.count="", socket.idle.timeout="", ssl.verify.client="", ssl.protocol="", tls.store.type="", parameters="", ciphers="", ssl.enabled.protocols="", server.enable.session.creation="", server.supported.snimatchers="", server.suported.server.names="", request.size.validation.configuration="", request.size.validation="", request.size.validation.maximum.value="", request.size.validation.reject.status.code="", request.size.validation.reject.message="", request.size.validation.reject.message.content.type="", header.size.validation="", header.validation.maximum.request.line="", header.validation.maximum.size="", header.validation.maximum.chunk.size="", header.validation.reject.status.code="", header.validation.reject.message="", header.validation.reject.message.content.type="", server.bootstrap.configuration="", server.bootstrap.nodelay="", server.bootstrap.keepalive="", server.bootstrap.sendbuffersize="", server.bootstrap.recievebuffersize="", server.bootstrap.connect.timeout="", server.bootstrap.socket.reuse="", server.bootstrap.socket.timeout="", server.bootstrap.socket.backlog="", trace.log.enabled="", @map(...))) -``` - -QUERY PARAMETERS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
receiver.urlThe URL to which the events should be received. User can provide any valid url and if the url is not provided the system will use the following format http://0.0.0.0:9763/<appNAme>/<streamName>If the user want to use SSL the url should be given in following format https://localhost:8080/<streamName>http://0.0.0.0:9763//STRINGYesNo
source.idIdentifier need to map the source to sink.STRINGNoNo
connection.timeoutConnection timeout in milliseconds. If the mapped http-response sink does not get a correlated message, after this timeout value, a timeout response is sent120000INTYesNo
basic.auth.enabledIf this is set to true, basic authentication is enabled for incoming events, and the credentials with which each event is sent are verified to ensure that the user is authorized to access the service. If basic authentication fails, the event is not authenticated and an authentication error is logged in the CLI. By default this values 'false' falseSTRINGYesNo
worker.countThe number of active worker threads to serve the incoming events. The value is 1 by default. This will ensure that the events are directed to the event stream in the same order in which they arrive. By increasing this value the performance might increase at the cost of loosing event ordering.1STRINGYesNo
socket.idle.timeoutIdle timeout for HTTP connection.120000INTYesNo
ssl.verify.clientThe type of client certificate verification.nullSTRINGYesNo
ssl.protocolssl/tls related optionsTLSSTRINGYesNo
tls.store.typeTLS store type.JKSSTRINGYesNo
parametersParameters other than basics such as ciphers,sslEnabledProtocols,client.enable.session.creation. Expected format of these parameters is as follows: "'ciphers:xxx','sslEnabledProtocols,client.enable:xxx'"nullSTRINGYesNo
ciphersList of ciphers to be used. This parameter should include under parameters Ex: 'ciphers:TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256'nullSTRINGYesNo
ssl.enabled.protocolsSSL/TLS protocols to be enabled. This parameter should be in camel case format(sslEnabledProtocols) under parameters. Ex 'sslEnabledProtocols:true'nullSTRINGYesNo
server.enable.session.creationEnable HTTP session creation.This parameter should include under parameters Ex: 'client.enable.session.creation:true'nullSTRINGYesNo
server.supported.snimatchersHttp SNIMatcher to be added. This parameter should include under parameters Ex: 'server.supported.snimatchers:SNIMatcher'nullSTRINGYesNo
server.suported.server.namesHttp supported servers. This parameter should include under parameters Ex: 'server.suported.server.names:server'nullSTRINGYesNo
request.size.validation.configurationParameters that responsible for validating the http request and request headers. Expected format of these parameters is as follows: "'request.size.validation:xxx','request.size.validation.maximum.value:xxx'"nullSTRINGYesNo
request.size.validationTo enable the request size validation.falseSTRINGYesNo
request.size.validation.maximum.valueIf request size is validated then maximum size.Integer.MAX_VALUESTRINGYesNo
request.size.validation.reject.status.codeIf request is exceed maximum size and request.size.validation is enabled then status code to be send as response.401STRINGYesNo
request.size.validation.reject.messageIf request is exceed maximum size and request.size.validation is enabled then status message to be send as response.Message is bigger than the valid sizeSTRINGYesNo
request.size.validation.reject.message.content.typeIf request is exceed maximum size and request.size.validation is enabled then content type to be send as response.plain/textSTRINGYesNo
header.size.validationTo enable the header size validation.falseSTRINGYesNo
header.validation.maximum.request.lineIf header header validation is enabled then the maximum request line.4096STRINGYesNo
header.validation.maximum.sizeIf header header validation is enabled then the maximum expected header size.8192STRINGYesNo
header.validation.maximum.chunk.sizeIf header header validation is enabled then the maximum expected chunk size.8192STRINGYesNo
header.validation.reject.status.code401If header is exceed maximum size and header.size.validation is enabled then status code to be send as response.STRINGYesNo
header.validation.reject.messageIf header is exceed maximum size and header.size.validation is enabled then message to be send as response.Message header is bigger than the valid sizeSTRINGYesNo
header.validation.reject.message.content.typeIf header is exceed maximum size and header.size.validation is enabled then content type to be send as response.plain/textSTRINGYesNo
server.bootstrap.configurationParameters that for bootstrap configurations of the server. Expected format of these parameters is as follows: "'ciphers:xxx','sslEnabledProtocols,client.enable:xxx'"nullOBJECTYesNo
server.bootstrap.nodelayHttp server no delay.trueBOOLYesNo
server.bootstrap.keepaliveHttp server keep alive.trueBOOLYesNo
server.bootstrap.sendbuffersizeHttp server send buffer size.1048576INTYesNo
server.bootstrap.recievebuffersizeHttp server receive buffer size.1048576INTYesNo
server.bootstrap.connect.timeoutHttp server connection timeout.15000INTYesNo
server.bootstrap.socket.reuseTo enable http socket reuse.falseBOOLYesNo
server.bootstrap.socket.timeoutHttp server socket timeout.15BOOLYesNo
server.bootstrap.socket.backlogTHttp server socket backlog.100BOOLYesNo
trace.log.enabledHttp traffic monitoring.falseBOOLYesNo
- -System Parameters - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Parameters
serverBootstrapBossGroupSizeproperty to configure number of boss threads, which accepts incoming connections until the ports are unbound. Once connection accepts successfully, boss thread passes the accepted channel to one of the worker threads.Number of available processorsAny integer
serverBootstrapWorkerGroupSizeproperty to configure number of worker threads, which performs non blocking read and write for one or more channels in non-blocking mode.(Number of available processors)*2Any integer
serverBootstrapClientGroupSizeproperty to configure number of client threads, which performs non blocking read and write for one or more channels in non-blocking mode.(Number of available processors)*2Any integer
defaultHostThe default host of the transport.0.0.0.0Any valid host
defaultHttpPortThe default port if the default scheme is 'http'.8280Any valid port
defaultHttpsPortThe default port if the default scheme is 'https'.8243Any valid port
defaultSchemeThe default protocol.httphttp
https
keyStoreLocationThe default keystore file path.${carbon.home}/resources/security/wso2carbon.jksPath to wso2carbon.jks file
keyStorePasswordThe default keystore password.wso2carbonString of keystore password
certPasswordThe default cert password.wso2carbonString of cert password
- -Examples -EXAMPLE 1 -``` -@source(type='http-request', source.id='sampleSourceId, receiver.url='http://localhost:9055/endpoints/RecPro', connection.timeout='150000', parameters="'ciphers : TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256', 'sslEnabledProtocols:TLSv1.1,TLSv1.2'", request.size.validation.configuration="request.size.validation:true", server.bootstrap.configuration="server.bootstrap.socket.timeout:25", @map(type='json, @attributes(messageId='trp:messageId', symbol='$.events.event.symbol', price='$.events.event.price', volume='$.events.event.volume'))) -define stream FooStream (messageId string, symbol string, price float, volume long); - -``` -

The expected input is as follows:
{"events":
    {"event":
        "symbol":WSO2,
        "price":55.6,
        "volume":100,
    }
}
If basic authentication is enabled via the basic.auth.enabled='true setting, each input event is also expected to contain the Authorization:'Basic encodeBase64(username:Password)' header.

- diff --git a/docs/api/1.0.31.md b/docs/api/1.0.31.md deleted file mode 100644 index 34cd1d3a..00000000 --- a/docs/api/1.0.31.md +++ /dev/null @@ -1,1665 +0,0 @@ -# API Docs - v1.0.31 - -## Sink - -### http *(Sink)* - -

This extension publish the HTTP events in any HTTP method POST, GET, PUT, DELETE via HTTP or https protocols. As the additional features this component can provide basic authentication as well as user can publish events using custom client truststore files when publishing events via https protocol. And also user can add any number of headers including HTTP_METHOD header for each event dynamically.
Following content types will be set by default according to the type of sink mapper used.
You can override them by setting the new content types in headers.
     - TEXT : text/plain
     - XML : application/xml
     - JSON : application/json
     - KEYVALUE : application/x-www-form-urlencoded

- -Syntax -``` -@sink(type="http", publisher.url="", basic.auth.username="", basic.auth.password="", https.truststore.file="", https.truststore.password="", headers="", method="", socket.idle.timeout="", chunk.disabled="", ssl.protocol="", parameters="", ciphers="", ssl.enabled.protocols="", client.enable.session.creation="", follow.redirect="", max.redirect.count="", tls.store.type="", proxy.host="", proxy.port="", proxy.username="", proxy.password="", client.bootstrap.configuration="", client.bootstrap.nodelay="", client.bootstrap.keepalive="", client.bootstrap.sendbuffersize="", client.bootstrap.recievebuffersize="", client.bootstrap.connect.timeout="", client.bootstrap.socket.reuse="", client.bootstrap.socket.timeout="", client.threadpool.configurations="", client.connection.pool.count="", client.max.active.connections.per.pool="", client.min.idle.connections.per.pool="", client.max.idle.connections.per.pool="", client.min.eviction.idle.time="", sender.thread.count="", event.group.executor.thread.size="", max.wait.for.client.connection.pool="", @map(...))) -``` - -QUERY PARAMETERS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
publisher.urlThe URL to which the outgoing events should be published via HTTP. This is a mandatory parameter and if this is not specified, an error is logged in the CLI. If user wants to enable SSL for the events, use https instead of http in the publisher.url.e.g., http://localhost:8080/endpoint, https://localhost:8080/endpointSTRINGNoNo
basic.auth.usernameThe username to be included in the authentication header of the basic authentication enabled events. It is required to specify both username and password to enable basic authentication. If one of the parameter is not given by user then an error is logged in the CLI. STRINGYesNo
basic.auth.passwordThe password to include in the authentication header of the basic authentication enabled events. It is required to specify both username and password to enable basic authentication. If one of the parameter is not given by user then an error is logged in the CLI. STRINGYesNo
https.truststore.fileThe file path to the location of the truststore of the client that sends the HTTP events through 'https' protocol. A custom client-truststore can be specified if required.${carbon.home}/resources/security/client-truststore.jksSTRINGYesNo
https.truststore.passwordThe password for the client-truststore. A custom password can be specified if required. If no custom password is specified and the protocol of URL is 'https' then, the system uses default password.wso2carbonSTRINGYesNo
headersThe headers that should be included as HTTP request headers.
There can be any number of headers concatenated in following format. "'header1:value1','header2:value2'". User can include Content-Type header if he needs to use a specific content-type for the payload. Or else, system decides the Content-Type by considering the type of sink mapper, in following way.
 - @map(xml):application/xml
 - @map(json):application/json
 - @map(text):plain/text )
 - if user does not include any mapping type then the system gets 'plain/text' as default Content-Type header.
Note that providing content-length as a header is not supported. The size of the payload will be automatically calculated and included in the content-length header.
STRINGYesNo
methodFor HTTP events, HTTP_METHOD header should be included as a request header. If the parameter is null then system uses 'POST' as a default header.POSTSTRINGYesNo
socket.idle.timeoutSocket timeout value in millisecond6000INTYesNo
chunk.disabledport: Port number of the remote servicefalseBOOLYesNo
ssl.protocolThe SSL protocol versionTLSSTRINGYesNo
parametersParameters other than basics such as ciphers,sslEnabledProtocols,client.enable.session.creation. Expected format of these parameters is as follows: "'ciphers:xxx','sslEnabledProtocols,client.enable:xxx'"nullSTRINGYesNo
ciphersList of ciphers to be used. This parameter should include under parameters Ex: 'ciphers:TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256'nullSTRINGYesNo
ssl.enabled.protocolsSSL/TLS protocols to be enabled. This parameter should be in camel case format(sslEnabledProtocols) under parameters. Ex 'sslEnabledProtocols:true'nullSTRINGYesNo
client.enable.session.creationEnable HTTP session creation.This parameter should include under parameters Ex: 'client.enable.session.creation:true'nullSTRINGYesNo
follow.redirectRedirect related enabled.trueBOOLYesNo
max.redirect.countMaximum redirect count.5INTYesNo
tls.store.typeTLS store type to be used.JKSSTRINGYesNo
proxy.hostProxy server hostnullSTRINGYesNo
proxy.portProxy server portnullSTRINGYesNo
proxy.usernameProxy server usernamenullSTRINGYesNo
proxy.passwordProxy server passwordnullSTRINGYesNo
client.bootstrap.configurationClient bootsrap configurations. Expected format of these parameters is as follows: "'client.bootstrap.nodelay:xxx','client.bootstrap.keepalive:xxx'"TODOSTRINGYesNo
client.bootstrap.nodelayHttp client no delay.trueBOOLYesNo
client.bootstrap.keepaliveHttp client keep alive.trueBOOLYesNo
client.bootstrap.sendbuffersizeHttp client send buffer size.1048576INTYesNo
client.bootstrap.recievebuffersizeHttp client receive buffer size.1048576INTYesNo
client.bootstrap.connect.timeoutHttp client connection timeout.15000INTYesNo
client.bootstrap.socket.reuseTo enable http socket reuse.falseBOOLYesNo
client.bootstrap.socket.timeoutHttp client socket timeout.15STRINGYesNo
client.threadpool.configurationsThread pool configuration. Expected format of these parameters is as follows: "'client.connection.pool.count:xxx','client.max.active.connections.per.pool:xxx'"TODOSTRINGYesNo
client.connection.pool.countConnection pool count.0INTYesNo
client.max.active.connections.per.poolActive connections per pool.-1INTYesNo
client.min.idle.connections.per.poolMinimum ideal connection per pool.0INTYesNo
client.max.idle.connections.per.poolMaximum ideal connection per pool.100INTYesNo
client.min.eviction.idle.timeMinimum eviction idle time.5 * 60 * 1000STRINGYesNo
sender.thread.countHttp sender thread count.20STRINGYesNo
event.group.executor.thread.sizeEvent group executor thread size.15STRINGYesNo
max.wait.for.client.connection.poolMaximum wait for client connection pool.60000STRINGYesNo
- -System Parameters - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Parameters
clientBootstrapBossGroupSizeproperty to configure number of boss threads, which accepts incoming connections until the ports are unbound. Once connection accepts successfully, boss thread passes the accepted channel to one of the worker threads.Number of available processorsAny integer
clientBootstrapWorkerGroupSizeproperty to configure number of worker threads, which performs non blocking read and write for one or more channels in non-blocking mode.(Number of available processors)*2Any integer
clientBootstrapClientGroupSizeproperty to configure number of client threads, which performs non blocking read and write for one or more channels in non-blocking mode.(Number of available processors)*2Any integer
trustStoreLocationThe default truststore file path.${carbon.home}/resources/security/client-truststore.jksPath to client-truststore.jks
trustStorePasswordThe default truststore password.wso2carbonTruststore password
- -Examples -EXAMPLE 1 -``` -@sink(type='http',publisher.url='http://localhost:8009/foo', method='{{method}}',headers="'content-type:xml','content-length:94'", client.bootstrap.configuration="'client.bootstrap.socket.timeout:20', 'client.bootstrap.worker.group.size:10'", client.pool.configuration="'client.connection.pool.count:10','client.max.active.connections.per.pool:1'", @map(type='xml', @payload('{{payloadBody}}'))) -define stream FooStream (payloadBody String, method string, headers string); - -``` -

If it is xml mapping expected input should be in following format for FooStream:
{
<events>
    <event>
        <symbol>WSO2</symbol>
        <price>55.6</price>
        <volume>100</volume>
    </event>
</events>,
POST,
Content-Length:24#Content-Location:USA#Retry-After:120
}

Above event will generate output as below.
~Output http event payload
<events>
    <event>
        <symbol>WSO2</symbol>
        <price>55.6</price>
        <volume>100</volume>
    </event>
</events>

~Output http event headers
Content-Length:24,
Content-Location:'USA',
Retry-After:120,
Content-Type:'application/xml',
HTTP_METHOD:'POST',

~Output http event properties
HTTP_METHOD:'POST',
HOST:'localhost',
PORT:8009,
PROTOCOL:'http',
TO:'/foo'

- -### http-request *(Sink)* - -

This extension publish the HTTP events in any HTTP method POST, GET, PUT, DELETE via HTTP or https protocols. As the additional features this component can provide basic authentication as well as user can publish events using custom client truststore files when publishing events via https protocol. And also user can add any number of headers including HTTP_METHOD header for each event dynamically.
Following content types will be set by default according to the type of sink mapper used.
You can override them by setting the new content types in headers.
     - TEXT : text/plain
     - XML : application/xml
     - JSON : application/json
     - KEYVALUE : application/x-www-form-urlencoded

HTTP request sink is correlated with the The HTTP reponse source, through a unique sink.id.It sends the request to the defined url and the response is received by the response source which has the same 'sink.id'.

- -Syntax -``` -@sink(type="http-request", publisher.url="", basic.auth.username="", basic.auth.password="", https.truststore.file="", https.truststore.password="", headers="", method="", socket.idle.timeout="", chunk.disabled="", ssl.protocol="", parameters="", ciphers="", ssl.enabled.protocols="", client.enable.session.creation="", follow.redirect="", max.redirect.count="", tls.store.type="", proxy.host="", proxy.port="", proxy.username="", proxy.password="", client.bootstrap.configuration="", client.bootstrap.nodelay="", client.bootstrap.keepalive="", client.bootstrap.sendbuffersize="", client.bootstrap.recievebuffersize="", client.bootstrap.connect.timeout="", client.bootstrap.socket.reuse="", client.bootstrap.socket.timeout="", client.threadpool.configurations="", client.connection.pool.count="", client.max.active.connections.per.pool="", client.min.idle.connections.per.pool="", client.max.idle.connections.per.pool="", client.min.eviction.idle.time="", sender.thread.count="", event.group.executor.thread.size="", max.wait.for.client.connection.pool="", sink.id="", downloading.enabled="", download.path="", @map(...))) -``` - -QUERY PARAMETERS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
publisher.urlThe URL to which the outgoing events should be published via HTTP. This is a mandatory parameter and if this is not specified, an error is logged in the CLI. If user wants to enable SSL for the events, use https instead of http in the publisher.url.
e.g., http://localhost:8080/endpoint, https://localhost:8080/endpoint
This can be used as a dynamic parameter as well.
STRINGNoYes
basic.auth.usernameThe username to be included in the authentication header of the basic authentication enabled events. It is required to specify both username and password to enable basic authentication. If one of the parameter is not given by user then an error is logged in the CLI. STRINGYesNo
basic.auth.passwordThe password to include in the authentication header of the basic authentication enabled events. It is required to specify both username and password to enable basic authentication. If one of the parameter is not given by user then an error is logged in the CLI. STRINGYesNo
https.truststore.fileThe file path to the location of the truststore of the client that sends the HTTP events through 'https' protocol. A custom client-truststore can be specified if required.${carbon.home}/resources/security/client-truststore.jksSTRINGYesNo
https.truststore.passwordThe password for the client-truststore. A custom password can be specified if required. If no custom password is specified and the protocol of URL is 'https' then, the system uses default password.wso2carbonSTRINGYesNo
headersThe headers that should be included as HTTP request headers.
There can be any number of headers concatenated in following format. "'header1:value1','header2:value2'". User can include Content-Type header if he needs to use a specific content-type for the payload. Or else, system decides the Content-Type by considering the type of sink mapper, in following way.
 - @map(xml):application/xml
 - @map(json):application/json
 - @map(text):plain/text )
 - if user does not include any mapping type then the system gets 'plain/text' as default Content-Type header.
Note that providing content-length as a header is not supported. The size of the payload will be automatically calculated and included in the content-length header.
STRINGYesNo
methodFor HTTP events, HTTP_METHOD header should be included as a request header. If the parameter is null then system uses 'POST' as a default header.POSTSTRINGYesNo
socket.idle.timeoutSocket timeout value in millisecond6000INTYesNo
chunk.disabledport: Port number of the remote servicefalseBOOLYesNo
ssl.protocolThe SSL protocol versionTLSSTRINGYesNo
parametersParameters other than basics such as ciphers,sslEnabledProtocols,client.enable.session.creation. Expected format of these parameters is as follows: "'ciphers:xxx','sslEnabledProtocols,client.enable:xxx'"nullSTRINGYesNo
ciphersList of ciphers to be used. This parameter should include under parameters Ex: 'ciphers:TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256'nullSTRINGYesNo
ssl.enabled.protocolsSSL/TLS protocols to be enabled. This parameter should be in camel case format(sslEnabledProtocols) under parameters. Ex 'sslEnabledProtocols:true'nullSTRINGYesNo
client.enable.session.creationEnable HTTP session creation.This parameter should include under parameters Ex: 'client.enable.session.creation:true'nullSTRINGYesNo
follow.redirectRedirect related enabled.trueBOOLYesNo
max.redirect.countMaximum redirect count.5INTYesNo
tls.store.typeTLS store type to be used.JKSSTRINGYesNo
proxy.hostProxy server hostnullSTRINGYesNo
proxy.portProxy server portnullSTRINGYesNo
proxy.usernameProxy server usernamenullSTRINGYesNo
proxy.passwordProxy server passwordnullSTRINGYesNo
client.bootstrap.configurationClient bootsrap configurations. Expected format of these parameters is as follows: "'client.bootstrap.nodelay:xxx','client.bootstrap.keepalive:xxx'"TODOSTRINGYesNo
client.bootstrap.nodelayHttp client no delay.trueBOOLYesNo
client.bootstrap.keepaliveHttp client keep alive.trueBOOLYesNo
client.bootstrap.sendbuffersizeHttp client send buffer size.1048576INTYesNo
client.bootstrap.recievebuffersizeHttp client receive buffer size.1048576INTYesNo
client.bootstrap.connect.timeoutHttp client connection timeout.15000INTYesNo
client.bootstrap.socket.reuseTo enable http socket reuse.falseBOOLYesNo
client.bootstrap.socket.timeoutHttp client socket timeout.15STRINGYesNo
client.threadpool.configurationsThread pool configuration. Expected format of these parameters is as follows: "'client.connection.pool.count:xxx','client.max.active.connections.per.pool:xxx'"TODOSTRINGYesNo
client.connection.pool.countConnection pool count.0INTYesNo
client.max.active.connections.per.poolActive connections per pool.-1INTYesNo
client.min.idle.connections.per.poolMinimum ideal connection per pool.0INTYesNo
client.max.idle.connections.per.poolMaximum ideal connection per pool.100INTYesNo
client.min.eviction.idle.timeMinimum eviction idle time.5 * 60 * 1000STRINGYesNo
sender.thread.countHttp sender thread count.20STRINGYesNo
event.group.executor.thread.sizeEvent group executor thread size.15STRINGYesNo
max.wait.for.client.connection.poolMaximum wait for client connection pool.60000STRINGYesNo
sink.idIdentifier of the sink. This is used to co-relate with the corresponding http-response source which needs to process the repose for the request sent by this sink.STRINGNoNo
downloading.enabledIf this is set to 'true' then the response received by the response source will be written to a file. If downloading is enabled, the download.path parameter is mandatory.falseBOOLYesNo
download.pathIf downloading is enabled, the path of the file which is going to be downloaded should be specified using 'download.path' parameter. This should be an absolute path including the file name.nullSTRINGYesYes
- -Examples -EXAMPLE 1 -``` -@sink(type='http-request', sink.id='foo', publisher.url='http://localhost:8009/foo', @map(type='xml', @payload('{{payloadBody}}'))) -define stream FooStream (payloadBody String, method string, headers string); -@source(type='http-response', sink.id='foo', http.status.code='2\\d+', -@map(type='text', regex.A='((.|\n)*)', @attributes(headers='trp:headers', fileName='A[1]'))) -define stream responseStream2xx(fileName string, headers string); - -@source(type='http-response', sink.id='foo', http.status.code='4\\d+', -@map(type='text', regex.A='((.|\n)*)', @attributes(errorMsg='A[1]'))) -define stream responseStream4xx(errorMsg string); -``` -

In above example, the payload body for 'FooStream' will be in following format.
{
<events>
    <event>
        <symbol>WSO2</symbol>
        <price>55.6</price>
        <volume>100</volume>
    </event>
</events>,
This message will sent as the body of a POST request with the content-type 'application/xml' to the endpoint defined as the 'publisher.url' and in order to process the responses for these requests, there should be a source of type 'http-response' defined with the same sink id 'foo' in the siddhi app.
The responses with 2xx status codes will be received by the http-response source which has the http.status.code defined by the regex '2\\d+'.
If the response has a 4xx status code, it will be received by the http-response source which has the http.status.code defined by the regex '4\\d+'.

- -EXAMPLE 2 -``` -define stream FooStream (name String, id int, headers String, downloadPath string); -@sink(type='http-request', -downloading.enabled='true', -download.path='{{downloadPath}}',publisher.url='http://localhost:8005/files', -method='GET', headers='{{headers}}',sink.id='download-sink', -@map(type='json')) -define stream BarStream (name String, id int, headers String, downloadPath string); - -@source(type='http-response', sink.id='download-sink', http.status.code='2\\d+', -@map(type='text', regex.A='((.|\n)*)', @attributes(headers='trp:headers', fileName='A[1]'))) -define stream responseStream2xx(fileName string, headers string); - -@source(type='http-response', sink.id='download-sink', http.status.code='4\\d+', -@map(type='text', regex.A='((.|\n)*)', @attributes(errorMsg='A[1]'))) -define stream responseStream4xx(errorMsg string); -``` -

In above example, http-request sink will send a GET request to the publisher url and the requested file will be received as the response by a corresponding http-response source.
If the http status code of the response is a successful one (2xx), it will be received by the http-response source which has the http.status.code '2\\d+' and downloaded as a local file. Then the event received to the responseStream2xx will have the headers included in the request and the downloaded file name.
If the http status code of the response is a 4xx code, it will be received by the http-response source which has the http.status.code '4\\d+'. Then the event received to the responseStream4xx will have the response message body in text format.

- -### http-response *(Sink)* - -

HTTP response sink is correlated with the The HTTP request source, through a unique source.id, and it send a response to the HTTP request source having the same source.id. The response message can be formatted in text, XML or JSON and can be sent with appropriate headers.

- -Syntax -``` -@sink(type="http-response", source.id="", message.id="", headers="", @map(...))) -``` - -QUERY PARAMETERS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
source.idIdentifier of the source.STRINGNoNo
message.idIdentifier of the message.STRINGNoYes
headersThe headers that should be included as HTTP response headers. There can be any number of headers concatenated on following format. "'header1:value1','header2:value2'" User can include content-type header if he/she need to have any specific type for payload. If not system get the mapping type as the content-Type header (ie.@map(xml):application/xml, @map(json):application/json, @map(text):plain/text) and if user does not include any mapping type then system gets the plain/text as default Content-Type header. If user does not include Content-Length header then system calculate the bytes size of payload and include it as content-length header. STRINGYesNo
- -Examples -EXAMPLE 1 -``` -@sink(type='http-response', source.id='sampleSourceId', message.id='{{messageId}}', headers="'content-type:json','content-length:94'"@map(type='json', @payload('{{payloadBody}}'))) -define stream FooStream (payloadBody String, messageId string, headers string); - -``` -

If it is json mapping expected input should be in following format for FooStream:
{
{"events":
    {"event":
        "symbol":WSO2,
        "price":55.6,
        "volume":100,
    }
},
0cf708b1-7eae-440b-a93e-e72f801b486a,
Content-Length:24#Content-Location:USA
}

Above event will generate response for the matching source message as below.

~Output http event payload
{"events":
    {"event":
        "symbol":WSO2,
        "price":55.6,
        "volume":100,
    }
}

~Output http event headers
Content-Length:24,
Content-Location:'USA',
Content-Type:'application/json'

- -## Source - -### http *(Source)* - -

The HTTP source receives POST requests via HTTP or HTTPS in format such as text, XML and JSON. In WSO2 SP, if required, you can enable basic authentication to ensure that events are received only from users who are authorized to access the service.

- -Syntax -``` -@source(type="http", receiver.url="", basic.auth.enabled="", worker.count="", socket.idle.timeout="", ssl.verify.client="", ssl.protocol="", tls.store.type="", parameters="", ciphers="", ssl.enabled.protocols="", server.enable.session.creation="", server.supported.snimatchers="", server.suported.server.names="", request.size.validation.configuration="", request.size.validation="", request.size.validation.maximum.value="", request.size.validation.reject.status.code="", request.size.validation.reject.message="", request.size.validation.reject.message.content.type="", header.size.validation="", header.validation.maximum.request.line="", header.validation.maximum.size="", header.validation.maximum.chunk.size="", header.validation.reject.status.code="", header.validation.reject.message="", header.validation.reject.message.content.type="", server.bootstrap.configuration="", server.bootstrap.nodelay="", server.bootstrap.keepalive="", server.bootstrap.sendbuffersize="", server.bootstrap.recievebuffersize="", server.bootstrap.connect.timeout="", server.bootstrap.socket.reuse="", server.bootstrap.socket.timeout="", server.bootstrap.socket.backlog="", trace.log.enabled="", @map(...))) -``` - -QUERY PARAMETERS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
receiver.urlThe URL to which the events should be received. User can provide any valid url and if the url is not provided the system will use the following format http://0.0.0.0:9763/<appNAme>/<streamName>If the user want to use SSL the url should be given in following format https://localhost:8080/<streamName>http://0.0.0.0:9763//STRINGYesNo
basic.auth.enabledThis works only in WSO2 SP. If this is set to true, basic authentication is enabled for incoming events, and the credentials with which each event is sent are verified to ensure that the user is authorized to access the service. If basic authentication fails, the event is not authenticated and an authentication error is logged in the CLI.falseSTRINGYesNo
worker.countThe number of active worker threads to serve the incoming events. The value is 1 by default. This will ensure that the events are directed to the event stream in the same order in which they arrive. By increasing this value the performance might increase at the cost of loosing event ordering.1STRINGYesNo
socket.idle.timeoutIdle timeout for HTTP connection.120000INTYesNo
ssl.verify.clientThe type of client certificate verification.nullSTRINGYesNo
ssl.protocolssl/tls related optionsTLSSTRINGYesNo
tls.store.typeTLS store type.JKSSTRINGYesNo
parametersParameters other than basics such as ciphers,sslEnabledProtocols,client.enable.session.creation. Expected format of these parameters is as follows: "'ciphers:xxx','sslEnabledProtocols,client.enable:xxx'"nullSTRINGYesNo
ciphersList of ciphers to be used. This parameter should include under parameters Ex: 'ciphers:TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256'nullSTRINGYesNo
ssl.enabled.protocolsSSL/TLS protocols to be enabled. This parameter should be in camel case format(sslEnabledProtocols) under parameters. Ex 'sslEnabledProtocols:true'nullSTRINGYesNo
server.enable.session.creationEnable HTTP session creation.This parameter should include under parameters Ex: 'client.enable.session.creation:true'nullSTRINGYesNo
server.supported.snimatchersHttp SNIMatcher to be added. This parameter should include under parameters Ex: 'server.supported.snimatchers:SNIMatcher'nullSTRINGYesNo
server.suported.server.namesHttp supported servers. This parameter should include under parameters Ex: 'server.suported.server.names:server'nullSTRINGYesNo
request.size.validation.configurationParameters that responsible for validating the http request and request headers. Expected format of these parameters is as follows: "'request.size.validation:xxx','request.size.validation.maximum.value:xxx'"nullSTRINGYesNo
request.size.validationTo enable the request size validation.falseSTRINGYesNo
request.size.validation.maximum.valueIf request size is validated then maximum size.Integer.MAX_VALUESTRINGYesNo
request.size.validation.reject.status.codeIf request is exceed maximum size and request.size.validation is enabled then status code to be send as response.401STRINGYesNo
request.size.validation.reject.messageIf request is exceed maximum size and request.size.validation is enabled then status message to be send as response.Message is bigger than the valid sizeSTRINGYesNo
request.size.validation.reject.message.content.typeIf request is exceed maximum size and request.size.validation is enabled then content type to be send as response.plain/textSTRINGYesNo
header.size.validationTo enable the header size validation.falseSTRINGYesNo
header.validation.maximum.request.lineIf header header validation is enabled then the maximum request line.4096STRINGYesNo
header.validation.maximum.sizeIf header header validation is enabled then the maximum expected header size.8192STRINGYesNo
header.validation.maximum.chunk.sizeIf header header validation is enabled then the maximum expected chunk size.8192STRINGYesNo
header.validation.reject.status.code401If header is exceed maximum size and header.size.validation is enabled then status code to be send as response.STRINGYesNo
header.validation.reject.messageIf header is exceed maximum size and header.size.validation is enabled then message to be send as response.Message header is bigger than the valid sizeSTRINGYesNo
header.validation.reject.message.content.typeIf header is exceed maximum size and header.size.validation is enabled then content type to be send as response.plain/textSTRINGYesNo
server.bootstrap.configurationParameters that for bootstrap configurations of the server. Expected format of these parameters is as follows: "'ciphers:xxx','sslEnabledProtocols,client.enable:xxx'"nullOBJECTYesNo
server.bootstrap.nodelayHttp server no delay.trueBOOLYesNo
server.bootstrap.keepaliveHttp server keep alive.trueBOOLYesNo
server.bootstrap.sendbuffersizeHttp server send buffer size.1048576INTYesNo
server.bootstrap.recievebuffersizeHttp server receive buffer size.1048576INTYesNo
server.bootstrap.connect.timeoutHttp server connection timeout.15000INTYesNo
server.bootstrap.socket.reuseTo enable http socket reuse.falseBOOLYesNo
server.bootstrap.socket.timeoutHttp server socket timeout.15BOOLYesNo
server.bootstrap.socket.backlogTHttp server socket backlog.100BOOLYesNo
trace.log.enabledHttp traffic monitoring.falseBOOLYesNo
- -System Parameters - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Parameters
serverBootstrapBossGroupSizeproperty to configure number of boss threads, which accepts incoming connections until the ports are unbound. Once connection accepts successfully, boss thread passes the accepted channel to one of the worker threads.Number of available processorsAny integer
serverBootstrapWorkerGroupSizeproperty to configure number of worker threads, which performs non blocking read and write for one or more channels in non-blocking mode.(Number of available processors)*2Any integer
serverBootstrapClientGroupSizeproperty to configure number of client threads, which performs non blocking read and write for one or more channels in non-blocking mode.(Number of available processors)*2Any integer
defaultHostThe default host of the transport.0.0.0.0Any valid host
defaultHttpPortThe default port if the default scheme is 'http'.8280Any valid port
defaultHttpsPortThe default port if the default scheme is 'https'.8243Any valid port
defaultSchemeThe default protocol.httphttp
https
keyStoreLocationThe default keystore file path.${carbon.home}/resources/security/wso2carbon.jksPath to wso2carbon.jks file
keyStorePasswordThe default keystore password.wso2carbonString of keystore password
certPasswordThe default cert password.wso2carbonString of cert password
- -Examples -EXAMPLE 1 -``` -@source(type='http', receiver.url='http://localhost:9055/endpoints/RecPro', socketIdleTimeout='150000', parameters="'ciphers : TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256', 'sslEnabledProtocols:TLSv1.1,TLSv1.2'",request.size.validation.configuration="request.size.validation:true",server.bootstrap.configuration="server.bootstrap.socket.timeout:25" @map(type='xml')) -define stream FooStream (symbol string, price float, volume long); - -``` -

Above source listenerConfiguration performs a default XML input mapping. The expected input is as follows:
<events>
    <event>
        <symbol>WSO2</symbol>
        <price>55.6</price>
        <volume>100</volume>
    </event>
</events>
If basic authentication is enabled via the basic.auth.enabled='true setting, each input event is also expected to contain the Authorization:'Basic encodeBase64(username:Password)' header.

- -### http-request *(Source)* - -

The HTTP request is correlated with the HTTP response sink, through a unique source.id, and for each POST requests it receives via HTTP or HTTPS in format such as text, XML and JSON it sends the response via the HTTP response sink. The individual request and response messages are correlated at the sink using the message.id of the events. If required, you can enable basic authentication at the source to ensure that events are received only from users who are authorized to access the service.

- -Syntax -``` -@source(type="http-request", receiver.url="", source.id="", connection.timeout="", basic.auth.enabled="", worker.count="", socket.idle.timeout="", ssl.verify.client="", ssl.protocol="", tls.store.type="", parameters="", ciphers="", ssl.enabled.protocols="", server.enable.session.creation="", server.supported.snimatchers="", server.suported.server.names="", request.size.validation.configuration="", request.size.validation="", request.size.validation.maximum.value="", request.size.validation.reject.status.code="", request.size.validation.reject.message="", request.size.validation.reject.message.content.type="", header.size.validation="", header.validation.maximum.request.line="", header.validation.maximum.size="", header.validation.maximum.chunk.size="", header.validation.reject.status.code="", header.validation.reject.message="", header.validation.reject.message.content.type="", server.bootstrap.configuration="", server.bootstrap.nodelay="", server.bootstrap.keepalive="", server.bootstrap.sendbuffersize="", server.bootstrap.recievebuffersize="", server.bootstrap.connect.timeout="", server.bootstrap.socket.reuse="", server.bootstrap.socket.timeout="", server.bootstrap.socket.backlog="", trace.log.enabled="", @map(...))) -``` - -QUERY PARAMETERS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
receiver.urlThe URL to which the events should be received. User can provide any valid url and if the url is not provided the system will use the following format http://0.0.0.0:9763/<appNAme>/<streamName>If the user want to use SSL the url should be given in following format https://localhost:8080/<streamName>http://0.0.0.0:9763//STRINGYesNo
source.idIdentifier need to map the source to sink.STRINGNoNo
connection.timeoutConnection timeout in milliseconds. If the mapped http-response sink does not get a correlated message, after this timeout value, a timeout response is sent120000INTYesNo
basic.auth.enabledIf this is set to true, basic authentication is enabled for incoming events, and the credentials with which each event is sent are verified to ensure that the user is authorized to access the service. If basic authentication fails, the event is not authenticated and an authentication error is logged in the CLI. By default this values 'false' falseSTRINGYesNo
worker.countThe number of active worker threads to serve the incoming events. The value is 1 by default. This will ensure that the events are directed to the event stream in the same order in which they arrive. By increasing this value the performance might increase at the cost of loosing event ordering.1STRINGYesNo
socket.idle.timeoutIdle timeout for HTTP connection.120000INTYesNo
ssl.verify.clientThe type of client certificate verification.nullSTRINGYesNo
ssl.protocolssl/tls related optionsTLSSTRINGYesNo
tls.store.typeTLS store type.JKSSTRINGYesNo
parametersParameters other than basics such as ciphers,sslEnabledProtocols,client.enable.session.creation. Expected format of these parameters is as follows: "'ciphers:xxx','sslEnabledProtocols,client.enable:xxx'"nullSTRINGYesNo
ciphersList of ciphers to be used. This parameter should include under parameters Ex: 'ciphers:TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256'nullSTRINGYesNo
ssl.enabled.protocolsSSL/TLS protocols to be enabled. This parameter should be in camel case format(sslEnabledProtocols) under parameters. Ex 'sslEnabledProtocols:true'nullSTRINGYesNo
server.enable.session.creationEnable HTTP session creation.This parameter should include under parameters Ex: 'client.enable.session.creation:true'nullSTRINGYesNo
server.supported.snimatchersHttp SNIMatcher to be added. This parameter should include under parameters Ex: 'server.supported.snimatchers:SNIMatcher'nullSTRINGYesNo
server.suported.server.namesHttp supported servers. This parameter should include under parameters Ex: 'server.suported.server.names:server'nullSTRINGYesNo
request.size.validation.configurationParameters that responsible for validating the http request and request headers. Expected format of these parameters is as follows: "'request.size.validation:xxx','request.size.validation.maximum.value:xxx'"nullSTRINGYesNo
request.size.validationTo enable the request size validation.falseSTRINGYesNo
request.size.validation.maximum.valueIf request size is validated then maximum size.Integer.MAX_VALUESTRINGYesNo
request.size.validation.reject.status.codeIf request is exceed maximum size and request.size.validation is enabled then status code to be send as response.401STRINGYesNo
request.size.validation.reject.messageIf request is exceed maximum size and request.size.validation is enabled then status message to be send as response.Message is bigger than the valid sizeSTRINGYesNo
request.size.validation.reject.message.content.typeIf request is exceed maximum size and request.size.validation is enabled then content type to be send as response.plain/textSTRINGYesNo
header.size.validationTo enable the header size validation.falseSTRINGYesNo
header.validation.maximum.request.lineIf header header validation is enabled then the maximum request line.4096STRINGYesNo
header.validation.maximum.sizeIf header header validation is enabled then the maximum expected header size.8192STRINGYesNo
header.validation.maximum.chunk.sizeIf header header validation is enabled then the maximum expected chunk size.8192STRINGYesNo
header.validation.reject.status.code401If header is exceed maximum size and header.size.validation is enabled then status code to be send as response.STRINGYesNo
header.validation.reject.messageIf header is exceed maximum size and header.size.validation is enabled then message to be send as response.Message header is bigger than the valid sizeSTRINGYesNo
header.validation.reject.message.content.typeIf header is exceed maximum size and header.size.validation is enabled then content type to be send as response.plain/textSTRINGYesNo
server.bootstrap.configurationParameters that for bootstrap configurations of the server. Expected format of these parameters is as follows: "'ciphers:xxx','sslEnabledProtocols,client.enable:xxx'"nullOBJECTYesNo
server.bootstrap.nodelayHttp server no delay.trueBOOLYesNo
server.bootstrap.keepaliveHttp server keep alive.trueBOOLYesNo
server.bootstrap.sendbuffersizeHttp server send buffer size.1048576INTYesNo
server.bootstrap.recievebuffersizeHttp server receive buffer size.1048576INTYesNo
server.bootstrap.connect.timeoutHttp server connection timeout.15000INTYesNo
server.bootstrap.socket.reuseTo enable http socket reuse.falseBOOLYesNo
server.bootstrap.socket.timeoutHttp server socket timeout.15BOOLYesNo
server.bootstrap.socket.backlogTHttp server socket backlog.100BOOLYesNo
trace.log.enabledHttp traffic monitoring.falseBOOLYesNo
- -System Parameters - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Parameters
serverBootstrapBossGroupSizeproperty to configure number of boss threads, which accepts incoming connections until the ports are unbound. Once connection accepts successfully, boss thread passes the accepted channel to one of the worker threads.Number of available processorsAny integer
serverBootstrapWorkerGroupSizeproperty to configure number of worker threads, which performs non blocking read and write for one or more channels in non-blocking mode.(Number of available processors)*2Any integer
serverBootstrapClientGroupSizeproperty to configure number of client threads, which performs non blocking read and write for one or more channels in non-blocking mode.(Number of available processors)*2Any integer
defaultHostThe default host of the transport.0.0.0.0Any valid host
defaultHttpPortThe default port if the default scheme is 'http'.8280Any valid port
defaultHttpsPortThe default port if the default scheme is 'https'.8243Any valid port
defaultSchemeThe default protocol.httphttp
https
keyStoreLocationThe default keystore file path.${carbon.home}/resources/security/wso2carbon.jksPath to wso2carbon.jks file
keyStorePasswordThe default keystore password.wso2carbonString of keystore password
certPasswordThe default cert password.wso2carbonString of cert password
- -Examples -EXAMPLE 1 -``` -@source(type='http-request', source.id='sampleSourceId, receiver.url='http://localhost:9055/endpoints/RecPro', connection.timeout='150000', parameters="'ciphers : TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256', 'sslEnabledProtocols:TLSv1.1,TLSv1.2'", request.size.validation.configuration="request.size.validation:true", server.bootstrap.configuration="server.bootstrap.socket.timeout:25", @map(type='json, @attributes(messageId='trp:messageId', symbol='$.events.event.symbol', price='$.events.event.price', volume='$.events.event.volume'))) -define stream FooStream (messageId string, symbol string, price float, volume long); - -``` -

The expected input is as follows:
{"events":
    {"event":
        "symbol":WSO2,
        "price":55.6,
        "volume":100,
    }
}
If basic authentication is enabled via the basic.auth.enabled='true setting, each input event is also expected to contain the Authorization:'Basic encodeBase64(username:Password)' header.

- -### http-response *(Source)* - -

The http-response source co-relates with http-request sink with the parameter 'sink.id'.
This receives responses for the requests sent by the http-request sink which has the same sink id.
Response messages can be in formats such as TEXT, JSON and XML.
In order to handle the responses with different http status codes, user is allowed to defined the acceptable response source code using the parameter 'http.status.code'

- -Syntax -``` -@source(type="http-response", sink.id="", http.status.code="", @map(...))) -``` - -QUERY PARAMETERS - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
sink.idThis parameter is used to map the http-response source to a http-request sink. Then this source will accepts the response messages for the requests sent by corresponding http-request sink.STRINGNoNo
http.status.codeAcceptable http status code for the responses.
This can be a complete string or a regex.
Only the responses with matching status codes to the defined value, will be received by the http-response source.
Eg: 'http.status.code = '200', http.status.code = '2\\d+''
STRINGNoNo
- -Examples -EXAMPLE 1 -``` -@sink(type='http-request', -downloading.enabled='true', -publisher.url='http://localhost:8005/registry/employee', -method='POST', headers='{{headers}}',sink.id='employee-info', -@map(type='json')) -define stream BarStream (name String, id int, headers String, downloadPath string); - -@source(type='http-response' , sink.id='employee-info', http.status.code='2\\d+', -@map(type='text', regex.A='((.|\n)*)', @attributes(message='A[1]'))) -define stream responseStream2xx(message string);@source(type='http-response' , sink.id='employee-info', http.status.code='4\\d+' , -@map(type='text', regex.A='((.|\n)*)', @attributes(message='A[1]'))) -define stream responseStream4xx(message string); -``` -

In above example, the defined http-request sink will send a POST requests to the endpoint defined by 'publisher.url'.
Then for those requests, the source with the response code '2\\d+' and sink.id 'employee-info' will receive the responses with 2xx status codes.
The http-response source which has 'employee-info' as the 'sink.id' and '4\\d+' as the http.response.code will receive all the responses with 4xx status codes.
. Then the body of the response message will be extracted using text mapper and converted into siddhi events.
.

- diff --git a/docs/api/1.0.32.md b/docs/api/1.0.32.md deleted file mode 100644 index 3146e0d7..00000000 --- a/docs/api/1.0.32.md +++ /dev/null @@ -1,1665 +0,0 @@ -# API Docs - v1.0.32 - -## Sink - -### http *(Sink)* - -

This extension publish the HTTP events in any HTTP method POST, GET, PUT, DELETE via HTTP or https protocols. As the additional features this component can provide basic authentication as well as user can publish events using custom client truststore files when publishing events via https protocol. And also user can add any number of headers including HTTP_METHOD header for each event dynamically.
Following content types will be set by default according to the type of sink mapper used.
You can override them by setting the new content types in headers.
     - TEXT : text/plain
     - XML : application/xml
     - JSON : application/json
     - KEYVALUE : application/x-www-form-urlencoded

- -Syntax -``` -@sink(type="http", publisher.url="", basic.auth.username="", basic.auth.password="", https.truststore.file="", https.truststore.password="", headers="", method="", socket.idle.timeout="", chunk.disabled="", ssl.protocol="", parameters="", ciphers="", ssl.enabled.protocols="", client.enable.session.creation="", follow.redirect="", max.redirect.count="", tls.store.type="", proxy.host="", proxy.port="", proxy.username="", proxy.password="", client.bootstrap.configuration="", client.bootstrap.nodelay="", client.bootstrap.keepalive="", client.bootstrap.sendbuffersize="", client.bootstrap.recievebuffersize="", client.bootstrap.connect.timeout="", client.bootstrap.socket.reuse="", client.bootstrap.socket.timeout="", client.threadpool.configurations="", client.connection.pool.count="", client.max.active.connections.per.pool="", client.min.idle.connections.per.pool="", client.max.idle.connections.per.pool="", client.min.eviction.idle.time="", sender.thread.count="", event.group.executor.thread.size="", max.wait.for.client.connection.pool="", @map(...))) -``` - -QUERY PARAMETERS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
publisher.urlThe URL to which the outgoing events should be published via HTTP. This is a mandatory parameter and if this is not specified, an error is logged in the CLI. If user wants to enable SSL for the events, use https instead of http in the publisher.url.e.g., http://localhost:8080/endpoint, https://localhost:8080/endpointSTRINGNoNo
basic.auth.usernameThe username to be included in the authentication header of the basic authentication enabled events. It is required to specify both username and password to enable basic authentication. If one of the parameter is not given by user then an error is logged in the CLI. STRINGYesNo
basic.auth.passwordThe password to include in the authentication header of the basic authentication enabled events. It is required to specify both username and password to enable basic authentication. If one of the parameter is not given by user then an error is logged in the CLI. STRINGYesNo
https.truststore.fileThe file path to the location of the truststore of the client that sends the HTTP events through 'https' protocol. A custom client-truststore can be specified if required.${carbon.home}/resources/security/client-truststore.jksSTRINGYesNo
https.truststore.passwordThe password for the client-truststore. A custom password can be specified if required. If no custom password is specified and the protocol of URL is 'https' then, the system uses default password.wso2carbonSTRINGYesNo
headersThe headers that should be included as HTTP request headers.
There can be any number of headers concatenated in following format. "'header1:value1','header2:value2'". User can include Content-Type header if he needs to use a specific content-type for the payload. Or else, system decides the Content-Type by considering the type of sink mapper, in following way.
 - @map(xml):application/xml
 - @map(json):application/json
 - @map(text):plain/text )
 - if user does not include any mapping type then the system gets 'plain/text' as default Content-Type header.
Note that providing content-length as a header is not supported. The size of the payload will be automatically calculated and included in the content-length header.
STRINGYesNo
methodFor HTTP events, HTTP_METHOD header should be included as a request header. If the parameter is null then system uses 'POST' as a default header.POSTSTRINGYesNo
socket.idle.timeoutSocket timeout value in millisecond6000INTYesNo
chunk.disabledThis parameter is used to disable/enable chunked transfer encodingfalseBOOLYesNo
ssl.protocolThe SSL protocol versionTLSSTRINGYesNo
parametersParameters other than basics such as ciphers,sslEnabledProtocols,client.enable.session.creation. Expected format of these parameters is as follows: "'ciphers:xxx','sslEnabledProtocols,client.enable:xxx'"nullSTRINGYesNo
ciphersList of ciphers to be used. This parameter should include under parameters Ex: 'ciphers:TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256'nullSTRINGYesNo
ssl.enabled.protocolsSSL/TLS protocols to be enabled. This parameter should be in camel case format(sslEnabledProtocols) under parameters. Ex 'sslEnabledProtocols:true'nullSTRINGYesNo
client.enable.session.creationEnable HTTP session creation.This parameter should include under parameters Ex: 'client.enable.session.creation:true'nullSTRINGYesNo
follow.redirectRedirect related enabled.trueBOOLYesNo
max.redirect.countMaximum redirect count.5INTYesNo
tls.store.typeTLS store type to be used.JKSSTRINGYesNo
proxy.hostProxy server hostnullSTRINGYesNo
proxy.portProxy server portnullSTRINGYesNo
proxy.usernameProxy server usernamenullSTRINGYesNo
proxy.passwordProxy server passwordnullSTRINGYesNo
client.bootstrap.configurationClient bootsrap configurations. Expected format of these parameters is as follows: "'client.bootstrap.nodelay:xxx','client.bootstrap.keepalive:xxx'"TODOSTRINGYesNo
client.bootstrap.nodelayHttp client no delay.trueBOOLYesNo
client.bootstrap.keepaliveHttp client keep alive.trueBOOLYesNo
client.bootstrap.sendbuffersizeHttp client send buffer size.1048576INTYesNo
client.bootstrap.recievebuffersizeHttp client receive buffer size.1048576INTYesNo
client.bootstrap.connect.timeoutHttp client connection timeout.15000INTYesNo
client.bootstrap.socket.reuseTo enable http socket reuse.falseBOOLYesNo
client.bootstrap.socket.timeoutHttp client socket timeout.15STRINGYesNo
client.threadpool.configurationsThread pool configuration. Expected format of these parameters is as follows: "'client.connection.pool.count:xxx','client.max.active.connections.per.pool:xxx'"TODOSTRINGYesNo
client.connection.pool.countConnection pool count.0INTYesNo
client.max.active.connections.per.poolActive connections per pool.-1INTYesNo
client.min.idle.connections.per.poolMinimum ideal connection per pool.0INTYesNo
client.max.idle.connections.per.poolMaximum ideal connection per pool.100INTYesNo
client.min.eviction.idle.timeMinimum eviction idle time.5 * 60 * 1000STRINGYesNo
sender.thread.countHttp sender thread count.20STRINGYesNo
event.group.executor.thread.sizeEvent group executor thread size.15STRINGYesNo
max.wait.for.client.connection.poolMaximum wait for client connection pool.60000STRINGYesNo
- -System Parameters - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Parameters
clientBootstrapBossGroupSizeproperty to configure number of boss threads, which accepts incoming connections until the ports are unbound. Once connection accepts successfully, boss thread passes the accepted channel to one of the worker threads.Number of available processorsAny integer
clientBootstrapWorkerGroupSizeproperty to configure number of worker threads, which performs non blocking read and write for one or more channels in non-blocking mode.(Number of available processors)*2Any integer
clientBootstrapClientGroupSizeproperty to configure number of client threads, which performs non blocking read and write for one or more channels in non-blocking mode.(Number of available processors)*2Any integer
trustStoreLocationThe default truststore file path.${carbon.home}/resources/security/client-truststore.jksPath to client-truststore.jks
trustStorePasswordThe default truststore password.wso2carbonTruststore password
- -Examples -EXAMPLE 1 -``` -@sink(type='http',publisher.url='http://localhost:8009/foo', method='{{method}}',headers="'content-type:xml','content-length:94'", client.bootstrap.configuration="'client.bootstrap.socket.timeout:20', 'client.bootstrap.worker.group.size:10'", client.pool.configuration="'client.connection.pool.count:10','client.max.active.connections.per.pool:1'", @map(type='xml', @payload('{{payloadBody}}'))) -define stream FooStream (payloadBody String, method string, headers string); - -``` -

If it is xml mapping expected input should be in following format for FooStream:
{
<events>
    <event>
        <symbol>WSO2</symbol>
        <price>55.6</price>
        <volume>100</volume>
    </event>
</events>,
POST,
Content-Length:24#Content-Location:USA#Retry-After:120
}

Above event will generate output as below.
~Output http event payload
<events>
    <event>
        <symbol>WSO2</symbol>
        <price>55.6</price>
        <volume>100</volume>
    </event>
</events>

~Output http event headers
Content-Length:24,
Content-Location:'USA',
Retry-After:120,
Content-Type:'application/xml',
HTTP_METHOD:'POST',

~Output http event properties
HTTP_METHOD:'POST',
HOST:'localhost',
PORT:8009,
PROTOCOL:'http',
TO:'/foo'

- -### http-request *(Sink)* - -

This extension publish the HTTP events in any HTTP method POST, GET, PUT, DELETE via HTTP or https protocols. As the additional features this component can provide basic authentication as well as user can publish events using custom client truststore files when publishing events via https protocol. And also user can add any number of headers including HTTP_METHOD header for each event dynamically.
Following content types will be set by default according to the type of sink mapper used.
You can override them by setting the new content types in headers.
     - TEXT : text/plain
     - XML : application/xml
     - JSON : application/json
     - KEYVALUE : application/x-www-form-urlencoded

HTTP request sink is correlated with the The HTTP reponse source, through a unique sink.id.It sends the request to the defined url and the response is received by the response source which has the same 'sink.id'.

- -Syntax -``` -@sink(type="http-request", publisher.url="", basic.auth.username="", basic.auth.password="", https.truststore.file="", https.truststore.password="", headers="", method="", socket.idle.timeout="", chunk.disabled="", ssl.protocol="", parameters="", ciphers="", ssl.enabled.protocols="", client.enable.session.creation="", follow.redirect="", max.redirect.count="", tls.store.type="", proxy.host="", proxy.port="", proxy.username="", proxy.password="", client.bootstrap.configuration="", client.bootstrap.nodelay="", client.bootstrap.keepalive="", client.bootstrap.sendbuffersize="", client.bootstrap.recievebuffersize="", client.bootstrap.connect.timeout="", client.bootstrap.socket.reuse="", client.bootstrap.socket.timeout="", client.threadpool.configurations="", client.connection.pool.count="", client.max.active.connections.per.pool="", client.min.idle.connections.per.pool="", client.max.idle.connections.per.pool="", client.min.eviction.idle.time="", sender.thread.count="", event.group.executor.thread.size="", max.wait.for.client.connection.pool="", sink.id="", downloading.enabled="", download.path="", @map(...))) -``` - -QUERY PARAMETERS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
publisher.urlThe URL to which the outgoing events should be published via HTTP. This is a mandatory parameter and if this is not specified, an error is logged in the CLI. If user wants to enable SSL for the events, use https instead of http in the publisher.url.
e.g., http://localhost:8080/endpoint, https://localhost:8080/endpoint
This can be used as a dynamic parameter as well.
STRINGNoYes
basic.auth.usernameThe username to be included in the authentication header of the basic authentication enabled events. It is required to specify both username and password to enable basic authentication. If one of the parameter is not given by user then an error is logged in the CLI. STRINGYesNo
basic.auth.passwordThe password to include in the authentication header of the basic authentication enabled events. It is required to specify both username and password to enable basic authentication. If one of the parameter is not given by user then an error is logged in the CLI. STRINGYesNo
https.truststore.fileThe file path to the location of the truststore of the client that sends the HTTP events through 'https' protocol. A custom client-truststore can be specified if required.${carbon.home}/resources/security/client-truststore.jksSTRINGYesNo
https.truststore.passwordThe password for the client-truststore. A custom password can be specified if required. If no custom password is specified and the protocol of URL is 'https' then, the system uses default password.wso2carbonSTRINGYesNo
headersThe headers that should be included as HTTP request headers.
There can be any number of headers concatenated in following format. "'header1:value1','header2:value2'". User can include Content-Type header if he needs to use a specific content-type for the payload. Or else, system decides the Content-Type by considering the type of sink mapper, in following way.
 - @map(xml):application/xml
 - @map(json):application/json
 - @map(text):plain/text )
 - if user does not include any mapping type then the system gets 'plain/text' as default Content-Type header.
Note that providing content-length as a header is not supported. The size of the payload will be automatically calculated and included in the content-length header.
STRINGYesNo
methodFor HTTP events, HTTP_METHOD header should be included as a request header. If the parameter is null then system uses 'POST' as a default header.POSTSTRINGYesNo
socket.idle.timeoutSocket timeout value in millisecond6000INTYesNo
chunk.disabledport: Port number of the remote servicefalseBOOLYesNo
ssl.protocolThe SSL protocol versionTLSSTRINGYesNo
parametersParameters other than basics such as ciphers,sslEnabledProtocols,client.enable.session.creation. Expected format of these parameters is as follows: "'ciphers:xxx','sslEnabledProtocols,client.enable:xxx'"nullSTRINGYesNo
ciphersList of ciphers to be used. This parameter should include under parameters Ex: 'ciphers:TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256'nullSTRINGYesNo
ssl.enabled.protocolsSSL/TLS protocols to be enabled. This parameter should be in camel case format(sslEnabledProtocols) under parameters. Ex 'sslEnabledProtocols:true'nullSTRINGYesNo
client.enable.session.creationEnable HTTP session creation.This parameter should include under parameters Ex: 'client.enable.session.creation:true'nullSTRINGYesNo
follow.redirectRedirect related enabled.trueBOOLYesNo
max.redirect.countMaximum redirect count.5INTYesNo
tls.store.typeTLS store type to be used.JKSSTRINGYesNo
proxy.hostProxy server hostnullSTRINGYesNo
proxy.portProxy server portnullSTRINGYesNo
proxy.usernameProxy server usernamenullSTRINGYesNo
proxy.passwordProxy server passwordnullSTRINGYesNo
client.bootstrap.configurationClient bootsrap configurations. Expected format of these parameters is as follows: "'client.bootstrap.nodelay:xxx','client.bootstrap.keepalive:xxx'"TODOSTRINGYesNo
client.bootstrap.nodelayHttp client no delay.trueBOOLYesNo
client.bootstrap.keepaliveHttp client keep alive.trueBOOLYesNo
client.bootstrap.sendbuffersizeHttp client send buffer size.1048576INTYesNo
client.bootstrap.recievebuffersizeHttp client receive buffer size.1048576INTYesNo
client.bootstrap.connect.timeoutHttp client connection timeout.15000INTYesNo
client.bootstrap.socket.reuseTo enable http socket reuse.falseBOOLYesNo
client.bootstrap.socket.timeoutHttp client socket timeout.15STRINGYesNo
client.threadpool.configurationsThread pool configuration. Expected format of these parameters is as follows: "'client.connection.pool.count:xxx','client.max.active.connections.per.pool:xxx'"TODOSTRINGYesNo
client.connection.pool.countConnection pool count.0INTYesNo
client.max.active.connections.per.poolActive connections per pool.-1INTYesNo
client.min.idle.connections.per.poolMinimum ideal connection per pool.0INTYesNo
client.max.idle.connections.per.poolMaximum ideal connection per pool.100INTYesNo
client.min.eviction.idle.timeMinimum eviction idle time.5 * 60 * 1000STRINGYesNo
sender.thread.countHttp sender thread count.20STRINGYesNo
event.group.executor.thread.sizeEvent group executor thread size.15STRINGYesNo
max.wait.for.client.connection.poolMaximum wait for client connection pool.60000STRINGYesNo
sink.idIdentifier of the sink. This is used to co-relate with the corresponding http-response source which needs to process the repose for the request sent by this sink.STRINGNoNo
downloading.enabledIf this is set to 'true' then the response received by the response source will be written to a file. If downloading is enabled, the download.path parameter is mandatory.falseBOOLYesNo
download.pathIf downloading is enabled, the path of the file which is going to be downloaded should be specified using 'download.path' parameter. This should be an absolute path including the file name.nullSTRINGYesYes
- -Examples -EXAMPLE 1 -``` -@sink(type='http-request', sink.id='foo', publisher.url='http://localhost:8009/foo', @map(type='xml', @payload('{{payloadBody}}'))) -define stream FooStream (payloadBody String, method string, headers string); -@source(type='http-response', sink.id='foo', http.status.code='2\\d+', -@map(type='text', regex.A='((.|\n)*)', @attributes(headers='trp:headers', fileName='A[1]'))) -define stream responseStream2xx(fileName string, headers string); - -@source(type='http-response', sink.id='foo', http.status.code='4\\d+', -@map(type='text', regex.A='((.|\n)*)', @attributes(errorMsg='A[1]'))) -define stream responseStream4xx(errorMsg string); -``` -

In above example, the payload body for 'FooStream' will be in following format.
{
<events>
    <event>
        <symbol>WSO2</symbol>
        <price>55.6</price>
        <volume>100</volume>
    </event>
</events>,
This message will sent as the body of a POST request with the content-type 'application/xml' to the endpoint defined as the 'publisher.url' and in order to process the responses for these requests, there should be a source of type 'http-response' defined with the same sink id 'foo' in the siddhi app.
The responses with 2xx status codes will be received by the http-response source which has the http.status.code defined by the regex '2\\d+'.
If the response has a 4xx status code, it will be received by the http-response source which has the http.status.code defined by the regex '4\\d+'.

- -EXAMPLE 2 -``` -define stream FooStream (name String, id int, headers String, downloadPath string); -@sink(type='http-request', -downloading.enabled='true', -download.path='{{downloadPath}}',publisher.url='http://localhost:8005/files', -method='GET', headers='{{headers}}',sink.id='download-sink', -@map(type='json')) -define stream BarStream (name String, id int, headers String, downloadPath string); - -@source(type='http-response', sink.id='download-sink', http.status.code='2\\d+', -@map(type='text', regex.A='((.|\n)*)', @attributes(headers='trp:headers', fileName='A[1]'))) -define stream responseStream2xx(fileName string, headers string); - -@source(type='http-response', sink.id='download-sink', http.status.code='4\\d+', -@map(type='text', regex.A='((.|\n)*)', @attributes(errorMsg='A[1]'))) -define stream responseStream4xx(errorMsg string); -``` -

In above example, http-request sink will send a GET request to the publisher url and the requested file will be received as the response by a corresponding http-response source.
If the http status code of the response is a successful one (2xx), it will be received by the http-response source which has the http.status.code '2\\d+' and downloaded as a local file. Then the event received to the responseStream2xx will have the headers included in the request and the downloaded file name.
If the http status code of the response is a 4xx code, it will be received by the http-response source which has the http.status.code '4\\d+'. Then the event received to the responseStream4xx will have the response message body in text format.

- -### http-response *(Sink)* - -

HTTP response sink is correlated with the The HTTP request source, through a unique source.id, and it send a response to the HTTP request source having the same source.id. The response message can be formatted in text, XML or JSON and can be sent with appropriate headers.

- -Syntax -``` -@sink(type="http-response", source.id="", message.id="", headers="", @map(...))) -``` - -QUERY PARAMETERS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
source.idIdentifier of the source.STRINGNoNo
message.idIdentifier of the message.STRINGNoYes
headersThe headers that should be included as HTTP response headers. There can be any number of headers concatenated on following format. "'header1:value1','header2:value2'" User can include content-type header if he/she need to have any specific type for payload. If not system get the mapping type as the content-Type header (ie.@map(xml):application/xml, @map(json):application/json, @map(text):plain/text) and if user does not include any mapping type then system gets the plain/text as default Content-Type header. If user does not include Content-Length header then system calculate the bytes size of payload and include it as content-length header. STRINGYesNo
- -Examples -EXAMPLE 1 -``` -@sink(type='http-response', source.id='sampleSourceId', message.id='{{messageId}}', headers="'content-type:json','content-length:94'"@map(type='json', @payload('{{payloadBody}}'))) -define stream FooStream (payloadBody String, messageId string, headers string); - -``` -

If it is json mapping expected input should be in following format for FooStream:
{
{"events":
    {"event":
        "symbol":WSO2,
        "price":55.6,
        "volume":100,
    }
},
0cf708b1-7eae-440b-a93e-e72f801b486a,
Content-Length:24#Content-Location:USA
}

Above event will generate response for the matching source message as below.

~Output http event payload
{"events":
    {"event":
        "symbol":WSO2,
        "price":55.6,
        "volume":100,
    }
}

~Output http event headers
Content-Length:24,
Content-Location:'USA',
Content-Type:'application/json'

- -## Source - -### http *(Source)* - -

The HTTP source receives POST requests via HTTP or HTTPS in format such as text, XML and JSON. In WSO2 SP, if required, you can enable basic authentication to ensure that events are received only from users who are authorized to access the service.

- -Syntax -``` -@source(type="http", receiver.url="", basic.auth.enabled="", worker.count="", socket.idle.timeout="", ssl.verify.client="", ssl.protocol="", tls.store.type="", parameters="", ciphers="", ssl.enabled.protocols="", server.enable.session.creation="", server.supported.snimatchers="", server.suported.server.names="", request.size.validation.configuration="", request.size.validation="", request.size.validation.maximum.value="", request.size.validation.reject.status.code="", request.size.validation.reject.message="", request.size.validation.reject.message.content.type="", header.size.validation="", header.validation.maximum.request.line="", header.validation.maximum.size="", header.validation.maximum.chunk.size="", header.validation.reject.status.code="", header.validation.reject.message="", header.validation.reject.message.content.type="", server.bootstrap.configuration="", server.bootstrap.nodelay="", server.bootstrap.keepalive="", server.bootstrap.sendbuffersize="", server.bootstrap.recievebuffersize="", server.bootstrap.connect.timeout="", server.bootstrap.socket.reuse="", server.bootstrap.socket.timeout="", server.bootstrap.socket.backlog="", trace.log.enabled="", @map(...))) -``` - -QUERY PARAMETERS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
receiver.urlThe URL to which the events should be received. User can provide any valid url and if the url is not provided the system will use the following format http://0.0.0.0:9763/<appNAme>/<streamName>If the user want to use SSL the url should be given in following format https://localhost:8080/<streamName>http://0.0.0.0:9763//STRINGYesNo
basic.auth.enabledThis works only in WSO2 SP. If this is set to true, basic authentication is enabled for incoming events, and the credentials with which each event is sent are verified to ensure that the user is authorized to access the service. If basic authentication fails, the event is not authenticated and an authentication error is logged in the CLI.falseSTRINGYesNo
worker.countThe number of active worker threads to serve the incoming events. The value is 1 by default. This will ensure that the events are directed to the event stream in the same order in which they arrive. By increasing this value the performance might increase at the cost of loosing event ordering.1STRINGYesNo
socket.idle.timeoutIdle timeout for HTTP connection.120000INTYesNo
ssl.verify.clientThe type of client certificate verification.nullSTRINGYesNo
ssl.protocolssl/tls related optionsTLSSTRINGYesNo
tls.store.typeTLS store type.JKSSTRINGYesNo
parametersParameters other than basics such as ciphers,sslEnabledProtocols,client.enable.session.creation. Expected format of these parameters is as follows: "'ciphers:xxx','sslEnabledProtocols,client.enable:xxx'"nullSTRINGYesNo
ciphersList of ciphers to be used. This parameter should include under parameters Ex: 'ciphers:TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256'nullSTRINGYesNo
ssl.enabled.protocolsSSL/TLS protocols to be enabled. This parameter should be in camel case format(sslEnabledProtocols) under parameters. Ex 'sslEnabledProtocols:true'nullSTRINGYesNo
server.enable.session.creationEnable HTTP session creation.This parameter should include under parameters Ex: 'client.enable.session.creation:true'nullSTRINGYesNo
server.supported.snimatchersHttp SNIMatcher to be added. This parameter should include under parameters Ex: 'server.supported.snimatchers:SNIMatcher'nullSTRINGYesNo
server.suported.server.namesHttp supported servers. This parameter should include under parameters Ex: 'server.suported.server.names:server'nullSTRINGYesNo
request.size.validation.configurationParameters that responsible for validating the http request and request headers. Expected format of these parameters is as follows: "'request.size.validation:xxx','request.size.validation.maximum.value:xxx'"nullSTRINGYesNo
request.size.validationTo enable the request size validation.falseSTRINGYesNo
request.size.validation.maximum.valueIf request size is validated then maximum size.Integer.MAX_VALUESTRINGYesNo
request.size.validation.reject.status.codeIf request is exceed maximum size and request.size.validation is enabled then status code to be send as response.401STRINGYesNo
request.size.validation.reject.messageIf request is exceed maximum size and request.size.validation is enabled then status message to be send as response.Message is bigger than the valid sizeSTRINGYesNo
request.size.validation.reject.message.content.typeIf request is exceed maximum size and request.size.validation is enabled then content type to be send as response.plain/textSTRINGYesNo
header.size.validationTo enable the header size validation.falseSTRINGYesNo
header.validation.maximum.request.lineIf header header validation is enabled then the maximum request line.4096STRINGYesNo
header.validation.maximum.sizeIf header header validation is enabled then the maximum expected header size.8192STRINGYesNo
header.validation.maximum.chunk.sizeIf header header validation is enabled then the maximum expected chunk size.8192STRINGYesNo
header.validation.reject.status.code401If header is exceed maximum size and header.size.validation is enabled then status code to be send as response.STRINGYesNo
header.validation.reject.messageIf header is exceed maximum size and header.size.validation is enabled then message to be send as response.Message header is bigger than the valid sizeSTRINGYesNo
header.validation.reject.message.content.typeIf header is exceed maximum size and header.size.validation is enabled then content type to be send as response.plain/textSTRINGYesNo
server.bootstrap.configurationParameters that for bootstrap configurations of the server. Expected format of these parameters is as follows: "'ciphers:xxx','sslEnabledProtocols,client.enable:xxx'"nullOBJECTYesNo
server.bootstrap.nodelayHttp server no delay.trueBOOLYesNo
server.bootstrap.keepaliveHttp server keep alive.trueBOOLYesNo
server.bootstrap.sendbuffersizeHttp server send buffer size.1048576INTYesNo
server.bootstrap.recievebuffersizeHttp server receive buffer size.1048576INTYesNo
server.bootstrap.connect.timeoutHttp server connection timeout.15000INTYesNo
server.bootstrap.socket.reuseTo enable http socket reuse.falseBOOLYesNo
server.bootstrap.socket.timeoutHttp server socket timeout.15BOOLYesNo
server.bootstrap.socket.backlogTHttp server socket backlog.100BOOLYesNo
trace.log.enabledHttp traffic monitoring.falseBOOLYesNo
- -System Parameters - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Parameters
serverBootstrapBossGroupSizeproperty to configure number of boss threads, which accepts incoming connections until the ports are unbound. Once connection accepts successfully, boss thread passes the accepted channel to one of the worker threads.Number of available processorsAny integer
serverBootstrapWorkerGroupSizeproperty to configure number of worker threads, which performs non blocking read and write for one or more channels in non-blocking mode.(Number of available processors)*2Any integer
serverBootstrapClientGroupSizeproperty to configure number of client threads, which performs non blocking read and write for one or more channels in non-blocking mode.(Number of available processors)*2Any integer
defaultHostThe default host of the transport.0.0.0.0Any valid host
defaultHttpPortThe default port if the default scheme is 'http'.8280Any valid port
defaultHttpsPortThe default port if the default scheme is 'https'.8243Any valid port
defaultSchemeThe default protocol.httphttp
https
keyStoreLocationThe default keystore file path.${carbon.home}/resources/security/wso2carbon.jksPath to wso2carbon.jks file
keyStorePasswordThe default keystore password.wso2carbonString of keystore password
certPasswordThe default cert password.wso2carbonString of cert password
- -Examples -EXAMPLE 1 -``` -@source(type='http', receiver.url='http://localhost:9055/endpoints/RecPro', socketIdleTimeout='150000', parameters="'ciphers : TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256', 'sslEnabledProtocols:TLSv1.1,TLSv1.2'",request.size.validation.configuration="request.size.validation:true",server.bootstrap.configuration="server.bootstrap.socket.timeout:25" @map(type='xml')) -define stream FooStream (symbol string, price float, volume long); - -``` -

Above source listenerConfiguration performs a default XML input mapping. The expected input is as follows:
<events>
    <event>
        <symbol>WSO2</symbol>
        <price>55.6</price>
        <volume>100</volume>
    </event>
</events>
If basic authentication is enabled via the basic.auth.enabled='true setting, each input event is also expected to contain the Authorization:'Basic encodeBase64(username:Password)' header.

- -### http-request *(Source)* - -

The HTTP request is correlated with the HTTP response sink, through a unique source.id, and for each POST requests it receives via HTTP or HTTPS in format such as text, XML and JSON it sends the response via the HTTP response sink. The individual request and response messages are correlated at the sink using the message.id of the events. If required, you can enable basic authentication at the source to ensure that events are received only from users who are authorized to access the service.

- -Syntax -``` -@source(type="http-request", receiver.url="", source.id="", connection.timeout="", basic.auth.enabled="", worker.count="", socket.idle.timeout="", ssl.verify.client="", ssl.protocol="", tls.store.type="", parameters="", ciphers="", ssl.enabled.protocols="", server.enable.session.creation="", server.supported.snimatchers="", server.suported.server.names="", request.size.validation.configuration="", request.size.validation="", request.size.validation.maximum.value="", request.size.validation.reject.status.code="", request.size.validation.reject.message="", request.size.validation.reject.message.content.type="", header.size.validation="", header.validation.maximum.request.line="", header.validation.maximum.size="", header.validation.maximum.chunk.size="", header.validation.reject.status.code="", header.validation.reject.message="", header.validation.reject.message.content.type="", server.bootstrap.configuration="", server.bootstrap.nodelay="", server.bootstrap.keepalive="", server.bootstrap.sendbuffersize="", server.bootstrap.recievebuffersize="", server.bootstrap.connect.timeout="", server.bootstrap.socket.reuse="", server.bootstrap.socket.timeout="", server.bootstrap.socket.backlog="", trace.log.enabled="", @map(...))) -``` - -QUERY PARAMETERS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
receiver.urlThe URL to which the events should be received. User can provide any valid url and if the url is not provided the system will use the following format http://0.0.0.0:9763/<appNAme>/<streamName>If the user want to use SSL the url should be given in following format https://localhost:8080/<streamName>http://0.0.0.0:9763//STRINGYesNo
source.idIdentifier need to map the source to sink.STRINGNoNo
connection.timeoutConnection timeout in milliseconds. If the mapped http-response sink does not get a correlated message, after this timeout value, a timeout response is sent120000INTYesNo
basic.auth.enabledIf this is set to true, basic authentication is enabled for incoming events, and the credentials with which each event is sent are verified to ensure that the user is authorized to access the service. If basic authentication fails, the event is not authenticated and an authentication error is logged in the CLI. By default this values 'false' falseSTRINGYesNo
worker.countThe number of active worker threads to serve the incoming events. The value is 1 by default. This will ensure that the events are directed to the event stream in the same order in which they arrive. By increasing this value the performance might increase at the cost of loosing event ordering.1STRINGYesNo
socket.idle.timeoutIdle timeout for HTTP connection.120000INTYesNo
ssl.verify.clientThe type of client certificate verification.nullSTRINGYesNo
ssl.protocolssl/tls related optionsTLSSTRINGYesNo
tls.store.typeTLS store type.JKSSTRINGYesNo
parametersParameters other than basics such as ciphers,sslEnabledProtocols,client.enable.session.creation. Expected format of these parameters is as follows: "'ciphers:xxx','sslEnabledProtocols,client.enable:xxx'"nullSTRINGYesNo
ciphersList of ciphers to be used. This parameter should include under parameters Ex: 'ciphers:TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256'nullSTRINGYesNo
ssl.enabled.protocolsSSL/TLS protocols to be enabled. This parameter should be in camel case format(sslEnabledProtocols) under parameters. Ex 'sslEnabledProtocols:true'nullSTRINGYesNo
server.enable.session.creationEnable HTTP session creation.This parameter should include under parameters Ex: 'client.enable.session.creation:true'nullSTRINGYesNo
server.supported.snimatchersHttp SNIMatcher to be added. This parameter should include under parameters Ex: 'server.supported.snimatchers:SNIMatcher'nullSTRINGYesNo
server.suported.server.namesHttp supported servers. This parameter should include under parameters Ex: 'server.suported.server.names:server'nullSTRINGYesNo
request.size.validation.configurationParameters that responsible for validating the http request and request headers. Expected format of these parameters is as follows: "'request.size.validation:xxx','request.size.validation.maximum.value:xxx'"nullSTRINGYesNo
request.size.validationTo enable the request size validation.falseSTRINGYesNo
request.size.validation.maximum.valueIf request size is validated then maximum size.Integer.MAX_VALUESTRINGYesNo
request.size.validation.reject.status.codeIf request is exceed maximum size and request.size.validation is enabled then status code to be send as response.401STRINGYesNo
request.size.validation.reject.messageIf request is exceed maximum size and request.size.validation is enabled then status message to be send as response.Message is bigger than the valid sizeSTRINGYesNo
request.size.validation.reject.message.content.typeIf request is exceed maximum size and request.size.validation is enabled then content type to be send as response.plain/textSTRINGYesNo
header.size.validationTo enable the header size validation.falseSTRINGYesNo
header.validation.maximum.request.lineIf header header validation is enabled then the maximum request line.4096STRINGYesNo
header.validation.maximum.sizeIf header header validation is enabled then the maximum expected header size.8192STRINGYesNo
header.validation.maximum.chunk.sizeIf header header validation is enabled then the maximum expected chunk size.8192STRINGYesNo
header.validation.reject.status.code401If header is exceed maximum size and header.size.validation is enabled then status code to be send as response.STRINGYesNo
header.validation.reject.messageIf header is exceed maximum size and header.size.validation is enabled then message to be send as response.Message header is bigger than the valid sizeSTRINGYesNo
header.validation.reject.message.content.typeIf header is exceed maximum size and header.size.validation is enabled then content type to be send as response.plain/textSTRINGYesNo
server.bootstrap.configurationParameters that for bootstrap configurations of the server. Expected format of these parameters is as follows: "'ciphers:xxx','sslEnabledProtocols,client.enable:xxx'"nullOBJECTYesNo
server.bootstrap.nodelayHttp server no delay.trueBOOLYesNo
server.bootstrap.keepaliveHttp server keep alive.trueBOOLYesNo
server.bootstrap.sendbuffersizeHttp server send buffer size.1048576INTYesNo
server.bootstrap.recievebuffersizeHttp server receive buffer size.1048576INTYesNo
server.bootstrap.connect.timeoutHttp server connection timeout.15000INTYesNo
server.bootstrap.socket.reuseTo enable http socket reuse.falseBOOLYesNo
server.bootstrap.socket.timeoutHttp server socket timeout.15BOOLYesNo
server.bootstrap.socket.backlogTHttp server socket backlog.100BOOLYesNo
trace.log.enabledHttp traffic monitoring.falseBOOLYesNo
- -System Parameters - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Parameters
serverBootstrapBossGroupSizeproperty to configure number of boss threads, which accepts incoming connections until the ports are unbound. Once connection accepts successfully, boss thread passes the accepted channel to one of the worker threads.Number of available processorsAny integer
serverBootstrapWorkerGroupSizeproperty to configure number of worker threads, which performs non blocking read and write for one or more channels in non-blocking mode.(Number of available processors)*2Any integer
serverBootstrapClientGroupSizeproperty to configure number of client threads, which performs non blocking read and write for one or more channels in non-blocking mode.(Number of available processors)*2Any integer
defaultHostThe default host of the transport.0.0.0.0Any valid host
defaultHttpPortThe default port if the default scheme is 'http'.8280Any valid port
defaultHttpsPortThe default port if the default scheme is 'https'.8243Any valid port
defaultSchemeThe default protocol.httphttp
https
keyStoreLocationThe default keystore file path.${carbon.home}/resources/security/wso2carbon.jksPath to wso2carbon.jks file
keyStorePasswordThe default keystore password.wso2carbonString of keystore password
certPasswordThe default cert password.wso2carbonString of cert password
- -Examples -EXAMPLE 1 -``` -@source(type='http-request', source.id='sampleSourceId, receiver.url='http://localhost:9055/endpoints/RecPro', connection.timeout='150000', parameters="'ciphers : TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256', 'sslEnabledProtocols:TLSv1.1,TLSv1.2'", request.size.validation.configuration="request.size.validation:true", server.bootstrap.configuration="server.bootstrap.socket.timeout:25", @map(type='json, @attributes(messageId='trp:messageId', symbol='$.events.event.symbol', price='$.events.event.price', volume='$.events.event.volume'))) -define stream FooStream (messageId string, symbol string, price float, volume long); - -``` -

The expected input is as follows:
{"events":
    {"event":
        "symbol":WSO2,
        "price":55.6,
        "volume":100,
    }
}
If basic authentication is enabled via the basic.auth.enabled='true setting, each input event is also expected to contain the Authorization:'Basic encodeBase64(username:Password)' header.

- -### http-response *(Source)* - -

The http-response source co-relates with http-request sink with the parameter 'sink.id'.
This receives responses for the requests sent by the http-request sink which has the same sink id.
Response messages can be in formats such as TEXT, JSON and XML.
In order to handle the responses with different http status codes, user is allowed to defined the acceptable response source code using the parameter 'http.status.code'

- -Syntax -``` -@source(type="http-response", sink.id="", http.status.code="", @map(...))) -``` - -QUERY PARAMETERS - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
sink.idThis parameter is used to map the http-response source to a http-request sink. Then this source will accepts the response messages for the requests sent by corresponding http-request sink.STRINGNoNo
http.status.codeAcceptable http status code for the responses.
This can be a complete string or a regex.
Only the responses with matching status codes to the defined value, will be received by the http-response source.
Eg: 'http.status.code = '200', http.status.code = '2\\d+''
STRINGNoNo
- -Examples -EXAMPLE 1 -``` -@sink(type='http-request', -downloading.enabled='true', -publisher.url='http://localhost:8005/registry/employee', -method='POST', headers='{{headers}}',sink.id='employee-info', -@map(type='json')) -define stream BarStream (name String, id int, headers String, downloadPath string); - -@source(type='http-response' , sink.id='employee-info', http.status.code='2\\d+', -@map(type='text', regex.A='((.|\n)*)', @attributes(message='A[1]'))) -define stream responseStream2xx(message string);@source(type='http-response' , sink.id='employee-info', http.status.code='4\\d+' , -@map(type='text', regex.A='((.|\n)*)', @attributes(message='A[1]'))) -define stream responseStream4xx(message string); -``` -

In above example, the defined http-request sink will send a POST requests to the endpoint defined by 'publisher.url'.
Then for those requests, the source with the response code '2\\d+' and sink.id 'employee-info' will receive the responses with 2xx status codes.
The http-response source which has 'employee-info' as the 'sink.id' and '4\\d+' as the http.response.code will receive all the responses with 4xx status codes.
. Then the body of the response message will be extracted using text mapper and converted into siddhi events.
.

- diff --git a/docs/api/1.0.33.md b/docs/api/1.0.33.md deleted file mode 100644 index 4f15e971..00000000 --- a/docs/api/1.0.33.md +++ /dev/null @@ -1,1665 +0,0 @@ -# API Docs - v1.0.33 - -## Sink - -### http *(Sink)* - -

This extension publish the HTTP events in any HTTP method POST, GET, PUT, DELETE via HTTP or https protocols. As the additional features this component can provide basic authentication as well as user can publish events using custom client truststore files when publishing events via https protocol. And also user can add any number of headers including HTTP_METHOD header for each event dynamically.
Following content types will be set by default according to the type of sink mapper used.
You can override them by setting the new content types in headers.
     - TEXT : text/plain
     - XML : application/xml
     - JSON : application/json
     - KEYVALUE : application/x-www-form-urlencoded

- -Syntax -``` -@sink(type="http", publisher.url="", basic.auth.username="", basic.auth.password="", https.truststore.file="", https.truststore.password="", headers="", method="", socket.idle.timeout="", chunk.disabled="", ssl.protocol="", parameters="", ciphers="", ssl.enabled.protocols="", client.enable.session.creation="", follow.redirect="", max.redirect.count="", tls.store.type="", proxy.host="", proxy.port="", proxy.username="", proxy.password="", client.bootstrap.configuration="", client.bootstrap.nodelay="", client.bootstrap.keepalive="", client.bootstrap.sendbuffersize="", client.bootstrap.recievebuffersize="", client.bootstrap.connect.timeout="", client.bootstrap.socket.reuse="", client.bootstrap.socket.timeout="", client.threadpool.configurations="", client.connection.pool.count="", client.max.active.connections.per.pool="", client.min.idle.connections.per.pool="", client.max.idle.connections.per.pool="", client.min.eviction.idle.time="", sender.thread.count="", event.group.executor.thread.size="", max.wait.for.client.connection.pool="", @map(...))) -``` - -QUERY PARAMETERS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
publisher.urlThe URL to which the outgoing events should be published via HTTP. This is a mandatory parameter and if this is not specified, an error is logged in the CLI. If user wants to enable SSL for the events, use https instead of http in the publisher.url.e.g., http://localhost:8080/endpoint, https://localhost:8080/endpointSTRINGNoNo
basic.auth.usernameThe username to be included in the authentication header of the basic authentication enabled events. It is required to specify both username and password to enable basic authentication. If one of the parameter is not given by user then an error is logged in the CLI. STRINGYesNo
basic.auth.passwordThe password to include in the authentication header of the basic authentication enabled events. It is required to specify both username and password to enable basic authentication. If one of the parameter is not given by user then an error is logged in the CLI. STRINGYesNo
https.truststore.fileThe file path to the location of the truststore of the client that sends the HTTP events through 'https' protocol. A custom client-truststore can be specified if required.${carbon.home}/resources/security/client-truststore.jksSTRINGYesNo
https.truststore.passwordThe password for the client-truststore. A custom password can be specified if required. If no custom password is specified and the protocol of URL is 'https' then, the system uses default password.wso2carbonSTRINGYesNo
headersThe headers that should be included as HTTP request headers.
There can be any number of headers concatenated in following format. "'header1:value1','header2:value2'". User can include Content-Type header if he needs to use a specific content-type for the payload. Or else, system decides the Content-Type by considering the type of sink mapper, in following way.
 - @map(xml):application/xml
 - @map(json):application/json
 - @map(text):plain/text )
 - if user does not include any mapping type then the system gets 'plain/text' as default Content-Type header.
Note that providing content-length as a header is not supported. The size of the payload will be automatically calculated and included in the content-length header.
STRINGYesNo
methodFor HTTP events, HTTP_METHOD header should be included as a request header. If the parameter is null then system uses 'POST' as a default header.POSTSTRINGYesNo
socket.idle.timeoutSocket timeout value in millisecond6000INTYesNo
chunk.disabledThis parameter is used to disable/enable chunked transfer encodingfalseBOOLYesNo
ssl.protocolThe SSL protocol versionTLSSTRINGYesNo
parametersParameters other than basics such as ciphers,sslEnabledProtocols,client.enable.session.creation. Expected format of these parameters is as follows: "'ciphers:xxx','sslEnabledProtocols,client.enable:xxx'"nullSTRINGYesNo
ciphersList of ciphers to be used. This parameter should include under parameters Ex: 'ciphers:TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256'nullSTRINGYesNo
ssl.enabled.protocolsSSL/TLS protocols to be enabled. This parameter should be in camel case format(sslEnabledProtocols) under parameters. Ex 'sslEnabledProtocols:true'nullSTRINGYesNo
client.enable.session.creationEnable HTTP session creation.This parameter should include under parameters Ex: 'client.enable.session.creation:true'nullSTRINGYesNo
follow.redirectRedirect related enabled.trueBOOLYesNo
max.redirect.countMaximum redirect count.5INTYesNo
tls.store.typeTLS store type to be used.JKSSTRINGYesNo
proxy.hostProxy server hostnullSTRINGYesNo
proxy.portProxy server portnullSTRINGYesNo
proxy.usernameProxy server usernamenullSTRINGYesNo
proxy.passwordProxy server passwordnullSTRINGYesNo
client.bootstrap.configurationClient bootsrap configurations. Expected format of these parameters is as follows: "'client.bootstrap.nodelay:xxx','client.bootstrap.keepalive:xxx'"TODOSTRINGYesNo
client.bootstrap.nodelayHttp client no delay.trueBOOLYesNo
client.bootstrap.keepaliveHttp client keep alive.trueBOOLYesNo
client.bootstrap.sendbuffersizeHttp client send buffer size.1048576INTYesNo
client.bootstrap.recievebuffersizeHttp client receive buffer size.1048576INTYesNo
client.bootstrap.connect.timeoutHttp client connection timeout.15000INTYesNo
client.bootstrap.socket.reuseTo enable http socket reuse.falseBOOLYesNo
client.bootstrap.socket.timeoutHttp client socket timeout.15STRINGYesNo
client.threadpool.configurationsThread pool configuration. Expected format of these parameters is as follows: "'client.connection.pool.count:xxx','client.max.active.connections.per.pool:xxx'"TODOSTRINGYesNo
client.connection.pool.countConnection pool count.0INTYesNo
client.max.active.connections.per.poolActive connections per pool.-1INTYesNo
client.min.idle.connections.per.poolMinimum ideal connection per pool.0INTYesNo
client.max.idle.connections.per.poolMaximum ideal connection per pool.100INTYesNo
client.min.eviction.idle.timeMinimum eviction idle time.5 * 60 * 1000STRINGYesNo
sender.thread.countHttp sender thread count.20STRINGYesNo
event.group.executor.thread.sizeEvent group executor thread size.15STRINGYesNo
max.wait.for.client.connection.poolMaximum wait for client connection pool.60000STRINGYesNo
- -System Parameters - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Parameters
clientBootstrapBossGroupSizeproperty to configure number of boss threads, which accepts incoming connections until the ports are unbound. Once connection accepts successfully, boss thread passes the accepted channel to one of the worker threads.Number of available processorsAny integer
clientBootstrapWorkerGroupSizeproperty to configure number of worker threads, which performs non blocking read and write for one or more channels in non-blocking mode.(Number of available processors)*2Any integer
clientBootstrapClientGroupSizeproperty to configure number of client threads, which performs non blocking read and write for one or more channels in non-blocking mode.(Number of available processors)*2Any integer
trustStoreLocationThe default truststore file path.${carbon.home}/resources/security/client-truststore.jksPath to client-truststore.jks
trustStorePasswordThe default truststore password.wso2carbonTruststore password
- -Examples -EXAMPLE 1 -``` -@sink(type='http',publisher.url='http://localhost:8009/foo', method='{{method}}',headers="'content-type:xml','content-length:94'", client.bootstrap.configuration="'client.bootstrap.socket.timeout:20', 'client.bootstrap.worker.group.size:10'", client.pool.configuration="'client.connection.pool.count:10','client.max.active.connections.per.pool:1'", @map(type='xml', @payload('{{payloadBody}}'))) -define stream FooStream (payloadBody String, method string, headers string); - -``` -

If it is xml mapping expected input should be in following format for FooStream:
{
<events>
    <event>
        <symbol>WSO2</symbol>
        <price>55.6</price>
        <volume>100</volume>
    </event>
</events>,
POST,
Content-Length:24#Content-Location:USA#Retry-After:120
}

Above event will generate output as below.
~Output http event payload
<events>
    <event>
        <symbol>WSO2</symbol>
        <price>55.6</price>
        <volume>100</volume>
    </event>
</events>

~Output http event headers
Content-Length:24,
Content-Location:'USA',
Retry-After:120,
Content-Type:'application/xml',
HTTP_METHOD:'POST',

~Output http event properties
HTTP_METHOD:'POST',
HOST:'localhost',
PORT:8009,
PROTOCOL:'http',
TO:'/foo'

- -### http-request *(Sink)* - -

This extension publish the HTTP events in any HTTP method POST, GET, PUT, DELETE via HTTP or https protocols. As the additional features this component can provide basic authentication as well as user can publish events using custom client truststore files when publishing events via https protocol. And also user can add any number of headers including HTTP_METHOD header for each event dynamically.
Following content types will be set by default according to the type of sink mapper used.
You can override them by setting the new content types in headers.
     - TEXT : text/plain
     - XML : application/xml
     - JSON : application/json
     - KEYVALUE : application/x-www-form-urlencoded

HTTP request sink is correlated with the The HTTP reponse source, through a unique sink.id.It sends the request to the defined url and the response is received by the response source which has the same 'sink.id'.

- -Syntax -``` -@sink(type="http-request", publisher.url="", basic.auth.username="", basic.auth.password="", https.truststore.file="", https.truststore.password="", headers="", method="", socket.idle.timeout="", chunk.disabled="", ssl.protocol="", parameters="", ciphers="", ssl.enabled.protocols="", client.enable.session.creation="", follow.redirect="", max.redirect.count="", tls.store.type="", proxy.host="", proxy.port="", proxy.username="", proxy.password="", client.bootstrap.configuration="", client.bootstrap.nodelay="", client.bootstrap.keepalive="", client.bootstrap.sendbuffersize="", client.bootstrap.recievebuffersize="", client.bootstrap.connect.timeout="", client.bootstrap.socket.reuse="", client.bootstrap.socket.timeout="", client.threadpool.configurations="", client.connection.pool.count="", client.max.active.connections.per.pool="", client.min.idle.connections.per.pool="", client.max.idle.connections.per.pool="", client.min.eviction.idle.time="", sender.thread.count="", event.group.executor.thread.size="", max.wait.for.client.connection.pool="", sink.id="", downloading.enabled="", download.path="", @map(...))) -``` - -QUERY PARAMETERS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
publisher.urlThe URL to which the outgoing events should be published via HTTP. This is a mandatory parameter and if this is not specified, an error is logged in the CLI. If user wants to enable SSL for the events, use https instead of http in the publisher.url.
e.g., http://localhost:8080/endpoint, https://localhost:8080/endpoint
This can be used as a dynamic parameter as well.
STRINGNoYes
basic.auth.usernameThe username to be included in the authentication header of the basic authentication enabled events. It is required to specify both username and password to enable basic authentication. If one of the parameter is not given by user then an error is logged in the CLI. STRINGYesNo
basic.auth.passwordThe password to include in the authentication header of the basic authentication enabled events. It is required to specify both username and password to enable basic authentication. If one of the parameter is not given by user then an error is logged in the CLI. STRINGYesNo
https.truststore.fileThe file path to the location of the truststore of the client that sends the HTTP events through 'https' protocol. A custom client-truststore can be specified if required.${carbon.home}/resources/security/client-truststore.jksSTRINGYesNo
https.truststore.passwordThe password for the client-truststore. A custom password can be specified if required. If no custom password is specified and the protocol of URL is 'https' then, the system uses default password.wso2carbonSTRINGYesNo
headersThe headers that should be included as HTTP request headers.
There can be any number of headers concatenated in following format. "'header1:value1','header2:value2'". User can include Content-Type header if he needs to use a specific content-type for the payload. Or else, system decides the Content-Type by considering the type of sink mapper, in following way.
 - @map(xml):application/xml
 - @map(json):application/json
 - @map(text):plain/text )
 - if user does not include any mapping type then the system gets 'plain/text' as default Content-Type header.
Note that providing content-length as a header is not supported. The size of the payload will be automatically calculated and included in the content-length header.
STRINGYesNo
methodFor HTTP events, HTTP_METHOD header should be included as a request header. If the parameter is null then system uses 'POST' as a default header.POSTSTRINGYesNo
socket.idle.timeoutSocket timeout value in millisecond6000INTYesNo
chunk.disabledport: Port number of the remote servicefalseBOOLYesNo
ssl.protocolThe SSL protocol versionTLSSTRINGYesNo
parametersParameters other than basics such as ciphers,sslEnabledProtocols,client.enable.session.creation. Expected format of these parameters is as follows: "'ciphers:xxx','sslEnabledProtocols,client.enable:xxx'"nullSTRINGYesNo
ciphersList of ciphers to be used. This parameter should include under parameters Ex: 'ciphers:TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256'nullSTRINGYesNo
ssl.enabled.protocolsSSL/TLS protocols to be enabled. This parameter should be in camel case format(sslEnabledProtocols) under parameters. Ex 'sslEnabledProtocols:true'nullSTRINGYesNo
client.enable.session.creationEnable HTTP session creation.This parameter should include under parameters Ex: 'client.enable.session.creation:true'nullSTRINGYesNo
follow.redirectRedirect related enabled.trueBOOLYesNo
max.redirect.countMaximum redirect count.5INTYesNo
tls.store.typeTLS store type to be used.JKSSTRINGYesNo
proxy.hostProxy server hostnullSTRINGYesNo
proxy.portProxy server portnullSTRINGYesNo
proxy.usernameProxy server usernamenullSTRINGYesNo
proxy.passwordProxy server passwordnullSTRINGYesNo
client.bootstrap.configurationClient bootsrap configurations. Expected format of these parameters is as follows: "'client.bootstrap.nodelay:xxx','client.bootstrap.keepalive:xxx'"TODOSTRINGYesNo
client.bootstrap.nodelayHttp client no delay.trueBOOLYesNo
client.bootstrap.keepaliveHttp client keep alive.trueBOOLYesNo
client.bootstrap.sendbuffersizeHttp client send buffer size.1048576INTYesNo
client.bootstrap.recievebuffersizeHttp client receive buffer size.1048576INTYesNo
client.bootstrap.connect.timeoutHttp client connection timeout.15000INTYesNo
client.bootstrap.socket.reuseTo enable http socket reuse.falseBOOLYesNo
client.bootstrap.socket.timeoutHttp client socket timeout.15STRINGYesNo
client.threadpool.configurationsThread pool configuration. Expected format of these parameters is as follows: "'client.connection.pool.count:xxx','client.max.active.connections.per.pool:xxx'"TODOSTRINGYesNo
client.connection.pool.countConnection pool count.0INTYesNo
client.max.active.connections.per.poolActive connections per pool.-1INTYesNo
client.min.idle.connections.per.poolMinimum ideal connection per pool.0INTYesNo
client.max.idle.connections.per.poolMaximum ideal connection per pool.100INTYesNo
client.min.eviction.idle.timeMinimum eviction idle time.5 * 60 * 1000STRINGYesNo
sender.thread.countHttp sender thread count.20STRINGYesNo
event.group.executor.thread.sizeEvent group executor thread size.15STRINGYesNo
max.wait.for.client.connection.poolMaximum wait for client connection pool.60000STRINGYesNo
sink.idIdentifier of the sink. This is used to co-relate with the corresponding http-response source which needs to process the repose for the request sent by this sink.STRINGNoNo
downloading.enabledIf this is set to 'true' then the response received by the response source will be written to a file. If downloading is enabled, the download.path parameter is mandatory.falseBOOLYesNo
download.pathIf downloading is enabled, the path of the file which is going to be downloaded should be specified using 'download.path' parameter. This should be an absolute path including the file name.nullSTRINGYesYes
- -Examples -EXAMPLE 1 -``` -@sink(type='http-request', sink.id='foo', publisher.url='http://localhost:8009/foo', @map(type='xml', @payload('{{payloadBody}}'))) -define stream FooStream (payloadBody String, method string, headers string); -@source(type='http-response', sink.id='foo', http.status.code='2\\d+', -@map(type='text', regex.A='((.|\n)*)', @attributes(headers='trp:headers', fileName='A[1]'))) -define stream responseStream2xx(fileName string, headers string); - -@source(type='http-response', sink.id='foo', http.status.code='4\\d+', -@map(type='text', regex.A='((.|\n)*)', @attributes(errorMsg='A[1]'))) -define stream responseStream4xx(errorMsg string); -``` -

In above example, the payload body for 'FooStream' will be in following format.
{
<events>
    <event>
        <symbol>WSO2</symbol>
        <price>55.6</price>
        <volume>100</volume>
    </event>
</events>,
This message will sent as the body of a POST request with the content-type 'application/xml' to the endpoint defined as the 'publisher.url' and in order to process the responses for these requests, there should be a source of type 'http-response' defined with the same sink id 'foo' in the siddhi app.
The responses with 2xx status codes will be received by the http-response source which has the http.status.code defined by the regex '2\\d+'.
If the response has a 4xx status code, it will be received by the http-response source which has the http.status.code defined by the regex '4\\d+'.

- -EXAMPLE 2 -``` -define stream FooStream (name String, id int, headers String, downloadPath string); -@sink(type='http-request', -downloading.enabled='true', -download.path='{{downloadPath}}',publisher.url='http://localhost:8005/files', -method='GET', headers='{{headers}}',sink.id='download-sink', -@map(type='json')) -define stream BarStream (name String, id int, headers String, downloadPath string); - -@source(type='http-response', sink.id='download-sink', http.status.code='2\\d+', -@map(type='text', regex.A='((.|\n)*)', @attributes(headers='trp:headers', fileName='A[1]'))) -define stream responseStream2xx(fileName string, headers string); - -@source(type='http-response', sink.id='download-sink', http.status.code='4\\d+', -@map(type='text', regex.A='((.|\n)*)', @attributes(errorMsg='A[1]'))) -define stream responseStream4xx(errorMsg string); -``` -

In above example, http-request sink will send a GET request to the publisher url and the requested file will be received as the response by a corresponding http-response source.
If the http status code of the response is a successful one (2xx), it will be received by the http-response source which has the http.status.code '2\\d+' and downloaded as a local file. Then the event received to the responseStream2xx will have the headers included in the request and the downloaded file name.
If the http status code of the response is a 4xx code, it will be received by the http-response source which has the http.status.code '4\\d+'. Then the event received to the responseStream4xx will have the response message body in text format.

- -### http-response *(Sink)* - -

HTTP response sink is correlated with the The HTTP request source, through a unique source.id, and it send a response to the HTTP request source having the same source.id. The response message can be formatted in text, XML or JSON and can be sent with appropriate headers.

- -Syntax -``` -@sink(type="http-response", source.id="", message.id="", headers="", @map(...))) -``` - -QUERY PARAMETERS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
source.idIdentifier of the source.STRINGNoNo
message.idIdentifier of the message.STRINGNoYes
headersThe headers that should be included as HTTP response headers. There can be any number of headers concatenated on following format. "'header1:value1','header2:value2'" User can include content-type header if he/she need to have any specific type for payload. If not system get the mapping type as the content-Type header (ie.@map(xml):application/xml, @map(json):application/json, @map(text):plain/text) and if user does not include any mapping type then system gets the plain/text as default Content-Type header. If user does not include Content-Length header then system calculate the bytes size of payload and include it as content-length header. STRINGYesNo
- -Examples -EXAMPLE 1 -``` -@sink(type='http-response', source.id='sampleSourceId', message.id='{{messageId}}', headers="'content-type:json','content-length:94'"@map(type='json', @payload('{{payloadBody}}'))) -define stream FooStream (payloadBody String, messageId string, headers string); - -``` -

If it is json mapping expected input should be in following format for FooStream:
{
{"events":
    {"event":
        "symbol":WSO2,
        "price":55.6,
        "volume":100,
    }
},
0cf708b1-7eae-440b-a93e-e72f801b486a,
Content-Length:24#Content-Location:USA
}

Above event will generate response for the matching source message as below.

~Output http event payload
{"events":
    {"event":
        "symbol":WSO2,
        "price":55.6,
        "volume":100,
    }
}

~Output http event headers
Content-Length:24,
Content-Location:'USA',
Content-Type:'application/json'

- -## Source - -### http *(Source)* - -

The HTTP source receives POST requests via HTTP or HTTPS in format such as text, XML and JSON. In WSO2 SP, if required, you can enable basic authentication to ensure that events are received only from users who are authorized to access the service.

- -Syntax -``` -@source(type="http", receiver.url="", basic.auth.enabled="", worker.count="", socket.idle.timeout="", ssl.verify.client="", ssl.protocol="", tls.store.type="", parameters="", ciphers="", ssl.enabled.protocols="", server.enable.session.creation="", server.supported.snimatchers="", server.suported.server.names="", request.size.validation.configuration="", request.size.validation="", request.size.validation.maximum.value="", request.size.validation.reject.status.code="", request.size.validation.reject.message="", request.size.validation.reject.message.content.type="", header.size.validation="", header.validation.maximum.request.line="", header.validation.maximum.size="", header.validation.maximum.chunk.size="", header.validation.reject.status.code="", header.validation.reject.message="", header.validation.reject.message.content.type="", server.bootstrap.configuration="", server.bootstrap.nodelay="", server.bootstrap.keepalive="", server.bootstrap.sendbuffersize="", server.bootstrap.recievebuffersize="", server.bootstrap.connect.timeout="", server.bootstrap.socket.reuse="", server.bootstrap.socket.timeout="", server.bootstrap.socket.backlog="", trace.log.enabled="", @map(...))) -``` - -QUERY PARAMETERS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
receiver.urlThe URL to which the events should be received. User can provide any valid url and if the url is not provided the system will use the following format http://0.0.0.0:9763/<appNAme>/<streamName>If the user want to use SSL the url should be given in following format https://localhost:8080/<streamName>http://0.0.0.0:9763//STRINGYesNo
basic.auth.enabledThis works only in WSO2 SP. If this is set to true, basic authentication is enabled for incoming events, and the credentials with which each event is sent are verified to ensure that the user is authorized to access the service. If basic authentication fails, the event is not authenticated and an authentication error is logged in the CLI.falseSTRINGYesNo
worker.countThe number of active worker threads to serve the incoming events. The value is 1 by default. This will ensure that the events are directed to the event stream in the same order in which they arrive. By increasing this value the performance might increase at the cost of loosing event ordering.1STRINGYesNo
socket.idle.timeoutIdle timeout for HTTP connection.120000INTYesNo
ssl.verify.clientThe type of client certificate verification.nullSTRINGYesNo
ssl.protocolssl/tls related optionsTLSSTRINGYesNo
tls.store.typeTLS store type.JKSSTRINGYesNo
parametersParameters other than basics such as ciphers,sslEnabledProtocols,client.enable.session.creation. Expected format of these parameters is as follows: "'ciphers:xxx','sslEnabledProtocols,client.enable:xxx'"nullSTRINGYesNo
ciphersList of ciphers to be used. This parameter should include under parameters Ex: 'ciphers:TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256'nullSTRINGYesNo
ssl.enabled.protocolsSSL/TLS protocols to be enabled. This parameter should be in camel case format(sslEnabledProtocols) under parameters. Ex 'sslEnabledProtocols:true'nullSTRINGYesNo
server.enable.session.creationEnable HTTP session creation.This parameter should include under parameters Ex: 'client.enable.session.creation:true'nullSTRINGYesNo
server.supported.snimatchersHttp SNIMatcher to be added. This parameter should include under parameters Ex: 'server.supported.snimatchers:SNIMatcher'nullSTRINGYesNo
server.suported.server.namesHttp supported servers. This parameter should include under parameters Ex: 'server.suported.server.names:server'nullSTRINGYesNo
request.size.validation.configurationParameters that responsible for validating the http request and request headers. Expected format of these parameters is as follows: "'request.size.validation:xxx','request.size.validation.maximum.value:xxx'"nullSTRINGYesNo
request.size.validationTo enable the request size validation.falseSTRINGYesNo
request.size.validation.maximum.valueIf request size is validated then maximum size.Integer.MAX_VALUESTRINGYesNo
request.size.validation.reject.status.codeIf request is exceed maximum size and request.size.validation is enabled then status code to be send as response.401STRINGYesNo
request.size.validation.reject.messageIf request is exceed maximum size and request.size.validation is enabled then status message to be send as response.Message is bigger than the valid sizeSTRINGYesNo
request.size.validation.reject.message.content.typeIf request is exceed maximum size and request.size.validation is enabled then content type to be send as response.plain/textSTRINGYesNo
header.size.validationTo enable the header size validation.falseSTRINGYesNo
header.validation.maximum.request.lineIf header header validation is enabled then the maximum request line.4096STRINGYesNo
header.validation.maximum.sizeIf header header validation is enabled then the maximum expected header size.8192STRINGYesNo
header.validation.maximum.chunk.sizeIf header header validation is enabled then the maximum expected chunk size.8192STRINGYesNo
header.validation.reject.status.code401If header is exceed maximum size and header.size.validation is enabled then status code to be send as response.STRINGYesNo
header.validation.reject.messageIf header is exceed maximum size and header.size.validation is enabled then message to be send as response.Message header is bigger than the valid sizeSTRINGYesNo
header.validation.reject.message.content.typeIf header is exceed maximum size and header.size.validation is enabled then content type to be send as response.plain/textSTRINGYesNo
server.bootstrap.configurationParameters that for bootstrap configurations of the server. Expected format of these parameters is as follows: "'ciphers:xxx','sslEnabledProtocols,client.enable:xxx'"nullOBJECTYesNo
server.bootstrap.nodelayHttp server no delay.trueBOOLYesNo
server.bootstrap.keepaliveHttp server keep alive.trueBOOLYesNo
server.bootstrap.sendbuffersizeHttp server send buffer size.1048576INTYesNo
server.bootstrap.recievebuffersizeHttp server receive buffer size.1048576INTYesNo
server.bootstrap.connect.timeoutHttp server connection timeout.15000INTYesNo
server.bootstrap.socket.reuseTo enable http socket reuse.falseBOOLYesNo
server.bootstrap.socket.timeoutHttp server socket timeout.15BOOLYesNo
server.bootstrap.socket.backlogTHttp server socket backlog.100BOOLYesNo
trace.log.enabledHttp traffic monitoring.falseBOOLYesNo
- -System Parameters - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Parameters
serverBootstrapBossGroupSizeproperty to configure number of boss threads, which accepts incoming connections until the ports are unbound. Once connection accepts successfully, boss thread passes the accepted channel to one of the worker threads.Number of available processorsAny integer
serverBootstrapWorkerGroupSizeproperty to configure number of worker threads, which performs non blocking read and write for one or more channels in non-blocking mode.(Number of available processors)*2Any integer
serverBootstrapClientGroupSizeproperty to configure number of client threads, which performs non blocking read and write for one or more channels in non-blocking mode.(Number of available processors)*2Any integer
defaultHostThe default host of the transport.0.0.0.0Any valid host
defaultHttpPortThe default port if the default scheme is 'http'.8280Any valid port
defaultHttpsPortThe default port if the default scheme is 'https'.8243Any valid port
defaultSchemeThe default protocol.httphttp
https
keyStoreLocationThe default keystore file path.${carbon.home}/resources/security/wso2carbon.jksPath to wso2carbon.jks file
keyStorePasswordThe default keystore password.wso2carbonString of keystore password
certPasswordThe default cert password.wso2carbonString of cert password
- -Examples -EXAMPLE 1 -``` -@source(type='http', receiver.url='http://localhost:9055/endpoints/RecPro', socketIdleTimeout='150000', parameters="'ciphers : TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256', 'sslEnabledProtocols:TLSv1.1,TLSv1.2'",request.size.validation.configuration="request.size.validation:true",server.bootstrap.configuration="server.bootstrap.socket.timeout:25" @map(type='xml')) -define stream FooStream (symbol string, price float, volume long); - -``` -

Above source listenerConfiguration performs a default XML input mapping. The expected input is as follows:
<events>
    <event>
        <symbol>WSO2</symbol>
        <price>55.6</price>
        <volume>100</volume>
    </event>
</events>
If basic authentication is enabled via the basic.auth.enabled='true setting, each input event is also expected to contain the Authorization:'Basic encodeBase64(username:Password)' header.

- -### http-request *(Source)* - -

The HTTP request is correlated with the HTTP response sink, through a unique source.id, and for each POST requests it receives via HTTP or HTTPS in format such as text, XML and JSON it sends the response via the HTTP response sink. The individual request and response messages are correlated at the sink using the message.id of the events. If required, you can enable basic authentication at the source to ensure that events are received only from users who are authorized to access the service.

- -Syntax -``` -@source(type="http-request", receiver.url="", source.id="", connection.timeout="", basic.auth.enabled="", worker.count="", socket.idle.timeout="", ssl.verify.client="", ssl.protocol="", tls.store.type="", parameters="", ciphers="", ssl.enabled.protocols="", server.enable.session.creation="", server.supported.snimatchers="", server.suported.server.names="", request.size.validation.configuration="", request.size.validation="", request.size.validation.maximum.value="", request.size.validation.reject.status.code="", request.size.validation.reject.message="", request.size.validation.reject.message.content.type="", header.size.validation="", header.validation.maximum.request.line="", header.validation.maximum.size="", header.validation.maximum.chunk.size="", header.validation.reject.status.code="", header.validation.reject.message="", header.validation.reject.message.content.type="", server.bootstrap.configuration="", server.bootstrap.nodelay="", server.bootstrap.keepalive="", server.bootstrap.sendbuffersize="", server.bootstrap.recievebuffersize="", server.bootstrap.connect.timeout="", server.bootstrap.socket.reuse="", server.bootstrap.socket.timeout="", server.bootstrap.socket.backlog="", trace.log.enabled="", @map(...))) -``` - -QUERY PARAMETERS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
receiver.urlThe URL to which the events should be received. User can provide any valid url and if the url is not provided the system will use the following format http://0.0.0.0:9763/<appNAme>/<streamName>If the user want to use SSL the url should be given in following format https://localhost:8080/<streamName>http://0.0.0.0:9763//STRINGYesNo
source.idIdentifier need to map the source to sink.STRINGNoNo
connection.timeoutConnection timeout in milliseconds. If the mapped http-response sink does not get a correlated message, after this timeout value, a timeout response is sent120000INTYesNo
basic.auth.enabledIf this is set to true, basic authentication is enabled for incoming events, and the credentials with which each event is sent are verified to ensure that the user is authorized to access the service. If basic authentication fails, the event is not authenticated and an authentication error is logged in the CLI. By default this values 'false' falseSTRINGYesNo
worker.countThe number of active worker threads to serve the incoming events. The value is 1 by default. This will ensure that the events are directed to the event stream in the same order in which they arrive. By increasing this value the performance might increase at the cost of loosing event ordering.1STRINGYesNo
socket.idle.timeoutIdle timeout for HTTP connection.120000INTYesNo
ssl.verify.clientThe type of client certificate verification.nullSTRINGYesNo
ssl.protocolssl/tls related optionsTLSSTRINGYesNo
tls.store.typeTLS store type.JKSSTRINGYesNo
parametersParameters other than basics such as ciphers,sslEnabledProtocols,client.enable.session.creation. Expected format of these parameters is as follows: "'ciphers:xxx','sslEnabledProtocols,client.enable:xxx'"nullSTRINGYesNo
ciphersList of ciphers to be used. This parameter should include under parameters Ex: 'ciphers:TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256'nullSTRINGYesNo
ssl.enabled.protocolsSSL/TLS protocols to be enabled. This parameter should be in camel case format(sslEnabledProtocols) under parameters. Ex 'sslEnabledProtocols:true'nullSTRINGYesNo
server.enable.session.creationEnable HTTP session creation.This parameter should include under parameters Ex: 'client.enable.session.creation:true'nullSTRINGYesNo
server.supported.snimatchersHttp SNIMatcher to be added. This parameter should include under parameters Ex: 'server.supported.snimatchers:SNIMatcher'nullSTRINGYesNo
server.suported.server.namesHttp supported servers. This parameter should include under parameters Ex: 'server.suported.server.names:server'nullSTRINGYesNo
request.size.validation.configurationParameters that responsible for validating the http request and request headers. Expected format of these parameters is as follows: "'request.size.validation:xxx','request.size.validation.maximum.value:xxx'"nullSTRINGYesNo
request.size.validationTo enable the request size validation.falseSTRINGYesNo
request.size.validation.maximum.valueIf request size is validated then maximum size.Integer.MAX_VALUESTRINGYesNo
request.size.validation.reject.status.codeIf request is exceed maximum size and request.size.validation is enabled then status code to be send as response.401STRINGYesNo
request.size.validation.reject.messageIf request is exceed maximum size and request.size.validation is enabled then status message to be send as response.Message is bigger than the valid sizeSTRINGYesNo
request.size.validation.reject.message.content.typeIf request is exceed maximum size and request.size.validation is enabled then content type to be send as response.plain/textSTRINGYesNo
header.size.validationTo enable the header size validation.falseSTRINGYesNo
header.validation.maximum.request.lineIf header header validation is enabled then the maximum request line.4096STRINGYesNo
header.validation.maximum.sizeIf header header validation is enabled then the maximum expected header size.8192STRINGYesNo
header.validation.maximum.chunk.sizeIf header header validation is enabled then the maximum expected chunk size.8192STRINGYesNo
header.validation.reject.status.code401If header is exceed maximum size and header.size.validation is enabled then status code to be send as response.STRINGYesNo
header.validation.reject.messageIf header is exceed maximum size and header.size.validation is enabled then message to be send as response.Message header is bigger than the valid sizeSTRINGYesNo
header.validation.reject.message.content.typeIf header is exceed maximum size and header.size.validation is enabled then content type to be send as response.plain/textSTRINGYesNo
server.bootstrap.configurationParameters that for bootstrap configurations of the server. Expected format of these parameters is as follows: "'ciphers:xxx','sslEnabledProtocols,client.enable:xxx'"nullOBJECTYesNo
server.bootstrap.nodelayHttp server no delay.trueBOOLYesNo
server.bootstrap.keepaliveHttp server keep alive.trueBOOLYesNo
server.bootstrap.sendbuffersizeHttp server send buffer size.1048576INTYesNo
server.bootstrap.recievebuffersizeHttp server receive buffer size.1048576INTYesNo
server.bootstrap.connect.timeoutHttp server connection timeout.15000INTYesNo
server.bootstrap.socket.reuseTo enable http socket reuse.falseBOOLYesNo
server.bootstrap.socket.timeoutHttp server socket timeout.15BOOLYesNo
server.bootstrap.socket.backlogTHttp server socket backlog.100BOOLYesNo
trace.log.enabledHttp traffic monitoring.falseBOOLYesNo
- -System Parameters - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Parameters
serverBootstrapBossGroupSizeproperty to configure number of boss threads, which accepts incoming connections until the ports are unbound. Once connection accepts successfully, boss thread passes the accepted channel to one of the worker threads.Number of available processorsAny integer
serverBootstrapWorkerGroupSizeproperty to configure number of worker threads, which performs non blocking read and write for one or more channels in non-blocking mode.(Number of available processors)*2Any integer
serverBootstrapClientGroupSizeproperty to configure number of client threads, which performs non blocking read and write for one or more channels in non-blocking mode.(Number of available processors)*2Any integer
defaultHostThe default host of the transport.0.0.0.0Any valid host
defaultHttpPortThe default port if the default scheme is 'http'.8280Any valid port
defaultHttpsPortThe default port if the default scheme is 'https'.8243Any valid port
defaultSchemeThe default protocol.httphttp
https
keyStoreLocationThe default keystore file path.${carbon.home}/resources/security/wso2carbon.jksPath to wso2carbon.jks file
keyStorePasswordThe default keystore password.wso2carbonString of keystore password
certPasswordThe default cert password.wso2carbonString of cert password
- -Examples -EXAMPLE 1 -``` -@source(type='http-request', source.id='sampleSourceId, receiver.url='http://localhost:9055/endpoints/RecPro', connection.timeout='150000', parameters="'ciphers : TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256', 'sslEnabledProtocols:TLSv1.1,TLSv1.2'", request.size.validation.configuration="request.size.validation:true", server.bootstrap.configuration="server.bootstrap.socket.timeout:25", @map(type='json, @attributes(messageId='trp:messageId', symbol='$.events.event.symbol', price='$.events.event.price', volume='$.events.event.volume'))) -define stream FooStream (messageId string, symbol string, price float, volume long); - -``` -

The expected input is as follows:
{"events":
    {"event":
        "symbol":WSO2,
        "price":55.6,
        "volume":100,
    }
}
If basic authentication is enabled via the basic.auth.enabled='true setting, each input event is also expected to contain the Authorization:'Basic encodeBase64(username:Password)' header.

- -### http-response *(Source)* - -

The http-response source co-relates with http-request sink with the parameter 'sink.id'.
This receives responses for the requests sent by the http-request sink which has the same sink id.
Response messages can be in formats such as TEXT, JSON and XML.
In order to handle the responses with different http status codes, user is allowed to defined the acceptable response source code using the parameter 'http.status.code'

- -Syntax -``` -@source(type="http-response", sink.id="", http.status.code="", @map(...))) -``` - -QUERY PARAMETERS - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
sink.idThis parameter is used to map the http-response source to a http-request sink. Then this source will accepts the response messages for the requests sent by corresponding http-request sink.STRINGNoNo
http.status.codeAcceptable http status code for the responses.
This can be a complete string or a regex.
Only the responses with matching status codes to the defined value, will be received by the http-response source.
Eg: 'http.status.code = '200', http.status.code = '2\\d+''
STRINGNoNo
- -Examples -EXAMPLE 1 -``` -@sink(type='http-request', -downloading.enabled='true', -publisher.url='http://localhost:8005/registry/employee', -method='POST', headers='{{headers}}',sink.id='employee-info', -@map(type='json')) -define stream BarStream (name String, id int, headers String, downloadPath string); - -@source(type='http-response' , sink.id='employee-info', http.status.code='2\\d+', -@map(type='text', regex.A='((.|\n)*)', @attributes(message='A[1]'))) -define stream responseStream2xx(message string);@source(type='http-response' , sink.id='employee-info', http.status.code='4\\d+' , -@map(type='text', regex.A='((.|\n)*)', @attributes(message='A[1]'))) -define stream responseStream4xx(message string); -``` -

In above example, the defined http-request sink will send a POST requests to the endpoint defined by 'publisher.url'.
Then for those requests, the source with the response code '2\\d+' and sink.id 'employee-info' will receive the responses with 2xx status codes.
The http-response source which has 'employee-info' as the 'sink.id' and '4\\d+' as the http.response.code will receive all the responses with 4xx status codes.
. Then the body of the response message will be extracted using text mapper and converted into siddhi events.
.

- diff --git a/docs/api/1.0.34.md b/docs/api/1.0.34.md deleted file mode 100644 index 3cc29d3d..00000000 --- a/docs/api/1.0.34.md +++ /dev/null @@ -1,1665 +0,0 @@ -# API Docs - v1.0.34 - -## Sink - -### http *(Sink)* - -

This extension publish the HTTP events in any HTTP method POST, GET, PUT, DELETE via HTTP or https protocols. As the additional features this component can provide basic authentication as well as user can publish events using custom client truststore files when publishing events via https protocol. And also user can add any number of headers including HTTP_METHOD header for each event dynamically.
Following content types will be set by default according to the type of sink mapper used.
You can override them by setting the new content types in headers.
     - TEXT : text/plain
     - XML : application/xml
     - JSON : application/json
     - KEYVALUE : application/x-www-form-urlencoded

- -Syntax -``` -@sink(type="http", publisher.url="", basic.auth.username="", basic.auth.password="", https.truststore.file="", https.truststore.password="", headers="", method="", socket.idle.timeout="", chunk.disabled="", ssl.protocol="", parameters="", ciphers="", ssl.enabled.protocols="", client.enable.session.creation="", follow.redirect="", max.redirect.count="", tls.store.type="", proxy.host="", proxy.port="", proxy.username="", proxy.password="", client.bootstrap.configuration="", client.bootstrap.nodelay="", client.bootstrap.keepalive="", client.bootstrap.sendbuffersize="", client.bootstrap.recievebuffersize="", client.bootstrap.connect.timeout="", client.bootstrap.socket.reuse="", client.bootstrap.socket.timeout="", client.threadpool.configurations="", client.connection.pool.count="", client.max.active.connections.per.pool="", client.min.idle.connections.per.pool="", client.max.idle.connections.per.pool="", client.min.eviction.idle.time="", sender.thread.count="", event.group.executor.thread.size="", max.wait.for.client.connection.pool="", @map(...))) -``` - -QUERY PARAMETERS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
publisher.urlThe URL to which the outgoing events should be published via HTTP. This is a mandatory parameter and if this is not specified, an error is logged in the CLI. If user wants to enable SSL for the events, use https instead of http in the publisher.url.e.g., http://localhost:8080/endpoint, https://localhost:8080/endpointSTRINGNoNo
basic.auth.usernameThe username to be included in the authentication header of the basic authentication enabled events. It is required to specify both username and password to enable basic authentication. If one of the parameter is not given by user then an error is logged in the CLI. STRINGYesNo
basic.auth.passwordThe password to include in the authentication header of the basic authentication enabled events. It is required to specify both username and password to enable basic authentication. If one of the parameter is not given by user then an error is logged in the CLI. STRINGYesNo
https.truststore.fileThe file path to the location of the truststore of the client that sends the HTTP events through 'https' protocol. A custom client-truststore can be specified if required.${carbon.home}/resources/security/client-truststore.jksSTRINGYesNo
https.truststore.passwordThe password for the client-truststore. A custom password can be specified if required. If no custom password is specified and the protocol of URL is 'https' then, the system uses default password.wso2carbonSTRINGYesNo
headersThe headers that should be included as HTTP request headers.
There can be any number of headers concatenated in following format. "'header1:value1','header2:value2'". User can include Content-Type header if he needs to use a specific content-type for the payload. Or else, system decides the Content-Type by considering the type of sink mapper, in following way.
 - @map(xml):application/xml
 - @map(json):application/json
 - @map(text):plain/text )
 - if user does not include any mapping type then the system gets 'plain/text' as default Content-Type header.
Note that providing content-length as a header is not supported. The size of the payload will be automatically calculated and included in the content-length header.
STRINGYesNo
methodFor HTTP events, HTTP_METHOD header should be included as a request header. If the parameter is null then system uses 'POST' as a default header.POSTSTRINGYesNo
socket.idle.timeoutSocket timeout value in millisecond6000INTYesNo
chunk.disabledThis parameter is used to disable/enable chunked transfer encodingfalseBOOLYesNo
ssl.protocolThe SSL protocol versionTLSSTRINGYesNo
parametersParameters other than basics such as ciphers,sslEnabledProtocols,client.enable.session.creation. Expected format of these parameters is as follows: "'ciphers:xxx','sslEnabledProtocols,client.enable:xxx'"nullSTRINGYesNo
ciphersList of ciphers to be used. This parameter should include under parameters Ex: 'ciphers:TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256'nullSTRINGYesNo
ssl.enabled.protocolsSSL/TLS protocols to be enabled. This parameter should be in camel case format(sslEnabledProtocols) under parameters. Ex 'sslEnabledProtocols:true'nullSTRINGYesNo
client.enable.session.creationEnable HTTP session creation.This parameter should include under parameters Ex: 'client.enable.session.creation:true'nullSTRINGYesNo
follow.redirectRedirect related enabled.trueBOOLYesNo
max.redirect.countMaximum redirect count.5INTYesNo
tls.store.typeTLS store type to be used.JKSSTRINGYesNo
proxy.hostProxy server hostnullSTRINGYesNo
proxy.portProxy server portnullSTRINGYesNo
proxy.usernameProxy server usernamenullSTRINGYesNo
proxy.passwordProxy server passwordnullSTRINGYesNo
client.bootstrap.configurationClient bootsrap configurations. Expected format of these parameters is as follows: "'client.bootstrap.nodelay:xxx','client.bootstrap.keepalive:xxx'"TODOSTRINGYesNo
client.bootstrap.nodelayHttp client no delay.trueBOOLYesNo
client.bootstrap.keepaliveHttp client keep alive.trueBOOLYesNo
client.bootstrap.sendbuffersizeHttp client send buffer size.1048576INTYesNo
client.bootstrap.recievebuffersizeHttp client receive buffer size.1048576INTYesNo
client.bootstrap.connect.timeoutHttp client connection timeout.15000INTYesNo
client.bootstrap.socket.reuseTo enable http socket reuse.falseBOOLYesNo
client.bootstrap.socket.timeoutHttp client socket timeout.15STRINGYesNo
client.threadpool.configurationsThread pool configuration. Expected format of these parameters is as follows: "'client.connection.pool.count:xxx','client.max.active.connections.per.pool:xxx'"TODOSTRINGYesNo
client.connection.pool.countConnection pool count.0INTYesNo
client.max.active.connections.per.poolActive connections per pool.-1INTYesNo
client.min.idle.connections.per.poolMinimum ideal connection per pool.0INTYesNo
client.max.idle.connections.per.poolMaximum ideal connection per pool.100INTYesNo
client.min.eviction.idle.timeMinimum eviction idle time.5 * 60 * 1000STRINGYesNo
sender.thread.countHttp sender thread count.20STRINGYesNo
event.group.executor.thread.sizeEvent group executor thread size.15STRINGYesNo
max.wait.for.client.connection.poolMaximum wait for client connection pool.60000STRINGYesNo
- -System Parameters - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Parameters
clientBootstrapBossGroupSizeproperty to configure number of boss threads, which accepts incoming connections until the ports are unbound. Once connection accepts successfully, boss thread passes the accepted channel to one of the worker threads.Number of available processorsAny integer
clientBootstrapWorkerGroupSizeproperty to configure number of worker threads, which performs non blocking read and write for one or more channels in non-blocking mode.(Number of available processors)*2Any integer
clientBootstrapClientGroupSizeproperty to configure number of client threads, which performs non blocking read and write for one or more channels in non-blocking mode.(Number of available processors)*2Any integer
trustStoreLocationThe default truststore file path.${carbon.home}/resources/security/client-truststore.jksPath to client-truststore.jks
trustStorePasswordThe default truststore password.wso2carbonTruststore password
- -Examples -EXAMPLE 1 -``` -@sink(type='http',publisher.url='http://localhost:8009/foo', method='{{method}}',headers="'content-type:xml','content-length:94'", client.bootstrap.configuration="'client.bootstrap.socket.timeout:20', 'client.bootstrap.worker.group.size:10'", client.pool.configuration="'client.connection.pool.count:10','client.max.active.connections.per.pool:1'", @map(type='xml', @payload('{{payloadBody}}'))) -define stream FooStream (payloadBody String, method string, headers string); - -``` -

If it is xml mapping expected input should be in following format for FooStream:
{
<events>
    <event>
        <symbol>WSO2</symbol>
        <price>55.6</price>
        <volume>100</volume>
    </event>
</events>,
POST,
Content-Length:24#Content-Location:USA#Retry-After:120
}

Above event will generate output as below.
~Output http event payload
<events>
    <event>
        <symbol>WSO2</symbol>
        <price>55.6</price>
        <volume>100</volume>
    </event>
</events>

~Output http event headers
Content-Length:24,
Content-Location:'USA',
Retry-After:120,
Content-Type:'application/xml',
HTTP_METHOD:'POST',

~Output http event properties
HTTP_METHOD:'POST',
HOST:'localhost',
PORT:8009,
PROTOCOL:'http',
TO:'/foo'

- -### http-request *(Sink)* - -

This extension publish the HTTP events in any HTTP method POST, GET, PUT, DELETE via HTTP or https protocols. As the additional features this component can provide basic authentication as well as user can publish events using custom client truststore files when publishing events via https protocol. And also user can add any number of headers including HTTP_METHOD header for each event dynamically.
Following content types will be set by default according to the type of sink mapper used.
You can override them by setting the new content types in headers.
     - TEXT : text/plain
     - XML : application/xml
     - JSON : application/json
     - KEYVALUE : application/x-www-form-urlencoded

HTTP request sink is correlated with the The HTTP reponse source, through a unique sink.id.It sends the request to the defined url and the response is received by the response source which has the same 'sink.id'.

- -Syntax -``` -@sink(type="http-request", publisher.url="", basic.auth.username="", basic.auth.password="", https.truststore.file="", https.truststore.password="", headers="", method="", socket.idle.timeout="", chunk.disabled="", ssl.protocol="", parameters="", ciphers="", ssl.enabled.protocols="", client.enable.session.creation="", follow.redirect="", max.redirect.count="", tls.store.type="", proxy.host="", proxy.port="", proxy.username="", proxy.password="", client.bootstrap.configuration="", client.bootstrap.nodelay="", client.bootstrap.keepalive="", client.bootstrap.sendbuffersize="", client.bootstrap.recievebuffersize="", client.bootstrap.connect.timeout="", client.bootstrap.socket.reuse="", client.bootstrap.socket.timeout="", client.threadpool.configurations="", client.connection.pool.count="", client.max.active.connections.per.pool="", client.min.idle.connections.per.pool="", client.max.idle.connections.per.pool="", client.min.eviction.idle.time="", sender.thread.count="", event.group.executor.thread.size="", max.wait.for.client.connection.pool="", sink.id="", downloading.enabled="", download.path="", @map(...))) -``` - -QUERY PARAMETERS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
publisher.urlThe URL to which the outgoing events should be published via HTTP. This is a mandatory parameter and if this is not specified, an error is logged in the CLI. If user wants to enable SSL for the events, use https instead of http in the publisher.url.
e.g., http://localhost:8080/endpoint, https://localhost:8080/endpoint
This can be used as a dynamic parameter as well.
STRINGNoYes
basic.auth.usernameThe username to be included in the authentication header of the basic authentication enabled events. It is required to specify both username and password to enable basic authentication. If one of the parameter is not given by user then an error is logged in the CLI. STRINGYesNo
basic.auth.passwordThe password to include in the authentication header of the basic authentication enabled events. It is required to specify both username and password to enable basic authentication. If one of the parameter is not given by user then an error is logged in the CLI. STRINGYesNo
https.truststore.fileThe file path to the location of the truststore of the client that sends the HTTP events through 'https' protocol. A custom client-truststore can be specified if required.${carbon.home}/resources/security/client-truststore.jksSTRINGYesNo
https.truststore.passwordThe password for the client-truststore. A custom password can be specified if required. If no custom password is specified and the protocol of URL is 'https' then, the system uses default password.wso2carbonSTRINGYesNo
headersThe headers that should be included as HTTP request headers.
There can be any number of headers concatenated in following format. "'header1:value1','header2:value2'". User can include Content-Type header if he needs to use a specific content-type for the payload. Or else, system decides the Content-Type by considering the type of sink mapper, in following way.
 - @map(xml):application/xml
 - @map(json):application/json
 - @map(text):plain/text )
 - if user does not include any mapping type then the system gets 'plain/text' as default Content-Type header.
Note that providing content-length as a header is not supported. The size of the payload will be automatically calculated and included in the content-length header.
STRINGYesNo
methodFor HTTP events, HTTP_METHOD header should be included as a request header. If the parameter is null then system uses 'POST' as a default header.POSTSTRINGYesNo
socket.idle.timeoutSocket timeout value in millisecond6000INTYesNo
chunk.disabledport: Port number of the remote servicefalseBOOLYesNo
ssl.protocolThe SSL protocol versionTLSSTRINGYesNo
parametersParameters other than basics such as ciphers,sslEnabledProtocols,client.enable.session.creation. Expected format of these parameters is as follows: "'ciphers:xxx','sslEnabledProtocols,client.enable:xxx'"nullSTRINGYesNo
ciphersList of ciphers to be used. This parameter should include under parameters Ex: 'ciphers:TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256'nullSTRINGYesNo
ssl.enabled.protocolsSSL/TLS protocols to be enabled. This parameter should be in camel case format(sslEnabledProtocols) under parameters. Ex 'sslEnabledProtocols:true'nullSTRINGYesNo
client.enable.session.creationEnable HTTP session creation.This parameter should include under parameters Ex: 'client.enable.session.creation:true'nullSTRINGYesNo
follow.redirectRedirect related enabled.trueBOOLYesNo
max.redirect.countMaximum redirect count.5INTYesNo
tls.store.typeTLS store type to be used.JKSSTRINGYesNo
proxy.hostProxy server hostnullSTRINGYesNo
proxy.portProxy server portnullSTRINGYesNo
proxy.usernameProxy server usernamenullSTRINGYesNo
proxy.passwordProxy server passwordnullSTRINGYesNo
client.bootstrap.configurationClient bootsrap configurations. Expected format of these parameters is as follows: "'client.bootstrap.nodelay:xxx','client.bootstrap.keepalive:xxx'"TODOSTRINGYesNo
client.bootstrap.nodelayHttp client no delay.trueBOOLYesNo
client.bootstrap.keepaliveHttp client keep alive.trueBOOLYesNo
client.bootstrap.sendbuffersizeHttp client send buffer size.1048576INTYesNo
client.bootstrap.recievebuffersizeHttp client receive buffer size.1048576INTYesNo
client.bootstrap.connect.timeoutHttp client connection timeout.15000INTYesNo
client.bootstrap.socket.reuseTo enable http socket reuse.falseBOOLYesNo
client.bootstrap.socket.timeoutHttp client socket timeout.15STRINGYesNo
client.threadpool.configurationsThread pool configuration. Expected format of these parameters is as follows: "'client.connection.pool.count:xxx','client.max.active.connections.per.pool:xxx'"TODOSTRINGYesNo
client.connection.pool.countConnection pool count.0INTYesNo
client.max.active.connections.per.poolActive connections per pool.-1INTYesNo
client.min.idle.connections.per.poolMinimum ideal connection per pool.0INTYesNo
client.max.idle.connections.per.poolMaximum ideal connection per pool.100INTYesNo
client.min.eviction.idle.timeMinimum eviction idle time.5 * 60 * 1000STRINGYesNo
sender.thread.countHttp sender thread count.20STRINGYesNo
event.group.executor.thread.sizeEvent group executor thread size.15STRINGYesNo
max.wait.for.client.connection.poolMaximum wait for client connection pool.60000STRINGYesNo
sink.idIdentifier of the sink. This is used to co-relate with the corresponding http-response source which needs to process the repose for the request sent by this sink.STRINGNoNo
downloading.enabledIf this is set to 'true' then the response received by the response source will be written to a file. If downloading is enabled, the download.path parameter is mandatory.falseBOOLYesNo
download.pathIf downloading is enabled, the path of the file which is going to be downloaded should be specified using 'download.path' parameter. This should be an absolute path including the file name.nullSTRINGYesYes
- -Examples -EXAMPLE 1 -``` -@sink(type='http-request', sink.id='foo', publisher.url='http://localhost:8009/foo', @map(type='xml', @payload('{{payloadBody}}'))) -define stream FooStream (payloadBody String, method string, headers string); -@source(type='http-response', sink.id='foo', http.status.code='2\\d+', -@map(type='text', regex.A='((.|\n)*)', @attributes(headers='trp:headers', fileName='A[1]'))) -define stream responseStream2xx(fileName string, headers string); - -@source(type='http-response', sink.id='foo', http.status.code='4\\d+', -@map(type='text', regex.A='((.|\n)*)', @attributes(errorMsg='A[1]'))) -define stream responseStream4xx(errorMsg string); -``` -

In above example, the payload body for 'FooStream' will be in following format.
{
<events>
    <event>
        <symbol>WSO2</symbol>
        <price>55.6</price>
        <volume>100</volume>
    </event>
</events>,
This message will sent as the body of a POST request with the content-type 'application/xml' to the endpoint defined as the 'publisher.url' and in order to process the responses for these requests, there should be a source of type 'http-response' defined with the same sink id 'foo' in the siddhi app.
The responses with 2xx status codes will be received by the http-response source which has the http.status.code defined by the regex '2\\d+'.
If the response has a 4xx status code, it will be received by the http-response source which has the http.status.code defined by the regex '4\\d+'.

- -EXAMPLE 2 -``` -define stream FooStream (name String, id int, headers String, downloadPath string); -@sink(type='http-request', -downloading.enabled='true', -download.path='{{downloadPath}}',publisher.url='http://localhost:8005/files', -method='GET', headers='{{headers}}',sink.id='download-sink', -@map(type='json')) -define stream BarStream (name String, id int, headers String, downloadPath string); - -@source(type='http-response', sink.id='download-sink', http.status.code='2\\d+', -@map(type='text', regex.A='((.|\n)*)', @attributes(headers='trp:headers', fileName='A[1]'))) -define stream responseStream2xx(fileName string, headers string); - -@source(type='http-response', sink.id='download-sink', http.status.code='4\\d+', -@map(type='text', regex.A='((.|\n)*)', @attributes(errorMsg='A[1]'))) -define stream responseStream4xx(errorMsg string); -``` -

In above example, http-request sink will send a GET request to the publisher url and the requested file will be received as the response by a corresponding http-response source.
If the http status code of the response is a successful one (2xx), it will be received by the http-response source which has the http.status.code '2\\d+' and downloaded as a local file. Then the event received to the responseStream2xx will have the headers included in the request and the downloaded file name.
If the http status code of the response is a 4xx code, it will be received by the http-response source which has the http.status.code '4\\d+'. Then the event received to the responseStream4xx will have the response message body in text format.

- -### http-response *(Sink)* - -

HTTP response sink is correlated with the The HTTP request source, through a unique source.id, and it send a response to the HTTP request source having the same source.id. The response message can be formatted in text, XML or JSON and can be sent with appropriate headers.

- -Syntax -``` -@sink(type="http-response", source.id="", message.id="", headers="", @map(...))) -``` - -QUERY PARAMETERS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
source.idIdentifier of the source.STRINGNoNo
message.idIdentifier of the message.STRINGNoYes
headersThe headers that should be included as HTTP response headers. There can be any number of headers concatenated on following format. "'header1:value1','header2:value2'" User can include content-type header if he/she need to have any specific type for payload. If not system get the mapping type as the content-Type header (ie.@map(xml):application/xml, @map(json):application/json, @map(text):plain/text) and if user does not include any mapping type then system gets the plain/text as default Content-Type header. If user does not include Content-Length header then system calculate the bytes size of payload and include it as content-length header. STRINGYesNo
- -Examples -EXAMPLE 1 -``` -@sink(type='http-response', source.id='sampleSourceId', message.id='{{messageId}}', headers="'content-type:json','content-length:94'"@map(type='json', @payload('{{payloadBody}}'))) -define stream FooStream (payloadBody String, messageId string, headers string); - -``` -

If it is json mapping expected input should be in following format for FooStream:
{
{"events":
    {"event":
        "symbol":WSO2,
        "price":55.6,
        "volume":100,
    }
},
0cf708b1-7eae-440b-a93e-e72f801b486a,
Content-Length:24#Content-Location:USA
}

Above event will generate response for the matching source message as below.

~Output http event payload
{"events":
    {"event":
        "symbol":WSO2,
        "price":55.6,
        "volume":100,
    }
}

~Output http event headers
Content-Length:24,
Content-Location:'USA',
Content-Type:'application/json'

- -## Source - -### http *(Source)* - -

The HTTP source receives POST requests via HTTP or HTTPS in format such as text, XML and JSON. In WSO2 SP, if required, you can enable basic authentication to ensure that events are received only from users who are authorized to access the service.

- -Syntax -``` -@source(type="http", receiver.url="", basic.auth.enabled="", worker.count="", socket.idle.timeout="", ssl.verify.client="", ssl.protocol="", tls.store.type="", parameters="", ciphers="", ssl.enabled.protocols="", server.enable.session.creation="", server.supported.snimatchers="", server.suported.server.names="", request.size.validation.configuration="", request.size.validation="", request.size.validation.maximum.value="", request.size.validation.reject.status.code="", request.size.validation.reject.message="", request.size.validation.reject.message.content.type="", header.size.validation="", header.validation.maximum.request.line="", header.validation.maximum.size="", header.validation.maximum.chunk.size="", header.validation.reject.status.code="", header.validation.reject.message="", header.validation.reject.message.content.type="", server.bootstrap.configuration="", server.bootstrap.nodelay="", server.bootstrap.keepalive="", server.bootstrap.sendbuffersize="", server.bootstrap.recievebuffersize="", server.bootstrap.connect.timeout="", server.bootstrap.socket.reuse="", server.bootstrap.socket.timeout="", server.bootstrap.socket.backlog="", trace.log.enabled="", @map(...))) -``` - -QUERY PARAMETERS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
receiver.urlThe URL to which the events should be received. User can provide any valid url and if the url is not provided the system will use the following format http://0.0.0.0:9763/<appNAme>/<streamName>If the user want to use SSL the url should be given in following format https://localhost:8080/<streamName>http://0.0.0.0:9763//STRINGYesNo
basic.auth.enabledThis works only in WSO2 SP. If this is set to true, basic authentication is enabled for incoming events, and the credentials with which each event is sent are verified to ensure that the user is authorized to access the service. If basic authentication fails, the event is not authenticated and an authentication error is logged in the CLI.falseSTRINGYesNo
worker.countThe number of active worker threads to serve the incoming events. The value is 1 by default. This will ensure that the events are directed to the event stream in the same order in which they arrive. By increasing this value the performance might increase at the cost of loosing event ordering.1STRINGYesNo
socket.idle.timeoutIdle timeout for HTTP connection.120000INTYesNo
ssl.verify.clientThe type of client certificate verification.nullSTRINGYesNo
ssl.protocolssl/tls related optionsTLSSTRINGYesNo
tls.store.typeTLS store type.JKSSTRINGYesNo
parametersParameters other than basics such as ciphers,sslEnabledProtocols,client.enable.session.creation. Expected format of these parameters is as follows: "'ciphers:xxx','sslEnabledProtocols,client.enable:xxx'"nullSTRINGYesNo
ciphersList of ciphers to be used. This parameter should include under parameters Ex: 'ciphers:TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256'nullSTRINGYesNo
ssl.enabled.protocolsSSL/TLS protocols to be enabled. This parameter should be in camel case format(sslEnabledProtocols) under parameters. Ex 'sslEnabledProtocols:true'nullSTRINGYesNo
server.enable.session.creationEnable HTTP session creation.This parameter should include under parameters Ex: 'client.enable.session.creation:true'nullSTRINGYesNo
server.supported.snimatchersHttp SNIMatcher to be added. This parameter should include under parameters Ex: 'server.supported.snimatchers:SNIMatcher'nullSTRINGYesNo
server.suported.server.namesHttp supported servers. This parameter should include under parameters Ex: 'server.suported.server.names:server'nullSTRINGYesNo
request.size.validation.configurationParameters that responsible for validating the http request and request headers. Expected format of these parameters is as follows: "'request.size.validation:xxx','request.size.validation.maximum.value:xxx'"nullSTRINGYesNo
request.size.validationTo enable the request size validation.falseSTRINGYesNo
request.size.validation.maximum.valueIf request size is validated then maximum size.Integer.MAX_VALUESTRINGYesNo
request.size.validation.reject.status.codeIf request is exceed maximum size and request.size.validation is enabled then status code to be send as response.401STRINGYesNo
request.size.validation.reject.messageIf request is exceed maximum size and request.size.validation is enabled then status message to be send as response.Message is bigger than the valid sizeSTRINGYesNo
request.size.validation.reject.message.content.typeIf request is exceed maximum size and request.size.validation is enabled then content type to be send as response.plain/textSTRINGYesNo
header.size.validationTo enable the header size validation.falseSTRINGYesNo
header.validation.maximum.request.lineIf header header validation is enabled then the maximum request line.4096STRINGYesNo
header.validation.maximum.sizeIf header header validation is enabled then the maximum expected header size.8192STRINGYesNo
header.validation.maximum.chunk.sizeIf header header validation is enabled then the maximum expected chunk size.8192STRINGYesNo
header.validation.reject.status.code401If header is exceed maximum size and header.size.validation is enabled then status code to be send as response.STRINGYesNo
header.validation.reject.messageIf header is exceed maximum size and header.size.validation is enabled then message to be send as response.Message header is bigger than the valid sizeSTRINGYesNo
header.validation.reject.message.content.typeIf header is exceed maximum size and header.size.validation is enabled then content type to be send as response.plain/textSTRINGYesNo
server.bootstrap.configurationParameters that for bootstrap configurations of the server. Expected format of these parameters is as follows: "'ciphers:xxx','sslEnabledProtocols,client.enable:xxx'"nullOBJECTYesNo
server.bootstrap.nodelayHttp server no delay.trueBOOLYesNo
server.bootstrap.keepaliveHttp server keep alive.trueBOOLYesNo
server.bootstrap.sendbuffersizeHttp server send buffer size.1048576INTYesNo
server.bootstrap.recievebuffersizeHttp server receive buffer size.1048576INTYesNo
server.bootstrap.connect.timeoutHttp server connection timeout.15000INTYesNo
server.bootstrap.socket.reuseTo enable http socket reuse.falseBOOLYesNo
server.bootstrap.socket.timeoutHttp server socket timeout.15BOOLYesNo
server.bootstrap.socket.backlogTHttp server socket backlog.100BOOLYesNo
trace.log.enabledHttp traffic monitoring.falseBOOLYesNo
- -System Parameters - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Parameters
serverBootstrapBossGroupSizeproperty to configure number of boss threads, which accepts incoming connections until the ports are unbound. Once connection accepts successfully, boss thread passes the accepted channel to one of the worker threads.Number of available processorsAny integer
serverBootstrapWorkerGroupSizeproperty to configure number of worker threads, which performs non blocking read and write for one or more channels in non-blocking mode.(Number of available processors)*2Any integer
serverBootstrapClientGroupSizeproperty to configure number of client threads, which performs non blocking read and write for one or more channels in non-blocking mode.(Number of available processors)*2Any integer
defaultHostThe default host of the transport.0.0.0.0Any valid host
defaultHttpPortThe default port if the default scheme is 'http'.8280Any valid port
defaultHttpsPortThe default port if the default scheme is 'https'.8243Any valid port
defaultSchemeThe default protocol.httphttp
https
keyStoreLocationThe default keystore file path.${carbon.home}/resources/security/wso2carbon.jksPath to wso2carbon.jks file
keyStorePasswordThe default keystore password.wso2carbonString of keystore password
certPasswordThe default cert password.wso2carbonString of cert password
- -Examples -EXAMPLE 1 -``` -@source(type='http', receiver.url='http://localhost:9055/endpoints/RecPro', socketIdleTimeout='150000', parameters="'ciphers : TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256', 'sslEnabledProtocols:TLSv1.1,TLSv1.2'",request.size.validation.configuration="request.size.validation:true",server.bootstrap.configuration="server.bootstrap.socket.timeout:25" @map(type='xml')) -define stream FooStream (symbol string, price float, volume long); - -``` -

Above source listenerConfiguration performs a default XML input mapping. The expected input is as follows:
<events>
    <event>
        <symbol>WSO2</symbol>
        <price>55.6</price>
        <volume>100</volume>
    </event>
</events>
If basic authentication is enabled via the basic.auth.enabled='true setting, each input event is also expected to contain the Authorization:'Basic encodeBase64(username:Password)' header.

- -### http-request *(Source)* - -

The HTTP request is correlated with the HTTP response sink, through a unique source.id, and for each POST requests it receives via HTTP or HTTPS in format such as text, XML and JSON it sends the response via the HTTP response sink. The individual request and response messages are correlated at the sink using the message.id of the events. If required, you can enable basic authentication at the source to ensure that events are received only from users who are authorized to access the service.

- -Syntax -``` -@source(type="http-request", receiver.url="", source.id="", connection.timeout="", basic.auth.enabled="", worker.count="", socket.idle.timeout="", ssl.verify.client="", ssl.protocol="", tls.store.type="", parameters="", ciphers="", ssl.enabled.protocols="", server.enable.session.creation="", server.supported.snimatchers="", server.suported.server.names="", request.size.validation.configuration="", request.size.validation="", request.size.validation.maximum.value="", request.size.validation.reject.status.code="", request.size.validation.reject.message="", request.size.validation.reject.message.content.type="", header.size.validation="", header.validation.maximum.request.line="", header.validation.maximum.size="", header.validation.maximum.chunk.size="", header.validation.reject.status.code="", header.validation.reject.message="", header.validation.reject.message.content.type="", server.bootstrap.configuration="", server.bootstrap.nodelay="", server.bootstrap.keepalive="", server.bootstrap.sendbuffersize="", server.bootstrap.recievebuffersize="", server.bootstrap.connect.timeout="", server.bootstrap.socket.reuse="", server.bootstrap.socket.timeout="", server.bootstrap.socket.backlog="", trace.log.enabled="", @map(...))) -``` - -QUERY PARAMETERS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
receiver.urlThe URL to which the events should be received. User can provide any valid url and if the url is not provided the system will use the following format http://0.0.0.0:9763/<appNAme>/<streamName>If the user want to use SSL the url should be given in following format https://localhost:8080/<streamName>http://0.0.0.0:9763//STRINGYesNo
source.idIdentifier need to map the source to sink.STRINGNoNo
connection.timeoutConnection timeout in milliseconds. If the mapped http-response sink does not get a correlated message, after this timeout value, a timeout response is sent120000INTYesNo
basic.auth.enabledIf this is set to true, basic authentication is enabled for incoming events, and the credentials with which each event is sent are verified to ensure that the user is authorized to access the service. If basic authentication fails, the event is not authenticated and an authentication error is logged in the CLI. By default this values 'false' falseSTRINGYesNo
worker.countThe number of active worker threads to serve the incoming events. The value is 1 by default. This will ensure that the events are directed to the event stream in the same order in which they arrive. By increasing this value the performance might increase at the cost of loosing event ordering.1STRINGYesNo
socket.idle.timeoutIdle timeout for HTTP connection.120000INTYesNo
ssl.verify.clientThe type of client certificate verification.nullSTRINGYesNo
ssl.protocolssl/tls related optionsTLSSTRINGYesNo
tls.store.typeTLS store type.JKSSTRINGYesNo
parametersParameters other than basics such as ciphers,sslEnabledProtocols,client.enable.session.creation. Expected format of these parameters is as follows: "'ciphers:xxx','sslEnabledProtocols,client.enable:xxx'"nullSTRINGYesNo
ciphersList of ciphers to be used. This parameter should include under parameters Ex: 'ciphers:TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256'nullSTRINGYesNo
ssl.enabled.protocolsSSL/TLS protocols to be enabled. This parameter should be in camel case format(sslEnabledProtocols) under parameters. Ex 'sslEnabledProtocols:true'nullSTRINGYesNo
server.enable.session.creationEnable HTTP session creation.This parameter should include under parameters Ex: 'client.enable.session.creation:true'nullSTRINGYesNo
server.supported.snimatchersHttp SNIMatcher to be added. This parameter should include under parameters Ex: 'server.supported.snimatchers:SNIMatcher'nullSTRINGYesNo
server.suported.server.namesHttp supported servers. This parameter should include under parameters Ex: 'server.suported.server.names:server'nullSTRINGYesNo
request.size.validation.configurationParameters that responsible for validating the http request and request headers. Expected format of these parameters is as follows: "'request.size.validation:xxx','request.size.validation.maximum.value:xxx'"nullSTRINGYesNo
request.size.validationTo enable the request size validation.falseSTRINGYesNo
request.size.validation.maximum.valueIf request size is validated then maximum size.Integer.MAX_VALUESTRINGYesNo
request.size.validation.reject.status.codeIf request is exceed maximum size and request.size.validation is enabled then status code to be send as response.401STRINGYesNo
request.size.validation.reject.messageIf request is exceed maximum size and request.size.validation is enabled then status message to be send as response.Message is bigger than the valid sizeSTRINGYesNo
request.size.validation.reject.message.content.typeIf request is exceed maximum size and request.size.validation is enabled then content type to be send as response.plain/textSTRINGYesNo
header.size.validationTo enable the header size validation.falseSTRINGYesNo
header.validation.maximum.request.lineIf header header validation is enabled then the maximum request line.4096STRINGYesNo
header.validation.maximum.sizeIf header header validation is enabled then the maximum expected header size.8192STRINGYesNo
header.validation.maximum.chunk.sizeIf header header validation is enabled then the maximum expected chunk size.8192STRINGYesNo
header.validation.reject.status.code401If header is exceed maximum size and header.size.validation is enabled then status code to be send as response.STRINGYesNo
header.validation.reject.messageIf header is exceed maximum size and header.size.validation is enabled then message to be send as response.Message header is bigger than the valid sizeSTRINGYesNo
header.validation.reject.message.content.typeIf header is exceed maximum size and header.size.validation is enabled then content type to be send as response.plain/textSTRINGYesNo
server.bootstrap.configurationParameters that for bootstrap configurations of the server. Expected format of these parameters is as follows: "'ciphers:xxx','sslEnabledProtocols,client.enable:xxx'"nullOBJECTYesNo
server.bootstrap.nodelayHttp server no delay.trueBOOLYesNo
server.bootstrap.keepaliveHttp server keep alive.trueBOOLYesNo
server.bootstrap.sendbuffersizeHttp server send buffer size.1048576INTYesNo
server.bootstrap.recievebuffersizeHttp server receive buffer size.1048576INTYesNo
server.bootstrap.connect.timeoutHttp server connection timeout.15000INTYesNo
server.bootstrap.socket.reuseTo enable http socket reuse.falseBOOLYesNo
server.bootstrap.socket.timeoutHttp server socket timeout.15BOOLYesNo
server.bootstrap.socket.backlogTHttp server socket backlog.100BOOLYesNo
trace.log.enabledHttp traffic monitoring.falseBOOLYesNo
- -System Parameters - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Parameters
serverBootstrapBossGroupSizeproperty to configure number of boss threads, which accepts incoming connections until the ports are unbound. Once connection accepts successfully, boss thread passes the accepted channel to one of the worker threads.Number of available processorsAny integer
serverBootstrapWorkerGroupSizeproperty to configure number of worker threads, which performs non blocking read and write for one or more channels in non-blocking mode.(Number of available processors)*2Any integer
serverBootstrapClientGroupSizeproperty to configure number of client threads, which performs non blocking read and write for one or more channels in non-blocking mode.(Number of available processors)*2Any integer
defaultHostThe default host of the transport.0.0.0.0Any valid host
defaultHttpPortThe default port if the default scheme is 'http'.8280Any valid port
defaultHttpsPortThe default port if the default scheme is 'https'.8243Any valid port
defaultSchemeThe default protocol.httphttp
https
keyStoreLocationThe default keystore file path.${carbon.home}/resources/security/wso2carbon.jksPath to wso2carbon.jks file
keyStorePasswordThe default keystore password.wso2carbonString of keystore password
certPasswordThe default cert password.wso2carbonString of cert password
- -Examples -EXAMPLE 1 -``` -@source(type='http-request', source.id='sampleSourceId, receiver.url='http://localhost:9055/endpoints/RecPro', connection.timeout='150000', parameters="'ciphers : TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256', 'sslEnabledProtocols:TLSv1.1,TLSv1.2'", request.size.validation.configuration="request.size.validation:true", server.bootstrap.configuration="server.bootstrap.socket.timeout:25", @map(type='json, @attributes(messageId='trp:messageId', symbol='$.events.event.symbol', price='$.events.event.price', volume='$.events.event.volume'))) -define stream FooStream (messageId string, symbol string, price float, volume long); - -``` -

The expected input is as follows:
{"events":
    {"event":
        "symbol":WSO2,
        "price":55.6,
        "volume":100,
    }
}
If basic authentication is enabled via the basic.auth.enabled='true setting, each input event is also expected to contain the Authorization:'Basic encodeBase64(username:Password)' header.

- -### http-response *(Source)* - -

The http-response source co-relates with http-request sink with the parameter 'sink.id'.
This receives responses for the requests sent by the http-request sink which has the same sink id.
Response messages can be in formats such as TEXT, JSON and XML.
In order to handle the responses with different http status codes, user is allowed to defined the acceptable response source code using the parameter 'http.status.code'

- -Syntax -``` -@source(type="http-response", sink.id="", http.status.code="", @map(...))) -``` - -QUERY PARAMETERS - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
sink.idThis parameter is used to map the http-response source to a http-request sink. Then this source will accepts the response messages for the requests sent by corresponding http-request sink.STRINGNoNo
http.status.codeAcceptable http status code for the responses.
This can be a complete string or a regex.
Only the responses with matching status codes to the defined value, will be received by the http-response source.
Eg: 'http.status.code = '200', http.status.code = '2\\d+''
STRINGNoNo
- -Examples -EXAMPLE 1 -``` -@sink(type='http-request', -downloading.enabled='true', -publisher.url='http://localhost:8005/registry/employee', -method='POST', headers='{{headers}}',sink.id='employee-info', -@map(type='json')) -define stream BarStream (name String, id int, headers String, downloadPath string); - -@source(type='http-response' , sink.id='employee-info', http.status.code='2\\d+', -@map(type='text', regex.A='((.|\n)*)', @attributes(message='A[1]'))) -define stream responseStream2xx(message string);@source(type='http-response' , sink.id='employee-info', http.status.code='4\\d+' , -@map(type='text', regex.A='((.|\n)*)', @attributes(message='A[1]'))) -define stream responseStream4xx(message string); -``` -

In above example, the defined http-request sink will send a POST requests to the endpoint defined by 'publisher.url'.
Then for those requests, the source with the response code '2\\d+' and sink.id 'employee-info' will receive the responses with 2xx status codes.
The http-response source which has 'employee-info' as the 'sink.id' and '4\\d+' as the http.response.code will receive all the responses with 4xx status codes.
. Then the body of the response message will be extracted using text mapper and converted into siddhi events.
.

- diff --git a/docs/api/1.0.35.md b/docs/api/1.0.35.md deleted file mode 100644 index 977aa1ef..00000000 --- a/docs/api/1.0.35.md +++ /dev/null @@ -1,1665 +0,0 @@ -# API Docs - v1.0.35 - -## Sink - -### http *(Sink)* - -

This extension publish the HTTP events in any HTTP method POST, GET, PUT, DELETE via HTTP or https protocols. As the additional features this component can provide basic authentication as well as user can publish events using custom client truststore files when publishing events via https protocol. And also user can add any number of headers including HTTP_METHOD header for each event dynamically.
Following content types will be set by default according to the type of sink mapper used.
You can override them by setting the new content types in headers.
     - TEXT : text/plain
     - XML : application/xml
     - JSON : application/json
     - KEYVALUE : application/x-www-form-urlencoded

- -Syntax -``` -@sink(type="http", publisher.url="", basic.auth.username="", basic.auth.password="", https.truststore.file="", https.truststore.password="", headers="", method="", socket.idle.timeout="", chunk.disabled="", ssl.protocol="", parameters="", ciphers="", ssl.enabled.protocols="", client.enable.session.creation="", follow.redirect="", max.redirect.count="", tls.store.type="", proxy.host="", proxy.port="", proxy.username="", proxy.password="", client.bootstrap.configuration="", client.bootstrap.nodelay="", client.bootstrap.keepalive="", client.bootstrap.sendbuffersize="", client.bootstrap.recievebuffersize="", client.bootstrap.connect.timeout="", client.bootstrap.socket.reuse="", client.bootstrap.socket.timeout="", client.threadpool.configurations="", client.connection.pool.count="", client.max.active.connections.per.pool="", client.min.idle.connections.per.pool="", client.max.idle.connections.per.pool="", client.min.eviction.idle.time="", sender.thread.count="", event.group.executor.thread.size="", max.wait.for.client.connection.pool="", @map(...))) -``` - -QUERY PARAMETERS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
publisher.urlThe URL to which the outgoing events should be published via HTTP. This is a mandatory parameter and if this is not specified, an error is logged in the CLI. If user wants to enable SSL for the events, use https instead of http in the publisher.url.e.g., http://localhost:8080/endpoint, https://localhost:8080/endpointSTRINGNoNo
basic.auth.usernameThe username to be included in the authentication header of the basic authentication enabled events. It is required to specify both username and password to enable basic authentication. If one of the parameter is not given by user then an error is logged in the CLI. STRINGYesNo
basic.auth.passwordThe password to include in the authentication header of the basic authentication enabled events. It is required to specify both username and password to enable basic authentication. If one of the parameter is not given by user then an error is logged in the CLI. STRINGYesNo
https.truststore.fileThe file path to the location of the truststore of the client that sends the HTTP events through 'https' protocol. A custom client-truststore can be specified if required.${carbon.home}/resources/security/client-truststore.jksSTRINGYesNo
https.truststore.passwordThe password for the client-truststore. A custom password can be specified if required. If no custom password is specified and the protocol of URL is 'https' then, the system uses default password.wso2carbonSTRINGYesNo
headersThe headers that should be included as HTTP request headers.
There can be any number of headers concatenated in following format. "'header1:value1','header2:value2'". User can include Content-Type header if he needs to use a specific content-type for the payload. Or else, system decides the Content-Type by considering the type of sink mapper, in following way.
 - @map(xml):application/xml
 - @map(json):application/json
 - @map(text):plain/text )
 - if user does not include any mapping type then the system gets 'plain/text' as default Content-Type header.
Note that providing content-length as a header is not supported. The size of the payload will be automatically calculated and included in the content-length header.
STRINGYesNo
methodFor HTTP events, HTTP_METHOD header should be included as a request header. If the parameter is null then system uses 'POST' as a default header.POSTSTRINGYesNo
socket.idle.timeoutSocket timeout value in millisecond6000INTYesNo
chunk.disabledThis parameter is used to disable/enable chunked transfer encodingfalseBOOLYesNo
ssl.protocolThe SSL protocol versionTLSSTRINGYesNo
parametersParameters other than basics such as ciphers,sslEnabledProtocols,client.enable.session.creation. Expected format of these parameters is as follows: "'ciphers:xxx','sslEnabledProtocols,client.enable:xxx'"nullSTRINGYesNo
ciphersList of ciphers to be used. This parameter should include under parameters Ex: 'ciphers:TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256'nullSTRINGYesNo
ssl.enabled.protocolsSSL/TLS protocols to be enabled. This parameter should be in camel case format(sslEnabledProtocols) under parameters. Ex 'sslEnabledProtocols:true'nullSTRINGYesNo
client.enable.session.creationEnable HTTP session creation.This parameter should include under parameters Ex: 'client.enable.session.creation:true'nullSTRINGYesNo
follow.redirectRedirect related enabled.trueBOOLYesNo
max.redirect.countMaximum redirect count.5INTYesNo
tls.store.typeTLS store type to be used.JKSSTRINGYesNo
proxy.hostProxy server hostnullSTRINGYesNo
proxy.portProxy server portnullSTRINGYesNo
proxy.usernameProxy server usernamenullSTRINGYesNo
proxy.passwordProxy server passwordnullSTRINGYesNo
client.bootstrap.configurationClient bootsrap configurations. Expected format of these parameters is as follows: "'client.bootstrap.nodelay:xxx','client.bootstrap.keepalive:xxx'"TODOSTRINGYesNo
client.bootstrap.nodelayHttp client no delay.trueBOOLYesNo
client.bootstrap.keepaliveHttp client keep alive.trueBOOLYesNo
client.bootstrap.sendbuffersizeHttp client send buffer size.1048576INTYesNo
client.bootstrap.recievebuffersizeHttp client receive buffer size.1048576INTYesNo
client.bootstrap.connect.timeoutHttp client connection timeout.15000INTYesNo
client.bootstrap.socket.reuseTo enable http socket reuse.falseBOOLYesNo
client.bootstrap.socket.timeoutHttp client socket timeout.15STRINGYesNo
client.threadpool.configurationsThread pool configuration. Expected format of these parameters is as follows: "'client.connection.pool.count:xxx','client.max.active.connections.per.pool:xxx'"TODOSTRINGYesNo
client.connection.pool.countConnection pool count.0INTYesNo
client.max.active.connections.per.poolActive connections per pool.-1INTYesNo
client.min.idle.connections.per.poolMinimum ideal connection per pool.0INTYesNo
client.max.idle.connections.per.poolMaximum ideal connection per pool.100INTYesNo
client.min.eviction.idle.timeMinimum eviction idle time.5 * 60 * 1000STRINGYesNo
sender.thread.countHttp sender thread count.20STRINGYesNo
event.group.executor.thread.sizeEvent group executor thread size.15STRINGYesNo
max.wait.for.client.connection.poolMaximum wait for client connection pool.60000STRINGYesNo
- -System Parameters - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Parameters
clientBootstrapBossGroupSizeproperty to configure number of boss threads, which accepts incoming connections until the ports are unbound. Once connection accepts successfully, boss thread passes the accepted channel to one of the worker threads.Number of available processorsAny integer
clientBootstrapWorkerGroupSizeproperty to configure number of worker threads, which performs non blocking read and write for one or more channels in non-blocking mode.(Number of available processors)*2Any integer
clientBootstrapClientGroupSizeproperty to configure number of client threads, which performs non blocking read and write for one or more channels in non-blocking mode.(Number of available processors)*2Any integer
trustStoreLocationThe default truststore file path.${carbon.home}/resources/security/client-truststore.jksPath to client-truststore.jks
trustStorePasswordThe default truststore password.wso2carbonTruststore password
- -Examples -EXAMPLE 1 -``` -@sink(type='http',publisher.url='http://localhost:8009/foo', method='{{method}}',headers="'content-type:xml','content-length:94'", client.bootstrap.configuration="'client.bootstrap.socket.timeout:20', 'client.bootstrap.worker.group.size:10'", client.pool.configuration="'client.connection.pool.count:10','client.max.active.connections.per.pool:1'", @map(type='xml', @payload('{{payloadBody}}'))) -define stream FooStream (payloadBody String, method string, headers string); - -``` -

If it is xml mapping expected input should be in following format for FooStream:
{
<events>
    <event>
        <symbol>WSO2</symbol>
        <price>55.6</price>
        <volume>100</volume>
    </event>
</events>,
POST,
Content-Length:24#Content-Location:USA#Retry-After:120
}

Above event will generate output as below.
~Output http event payload
<events>
    <event>
        <symbol>WSO2</symbol>
        <price>55.6</price>
        <volume>100</volume>
    </event>
</events>

~Output http event headers
Content-Length:24,
Content-Location:'USA',
Retry-After:120,
Content-Type:'application/xml',
HTTP_METHOD:'POST',

~Output http event properties
HTTP_METHOD:'POST',
HOST:'localhost',
PORT:8009,
PROTOCOL:'http',
TO:'/foo'

- -### http-request *(Sink)* - -

This extension publish the HTTP events in any HTTP method POST, GET, PUT, DELETE via HTTP or https protocols. As the additional features this component can provide basic authentication as well as user can publish events using custom client truststore files when publishing events via https protocol. And also user can add any number of headers including HTTP_METHOD header for each event dynamically.
Following content types will be set by default according to the type of sink mapper used.
You can override them by setting the new content types in headers.
     - TEXT : text/plain
     - XML : application/xml
     - JSON : application/json
     - KEYVALUE : application/x-www-form-urlencoded

HTTP request sink is correlated with the The HTTP reponse source, through a unique sink.id.It sends the request to the defined url and the response is received by the response source which has the same 'sink.id'.

- -Syntax -``` -@sink(type="http-request", publisher.url="", basic.auth.username="", basic.auth.password="", https.truststore.file="", https.truststore.password="", headers="", method="", socket.idle.timeout="", chunk.disabled="", ssl.protocol="", parameters="", ciphers="", ssl.enabled.protocols="", client.enable.session.creation="", follow.redirect="", max.redirect.count="", tls.store.type="", proxy.host="", proxy.port="", proxy.username="", proxy.password="", client.bootstrap.configuration="", client.bootstrap.nodelay="", client.bootstrap.keepalive="", client.bootstrap.sendbuffersize="", client.bootstrap.recievebuffersize="", client.bootstrap.connect.timeout="", client.bootstrap.socket.reuse="", client.bootstrap.socket.timeout="", client.threadpool.configurations="", client.connection.pool.count="", client.max.active.connections.per.pool="", client.min.idle.connections.per.pool="", client.max.idle.connections.per.pool="", client.min.eviction.idle.time="", sender.thread.count="", event.group.executor.thread.size="", max.wait.for.client.connection.pool="", sink.id="", downloading.enabled="", download.path="", @map(...))) -``` - -QUERY PARAMETERS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
publisher.urlThe URL to which the outgoing events should be published via HTTP. This is a mandatory parameter and if this is not specified, an error is logged in the CLI. If user wants to enable SSL for the events, use https instead of http in the publisher.url.
e.g., http://localhost:8080/endpoint, https://localhost:8080/endpoint
This can be used as a dynamic parameter as well.
STRINGNoYes
basic.auth.usernameThe username to be included in the authentication header of the basic authentication enabled events. It is required to specify both username and password to enable basic authentication. If one of the parameter is not given by user then an error is logged in the CLI. STRINGYesNo
basic.auth.passwordThe password to include in the authentication header of the basic authentication enabled events. It is required to specify both username and password to enable basic authentication. If one of the parameter is not given by user then an error is logged in the CLI. STRINGYesNo
https.truststore.fileThe file path to the location of the truststore of the client that sends the HTTP events through 'https' protocol. A custom client-truststore can be specified if required.${carbon.home}/resources/security/client-truststore.jksSTRINGYesNo
https.truststore.passwordThe password for the client-truststore. A custom password can be specified if required. If no custom password is specified and the protocol of URL is 'https' then, the system uses default password.wso2carbonSTRINGYesNo
headersThe headers that should be included as HTTP request headers.
There can be any number of headers concatenated in following format. "'header1:value1','header2:value2'". User can include Content-Type header if he needs to use a specific content-type for the payload. Or else, system decides the Content-Type by considering the type of sink mapper, in following way.
 - @map(xml):application/xml
 - @map(json):application/json
 - @map(text):plain/text )
 - if user does not include any mapping type then the system gets 'plain/text' as default Content-Type header.
Note that providing content-length as a header is not supported. The size of the payload will be automatically calculated and included in the content-length header.
STRINGYesNo
methodFor HTTP events, HTTP_METHOD header should be included as a request header. If the parameter is null then system uses 'POST' as a default header.POSTSTRINGYesNo
socket.idle.timeoutSocket timeout value in millisecond6000INTYesNo
chunk.disabledport: Port number of the remote servicefalseBOOLYesNo
ssl.protocolThe SSL protocol versionTLSSTRINGYesNo
parametersParameters other than basics such as ciphers,sslEnabledProtocols,client.enable.session.creation. Expected format of these parameters is as follows: "'ciphers:xxx','sslEnabledProtocols,client.enable:xxx'"nullSTRINGYesNo
ciphersList of ciphers to be used. This parameter should include under parameters Ex: 'ciphers:TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256'nullSTRINGYesNo
ssl.enabled.protocolsSSL/TLS protocols to be enabled. This parameter should be in camel case format(sslEnabledProtocols) under parameters. Ex 'sslEnabledProtocols:true'nullSTRINGYesNo
client.enable.session.creationEnable HTTP session creation.This parameter should include under parameters Ex: 'client.enable.session.creation:true'nullSTRINGYesNo
follow.redirectRedirect related enabled.trueBOOLYesNo
max.redirect.countMaximum redirect count.5INTYesNo
tls.store.typeTLS store type to be used.JKSSTRINGYesNo
proxy.hostProxy server hostnullSTRINGYesNo
proxy.portProxy server portnullSTRINGYesNo
proxy.usernameProxy server usernamenullSTRINGYesNo
proxy.passwordProxy server passwordnullSTRINGYesNo
client.bootstrap.configurationClient bootsrap configurations. Expected format of these parameters is as follows: "'client.bootstrap.nodelay:xxx','client.bootstrap.keepalive:xxx'"TODOSTRINGYesNo
client.bootstrap.nodelayHttp client no delay.trueBOOLYesNo
client.bootstrap.keepaliveHttp client keep alive.trueBOOLYesNo
client.bootstrap.sendbuffersizeHttp client send buffer size.1048576INTYesNo
client.bootstrap.recievebuffersizeHttp client receive buffer size.1048576INTYesNo
client.bootstrap.connect.timeoutHttp client connection timeout.15000INTYesNo
client.bootstrap.socket.reuseTo enable http socket reuse.falseBOOLYesNo
client.bootstrap.socket.timeoutHttp client socket timeout.15STRINGYesNo
client.threadpool.configurationsThread pool configuration. Expected format of these parameters is as follows: "'client.connection.pool.count:xxx','client.max.active.connections.per.pool:xxx'"TODOSTRINGYesNo
client.connection.pool.countConnection pool count.0INTYesNo
client.max.active.connections.per.poolActive connections per pool.-1INTYesNo
client.min.idle.connections.per.poolMinimum ideal connection per pool.0INTYesNo
client.max.idle.connections.per.poolMaximum ideal connection per pool.100INTYesNo
client.min.eviction.idle.timeMinimum eviction idle time.5 * 60 * 1000STRINGYesNo
sender.thread.countHttp sender thread count.20STRINGYesNo
event.group.executor.thread.sizeEvent group executor thread size.15STRINGYesNo
max.wait.for.client.connection.poolMaximum wait for client connection pool.60000STRINGYesNo
sink.idIdentifier of the sink. This is used to co-relate with the corresponding http-response source which needs to process the repose for the request sent by this sink.STRINGNoNo
downloading.enabledIf this is set to 'true' then the response received by the response source will be written to a file. If downloading is enabled, the download.path parameter is mandatory.falseBOOLYesNo
download.pathIf downloading is enabled, the path of the file which is going to be downloaded should be specified using 'download.path' parameter. This should be an absolute path including the file name.nullSTRINGYesYes
- -Examples -EXAMPLE 1 -``` -@sink(type='http-request', sink.id='foo', publisher.url='http://localhost:8009/foo', @map(type='xml', @payload('{{payloadBody}}'))) -define stream FooStream (payloadBody String, method string, headers string); -@source(type='http-response', sink.id='foo', http.status.code='2\\d+', -@map(type='text', regex.A='((.|\n)*)', @attributes(headers='trp:headers', fileName='A[1]'))) -define stream responseStream2xx(fileName string, headers string); - -@source(type='http-response', sink.id='foo', http.status.code='4\\d+', -@map(type='text', regex.A='((.|\n)*)', @attributes(errorMsg='A[1]'))) -define stream responseStream4xx(errorMsg string); -``` -

In above example, the payload body for 'FooStream' will be in following format.
{
<events>
    <event>
        <symbol>WSO2</symbol>
        <price>55.6</price>
        <volume>100</volume>
    </event>
</events>,
This message will sent as the body of a POST request with the content-type 'application/xml' to the endpoint defined as the 'publisher.url' and in order to process the responses for these requests, there should be a source of type 'http-response' defined with the same sink id 'foo' in the siddhi app.
The responses with 2xx status codes will be received by the http-response source which has the http.status.code defined by the regex '2\\d+'.
If the response has a 4xx status code, it will be received by the http-response source which has the http.status.code defined by the regex '4\\d+'.

- -EXAMPLE 2 -``` -define stream FooStream (name String, id int, headers String, downloadPath string); -@sink(type='http-request', -downloading.enabled='true', -download.path='{{downloadPath}}',publisher.url='http://localhost:8005/files', -method='GET', headers='{{headers}}',sink.id='download-sink', -@map(type='json')) -define stream BarStream (name String, id int, headers String, downloadPath string); - -@source(type='http-response', sink.id='download-sink', http.status.code='2\\d+', -@map(type='text', regex.A='((.|\n)*)', @attributes(headers='trp:headers', fileName='A[1]'))) -define stream responseStream2xx(fileName string, headers string); - -@source(type='http-response', sink.id='download-sink', http.status.code='4\\d+', -@map(type='text', regex.A='((.|\n)*)', @attributes(errorMsg='A[1]'))) -define stream responseStream4xx(errorMsg string); -``` -

In above example, http-request sink will send a GET request to the publisher url and the requested file will be received as the response by a corresponding http-response source.
If the http status code of the response is a successful one (2xx), it will be received by the http-response source which has the http.status.code '2\\d+' and downloaded as a local file. Then the event received to the responseStream2xx will have the headers included in the request and the downloaded file name.
If the http status code of the response is a 4xx code, it will be received by the http-response source which has the http.status.code '4\\d+'. Then the event received to the responseStream4xx will have the response message body in text format.

- -### http-response *(Sink)* - -

HTTP response sink is correlated with the The HTTP request source, through a unique source.id, and it send a response to the HTTP request source having the same source.id. The response message can be formatted in text, XML or JSON and can be sent with appropriate headers.

- -Syntax -``` -@sink(type="http-response", source.id="", message.id="", headers="", @map(...))) -``` - -QUERY PARAMETERS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
source.idIdentifier of the source.STRINGNoNo
message.idIdentifier of the message.STRINGNoYes
headersThe headers that should be included as HTTP response headers. There can be any number of headers concatenated on following format. "'header1:value1','header2:value2'" User can include content-type header if he/she need to have any specific type for payload. If not system get the mapping type as the content-Type header (ie.@map(xml):application/xml, @map(json):application/json, @map(text):plain/text) and if user does not include any mapping type then system gets the plain/text as default Content-Type header. If user does not include Content-Length header then system calculate the bytes size of payload and include it as content-length header. STRINGYesNo
- -Examples -EXAMPLE 1 -``` -@sink(type='http-response', source.id='sampleSourceId', message.id='{{messageId}}', headers="'content-type:json','content-length:94'"@map(type='json', @payload('{{payloadBody}}'))) -define stream FooStream (payloadBody String, messageId string, headers string); - -``` -

If it is json mapping expected input should be in following format for FooStream:
{
{"events":
    {"event":
        "symbol":WSO2,
        "price":55.6,
        "volume":100,
    }
},
0cf708b1-7eae-440b-a93e-e72f801b486a,
Content-Length:24#Content-Location:USA
}

Above event will generate response for the matching source message as below.

~Output http event payload
{"events":
    {"event":
        "symbol":WSO2,
        "price":55.6,
        "volume":100,
    }
}

~Output http event headers
Content-Length:24,
Content-Location:'USA',
Content-Type:'application/json'

- -## Source - -### http *(Source)* - -

The HTTP source receives POST requests via HTTP or HTTPS in format such as text, XML and JSON. In WSO2 SP, if required, you can enable basic authentication to ensure that events are received only from users who are authorized to access the service.

- -Syntax -``` -@source(type="http", receiver.url="", basic.auth.enabled="", worker.count="", socket.idle.timeout="", ssl.verify.client="", ssl.protocol="", tls.store.type="", parameters="", ciphers="", ssl.enabled.protocols="", server.enable.session.creation="", server.supported.snimatchers="", server.suported.server.names="", request.size.validation.configuration="", request.size.validation="", request.size.validation.maximum.value="", request.size.validation.reject.status.code="", request.size.validation.reject.message="", request.size.validation.reject.message.content.type="", header.size.validation="", header.validation.maximum.request.line="", header.validation.maximum.size="", header.validation.maximum.chunk.size="", header.validation.reject.status.code="", header.validation.reject.message="", header.validation.reject.message.content.type="", server.bootstrap.configuration="", server.bootstrap.nodelay="", server.bootstrap.keepalive="", server.bootstrap.sendbuffersize="", server.bootstrap.recievebuffersize="", server.bootstrap.connect.timeout="", server.bootstrap.socket.reuse="", server.bootstrap.socket.timeout="", server.bootstrap.socket.backlog="", trace.log.enabled="", @map(...))) -``` - -QUERY PARAMETERS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
receiver.urlThe URL to which the events should be received. User can provide any valid url and if the url is not provided the system will use the following format http://0.0.0.0:9763/<appNAme>/<streamName>If the user want to use SSL the url should be given in following format https://localhost:8080/<streamName>http://0.0.0.0:9763//STRINGYesNo
basic.auth.enabledThis works only in WSO2 SP. If this is set to true, basic authentication is enabled for incoming events, and the credentials with which each event is sent are verified to ensure that the user is authorized to access the service. If basic authentication fails, the event is not authenticated and an authentication error is logged in the CLI.falseSTRINGYesNo
worker.countThe number of active worker threads to serve the incoming events. The value is 1 by default. This will ensure that the events are directed to the event stream in the same order in which they arrive. By increasing this value the performance might increase at the cost of loosing event ordering.1STRINGYesNo
socket.idle.timeoutIdle timeout for HTTP connection.120000INTYesNo
ssl.verify.clientThe type of client certificate verification.nullSTRINGYesNo
ssl.protocolssl/tls related optionsTLSSTRINGYesNo
tls.store.typeTLS store type.JKSSTRINGYesNo
parametersParameters other than basics such as ciphers,sslEnabledProtocols,client.enable.session.creation. Expected format of these parameters is as follows: "'ciphers:xxx','sslEnabledProtocols,client.enable:xxx'"nullSTRINGYesNo
ciphersList of ciphers to be used. This parameter should include under parameters Ex: 'ciphers:TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256'nullSTRINGYesNo
ssl.enabled.protocolsSSL/TLS protocols to be enabled. This parameter should be in camel case format(sslEnabledProtocols) under parameters. Ex 'sslEnabledProtocols:true'nullSTRINGYesNo
server.enable.session.creationEnable HTTP session creation.This parameter should include under parameters Ex: 'client.enable.session.creation:true'nullSTRINGYesNo
server.supported.snimatchersHttp SNIMatcher to be added. This parameter should include under parameters Ex: 'server.supported.snimatchers:SNIMatcher'nullSTRINGYesNo
server.suported.server.namesHttp supported servers. This parameter should include under parameters Ex: 'server.suported.server.names:server'nullSTRINGYesNo
request.size.validation.configurationParameters that responsible for validating the http request and request headers. Expected format of these parameters is as follows: "'request.size.validation:xxx','request.size.validation.maximum.value:xxx'"nullSTRINGYesNo
request.size.validationTo enable the request size validation.falseSTRINGYesNo
request.size.validation.maximum.valueIf request size is validated then maximum size.Integer.MAX_VALUESTRINGYesNo
request.size.validation.reject.status.codeIf request is exceed maximum size and request.size.validation is enabled then status code to be send as response.401STRINGYesNo
request.size.validation.reject.messageIf request is exceed maximum size and request.size.validation is enabled then status message to be send as response.Message is bigger than the valid sizeSTRINGYesNo
request.size.validation.reject.message.content.typeIf request is exceed maximum size and request.size.validation is enabled then content type to be send as response.plain/textSTRINGYesNo
header.size.validationTo enable the header size validation.falseSTRINGYesNo
header.validation.maximum.request.lineIf header header validation is enabled then the maximum request line.4096STRINGYesNo
header.validation.maximum.sizeIf header header validation is enabled then the maximum expected header size.8192STRINGYesNo
header.validation.maximum.chunk.sizeIf header header validation is enabled then the maximum expected chunk size.8192STRINGYesNo
header.validation.reject.status.code401If header is exceed maximum size and header.size.validation is enabled then status code to be send as response.STRINGYesNo
header.validation.reject.messageIf header is exceed maximum size and header.size.validation is enabled then message to be send as response.Message header is bigger than the valid sizeSTRINGYesNo
header.validation.reject.message.content.typeIf header is exceed maximum size and header.size.validation is enabled then content type to be send as response.plain/textSTRINGYesNo
server.bootstrap.configurationParameters that for bootstrap configurations of the server. Expected format of these parameters is as follows: "'ciphers:xxx','sslEnabledProtocols,client.enable:xxx'"nullOBJECTYesNo
server.bootstrap.nodelayHttp server no delay.trueBOOLYesNo
server.bootstrap.keepaliveHttp server keep alive.trueBOOLYesNo
server.bootstrap.sendbuffersizeHttp server send buffer size.1048576INTYesNo
server.bootstrap.recievebuffersizeHttp server receive buffer size.1048576INTYesNo
server.bootstrap.connect.timeoutHttp server connection timeout.15000INTYesNo
server.bootstrap.socket.reuseTo enable http socket reuse.falseBOOLYesNo
server.bootstrap.socket.timeoutHttp server socket timeout.15BOOLYesNo
server.bootstrap.socket.backlogTHttp server socket backlog.100BOOLYesNo
trace.log.enabledHttp traffic monitoring.falseBOOLYesNo
- -System Parameters - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Parameters
serverBootstrapBossGroupSizeproperty to configure number of boss threads, which accepts incoming connections until the ports are unbound. Once connection accepts successfully, boss thread passes the accepted channel to one of the worker threads.Number of available processorsAny integer
serverBootstrapWorkerGroupSizeproperty to configure number of worker threads, which performs non blocking read and write for one or more channels in non-blocking mode.(Number of available processors)*2Any integer
serverBootstrapClientGroupSizeproperty to configure number of client threads, which performs non blocking read and write for one or more channels in non-blocking mode.(Number of available processors)*2Any integer
defaultHostThe default host of the transport.0.0.0.0Any valid host
defaultHttpPortThe default port if the default scheme is 'http'.8280Any valid port
defaultHttpsPortThe default port if the default scheme is 'https'.8243Any valid port
defaultSchemeThe default protocol.httphttp
https
keyStoreLocationThe default keystore file path.${carbon.home}/resources/security/wso2carbon.jksPath to wso2carbon.jks file
keyStorePasswordThe default keystore password.wso2carbonString of keystore password
certPasswordThe default cert password.wso2carbonString of cert password
- -Examples -EXAMPLE 1 -``` -@source(type='http', receiver.url='http://localhost:9055/endpoints/RecPro', socketIdleTimeout='150000', parameters="'ciphers : TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256', 'sslEnabledProtocols:TLSv1.1,TLSv1.2'",request.size.validation.configuration="request.size.validation:true",server.bootstrap.configuration="server.bootstrap.socket.timeout:25" @map(type='xml')) -define stream FooStream (symbol string, price float, volume long); - -``` -

Above source listenerConfiguration performs a default XML input mapping. The expected input is as follows:
<events>
    <event>
        <symbol>WSO2</symbol>
        <price>55.6</price>
        <volume>100</volume>
    </event>
</events>
If basic authentication is enabled via the basic.auth.enabled='true setting, each input event is also expected to contain the Authorization:'Basic encodeBase64(username:Password)' header.

- -### http-request *(Source)* - -

The HTTP request is correlated with the HTTP response sink, through a unique source.id, and for each POST requests it receives via HTTP or HTTPS in format such as text, XML and JSON it sends the response via the HTTP response sink. The individual request and response messages are correlated at the sink using the message.id of the events. If required, you can enable basic authentication at the source to ensure that events are received only from users who are authorized to access the service.

- -Syntax -``` -@source(type="http-request", receiver.url="", source.id="", connection.timeout="", basic.auth.enabled="", worker.count="", socket.idle.timeout="", ssl.verify.client="", ssl.protocol="", tls.store.type="", parameters="", ciphers="", ssl.enabled.protocols="", server.enable.session.creation="", server.supported.snimatchers="", server.suported.server.names="", request.size.validation.configuration="", request.size.validation="", request.size.validation.maximum.value="", request.size.validation.reject.status.code="", request.size.validation.reject.message="", request.size.validation.reject.message.content.type="", header.size.validation="", header.validation.maximum.request.line="", header.validation.maximum.size="", header.validation.maximum.chunk.size="", header.validation.reject.status.code="", header.validation.reject.message="", header.validation.reject.message.content.type="", server.bootstrap.configuration="", server.bootstrap.nodelay="", server.bootstrap.keepalive="", server.bootstrap.sendbuffersize="", server.bootstrap.recievebuffersize="", server.bootstrap.connect.timeout="", server.bootstrap.socket.reuse="", server.bootstrap.socket.timeout="", server.bootstrap.socket.backlog="", trace.log.enabled="", @map(...))) -``` - -QUERY PARAMETERS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
receiver.urlThe URL to which the events should be received. User can provide any valid url and if the url is not provided the system will use the following format http://0.0.0.0:9763/<appNAme>/<streamName>If the user want to use SSL the url should be given in following format https://localhost:8080/<streamName>http://0.0.0.0:9763//STRINGYesNo
source.idIdentifier need to map the source to sink.STRINGNoNo
connection.timeoutConnection timeout in milliseconds. If the mapped http-response sink does not get a correlated message, after this timeout value, a timeout response is sent120000INTYesNo
basic.auth.enabledIf this is set to true, basic authentication is enabled for incoming events, and the credentials with which each event is sent are verified to ensure that the user is authorized to access the service. If basic authentication fails, the event is not authenticated and an authentication error is logged in the CLI. By default this values 'false' falseSTRINGYesNo
worker.countThe number of active worker threads to serve the incoming events. The value is 1 by default. This will ensure that the events are directed to the event stream in the same order in which they arrive. By increasing this value the performance might increase at the cost of loosing event ordering.1STRINGYesNo
socket.idle.timeoutIdle timeout for HTTP connection.120000INTYesNo
ssl.verify.clientThe type of client certificate verification.nullSTRINGYesNo
ssl.protocolssl/tls related optionsTLSSTRINGYesNo
tls.store.typeTLS store type.JKSSTRINGYesNo
parametersParameters other than basics such as ciphers,sslEnabledProtocols,client.enable.session.creation. Expected format of these parameters is as follows: "'ciphers:xxx','sslEnabledProtocols,client.enable:xxx'"nullSTRINGYesNo
ciphersList of ciphers to be used. This parameter should include under parameters Ex: 'ciphers:TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256'nullSTRINGYesNo
ssl.enabled.protocolsSSL/TLS protocols to be enabled. This parameter should be in camel case format(sslEnabledProtocols) under parameters. Ex 'sslEnabledProtocols:true'nullSTRINGYesNo
server.enable.session.creationEnable HTTP session creation.This parameter should include under parameters Ex: 'client.enable.session.creation:true'nullSTRINGYesNo
server.supported.snimatchersHttp SNIMatcher to be added. This parameter should include under parameters Ex: 'server.supported.snimatchers:SNIMatcher'nullSTRINGYesNo
server.suported.server.namesHttp supported servers. This parameter should include under parameters Ex: 'server.suported.server.names:server'nullSTRINGYesNo
request.size.validation.configurationParameters that responsible for validating the http request and request headers. Expected format of these parameters is as follows: "'request.size.validation:xxx','request.size.validation.maximum.value:xxx'"nullSTRINGYesNo
request.size.validationTo enable the request size validation.falseSTRINGYesNo
request.size.validation.maximum.valueIf request size is validated then maximum size.Integer.MAX_VALUESTRINGYesNo
request.size.validation.reject.status.codeIf request is exceed maximum size and request.size.validation is enabled then status code to be send as response.401STRINGYesNo
request.size.validation.reject.messageIf request is exceed maximum size and request.size.validation is enabled then status message to be send as response.Message is bigger than the valid sizeSTRINGYesNo
request.size.validation.reject.message.content.typeIf request is exceed maximum size and request.size.validation is enabled then content type to be send as response.plain/textSTRINGYesNo
header.size.validationTo enable the header size validation.falseSTRINGYesNo
header.validation.maximum.request.lineIf header header validation is enabled then the maximum request line.4096STRINGYesNo
header.validation.maximum.sizeIf header header validation is enabled then the maximum expected header size.8192STRINGYesNo
header.validation.maximum.chunk.sizeIf header header validation is enabled then the maximum expected chunk size.8192STRINGYesNo
header.validation.reject.status.code401If header is exceed maximum size and header.size.validation is enabled then status code to be send as response.STRINGYesNo
header.validation.reject.messageIf header is exceed maximum size and header.size.validation is enabled then message to be send as response.Message header is bigger than the valid sizeSTRINGYesNo
header.validation.reject.message.content.typeIf header is exceed maximum size and header.size.validation is enabled then content type to be send as response.plain/textSTRINGYesNo
server.bootstrap.configurationParameters that for bootstrap configurations of the server. Expected format of these parameters is as follows: "'ciphers:xxx','sslEnabledProtocols,client.enable:xxx'"nullOBJECTYesNo
server.bootstrap.nodelayHttp server no delay.trueBOOLYesNo
server.bootstrap.keepaliveHttp server keep alive.trueBOOLYesNo
server.bootstrap.sendbuffersizeHttp server send buffer size.1048576INTYesNo
server.bootstrap.recievebuffersizeHttp server receive buffer size.1048576INTYesNo
server.bootstrap.connect.timeoutHttp server connection timeout.15000INTYesNo
server.bootstrap.socket.reuseTo enable http socket reuse.falseBOOLYesNo
server.bootstrap.socket.timeoutHttp server socket timeout.15BOOLYesNo
server.bootstrap.socket.backlogTHttp server socket backlog.100BOOLYesNo
trace.log.enabledHttp traffic monitoring.falseBOOLYesNo
- -System Parameters - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Parameters
serverBootstrapBossGroupSizeproperty to configure number of boss threads, which accepts incoming connections until the ports are unbound. Once connection accepts successfully, boss thread passes the accepted channel to one of the worker threads.Number of available processorsAny integer
serverBootstrapWorkerGroupSizeproperty to configure number of worker threads, which performs non blocking read and write for one or more channels in non-blocking mode.(Number of available processors)*2Any integer
serverBootstrapClientGroupSizeproperty to configure number of client threads, which performs non blocking read and write for one or more channels in non-blocking mode.(Number of available processors)*2Any integer
defaultHostThe default host of the transport.0.0.0.0Any valid host
defaultHttpPortThe default port if the default scheme is 'http'.8280Any valid port
defaultHttpsPortThe default port if the default scheme is 'https'.8243Any valid port
defaultSchemeThe default protocol.httphttp
https
keyStoreLocationThe default keystore file path.${carbon.home}/resources/security/wso2carbon.jksPath to wso2carbon.jks file
keyStorePasswordThe default keystore password.wso2carbonString of keystore password
certPasswordThe default cert password.wso2carbonString of cert password
- -Examples -EXAMPLE 1 -``` -@source(type='http-request', source.id='sampleSourceId, receiver.url='http://localhost:9055/endpoints/RecPro', connection.timeout='150000', parameters="'ciphers : TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256', 'sslEnabledProtocols:TLSv1.1,TLSv1.2'", request.size.validation.configuration="request.size.validation:true", server.bootstrap.configuration="server.bootstrap.socket.timeout:25", @map(type='json, @attributes(messageId='trp:messageId', symbol='$.events.event.symbol', price='$.events.event.price', volume='$.events.event.volume'))) -define stream FooStream (messageId string, symbol string, price float, volume long); - -``` -

The expected input is as follows:
{"events":
    {"event":
        "symbol":WSO2,
        "price":55.6,
        "volume":100,
    }
}
If basic authentication is enabled via the basic.auth.enabled='true setting, each input event is also expected to contain the Authorization:'Basic encodeBase64(username:Password)' header.

- -### http-response *(Source)* - -

The http-response source co-relates with http-request sink with the parameter 'sink.id'.
This receives responses for the requests sent by the http-request sink which has the same sink id.
Response messages can be in formats such as TEXT, JSON and XML.
In order to handle the responses with different http status codes, user is allowed to defined the acceptable response source code using the parameter 'http.status.code'

- -Syntax -``` -@source(type="http-response", sink.id="", http.status.code="", @map(...))) -``` - -QUERY PARAMETERS - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
sink.idThis parameter is used to map the http-response source to a http-request sink. Then this source will accepts the response messages for the requests sent by corresponding http-request sink.STRINGNoNo
http.status.codeAcceptable http status code for the responses.
This can be a complete string or a regex.
Only the responses with matching status codes to the defined value, will be received by the http-response source.
Eg: 'http.status.code = '200', http.status.code = '2\\d+''
STRINGNoNo
- -Examples -EXAMPLE 1 -``` -@sink(type='http-request', -downloading.enabled='true', -publisher.url='http://localhost:8005/registry/employee', -method='POST', headers='{{headers}}',sink.id='employee-info', -@map(type='json')) -define stream BarStream (name String, id int, headers String, downloadPath string); - -@source(type='http-response' , sink.id='employee-info', http.status.code='2\\d+', -@map(type='text', regex.A='((.|\n)*)', @attributes(message='A[1]'))) -define stream responseStream2xx(message string);@source(type='http-response' , sink.id='employee-info', http.status.code='4\\d+' , -@map(type='text', regex.A='((.|\n)*)', @attributes(message='A[1]'))) -define stream responseStream4xx(message string); -``` -

In above example, the defined http-request sink will send a POST requests to the endpoint defined by 'publisher.url'.
Then for those requests, the source with the response code '2\\d+' and sink.id 'employee-info' will receive the responses with 2xx status codes.
The http-response source which has 'employee-info' as the 'sink.id' and '4\\d+' as the http.response.code will receive all the responses with 4xx status codes.
. Then the body of the response message will be extracted using text mapper and converted into siddhi events.
.

- diff --git a/docs/api/1.0.36.md b/docs/api/1.0.36.md deleted file mode 100644 index b1ef403a..00000000 --- a/docs/api/1.0.36.md +++ /dev/null @@ -1,1665 +0,0 @@ -# API Docs - v1.0.36 - -## Sink - -### http *(Sink)* - -

This extension publish the HTTP events in any HTTP method POST, GET, PUT, DELETE via HTTP or https protocols. As the additional features this component can provide basic authentication as well as user can publish events using custom client truststore files when publishing events via https protocol. And also user can add any number of headers including HTTP_METHOD header for each event dynamically.
Following content types will be set by default according to the type of sink mapper used.
You can override them by setting the new content types in headers.
     - TEXT : text/plain
     - XML : application/xml
     - JSON : application/json
     - KEYVALUE : application/x-www-form-urlencoded

- -Syntax -``` -@sink(type="http", publisher.url="", basic.auth.username="", basic.auth.password="", https.truststore.file="", https.truststore.password="", headers="", method="", socket.idle.timeout="", chunk.disabled="", ssl.protocol="", parameters="", ciphers="", ssl.enabled.protocols="", client.enable.session.creation="", follow.redirect="", max.redirect.count="", tls.store.type="", proxy.host="", proxy.port="", proxy.username="", proxy.password="", client.bootstrap.configuration="", client.bootstrap.nodelay="", client.bootstrap.keepalive="", client.bootstrap.sendbuffersize="", client.bootstrap.recievebuffersize="", client.bootstrap.connect.timeout="", client.bootstrap.socket.reuse="", client.bootstrap.socket.timeout="", client.threadpool.configurations="", client.connection.pool.count="", client.max.active.connections.per.pool="", client.min.idle.connections.per.pool="", client.max.idle.connections.per.pool="", client.min.eviction.idle.time="", sender.thread.count="", event.group.executor.thread.size="", max.wait.for.client.connection.pool="", @map(...))) -``` - -QUERY PARAMETERS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
publisher.urlThe URL to which the outgoing events should be published via HTTP. This is a mandatory parameter and if this is not specified, an error is logged in the CLI. If user wants to enable SSL for the events, use https instead of http in the publisher.url.e.g., http://localhost:8080/endpoint, https://localhost:8080/endpointSTRINGNoNo
basic.auth.usernameThe username to be included in the authentication header of the basic authentication enabled events. It is required to specify both username and password to enable basic authentication. If one of the parameter is not given by user then an error is logged in the CLI. STRINGYesNo
basic.auth.passwordThe password to include in the authentication header of the basic authentication enabled events. It is required to specify both username and password to enable basic authentication. If one of the parameter is not given by user then an error is logged in the CLI. STRINGYesNo
https.truststore.fileThe file path to the location of the truststore of the client that sends the HTTP events through 'https' protocol. A custom client-truststore can be specified if required.${carbon.home}/resources/security/client-truststore.jksSTRINGYesNo
https.truststore.passwordThe password for the client-truststore. A custom password can be specified if required. If no custom password is specified and the protocol of URL is 'https' then, the system uses default password.wso2carbonSTRINGYesNo
headersThe headers that should be included as HTTP request headers.
There can be any number of headers concatenated in following format. "'header1:value1','header2:value2'". User can include Content-Type header if he needs to use a specific content-type for the payload. Or else, system decides the Content-Type by considering the type of sink mapper, in following way.
 - @map(xml):application/xml
 - @map(json):application/json
 - @map(text):plain/text )
 - if user does not include any mapping type then the system gets 'plain/text' as default Content-Type header.
Note that providing content-length as a header is not supported. The size of the payload will be automatically calculated and included in the content-length header.
STRINGYesNo
methodFor HTTP events, HTTP_METHOD header should be included as a request header. If the parameter is null then system uses 'POST' as a default header.POSTSTRINGYesNo
socket.idle.timeoutSocket timeout value in millisecond6000INTYesNo
chunk.disabledThis parameter is used to disable/enable chunked transfer encodingfalseBOOLYesNo
ssl.protocolThe SSL protocol versionTLSSTRINGYesNo
parametersParameters other than basics such as ciphers,sslEnabledProtocols,client.enable.session.creation. Expected format of these parameters is as follows: "'ciphers:xxx','sslEnabledProtocols,client.enable:xxx'"nullSTRINGYesNo
ciphersList of ciphers to be used. This parameter should include under parameters Ex: 'ciphers:TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256'nullSTRINGYesNo
ssl.enabled.protocolsSSL/TLS protocols to be enabled. This parameter should be in camel case format(sslEnabledProtocols) under parameters. Ex 'sslEnabledProtocols:true'nullSTRINGYesNo
client.enable.session.creationEnable HTTP session creation.This parameter should include under parameters Ex: 'client.enable.session.creation:true'nullSTRINGYesNo
follow.redirectRedirect related enabled.trueBOOLYesNo
max.redirect.countMaximum redirect count.5INTYesNo
tls.store.typeTLS store type to be used.JKSSTRINGYesNo
proxy.hostProxy server hostnullSTRINGYesNo
proxy.portProxy server portnullSTRINGYesNo
proxy.usernameProxy server usernamenullSTRINGYesNo
proxy.passwordProxy server passwordnullSTRINGYesNo
client.bootstrap.configurationClient bootsrap configurations. Expected format of these parameters is as follows: "'client.bootstrap.nodelay:xxx','client.bootstrap.keepalive:xxx'"TODOSTRINGYesNo
client.bootstrap.nodelayHttp client no delay.trueBOOLYesNo
client.bootstrap.keepaliveHttp client keep alive.trueBOOLYesNo
client.bootstrap.sendbuffersizeHttp client send buffer size.1048576INTYesNo
client.bootstrap.recievebuffersizeHttp client receive buffer size.1048576INTYesNo
client.bootstrap.connect.timeoutHttp client connection timeout.15000INTYesNo
client.bootstrap.socket.reuseTo enable http socket reuse.falseBOOLYesNo
client.bootstrap.socket.timeoutHttp client socket timeout.15STRINGYesNo
client.threadpool.configurationsThread pool configuration. Expected format of these parameters is as follows: "'client.connection.pool.count:xxx','client.max.active.connections.per.pool:xxx'"TODOSTRINGYesNo
client.connection.pool.countConnection pool count.0INTYesNo
client.max.active.connections.per.poolActive connections per pool.-1INTYesNo
client.min.idle.connections.per.poolMinimum ideal connection per pool.0INTYesNo
client.max.idle.connections.per.poolMaximum ideal connection per pool.100INTYesNo
client.min.eviction.idle.timeMinimum eviction idle time.5 * 60 * 1000STRINGYesNo
sender.thread.countHttp sender thread count.20STRINGYesNo
event.group.executor.thread.sizeEvent group executor thread size.15STRINGYesNo
max.wait.for.client.connection.poolMaximum wait for client connection pool.60000STRINGYesNo
- -System Parameters - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Parameters
clientBootstrapBossGroupSizeproperty to configure number of boss threads, which accepts incoming connections until the ports are unbound. Once connection accepts successfully, boss thread passes the accepted channel to one of the worker threads.Number of available processorsAny integer
clientBootstrapWorkerGroupSizeproperty to configure number of worker threads, which performs non blocking read and write for one or more channels in non-blocking mode.(Number of available processors)*2Any integer
clientBootstrapClientGroupSizeproperty to configure number of client threads, which performs non blocking read and write for one or more channels in non-blocking mode.(Number of available processors)*2Any integer
trustStoreLocationThe default truststore file path.${carbon.home}/resources/security/client-truststore.jksPath to client-truststore.jks
trustStorePasswordThe default truststore password.wso2carbonTruststore password
- -Examples -EXAMPLE 1 -``` -@sink(type='http',publisher.url='http://localhost:8009/foo', method='{{method}}',headers="'content-type:xml','content-length:94'", client.bootstrap.configuration="'client.bootstrap.socket.timeout:20', 'client.bootstrap.worker.group.size:10'", client.pool.configuration="'client.connection.pool.count:10','client.max.active.connections.per.pool:1'", @map(type='xml', @payload('{{payloadBody}}'))) -define stream FooStream (payloadBody String, method string, headers string); - -``` -

If it is xml mapping expected input should be in following format for FooStream:
{
<events>
    <event>
        <symbol>WSO2</symbol>
        <price>55.6</price>
        <volume>100</volume>
    </event>
</events>,
POST,
Content-Length:24#Content-Location:USA#Retry-After:120
}

Above event will generate output as below.
~Output http event payload
<events>
    <event>
        <symbol>WSO2</symbol>
        <price>55.6</price>
        <volume>100</volume>
    </event>
</events>

~Output http event headers
Content-Length:24,
Content-Location:'USA',
Retry-After:120,
Content-Type:'application/xml',
HTTP_METHOD:'POST',

~Output http event properties
HTTP_METHOD:'POST',
HOST:'localhost',
PORT:8009,
PROTOCOL:'http',
TO:'/foo'

- -### http-request *(Sink)* - -

This extension publish the HTTP events in any HTTP method POST, GET, PUT, DELETE via HTTP or https protocols. As the additional features this component can provide basic authentication as well as user can publish events using custom client truststore files when publishing events via https protocol. And also user can add any number of headers including HTTP_METHOD header for each event dynamically.
Following content types will be set by default according to the type of sink mapper used.
You can override them by setting the new content types in headers.
     - TEXT : text/plain
     - XML : application/xml
     - JSON : application/json
     - KEYVALUE : application/x-www-form-urlencoded

HTTP request sink is correlated with the The HTTP reponse source, through a unique sink.id.It sends the request to the defined url and the response is received by the response source which has the same 'sink.id'.

- -Syntax -``` -@sink(type="http-request", publisher.url="", basic.auth.username="", basic.auth.password="", https.truststore.file="", https.truststore.password="", headers="", method="", socket.idle.timeout="", chunk.disabled="", ssl.protocol="", parameters="", ciphers="", ssl.enabled.protocols="", client.enable.session.creation="", follow.redirect="", max.redirect.count="", tls.store.type="", proxy.host="", proxy.port="", proxy.username="", proxy.password="", client.bootstrap.configuration="", client.bootstrap.nodelay="", client.bootstrap.keepalive="", client.bootstrap.sendbuffersize="", client.bootstrap.recievebuffersize="", client.bootstrap.connect.timeout="", client.bootstrap.socket.reuse="", client.bootstrap.socket.timeout="", client.threadpool.configurations="", client.connection.pool.count="", client.max.active.connections.per.pool="", client.min.idle.connections.per.pool="", client.max.idle.connections.per.pool="", client.min.eviction.idle.time="", sender.thread.count="", event.group.executor.thread.size="", max.wait.for.client.connection.pool="", sink.id="", downloading.enabled="", download.path="", @map(...))) -``` - -QUERY PARAMETERS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
publisher.urlThe URL to which the outgoing events should be published via HTTP. This is a mandatory parameter and if this is not specified, an error is logged in the CLI. If user wants to enable SSL for the events, use https instead of http in the publisher.url.
e.g., http://localhost:8080/endpoint, https://localhost:8080/endpoint
This can be used as a dynamic parameter as well.
STRINGNoYes
basic.auth.usernameThe username to be included in the authentication header of the basic authentication enabled events. It is required to specify both username and password to enable basic authentication. If one of the parameter is not given by user then an error is logged in the CLI. STRINGYesNo
basic.auth.passwordThe password to include in the authentication header of the basic authentication enabled events. It is required to specify both username and password to enable basic authentication. If one of the parameter is not given by user then an error is logged in the CLI. STRINGYesNo
https.truststore.fileThe file path to the location of the truststore of the client that sends the HTTP events through 'https' protocol. A custom client-truststore can be specified if required.${carbon.home}/resources/security/client-truststore.jksSTRINGYesNo
https.truststore.passwordThe password for the client-truststore. A custom password can be specified if required. If no custom password is specified and the protocol of URL is 'https' then, the system uses default password.wso2carbonSTRINGYesNo
headersThe headers that should be included as HTTP request headers.
There can be any number of headers concatenated in following format. "'header1:value1','header2:value2'". User can include Content-Type header if he needs to use a specific content-type for the payload. Or else, system decides the Content-Type by considering the type of sink mapper, in following way.
 - @map(xml):application/xml
 - @map(json):application/json
 - @map(text):plain/text )
 - if user does not include any mapping type then the system gets 'plain/text' as default Content-Type header.
Note that providing content-length as a header is not supported. The size of the payload will be automatically calculated and included in the content-length header.
STRINGYesNo
methodFor HTTP events, HTTP_METHOD header should be included as a request header. If the parameter is null then system uses 'POST' as a default header.POSTSTRINGYesNo
socket.idle.timeoutSocket timeout value in millisecond6000INTYesNo
chunk.disabledport: Port number of the remote servicefalseBOOLYesNo
ssl.protocolThe SSL protocol versionTLSSTRINGYesNo
parametersParameters other than basics such as ciphers,sslEnabledProtocols,client.enable.session.creation. Expected format of these parameters is as follows: "'ciphers:xxx','sslEnabledProtocols,client.enable:xxx'"nullSTRINGYesNo
ciphersList of ciphers to be used. This parameter should include under parameters Ex: 'ciphers:TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256'nullSTRINGYesNo
ssl.enabled.protocolsSSL/TLS protocols to be enabled. This parameter should be in camel case format(sslEnabledProtocols) under parameters. Ex 'sslEnabledProtocols:true'nullSTRINGYesNo
client.enable.session.creationEnable HTTP session creation.This parameter should include under parameters Ex: 'client.enable.session.creation:true'nullSTRINGYesNo
follow.redirectRedirect related enabled.trueBOOLYesNo
max.redirect.countMaximum redirect count.5INTYesNo
tls.store.typeTLS store type to be used.JKSSTRINGYesNo
proxy.hostProxy server hostnullSTRINGYesNo
proxy.portProxy server portnullSTRINGYesNo
proxy.usernameProxy server usernamenullSTRINGYesNo
proxy.passwordProxy server passwordnullSTRINGYesNo
client.bootstrap.configurationClient bootsrap configurations. Expected format of these parameters is as follows: "'client.bootstrap.nodelay:xxx','client.bootstrap.keepalive:xxx'"TODOSTRINGYesNo
client.bootstrap.nodelayHttp client no delay.trueBOOLYesNo
client.bootstrap.keepaliveHttp client keep alive.trueBOOLYesNo
client.bootstrap.sendbuffersizeHttp client send buffer size.1048576INTYesNo
client.bootstrap.recievebuffersizeHttp client receive buffer size.1048576INTYesNo
client.bootstrap.connect.timeoutHttp client connection timeout.15000INTYesNo
client.bootstrap.socket.reuseTo enable http socket reuse.falseBOOLYesNo
client.bootstrap.socket.timeoutHttp client socket timeout.15STRINGYesNo
client.threadpool.configurationsThread pool configuration. Expected format of these parameters is as follows: "'client.connection.pool.count:xxx','client.max.active.connections.per.pool:xxx'"TODOSTRINGYesNo
client.connection.pool.countConnection pool count.0INTYesNo
client.max.active.connections.per.poolActive connections per pool.-1INTYesNo
client.min.idle.connections.per.poolMinimum ideal connection per pool.0INTYesNo
client.max.idle.connections.per.poolMaximum ideal connection per pool.100INTYesNo
client.min.eviction.idle.timeMinimum eviction idle time.5 * 60 * 1000STRINGYesNo
sender.thread.countHttp sender thread count.20STRINGYesNo
event.group.executor.thread.sizeEvent group executor thread size.15STRINGYesNo
max.wait.for.client.connection.poolMaximum wait for client connection pool.60000STRINGYesNo
sink.idIdentifier of the sink. This is used to co-relate with the corresponding http-response source which needs to process the repose for the request sent by this sink.STRINGNoNo
downloading.enabledIf this is set to 'true' then the response received by the response source will be written to a file. If downloading is enabled, the download.path parameter is mandatory.falseBOOLYesNo
download.pathIf downloading is enabled, the path of the file which is going to be downloaded should be specified using 'download.path' parameter. This should be an absolute path including the file name.nullSTRINGYesYes
- -Examples -EXAMPLE 1 -``` -@sink(type='http-request', sink.id='foo', publisher.url='http://localhost:8009/foo', @map(type='xml', @payload('{{payloadBody}}'))) -define stream FooStream (payloadBody String, method string, headers string); -@source(type='http-response', sink.id='foo', http.status.code='2\\d+', -@map(type='text', regex.A='((.|\n)*)', @attributes(headers='trp:headers', fileName='A[1]'))) -define stream responseStream2xx(fileName string, headers string); - -@source(type='http-response', sink.id='foo', http.status.code='4\\d+', -@map(type='text', regex.A='((.|\n)*)', @attributes(errorMsg='A[1]'))) -define stream responseStream4xx(errorMsg string); -``` -

In above example, the payload body for 'FooStream' will be in following format.
{
<events>
    <event>
        <symbol>WSO2</symbol>
        <price>55.6</price>
        <volume>100</volume>
    </event>
</events>,
This message will sent as the body of a POST request with the content-type 'application/xml' to the endpoint defined as the 'publisher.url' and in order to process the responses for these requests, there should be a source of type 'http-response' defined with the same sink id 'foo' in the siddhi app.
The responses with 2xx status codes will be received by the http-response source which has the http.status.code defined by the regex '2\\d+'.
If the response has a 4xx status code, it will be received by the http-response source which has the http.status.code defined by the regex '4\\d+'.

- -EXAMPLE 2 -``` -define stream FooStream (name String, id int, headers String, downloadPath string); -@sink(type='http-request', -downloading.enabled='true', -download.path='{{downloadPath}}',publisher.url='http://localhost:8005/files', -method='GET', headers='{{headers}}',sink.id='download-sink', -@map(type='json')) -define stream BarStream (name String, id int, headers String, downloadPath string); - -@source(type='http-response', sink.id='download-sink', http.status.code='2\\d+', -@map(type='text', regex.A='((.|\n)*)', @attributes(headers='trp:headers', fileName='A[1]'))) -define stream responseStream2xx(fileName string, headers string); - -@source(type='http-response', sink.id='download-sink', http.status.code='4\\d+', -@map(type='text', regex.A='((.|\n)*)', @attributes(errorMsg='A[1]'))) -define stream responseStream4xx(errorMsg string); -``` -

In above example, http-request sink will send a GET request to the publisher url and the requested file will be received as the response by a corresponding http-response source.
If the http status code of the response is a successful one (2xx), it will be received by the http-response source which has the http.status.code '2\\d+' and downloaded as a local file. Then the event received to the responseStream2xx will have the headers included in the request and the downloaded file name.
If the http status code of the response is a 4xx code, it will be received by the http-response source which has the http.status.code '4\\d+'. Then the event received to the responseStream4xx will have the response message body in text format.

- -### http-response *(Sink)* - -

HTTP response sink is correlated with the The HTTP request source, through a unique source.id, and it send a response to the HTTP request source having the same source.id. The response message can be formatted in text, XML or JSON and can be sent with appropriate headers.

- -Syntax -``` -@sink(type="http-response", source.id="", message.id="", headers="", @map(...))) -``` - -QUERY PARAMETERS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
source.idIdentifier of the source.STRINGNoNo
message.idIdentifier of the message.STRINGNoYes
headersThe headers that should be included as HTTP response headers. There can be any number of headers concatenated on following format. "'header1:value1','header2:value2'" User can include content-type header if he/she need to have any specific type for payload. If not system get the mapping type as the content-Type header (ie.@map(xml):application/xml, @map(json):application/json, @map(text):plain/text) and if user does not include any mapping type then system gets the plain/text as default Content-Type header. If user does not include Content-Length header then system calculate the bytes size of payload and include it as content-length header. STRINGYesNo
- -Examples -EXAMPLE 1 -``` -@sink(type='http-response', source.id='sampleSourceId', message.id='{{messageId}}', headers="'content-type:json','content-length:94'"@map(type='json', @payload('{{payloadBody}}'))) -define stream FooStream (payloadBody String, messageId string, headers string); - -``` -

If it is json mapping expected input should be in following format for FooStream:
{
{"events":
    {"event":
        "symbol":WSO2,
        "price":55.6,
        "volume":100,
    }
},
0cf708b1-7eae-440b-a93e-e72f801b486a,
Content-Length:24#Content-Location:USA
}

Above event will generate response for the matching source message as below.

~Output http event payload
{"events":
    {"event":
        "symbol":WSO2,
        "price":55.6,
        "volume":100,
    }
}

~Output http event headers
Content-Length:24,
Content-Location:'USA',
Content-Type:'application/json'

- -## Source - -### http *(Source)* - -

The HTTP source receives POST requests via HTTP or HTTPS in format such as text, XML and JSON. In WSO2 SP, if required, you can enable basic authentication to ensure that events are received only from users who are authorized to access the service.

- -Syntax -``` -@source(type="http", receiver.url="", basic.auth.enabled="", worker.count="", socket.idle.timeout="", ssl.verify.client="", ssl.protocol="", tls.store.type="", parameters="", ciphers="", ssl.enabled.protocols="", server.enable.session.creation="", server.supported.snimatchers="", server.suported.server.names="", request.size.validation.configuration="", request.size.validation="", request.size.validation.maximum.value="", request.size.validation.reject.status.code="", request.size.validation.reject.message="", request.size.validation.reject.message.content.type="", header.size.validation="", header.validation.maximum.request.line="", header.validation.maximum.size="", header.validation.maximum.chunk.size="", header.validation.reject.status.code="", header.validation.reject.message="", header.validation.reject.message.content.type="", server.bootstrap.configuration="", server.bootstrap.nodelay="", server.bootstrap.keepalive="", server.bootstrap.sendbuffersize="", server.bootstrap.recievebuffersize="", server.bootstrap.connect.timeout="", server.bootstrap.socket.reuse="", server.bootstrap.socket.timeout="", server.bootstrap.socket.backlog="", trace.log.enabled="", @map(...))) -``` - -QUERY PARAMETERS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
receiver.urlThe URL to which the events should be received. User can provide any valid url and if the url is not provided the system will use the following format http://0.0.0.0:9763/<appNAme>/<streamName>If the user want to use SSL the url should be given in following format https://localhost:8080/<streamName>http://0.0.0.0:9763//STRINGYesNo
basic.auth.enabledThis works only in WSO2 SP. If this is set to true, basic authentication is enabled for incoming events, and the credentials with which each event is sent are verified to ensure that the user is authorized to access the service. If basic authentication fails, the event is not authenticated and an authentication error is logged in the CLI.falseSTRINGYesNo
worker.countThe number of active worker threads to serve the incoming events. The value is 1 by default. This will ensure that the events are directed to the event stream in the same order in which they arrive. By increasing this value the performance might increase at the cost of loosing event ordering.1STRINGYesNo
socket.idle.timeoutIdle timeout for HTTP connection.120000INTYesNo
ssl.verify.clientThe type of client certificate verification.nullSTRINGYesNo
ssl.protocolssl/tls related optionsTLSSTRINGYesNo
tls.store.typeTLS store type.JKSSTRINGYesNo
parametersParameters other than basics such as ciphers,sslEnabledProtocols,client.enable.session.creation. Expected format of these parameters is as follows: "'ciphers:xxx','sslEnabledProtocols,client.enable:xxx'"nullSTRINGYesNo
ciphersList of ciphers to be used. This parameter should include under parameters Ex: 'ciphers:TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256'nullSTRINGYesNo
ssl.enabled.protocolsSSL/TLS protocols to be enabled. This parameter should be in camel case format(sslEnabledProtocols) under parameters. Ex 'sslEnabledProtocols:true'nullSTRINGYesNo
server.enable.session.creationEnable HTTP session creation.This parameter should include under parameters Ex: 'client.enable.session.creation:true'nullSTRINGYesNo
server.supported.snimatchersHttp SNIMatcher to be added. This parameter should include under parameters Ex: 'server.supported.snimatchers:SNIMatcher'nullSTRINGYesNo
server.suported.server.namesHttp supported servers. This parameter should include under parameters Ex: 'server.suported.server.names:server'nullSTRINGYesNo
request.size.validation.configurationParameters that responsible for validating the http request and request headers. Expected format of these parameters is as follows: "'request.size.validation:xxx','request.size.validation.maximum.value:xxx'"nullSTRINGYesNo
request.size.validationTo enable the request size validation.falseSTRINGYesNo
request.size.validation.maximum.valueIf request size is validated then maximum size.Integer.MAX_VALUESTRINGYesNo
request.size.validation.reject.status.codeIf request is exceed maximum size and request.size.validation is enabled then status code to be send as response.401STRINGYesNo
request.size.validation.reject.messageIf request is exceed maximum size and request.size.validation is enabled then status message to be send as response.Message is bigger than the valid sizeSTRINGYesNo
request.size.validation.reject.message.content.typeIf request is exceed maximum size and request.size.validation is enabled then content type to be send as response.plain/textSTRINGYesNo
header.size.validationTo enable the header size validation.falseSTRINGYesNo
header.validation.maximum.request.lineIf header header validation is enabled then the maximum request line.4096STRINGYesNo
header.validation.maximum.sizeIf header header validation is enabled then the maximum expected header size.8192STRINGYesNo
header.validation.maximum.chunk.sizeIf header header validation is enabled then the maximum expected chunk size.8192STRINGYesNo
header.validation.reject.status.code401If header is exceed maximum size and header.size.validation is enabled then status code to be send as response.STRINGYesNo
header.validation.reject.messageIf header is exceed maximum size and header.size.validation is enabled then message to be send as response.Message header is bigger than the valid sizeSTRINGYesNo
header.validation.reject.message.content.typeIf header is exceed maximum size and header.size.validation is enabled then content type to be send as response.plain/textSTRINGYesNo
server.bootstrap.configurationParameters that for bootstrap configurations of the server. Expected format of these parameters is as follows: "'ciphers:xxx','sslEnabledProtocols,client.enable:xxx'"nullOBJECTYesNo
server.bootstrap.nodelayHttp server no delay.trueBOOLYesNo
server.bootstrap.keepaliveHttp server keep alive.trueBOOLYesNo
server.bootstrap.sendbuffersizeHttp server send buffer size.1048576INTYesNo
server.bootstrap.recievebuffersizeHttp server receive buffer size.1048576INTYesNo
server.bootstrap.connect.timeoutHttp server connection timeout.15000INTYesNo
server.bootstrap.socket.reuseTo enable http socket reuse.falseBOOLYesNo
server.bootstrap.socket.timeoutHttp server socket timeout.15BOOLYesNo
server.bootstrap.socket.backlogTHttp server socket backlog.100BOOLYesNo
trace.log.enabledHttp traffic monitoring.falseBOOLYesNo
- -System Parameters - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Parameters
serverBootstrapBossGroupSizeproperty to configure number of boss threads, which accepts incoming connections until the ports are unbound. Once connection accepts successfully, boss thread passes the accepted channel to one of the worker threads.Number of available processorsAny integer
serverBootstrapWorkerGroupSizeproperty to configure number of worker threads, which performs non blocking read and write for one or more channels in non-blocking mode.(Number of available processors)*2Any integer
serverBootstrapClientGroupSizeproperty to configure number of client threads, which performs non blocking read and write for one or more channels in non-blocking mode.(Number of available processors)*2Any integer
defaultHostThe default host of the transport.0.0.0.0Any valid host
defaultHttpPortThe default port if the default scheme is 'http'.8280Any valid port
defaultHttpsPortThe default port if the default scheme is 'https'.8243Any valid port
defaultSchemeThe default protocol.httphttp
https
keyStoreLocationThe default keystore file path.${carbon.home}/resources/security/wso2carbon.jksPath to wso2carbon.jks file
keyStorePasswordThe default keystore password.wso2carbonString of keystore password
certPasswordThe default cert password.wso2carbonString of cert password
- -Examples -EXAMPLE 1 -``` -@source(type='http', receiver.url='http://localhost:9055/endpoints/RecPro', socketIdleTimeout='150000', parameters="'ciphers : TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256', 'sslEnabledProtocols:TLSv1.1,TLSv1.2'",request.size.validation.configuration="request.size.validation:true",server.bootstrap.configuration="server.bootstrap.socket.timeout:25" @map(type='xml')) -define stream FooStream (symbol string, price float, volume long); - -``` -

Above source listenerConfiguration performs a default XML input mapping. The expected input is as follows:
<events>
    <event>
        <symbol>WSO2</symbol>
        <price>55.6</price>
        <volume>100</volume>
    </event>
</events>
If basic authentication is enabled via the basic.auth.enabled='true setting, each input event is also expected to contain the Authorization:'Basic encodeBase64(username:Password)' header.

- -### http-request *(Source)* - -

The HTTP request is correlated with the HTTP response sink, through a unique source.id, and for each POST requests it receives via HTTP or HTTPS in format such as text, XML and JSON it sends the response via the HTTP response sink. The individual request and response messages are correlated at the sink using the message.id of the events. If required, you can enable basic authentication at the source to ensure that events are received only from users who are authorized to access the service.

- -Syntax -``` -@source(type="http-request", receiver.url="", source.id="", connection.timeout="", basic.auth.enabled="", worker.count="", socket.idle.timeout="", ssl.verify.client="", ssl.protocol="", tls.store.type="", parameters="", ciphers="", ssl.enabled.protocols="", server.enable.session.creation="", server.supported.snimatchers="", server.suported.server.names="", request.size.validation.configuration="", request.size.validation="", request.size.validation.maximum.value="", request.size.validation.reject.status.code="", request.size.validation.reject.message="", request.size.validation.reject.message.content.type="", header.size.validation="", header.validation.maximum.request.line="", header.validation.maximum.size="", header.validation.maximum.chunk.size="", header.validation.reject.status.code="", header.validation.reject.message="", header.validation.reject.message.content.type="", server.bootstrap.configuration="", server.bootstrap.nodelay="", server.bootstrap.keepalive="", server.bootstrap.sendbuffersize="", server.bootstrap.recievebuffersize="", server.bootstrap.connect.timeout="", server.bootstrap.socket.reuse="", server.bootstrap.socket.timeout="", server.bootstrap.socket.backlog="", trace.log.enabled="", @map(...))) -``` - -QUERY PARAMETERS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
receiver.urlThe URL to which the events should be received. User can provide any valid url and if the url is not provided the system will use the following format http://0.0.0.0:9763/<appNAme>/<streamName>If the user want to use SSL the url should be given in following format https://localhost:8080/<streamName>http://0.0.0.0:9763//STRINGYesNo
source.idIdentifier need to map the source to sink.STRINGNoNo
connection.timeoutConnection timeout in milliseconds. If the mapped http-response sink does not get a correlated message, after this timeout value, a timeout response is sent120000INTYesNo
basic.auth.enabledIf this is set to true, basic authentication is enabled for incoming events, and the credentials with which each event is sent are verified to ensure that the user is authorized to access the service. If basic authentication fails, the event is not authenticated and an authentication error is logged in the CLI. By default this values 'false' falseSTRINGYesNo
worker.countThe number of active worker threads to serve the incoming events. The value is 1 by default. This will ensure that the events are directed to the event stream in the same order in which they arrive. By increasing this value the performance might increase at the cost of loosing event ordering.1STRINGYesNo
socket.idle.timeoutIdle timeout for HTTP connection.120000INTYesNo
ssl.verify.clientThe type of client certificate verification.nullSTRINGYesNo
ssl.protocolssl/tls related optionsTLSSTRINGYesNo
tls.store.typeTLS store type.JKSSTRINGYesNo
parametersParameters other than basics such as ciphers,sslEnabledProtocols,client.enable.session.creation. Expected format of these parameters is as follows: "'ciphers:xxx','sslEnabledProtocols,client.enable:xxx'"nullSTRINGYesNo
ciphersList of ciphers to be used. This parameter should include under parameters Ex: 'ciphers:TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256'nullSTRINGYesNo
ssl.enabled.protocolsSSL/TLS protocols to be enabled. This parameter should be in camel case format(sslEnabledProtocols) under parameters. Ex 'sslEnabledProtocols:true'nullSTRINGYesNo
server.enable.session.creationEnable HTTP session creation.This parameter should include under parameters Ex: 'client.enable.session.creation:true'nullSTRINGYesNo
server.supported.snimatchersHttp SNIMatcher to be added. This parameter should include under parameters Ex: 'server.supported.snimatchers:SNIMatcher'nullSTRINGYesNo
server.suported.server.namesHttp supported servers. This parameter should include under parameters Ex: 'server.suported.server.names:server'nullSTRINGYesNo
request.size.validation.configurationParameters that responsible for validating the http request and request headers. Expected format of these parameters is as follows: "'request.size.validation:xxx','request.size.validation.maximum.value:xxx'"nullSTRINGYesNo
request.size.validationTo enable the request size validation.falseSTRINGYesNo
request.size.validation.maximum.valueIf request size is validated then maximum size.Integer.MAX_VALUESTRINGYesNo
request.size.validation.reject.status.codeIf request is exceed maximum size and request.size.validation is enabled then status code to be send as response.401STRINGYesNo
request.size.validation.reject.messageIf request is exceed maximum size and request.size.validation is enabled then status message to be send as response.Message is bigger than the valid sizeSTRINGYesNo
request.size.validation.reject.message.content.typeIf request is exceed maximum size and request.size.validation is enabled then content type to be send as response.plain/textSTRINGYesNo
header.size.validationTo enable the header size validation.falseSTRINGYesNo
header.validation.maximum.request.lineIf header header validation is enabled then the maximum request line.4096STRINGYesNo
header.validation.maximum.sizeIf header header validation is enabled then the maximum expected header size.8192STRINGYesNo
header.validation.maximum.chunk.sizeIf header header validation is enabled then the maximum expected chunk size.8192STRINGYesNo
header.validation.reject.status.code401If header is exceed maximum size and header.size.validation is enabled then status code to be send as response.STRINGYesNo
header.validation.reject.messageIf header is exceed maximum size and header.size.validation is enabled then message to be send as response.Message header is bigger than the valid sizeSTRINGYesNo
header.validation.reject.message.content.typeIf header is exceed maximum size and header.size.validation is enabled then content type to be send as response.plain/textSTRINGYesNo
server.bootstrap.configurationParameters that for bootstrap configurations of the server. Expected format of these parameters is as follows: "'ciphers:xxx','sslEnabledProtocols,client.enable:xxx'"nullOBJECTYesNo
server.bootstrap.nodelayHttp server no delay.trueBOOLYesNo
server.bootstrap.keepaliveHttp server keep alive.trueBOOLYesNo
server.bootstrap.sendbuffersizeHttp server send buffer size.1048576INTYesNo
server.bootstrap.recievebuffersizeHttp server receive buffer size.1048576INTYesNo
server.bootstrap.connect.timeoutHttp server connection timeout.15000INTYesNo
server.bootstrap.socket.reuseTo enable http socket reuse.falseBOOLYesNo
server.bootstrap.socket.timeoutHttp server socket timeout.15BOOLYesNo
server.bootstrap.socket.backlogTHttp server socket backlog.100BOOLYesNo
trace.log.enabledHttp traffic monitoring.falseBOOLYesNo
- -System Parameters - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Parameters
serverBootstrapBossGroupSizeproperty to configure number of boss threads, which accepts incoming connections until the ports are unbound. Once connection accepts successfully, boss thread passes the accepted channel to one of the worker threads.Number of available processorsAny integer
serverBootstrapWorkerGroupSizeproperty to configure number of worker threads, which performs non blocking read and write for one or more channels in non-blocking mode.(Number of available processors)*2Any integer
serverBootstrapClientGroupSizeproperty to configure number of client threads, which performs non blocking read and write for one or more channels in non-blocking mode.(Number of available processors)*2Any integer
defaultHostThe default host of the transport.0.0.0.0Any valid host
defaultHttpPortThe default port if the default scheme is 'http'.8280Any valid port
defaultHttpsPortThe default port if the default scheme is 'https'.8243Any valid port
defaultSchemeThe default protocol.httphttp
https
keyStoreLocationThe default keystore file path.${carbon.home}/resources/security/wso2carbon.jksPath to wso2carbon.jks file
keyStorePasswordThe default keystore password.wso2carbonString of keystore password
certPasswordThe default cert password.wso2carbonString of cert password
- -Examples -EXAMPLE 1 -``` -@source(type='http-request', source.id='sampleSourceId, receiver.url='http://localhost:9055/endpoints/RecPro', connection.timeout='150000', parameters="'ciphers : TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256', 'sslEnabledProtocols:TLSv1.1,TLSv1.2'", request.size.validation.configuration="request.size.validation:true", server.bootstrap.configuration="server.bootstrap.socket.timeout:25", @map(type='json, @attributes(messageId='trp:messageId', symbol='$.events.event.symbol', price='$.events.event.price', volume='$.events.event.volume'))) -define stream FooStream (messageId string, symbol string, price float, volume long); - -``` -

The expected input is as follows:
{"events":
    {"event":
        "symbol":WSO2,
        "price":55.6,
        "volume":100,
    }
}
If basic authentication is enabled via the basic.auth.enabled='true setting, each input event is also expected to contain the Authorization:'Basic encodeBase64(username:Password)' header.

- -### http-response *(Source)* - -

The http-response source co-relates with http-request sink with the parameter 'sink.id'.
This receives responses for the requests sent by the http-request sink which has the same sink id.
Response messages can be in formats such as TEXT, JSON and XML.
In order to handle the responses with different http status codes, user is allowed to defined the acceptable response source code using the parameter 'http.status.code'

- -Syntax -``` -@source(type="http-response", sink.id="", http.status.code="", @map(...))) -``` - -QUERY PARAMETERS - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
sink.idThis parameter is used to map the http-response source to a http-request sink. Then this source will accepts the response messages for the requests sent by corresponding http-request sink.STRINGNoNo
http.status.codeAcceptable http status code for the responses.
This can be a complete string or a regex.
Only the responses with matching status codes to the defined value, will be received by the http-response source.
Eg: 'http.status.code = '200', http.status.code = '2\\d+''
STRINGNoNo
- -Examples -EXAMPLE 1 -``` -@sink(type='http-request', -downloading.enabled='true', -publisher.url='http://localhost:8005/registry/employee', -method='POST', headers='{{headers}}',sink.id='employee-info', -@map(type='json')) -define stream BarStream (name String, id int, headers String, downloadPath string); - -@source(type='http-response' , sink.id='employee-info', http.status.code='2\\d+', -@map(type='text', regex.A='((.|\n)*)', @attributes(message='A[1]'))) -define stream responseStream2xx(message string);@source(type='http-response' , sink.id='employee-info', http.status.code='4\\d+' , -@map(type='text', regex.A='((.|\n)*)', @attributes(message='A[1]'))) -define stream responseStream4xx(message string); -``` -

In above example, the defined http-request sink will send a POST requests to the endpoint defined by 'publisher.url'.
Then for those requests, the source with the response code '2\\d+' and sink.id 'employee-info' will receive the responses with 2xx status codes.
The http-response source which has 'employee-info' as the 'sink.id' and '4\\d+' as the http.response.code will receive all the responses with 4xx status codes.
. Then the body of the response message will be extracted using text mapper and converted into siddhi events.
.

- diff --git a/docs/api/1.0.37.md b/docs/api/1.0.37.md deleted file mode 100644 index 316bb85e..00000000 --- a/docs/api/1.0.37.md +++ /dev/null @@ -1,1665 +0,0 @@ -# API Docs - v1.0.37 - -## Sink - -### http *(Sink)* - -

This extension publish the HTTP events in any HTTP method POST, GET, PUT, DELETE via HTTP or https protocols. As the additional features this component can provide basic authentication as well as user can publish events using custom client truststore files when publishing events via https protocol. And also user can add any number of headers including HTTP_METHOD header for each event dynamically.
Following content types will be set by default according to the type of sink mapper used.
You can override them by setting the new content types in headers.
     - TEXT : text/plain
     - XML : application/xml
     - JSON : application/json
     - KEYVALUE : application/x-www-form-urlencoded

- -Syntax -``` -@sink(type="http", publisher.url="", basic.auth.username="", basic.auth.password="", https.truststore.file="", https.truststore.password="", headers="", method="", socket.idle.timeout="", chunk.disabled="", ssl.protocol="", parameters="", ciphers="", ssl.enabled.protocols="", client.enable.session.creation="", follow.redirect="", max.redirect.count="", tls.store.type="", proxy.host="", proxy.port="", proxy.username="", proxy.password="", client.bootstrap.configuration="", client.bootstrap.nodelay="", client.bootstrap.keepalive="", client.bootstrap.sendbuffersize="", client.bootstrap.recievebuffersize="", client.bootstrap.connect.timeout="", client.bootstrap.socket.reuse="", client.bootstrap.socket.timeout="", client.threadpool.configurations="", client.connection.pool.count="", client.max.active.connections.per.pool="", client.min.idle.connections.per.pool="", client.max.idle.connections.per.pool="", client.min.eviction.idle.time="", sender.thread.count="", event.group.executor.thread.size="", max.wait.for.client.connection.pool="", @map(...))) -``` - -QUERY PARAMETERS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
publisher.urlThe URL to which the outgoing events should be published via HTTP. This is a mandatory parameter and if this is not specified, an error is logged in the CLI. If user wants to enable SSL for the events, use https instead of http in the publisher.url.e.g., http://localhost:8080/endpoint, https://localhost:8080/endpointSTRINGNoNo
basic.auth.usernameThe username to be included in the authentication header of the basic authentication enabled events. It is required to specify both username and password to enable basic authentication. If one of the parameter is not given by user then an error is logged in the CLI. STRINGYesNo
basic.auth.passwordThe password to include in the authentication header of the basic authentication enabled events. It is required to specify both username and password to enable basic authentication. If one of the parameter is not given by user then an error is logged in the CLI. STRINGYesNo
https.truststore.fileThe file path to the location of the truststore of the client that sends the HTTP events through 'https' protocol. A custom client-truststore can be specified if required.${carbon.home}/resources/security/client-truststore.jksSTRINGYesNo
https.truststore.passwordThe password for the client-truststore. A custom password can be specified if required. If no custom password is specified and the protocol of URL is 'https' then, the system uses default password.wso2carbonSTRINGYesNo
headersThe headers that should be included as HTTP request headers.
There can be any number of headers concatenated in following format. "'header1:value1','header2:value2'". User can include Content-Type header if he needs to use a specific content-type for the payload. Or else, system decides the Content-Type by considering the type of sink mapper, in following way.
 - @map(xml):application/xml
 - @map(json):application/json
 - @map(text):plain/text )
 - if user does not include any mapping type then the system gets 'plain/text' as default Content-Type header.
Note that providing content-length as a header is not supported. The size of the payload will be automatically calculated and included in the content-length header.
STRINGYesNo
methodFor HTTP events, HTTP_METHOD header should be included as a request header. If the parameter is null then system uses 'POST' as a default header.POSTSTRINGYesNo
socket.idle.timeoutSocket timeout value in millisecond6000INTYesNo
chunk.disabledThis parameter is used to disable/enable chunked transfer encodingfalseBOOLYesNo
ssl.protocolThe SSL protocol versionTLSSTRINGYesNo
parametersParameters other than basics such as ciphers,sslEnabledProtocols,client.enable.session.creation. Expected format of these parameters is as follows: "'ciphers:xxx','sslEnabledProtocols,client.enable:xxx'"nullSTRINGYesNo
ciphersList of ciphers to be used. This parameter should include under parameters Ex: 'ciphers:TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256'nullSTRINGYesNo
ssl.enabled.protocolsSSL/TLS protocols to be enabled. This parameter should be in camel case format(sslEnabledProtocols) under parameters. Ex 'sslEnabledProtocols:true'nullSTRINGYesNo
client.enable.session.creationEnable HTTP session creation.This parameter should include under parameters Ex: 'client.enable.session.creation:true'nullSTRINGYesNo
follow.redirectRedirect related enabled.trueBOOLYesNo
max.redirect.countMaximum redirect count.5INTYesNo
tls.store.typeTLS store type to be used.JKSSTRINGYesNo
proxy.hostProxy server hostnullSTRINGYesNo
proxy.portProxy server portnullSTRINGYesNo
proxy.usernameProxy server usernamenullSTRINGYesNo
proxy.passwordProxy server passwordnullSTRINGYesNo
client.bootstrap.configurationClient bootsrap configurations. Expected format of these parameters is as follows: "'client.bootstrap.nodelay:xxx','client.bootstrap.keepalive:xxx'"TODOSTRINGYesNo
client.bootstrap.nodelayHttp client no delay.trueBOOLYesNo
client.bootstrap.keepaliveHttp client keep alive.trueBOOLYesNo
client.bootstrap.sendbuffersizeHttp client send buffer size.1048576INTYesNo
client.bootstrap.recievebuffersizeHttp client receive buffer size.1048576INTYesNo
client.bootstrap.connect.timeoutHttp client connection timeout.15000INTYesNo
client.bootstrap.socket.reuseTo enable http socket reuse.falseBOOLYesNo
client.bootstrap.socket.timeoutHttp client socket timeout.15STRINGYesNo
client.threadpool.configurationsThread pool configuration. Expected format of these parameters is as follows: "'client.connection.pool.count:xxx','client.max.active.connections.per.pool:xxx'"TODOSTRINGYesNo
client.connection.pool.countConnection pool count.0INTYesNo
client.max.active.connections.per.poolActive connections per pool.-1INTYesNo
client.min.idle.connections.per.poolMinimum ideal connection per pool.0INTYesNo
client.max.idle.connections.per.poolMaximum ideal connection per pool.100INTYesNo
client.min.eviction.idle.timeMinimum eviction idle time.5 * 60 * 1000STRINGYesNo
sender.thread.countHttp sender thread count.20STRINGYesNo
event.group.executor.thread.sizeEvent group executor thread size.15STRINGYesNo
max.wait.for.client.connection.poolMaximum wait for client connection pool.60000STRINGYesNo
- -System Parameters - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Parameters
clientBootstrapBossGroupSizeproperty to configure number of boss threads, which accepts incoming connections until the ports are unbound. Once connection accepts successfully, boss thread passes the accepted channel to one of the worker threads.Number of available processorsAny integer
clientBootstrapWorkerGroupSizeproperty to configure number of worker threads, which performs non blocking read and write for one or more channels in non-blocking mode.(Number of available processors)*2Any integer
clientBootstrapClientGroupSizeproperty to configure number of client threads, which performs non blocking read and write for one or more channels in non-blocking mode.(Number of available processors)*2Any integer
trustStoreLocationThe default truststore file path.${carbon.home}/resources/security/client-truststore.jksPath to client-truststore.jks
trustStorePasswordThe default truststore password.wso2carbonTruststore password
- -Examples -EXAMPLE 1 -``` -@sink(type='http',publisher.url='http://localhost:8009/foo', method='{{method}}',headers="'content-type:xml','content-length:94'", client.bootstrap.configuration="'client.bootstrap.socket.timeout:20', 'client.bootstrap.worker.group.size:10'", client.pool.configuration="'client.connection.pool.count:10','client.max.active.connections.per.pool:1'", @map(type='xml', @payload('{{payloadBody}}'))) -define stream FooStream (payloadBody String, method string, headers string); - -``` -

If it is xml mapping expected input should be in following format for FooStream:
{
<events>
    <event>
        <symbol>WSO2</symbol>
        <price>55.6</price>
        <volume>100</volume>
    </event>
</events>,
POST,
Content-Length:24#Content-Location:USA#Retry-After:120
}

Above event will generate output as below.
~Output http event payload
<events>
    <event>
        <symbol>WSO2</symbol>
        <price>55.6</price>
        <volume>100</volume>
    </event>
</events>

~Output http event headers
Content-Length:24,
Content-Location:'USA',
Retry-After:120,
Content-Type:'application/xml',
HTTP_METHOD:'POST',

~Output http event properties
HTTP_METHOD:'POST',
HOST:'localhost',
PORT:8009,
PROTOCOL:'http',
TO:'/foo'

- -### http-request *(Sink)* - -

This extension publish the HTTP events in any HTTP method POST, GET, PUT, DELETE via HTTP or https protocols. As the additional features this component can provide basic authentication as well as user can publish events using custom client truststore files when publishing events via https protocol. And also user can add any number of headers including HTTP_METHOD header for each event dynamically.
Following content types will be set by default according to the type of sink mapper used.
You can override them by setting the new content types in headers.
     - TEXT : text/plain
     - XML : application/xml
     - JSON : application/json
     - KEYVALUE : application/x-www-form-urlencoded

HTTP request sink is correlated with the The HTTP reponse source, through a unique sink.id.It sends the request to the defined url and the response is received by the response source which has the same 'sink.id'.

- -Syntax -``` -@sink(type="http-request", publisher.url="", basic.auth.username="", basic.auth.password="", https.truststore.file="", https.truststore.password="", headers="", method="", socket.idle.timeout="", chunk.disabled="", ssl.protocol="", parameters="", ciphers="", ssl.enabled.protocols="", client.enable.session.creation="", follow.redirect="", max.redirect.count="", tls.store.type="", proxy.host="", proxy.port="", proxy.username="", proxy.password="", client.bootstrap.configuration="", client.bootstrap.nodelay="", client.bootstrap.keepalive="", client.bootstrap.sendbuffersize="", client.bootstrap.recievebuffersize="", client.bootstrap.connect.timeout="", client.bootstrap.socket.reuse="", client.bootstrap.socket.timeout="", client.threadpool.configurations="", client.connection.pool.count="", client.max.active.connections.per.pool="", client.min.idle.connections.per.pool="", client.max.idle.connections.per.pool="", client.min.eviction.idle.time="", sender.thread.count="", event.group.executor.thread.size="", max.wait.for.client.connection.pool="", sink.id="", downloading.enabled="", download.path="", @map(...))) -``` - -QUERY PARAMETERS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
publisher.urlThe URL to which the outgoing events should be published via HTTP. This is a mandatory parameter and if this is not specified, an error is logged in the CLI. If user wants to enable SSL for the events, use https instead of http in the publisher.url.
e.g., http://localhost:8080/endpoint, https://localhost:8080/endpoint
This can be used as a dynamic parameter as well.
STRINGNoYes
basic.auth.usernameThe username to be included in the authentication header of the basic authentication enabled events. It is required to specify both username and password to enable basic authentication. If one of the parameter is not given by user then an error is logged in the CLI. STRINGYesNo
basic.auth.passwordThe password to include in the authentication header of the basic authentication enabled events. It is required to specify both username and password to enable basic authentication. If one of the parameter is not given by user then an error is logged in the CLI. STRINGYesNo
https.truststore.fileThe file path to the location of the truststore of the client that sends the HTTP events through 'https' protocol. A custom client-truststore can be specified if required.${carbon.home}/resources/security/client-truststore.jksSTRINGYesNo
https.truststore.passwordThe password for the client-truststore. A custom password can be specified if required. If no custom password is specified and the protocol of URL is 'https' then, the system uses default password.wso2carbonSTRINGYesNo
headersThe headers that should be included as HTTP request headers.
There can be any number of headers concatenated in following format. "'header1:value1','header2:value2'". User can include Content-Type header if he needs to use a specific content-type for the payload. Or else, system decides the Content-Type by considering the type of sink mapper, in following way.
 - @map(xml):application/xml
 - @map(json):application/json
 - @map(text):plain/text )
 - if user does not include any mapping type then the system gets 'plain/text' as default Content-Type header.
Note that providing content-length as a header is not supported. The size of the payload will be automatically calculated and included in the content-length header.
STRINGYesNo
methodFor HTTP events, HTTP_METHOD header should be included as a request header. If the parameter is null then system uses 'POST' as a default header.POSTSTRINGYesNo
socket.idle.timeoutSocket timeout value in millisecond6000INTYesNo
chunk.disabledport: Port number of the remote servicefalseBOOLYesNo
ssl.protocolThe SSL protocol versionTLSSTRINGYesNo
parametersParameters other than basics such as ciphers,sslEnabledProtocols,client.enable.session.creation. Expected format of these parameters is as follows: "'ciphers:xxx','sslEnabledProtocols,client.enable:xxx'"nullSTRINGYesNo
ciphersList of ciphers to be used. This parameter should include under parameters Ex: 'ciphers:TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256'nullSTRINGYesNo
ssl.enabled.protocolsSSL/TLS protocols to be enabled. This parameter should be in camel case format(sslEnabledProtocols) under parameters. Ex 'sslEnabledProtocols:true'nullSTRINGYesNo
client.enable.session.creationEnable HTTP session creation.This parameter should include under parameters Ex: 'client.enable.session.creation:true'nullSTRINGYesNo
follow.redirectRedirect related enabled.trueBOOLYesNo
max.redirect.countMaximum redirect count.5INTYesNo
tls.store.typeTLS store type to be used.JKSSTRINGYesNo
proxy.hostProxy server hostnullSTRINGYesNo
proxy.portProxy server portnullSTRINGYesNo
proxy.usernameProxy server usernamenullSTRINGYesNo
proxy.passwordProxy server passwordnullSTRINGYesNo
client.bootstrap.configurationClient bootsrap configurations. Expected format of these parameters is as follows: "'client.bootstrap.nodelay:xxx','client.bootstrap.keepalive:xxx'"TODOSTRINGYesNo
client.bootstrap.nodelayHttp client no delay.trueBOOLYesNo
client.bootstrap.keepaliveHttp client keep alive.trueBOOLYesNo
client.bootstrap.sendbuffersizeHttp client send buffer size.1048576INTYesNo
client.bootstrap.recievebuffersizeHttp client receive buffer size.1048576INTYesNo
client.bootstrap.connect.timeoutHttp client connection timeout.15000INTYesNo
client.bootstrap.socket.reuseTo enable http socket reuse.falseBOOLYesNo
client.bootstrap.socket.timeoutHttp client socket timeout.15STRINGYesNo
client.threadpool.configurationsThread pool configuration. Expected format of these parameters is as follows: "'client.connection.pool.count:xxx','client.max.active.connections.per.pool:xxx'"TODOSTRINGYesNo
client.connection.pool.countConnection pool count.0INTYesNo
client.max.active.connections.per.poolActive connections per pool.-1INTYesNo
client.min.idle.connections.per.poolMinimum ideal connection per pool.0INTYesNo
client.max.idle.connections.per.poolMaximum ideal connection per pool.100INTYesNo
client.min.eviction.idle.timeMinimum eviction idle time.5 * 60 * 1000STRINGYesNo
sender.thread.countHttp sender thread count.20STRINGYesNo
event.group.executor.thread.sizeEvent group executor thread size.15STRINGYesNo
max.wait.for.client.connection.poolMaximum wait for client connection pool.60000STRINGYesNo
sink.idIdentifier of the sink. This is used to co-relate with the corresponding http-response source which needs to process the repose for the request sent by this sink.STRINGNoNo
downloading.enabledIf this is set to 'true' then the response received by the response source will be written to a file. If downloading is enabled, the download.path parameter is mandatory.falseBOOLYesNo
download.pathIf downloading is enabled, the path of the file which is going to be downloaded should be specified using 'download.path' parameter. This should be an absolute path including the file name.nullSTRINGYesYes
- -Examples -EXAMPLE 1 -``` -@sink(type='http-request', sink.id='foo', publisher.url='http://localhost:8009/foo', @map(type='xml', @payload('{{payloadBody}}'))) -define stream FooStream (payloadBody String, method string, headers string); -@source(type='http-response', sink.id='foo', http.status.code='2\\d+', -@map(type='text', regex.A='((.|\n)*)', @attributes(headers='trp:headers', fileName='A[1]'))) -define stream responseStream2xx(fileName string, headers string); - -@source(type='http-response', sink.id='foo', http.status.code='4\\d+', -@map(type='text', regex.A='((.|\n)*)', @attributes(errorMsg='A[1]'))) -define stream responseStream4xx(errorMsg string); -``` -

In above example, the payload body for 'FooStream' will be in following format.
{
<events>
    <event>
        <symbol>WSO2</symbol>
        <price>55.6</price>
        <volume>100</volume>
    </event>
</events>,
This message will sent as the body of a POST request with the content-type 'application/xml' to the endpoint defined as the 'publisher.url' and in order to process the responses for these requests, there should be a source of type 'http-response' defined with the same sink id 'foo' in the siddhi app.
The responses with 2xx status codes will be received by the http-response source which has the http.status.code defined by the regex '2\\d+'.
If the response has a 4xx status code, it will be received by the http-response source which has the http.status.code defined by the regex '4\\d+'.

- -EXAMPLE 2 -``` -define stream FooStream (name String, id int, headers String, downloadPath string); -@sink(type='http-request', -downloading.enabled='true', -download.path='{{downloadPath}}',publisher.url='http://localhost:8005/files', -method='GET', headers='{{headers}}',sink.id='download-sink', -@map(type='json')) -define stream BarStream (name String, id int, headers String, downloadPath string); - -@source(type='http-response', sink.id='download-sink', http.status.code='2\\d+', -@map(type='text', regex.A='((.|\n)*)', @attributes(headers='trp:headers', fileName='A[1]'))) -define stream responseStream2xx(fileName string, headers string); - -@source(type='http-response', sink.id='download-sink', http.status.code='4\\d+', -@map(type='text', regex.A='((.|\n)*)', @attributes(errorMsg='A[1]'))) -define stream responseStream4xx(errorMsg string); -``` -

In above example, http-request sink will send a GET request to the publisher url and the requested file will be received as the response by a corresponding http-response source.
If the http status code of the response is a successful one (2xx), it will be received by the http-response source which has the http.status.code '2\\d+' and downloaded as a local file. Then the event received to the responseStream2xx will have the headers included in the request and the downloaded file name.
If the http status code of the response is a 4xx code, it will be received by the http-response source which has the http.status.code '4\\d+'. Then the event received to the responseStream4xx will have the response message body in text format.

- -### http-response *(Sink)* - -

HTTP response sink is correlated with the The HTTP request source, through a unique source.id, and it send a response to the HTTP request source having the same source.id. The response message can be formatted in text, XML or JSON and can be sent with appropriate headers.

- -Syntax -``` -@sink(type="http-response", source.id="", message.id="", headers="", @map(...))) -``` - -QUERY PARAMETERS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
source.idIdentifier of the source.STRINGNoNo
message.idIdentifier of the message.STRINGNoYes
headersThe headers that should be included as HTTP response headers. There can be any number of headers concatenated on following format. "'header1:value1','header2:value2'" User can include content-type header if he/she need to have any specific type for payload. If not system get the mapping type as the content-Type header (ie.@map(xml):application/xml, @map(json):application/json, @map(text):plain/text) and if user does not include any mapping type then system gets the plain/text as default Content-Type header. If user does not include Content-Length header then system calculate the bytes size of payload and include it as content-length header. STRINGYesNo
- -Examples -EXAMPLE 1 -``` -@sink(type='http-response', source.id='sampleSourceId', message.id='{{messageId}}', headers="'content-type:json','content-length:94'"@map(type='json', @payload('{{payloadBody}}'))) -define stream FooStream (payloadBody String, messageId string, headers string); - -``` -

If it is json mapping expected input should be in following format for FooStream:
{
{"events":
    {"event":
        "symbol":WSO2,
        "price":55.6,
        "volume":100,
    }
},
0cf708b1-7eae-440b-a93e-e72f801b486a,
Content-Length:24#Content-Location:USA
}

Above event will generate response for the matching source message as below.

~Output http event payload
{"events":
    {"event":
        "symbol":WSO2,
        "price":55.6,
        "volume":100,
    }
}

~Output http event headers
Content-Length:24,
Content-Location:'USA',
Content-Type:'application/json'

- -## Source - -### http *(Source)* - -

The HTTP source receives POST requests via HTTP or HTTPS in format such as text, XML and JSON. In WSO2 SP, if required, you can enable basic authentication to ensure that events are received only from users who are authorized to access the service.

- -Syntax -``` -@source(type="http", receiver.url="", basic.auth.enabled="", worker.count="", socket.idle.timeout="", ssl.verify.client="", ssl.protocol="", tls.store.type="", parameters="", ciphers="", ssl.enabled.protocols="", server.enable.session.creation="", server.supported.snimatchers="", server.suported.server.names="", request.size.validation.configuration="", request.size.validation="", request.size.validation.maximum.value="", request.size.validation.reject.status.code="", request.size.validation.reject.message="", request.size.validation.reject.message.content.type="", header.size.validation="", header.validation.maximum.request.line="", header.validation.maximum.size="", header.validation.maximum.chunk.size="", header.validation.reject.status.code="", header.validation.reject.message="", header.validation.reject.message.content.type="", server.bootstrap.configuration="", server.bootstrap.nodelay="", server.bootstrap.keepalive="", server.bootstrap.sendbuffersize="", server.bootstrap.recievebuffersize="", server.bootstrap.connect.timeout="", server.bootstrap.socket.reuse="", server.bootstrap.socket.timeout="", server.bootstrap.socket.backlog="", trace.log.enabled="", @map(...))) -``` - -QUERY PARAMETERS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
receiver.urlThe URL to which the events should be received. User can provide any valid url and if the url is not provided the system will use the following format http://0.0.0.0:9763/<appNAme>/<streamName>If the user want to use SSL the url should be given in following format https://localhost:8080/<streamName>http://0.0.0.0:9763//STRINGYesNo
basic.auth.enabledThis works only in WSO2 SP. If this is set to true, basic authentication is enabled for incoming events, and the credentials with which each event is sent are verified to ensure that the user is authorized to access the service. If basic authentication fails, the event is not authenticated and an authentication error is logged in the CLI.falseSTRINGYesNo
worker.countThe number of active worker threads to serve the incoming events. The value is 1 by default. This will ensure that the events are directed to the event stream in the same order in which they arrive. By increasing this value the performance might increase at the cost of loosing event ordering.1STRINGYesNo
socket.idle.timeoutIdle timeout for HTTP connection.120000INTYesNo
ssl.verify.clientThe type of client certificate verification.nullSTRINGYesNo
ssl.protocolssl/tls related optionsTLSSTRINGYesNo
tls.store.typeTLS store type.JKSSTRINGYesNo
parametersParameters other than basics such as ciphers,sslEnabledProtocols,client.enable.session.creation. Expected format of these parameters is as follows: "'ciphers:xxx','sslEnabledProtocols,client.enable:xxx'"nullSTRINGYesNo
ciphersList of ciphers to be used. This parameter should include under parameters Ex: 'ciphers:TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256'nullSTRINGYesNo
ssl.enabled.protocolsSSL/TLS protocols to be enabled. This parameter should be in camel case format(sslEnabledProtocols) under parameters. Ex 'sslEnabledProtocols:true'nullSTRINGYesNo
server.enable.session.creationEnable HTTP session creation.This parameter should include under parameters Ex: 'client.enable.session.creation:true'nullSTRINGYesNo
server.supported.snimatchersHttp SNIMatcher to be added. This parameter should include under parameters Ex: 'server.supported.snimatchers:SNIMatcher'nullSTRINGYesNo
server.suported.server.namesHttp supported servers. This parameter should include under parameters Ex: 'server.suported.server.names:server'nullSTRINGYesNo
request.size.validation.configurationParameters that responsible for validating the http request and request headers. Expected format of these parameters is as follows: "'request.size.validation:xxx','request.size.validation.maximum.value:xxx'"nullSTRINGYesNo
request.size.validationTo enable the request size validation.falseSTRINGYesNo
request.size.validation.maximum.valueIf request size is validated then maximum size.Integer.MAX_VALUESTRINGYesNo
request.size.validation.reject.status.codeIf request is exceed maximum size and request.size.validation is enabled then status code to be send as response.401STRINGYesNo
request.size.validation.reject.messageIf request is exceed maximum size and request.size.validation is enabled then status message to be send as response.Message is bigger than the valid sizeSTRINGYesNo
request.size.validation.reject.message.content.typeIf request is exceed maximum size and request.size.validation is enabled then content type to be send as response.plain/textSTRINGYesNo
header.size.validationTo enable the header size validation.falseSTRINGYesNo
header.validation.maximum.request.lineIf header header validation is enabled then the maximum request line.4096STRINGYesNo
header.validation.maximum.sizeIf header header validation is enabled then the maximum expected header size.8192STRINGYesNo
header.validation.maximum.chunk.sizeIf header header validation is enabled then the maximum expected chunk size.8192STRINGYesNo
header.validation.reject.status.code401If header is exceed maximum size and header.size.validation is enabled then status code to be send as response.STRINGYesNo
header.validation.reject.messageIf header is exceed maximum size and header.size.validation is enabled then message to be send as response.Message header is bigger than the valid sizeSTRINGYesNo
header.validation.reject.message.content.typeIf header is exceed maximum size and header.size.validation is enabled then content type to be send as response.plain/textSTRINGYesNo
server.bootstrap.configurationParameters that for bootstrap configurations of the server. Expected format of these parameters is as follows: "'ciphers:xxx','sslEnabledProtocols,client.enable:xxx'"nullOBJECTYesNo
server.bootstrap.nodelayHttp server no delay.trueBOOLYesNo
server.bootstrap.keepaliveHttp server keep alive.trueBOOLYesNo
server.bootstrap.sendbuffersizeHttp server send buffer size.1048576INTYesNo
server.bootstrap.recievebuffersizeHttp server receive buffer size.1048576INTYesNo
server.bootstrap.connect.timeoutHttp server connection timeout.15000INTYesNo
server.bootstrap.socket.reuseTo enable http socket reuse.falseBOOLYesNo
server.bootstrap.socket.timeoutHttp server socket timeout.15BOOLYesNo
server.bootstrap.socket.backlogTHttp server socket backlog.100BOOLYesNo
trace.log.enabledHttp traffic monitoring.falseBOOLYesNo
- -System Parameters - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Parameters
serverBootstrapBossGroupSizeproperty to configure number of boss threads, which accepts incoming connections until the ports are unbound. Once connection accepts successfully, boss thread passes the accepted channel to one of the worker threads.Number of available processorsAny integer
serverBootstrapWorkerGroupSizeproperty to configure number of worker threads, which performs non blocking read and write for one or more channels in non-blocking mode.(Number of available processors)*2Any integer
serverBootstrapClientGroupSizeproperty to configure number of client threads, which performs non blocking read and write for one or more channels in non-blocking mode.(Number of available processors)*2Any integer
defaultHostThe default host of the transport.0.0.0.0Any valid host
defaultHttpPortThe default port if the default scheme is 'http'.8280Any valid port
defaultHttpsPortThe default port if the default scheme is 'https'.8243Any valid port
defaultSchemeThe default protocol.httphttp
https
keyStoreLocationThe default keystore file path.${carbon.home}/resources/security/wso2carbon.jksPath to wso2carbon.jks file
keyStorePasswordThe default keystore password.wso2carbonString of keystore password
certPasswordThe default cert password.wso2carbonString of cert password
- -Examples -EXAMPLE 1 -``` -@source(type='http', receiver.url='http://localhost:9055/endpoints/RecPro', socketIdleTimeout='150000', parameters="'ciphers : TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256', 'sslEnabledProtocols:TLSv1.1,TLSv1.2'",request.size.validation.configuration="request.size.validation:true",server.bootstrap.configuration="server.bootstrap.socket.timeout:25" @map(type='xml')) -define stream FooStream (symbol string, price float, volume long); - -``` -

Above source listenerConfiguration performs a default XML input mapping. The expected input is as follows:
<events>
    <event>
        <symbol>WSO2</symbol>
        <price>55.6</price>
        <volume>100</volume>
    </event>
</events>
If basic authentication is enabled via the basic.auth.enabled='true setting, each input event is also expected to contain the Authorization:'Basic encodeBase64(username:Password)' header.

- -### http-request *(Source)* - -

The HTTP request is correlated with the HTTP response sink, through a unique source.id, and for each POST requests it receives via HTTP or HTTPS in format such as text, XML and JSON it sends the response via the HTTP response sink. The individual request and response messages are correlated at the sink using the message.id of the events. If required, you can enable basic authentication at the source to ensure that events are received only from users who are authorized to access the service.

- -Syntax -``` -@source(type="http-request", receiver.url="", source.id="", connection.timeout="", basic.auth.enabled="", worker.count="", socket.idle.timeout="", ssl.verify.client="", ssl.protocol="", tls.store.type="", parameters="", ciphers="", ssl.enabled.protocols="", server.enable.session.creation="", server.supported.snimatchers="", server.suported.server.names="", request.size.validation.configuration="", request.size.validation="", request.size.validation.maximum.value="", request.size.validation.reject.status.code="", request.size.validation.reject.message="", request.size.validation.reject.message.content.type="", header.size.validation="", header.validation.maximum.request.line="", header.validation.maximum.size="", header.validation.maximum.chunk.size="", header.validation.reject.status.code="", header.validation.reject.message="", header.validation.reject.message.content.type="", server.bootstrap.configuration="", server.bootstrap.nodelay="", server.bootstrap.keepalive="", server.bootstrap.sendbuffersize="", server.bootstrap.recievebuffersize="", server.bootstrap.connect.timeout="", server.bootstrap.socket.reuse="", server.bootstrap.socket.timeout="", server.bootstrap.socket.backlog="", trace.log.enabled="", @map(...))) -``` - -QUERY PARAMETERS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
receiver.urlThe URL to which the events should be received. User can provide any valid url and if the url is not provided the system will use the following format http://0.0.0.0:9763/<appNAme>/<streamName>If the user want to use SSL the url should be given in following format https://localhost:8080/<streamName>http://0.0.0.0:9763//STRINGYesNo
source.idIdentifier need to map the source to sink.STRINGNoNo
connection.timeoutConnection timeout in milliseconds. If the mapped http-response sink does not get a correlated message, after this timeout value, a timeout response is sent120000INTYesNo
basic.auth.enabledIf this is set to true, basic authentication is enabled for incoming events, and the credentials with which each event is sent are verified to ensure that the user is authorized to access the service. If basic authentication fails, the event is not authenticated and an authentication error is logged in the CLI. By default this values 'false' falseSTRINGYesNo
worker.countThe number of active worker threads to serve the incoming events. The value is 1 by default. This will ensure that the events are directed to the event stream in the same order in which they arrive. By increasing this value the performance might increase at the cost of loosing event ordering.1STRINGYesNo
socket.idle.timeoutIdle timeout for HTTP connection.120000INTYesNo
ssl.verify.clientThe type of client certificate verification.nullSTRINGYesNo
ssl.protocolssl/tls related optionsTLSSTRINGYesNo
tls.store.typeTLS store type.JKSSTRINGYesNo
parametersParameters other than basics such as ciphers,sslEnabledProtocols,client.enable.session.creation. Expected format of these parameters is as follows: "'ciphers:xxx','sslEnabledProtocols,client.enable:xxx'"nullSTRINGYesNo
ciphersList of ciphers to be used. This parameter should include under parameters Ex: 'ciphers:TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256'nullSTRINGYesNo
ssl.enabled.protocolsSSL/TLS protocols to be enabled. This parameter should be in camel case format(sslEnabledProtocols) under parameters. Ex 'sslEnabledProtocols:true'nullSTRINGYesNo
server.enable.session.creationEnable HTTP session creation.This parameter should include under parameters Ex: 'client.enable.session.creation:true'nullSTRINGYesNo
server.supported.snimatchersHttp SNIMatcher to be added. This parameter should include under parameters Ex: 'server.supported.snimatchers:SNIMatcher'nullSTRINGYesNo
server.suported.server.namesHttp supported servers. This parameter should include under parameters Ex: 'server.suported.server.names:server'nullSTRINGYesNo
request.size.validation.configurationParameters that responsible for validating the http request and request headers. Expected format of these parameters is as follows: "'request.size.validation:xxx','request.size.validation.maximum.value:xxx'"nullSTRINGYesNo
request.size.validationTo enable the request size validation.falseSTRINGYesNo
request.size.validation.maximum.valueIf request size is validated then maximum size.Integer.MAX_VALUESTRINGYesNo
request.size.validation.reject.status.codeIf request is exceed maximum size and request.size.validation is enabled then status code to be send as response.401STRINGYesNo
request.size.validation.reject.messageIf request is exceed maximum size and request.size.validation is enabled then status message to be send as response.Message is bigger than the valid sizeSTRINGYesNo
request.size.validation.reject.message.content.typeIf request is exceed maximum size and request.size.validation is enabled then content type to be send as response.plain/textSTRINGYesNo
header.size.validationTo enable the header size validation.falseSTRINGYesNo
header.validation.maximum.request.lineIf header header validation is enabled then the maximum request line.4096STRINGYesNo
header.validation.maximum.sizeIf header header validation is enabled then the maximum expected header size.8192STRINGYesNo
header.validation.maximum.chunk.sizeIf header header validation is enabled then the maximum expected chunk size.8192STRINGYesNo
header.validation.reject.status.code401If header is exceed maximum size and header.size.validation is enabled then status code to be send as response.STRINGYesNo
header.validation.reject.messageIf header is exceed maximum size and header.size.validation is enabled then message to be send as response.Message header is bigger than the valid sizeSTRINGYesNo
header.validation.reject.message.content.typeIf header is exceed maximum size and header.size.validation is enabled then content type to be send as response.plain/textSTRINGYesNo
server.bootstrap.configurationParameters that for bootstrap configurations of the server. Expected format of these parameters is as follows: "'ciphers:xxx','sslEnabledProtocols,client.enable:xxx'"nullOBJECTYesNo
server.bootstrap.nodelayHttp server no delay.trueBOOLYesNo
server.bootstrap.keepaliveHttp server keep alive.trueBOOLYesNo
server.bootstrap.sendbuffersizeHttp server send buffer size.1048576INTYesNo
server.bootstrap.recievebuffersizeHttp server receive buffer size.1048576INTYesNo
server.bootstrap.connect.timeoutHttp server connection timeout.15000INTYesNo
server.bootstrap.socket.reuseTo enable http socket reuse.falseBOOLYesNo
server.bootstrap.socket.timeoutHttp server socket timeout.15BOOLYesNo
server.bootstrap.socket.backlogTHttp server socket backlog.100BOOLYesNo
trace.log.enabledHttp traffic monitoring.falseBOOLYesNo
- -System Parameters - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Parameters
serverBootstrapBossGroupSizeproperty to configure number of boss threads, which accepts incoming connections until the ports are unbound. Once connection accepts successfully, boss thread passes the accepted channel to one of the worker threads.Number of available processorsAny integer
serverBootstrapWorkerGroupSizeproperty to configure number of worker threads, which performs non blocking read and write for one or more channels in non-blocking mode.(Number of available processors)*2Any integer
serverBootstrapClientGroupSizeproperty to configure number of client threads, which performs non blocking read and write for one or more channels in non-blocking mode.(Number of available processors)*2Any integer
defaultHostThe default host of the transport.0.0.0.0Any valid host
defaultHttpPortThe default port if the default scheme is 'http'.8280Any valid port
defaultHttpsPortThe default port if the default scheme is 'https'.8243Any valid port
defaultSchemeThe default protocol.httphttp
https
keyStoreLocationThe default keystore file path.${carbon.home}/resources/security/wso2carbon.jksPath to wso2carbon.jks file
keyStorePasswordThe default keystore password.wso2carbonString of keystore password
certPasswordThe default cert password.wso2carbonString of cert password
- -Examples -EXAMPLE 1 -``` -@source(type='http-request', source.id='sampleSourceId, receiver.url='http://localhost:9055/endpoints/RecPro', connection.timeout='150000', parameters="'ciphers : TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256', 'sslEnabledProtocols:TLSv1.1,TLSv1.2'", request.size.validation.configuration="request.size.validation:true", server.bootstrap.configuration="server.bootstrap.socket.timeout:25", @map(type='json, @attributes(messageId='trp:messageId', symbol='$.events.event.symbol', price='$.events.event.price', volume='$.events.event.volume'))) -define stream FooStream (messageId string, symbol string, price float, volume long); - -``` -

The expected input is as follows:
{"events":
    {"event":
        "symbol":WSO2,
        "price":55.6,
        "volume":100,
    }
}
If basic authentication is enabled via the basic.auth.enabled='true setting, each input event is also expected to contain the Authorization:'Basic encodeBase64(username:Password)' header.

- -### http-response *(Source)* - -

The http-response source co-relates with http-request sink with the parameter 'sink.id'.
This receives responses for the requests sent by the http-request sink which has the same sink id.
Response messages can be in formats such as TEXT, JSON and XML.
In order to handle the responses with different http status codes, user is allowed to defined the acceptable response source code using the parameter 'http.status.code'

- -Syntax -``` -@source(type="http-response", sink.id="", http.status.code="", @map(...))) -``` - -QUERY PARAMETERS - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
sink.idThis parameter is used to map the http-response source to a http-request sink. Then this source will accepts the response messages for the requests sent by corresponding http-request sink.STRINGNoNo
http.status.codeAcceptable http status code for the responses.
This can be a complete string or a regex.
Only the responses with matching status codes to the defined value, will be received by the http-response source.
Eg: 'http.status.code = '200', http.status.code = '2\\d+''
STRINGNoNo
- -Examples -EXAMPLE 1 -``` -@sink(type='http-request', -downloading.enabled='true', -publisher.url='http://localhost:8005/registry/employee', -method='POST', headers='{{headers}}',sink.id='employee-info', -@map(type='json')) -define stream BarStream (name String, id int, headers String, downloadPath string); - -@source(type='http-response' , sink.id='employee-info', http.status.code='2\\d+', -@map(type='text', regex.A='((.|\n)*)', @attributes(message='A[1]'))) -define stream responseStream2xx(message string);@source(type='http-response' , sink.id='employee-info', http.status.code='4\\d+' , -@map(type='text', regex.A='((.|\n)*)', @attributes(message='A[1]'))) -define stream responseStream4xx(message string); -``` -

In above example, the defined http-request sink will send a POST requests to the endpoint defined by 'publisher.url'.
Then for those requests, the source with the response code '2\\d+' and sink.id 'employee-info' will receive the responses with 2xx status codes.
The http-response source which has 'employee-info' as the 'sink.id' and '4\\d+' as the http.response.code will receive all the responses with 4xx status codes.
. Then the body of the response message will be extracted using text mapper and converted into siddhi events.
.

- diff --git a/docs/api/1.0.40.md b/docs/api/1.0.40.md deleted file mode 100644 index 06ef4334..00000000 --- a/docs/api/1.0.40.md +++ /dev/null @@ -1,1673 +0,0 @@ -# API Docs - v1.0.40 - -## Sink - -### http *(Sink)* - -

This extension publish the HTTP events in any HTTP method POST, GET, PUT, DELETE via HTTP or https protocols. As the additional features this component can provide basic authentication as well as user can publish events using custom client truststore files when publishing events via https protocol. And also user can add any number of headers including HTTP_METHOD header for each event dynamically.
Following content types will be set by default according to the type of sink mapper used.
You can override them by setting the new content types in headers.
     - TEXT : text/plain
     - XML : application/xml
     - JSON : application/json
     - KEYVALUE : application/x-www-form-urlencoded

- -Syntax -``` -@sink(type="http", publisher.url="", basic.auth.username="", basic.auth.password="", https.truststore.file="", https.truststore.password="", headers="", method="", socket.idle.timeout="", chunk.disabled="", ssl.protocol="", parameters="", ciphers="", ssl.enabled.protocols="", client.enable.session.creation="", follow.redirect="", max.redirect.count="", tls.store.type="", proxy.host="", proxy.port="", proxy.username="", proxy.password="", client.bootstrap.configuration="", client.bootstrap.nodelay="", client.bootstrap.keepalive="", client.bootstrap.sendbuffersize="", client.bootstrap.recievebuffersize="", client.bootstrap.connect.timeout="", client.bootstrap.socket.reuse="", client.bootstrap.socket.timeout="", client.threadpool.configurations="", client.connection.pool.count="", client.max.active.connections.per.pool="", client.min.idle.connections.per.pool="", client.max.idle.connections.per.pool="", client.min.eviction.idle.time="", sender.thread.count="", event.group.executor.thread.size="", max.wait.for.client.connection.pool="", @map(...))) -``` - -QUERY PARAMETERS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
publisher.urlThe URL to which the outgoing events should be published via HTTP. This is a mandatory parameter and if this is not specified, an error is logged in the CLI. If user wants to enable SSL for the events, use https instead of http in the publisher.url.e.g., http://localhost:8080/endpoint, https://localhost:8080/endpointSTRINGNoNo
basic.auth.usernameThe username to be included in the authentication header of the basic authentication enabled events. It is required to specify both username and password to enable basic authentication. If one of the parameter is not given by user then an error is logged in the CLI. STRINGYesNo
basic.auth.passwordThe password to include in the authentication header of the basic authentication enabled events. It is required to specify both username and password to enable basic authentication. If one of the parameter is not given by user then an error is logged in the CLI. STRINGYesNo
https.truststore.fileThe file path to the location of the truststore of the client that sends the HTTP events through 'https' protocol. A custom client-truststore can be specified if required.${carbon.home}/resources/security/client-truststore.jksSTRINGYesNo
https.truststore.passwordThe password for the client-truststore. A custom password can be specified if required. If no custom password is specified and the protocol of URL is 'https' then, the system uses default password.wso2carbonSTRINGYesNo
headersThe headers that should be included as HTTP request headers.
There can be any number of headers concatenated in following format. "'header1:value1','header2:value2'". User can include Content-Type header if he needs to use a specific content-type for the payload. Or else, system decides the Content-Type by considering the type of sink mapper, in following way.
 - @map(xml):application/xml
 - @map(json):application/json
 - @map(text):plain/text )
 - if user does not include any mapping type then the system gets 'plain/text' as default Content-Type header.
Note that providing content-length as a header is not supported. The size of the payload will be automatically calculated and included in the content-length header.
STRINGYesNo
methodFor HTTP events, HTTP_METHOD header should be included as a request header. If the parameter is null then system uses 'POST' as a default header.POSTSTRINGYesNo
socket.idle.timeoutSocket timeout value in millisecond6000INTYesNo
chunk.disabledThis parameter is used to disable/enable chunked transfer encodingfalseBOOLYesNo
ssl.protocolThe SSL protocol versionTLSSTRINGYesNo
parametersParameters other than basics such as ciphers,sslEnabledProtocols,client.enable.session.creation. Expected format of these parameters is as follows: "'ciphers:xxx','sslEnabledProtocols,client.enable:xxx'"nullSTRINGYesNo
ciphersList of ciphers to be used. This parameter should include under parameters Ex: 'ciphers:TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256'nullSTRINGYesNo
ssl.enabled.protocolsSSL/TLS protocols to be enabled. This parameter should be in camel case format(sslEnabledProtocols) under parameters. Ex 'sslEnabledProtocols:true'nullSTRINGYesNo
client.enable.session.creationEnable HTTP session creation.This parameter should include under parameters Ex: 'client.enable.session.creation:true'nullSTRINGYesNo
follow.redirectRedirect related enabled.trueBOOLYesNo
max.redirect.countMaximum redirect count.5INTYesNo
tls.store.typeTLS store type to be used.JKSSTRINGYesNo
proxy.hostProxy server hostnullSTRINGYesNo
proxy.portProxy server portnullSTRINGYesNo
proxy.usernameProxy server usernamenullSTRINGYesNo
proxy.passwordProxy server passwordnullSTRINGYesNo
client.bootstrap.configurationClient bootsrap configurations. Expected format of these parameters is as follows: "'client.bootstrap.nodelay:xxx','client.bootstrap.keepalive:xxx'"TODOSTRINGYesNo
client.bootstrap.nodelayHttp client no delay.trueBOOLYesNo
client.bootstrap.keepaliveHttp client keep alive.trueBOOLYesNo
client.bootstrap.sendbuffersizeHttp client send buffer size.1048576INTYesNo
client.bootstrap.recievebuffersizeHttp client receive buffer size.1048576INTYesNo
client.bootstrap.connect.timeoutHttp client connection timeout.15000INTYesNo
client.bootstrap.socket.reuseTo enable http socket reuse.falseBOOLYesNo
client.bootstrap.socket.timeoutHttp client socket timeout.15STRINGYesNo
client.threadpool.configurationsThread pool configuration. Expected format of these parameters is as follows: "'client.connection.pool.count:xxx','client.max.active.connections.per.pool:xxx'"TODOSTRINGYesNo
client.connection.pool.countConnection pool count.0INTYesNo
client.max.active.connections.per.poolActive connections per pool.-1INTYesNo
client.min.idle.connections.per.poolMinimum ideal connection per pool.0INTYesNo
client.max.idle.connections.per.poolMaximum ideal connection per pool.100INTYesNo
client.min.eviction.idle.timeMinimum eviction idle time.5 * 60 * 1000STRINGYesNo
sender.thread.countHttp sender thread count.20STRINGYesNo
event.group.executor.thread.sizeEvent group executor thread size.15STRINGYesNo
max.wait.for.client.connection.poolMaximum wait for client connection pool.60000STRINGYesNo
- -System Parameters - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Parameters
clientBootstrapBossGroupSizeproperty to configure number of boss threads, which accepts incoming connections until the ports are unbound. Once connection accepts successfully, boss thread passes the accepted channel to one of the worker threads.Number of available processorsAny integer
clientBootstrapWorkerGroupSizeproperty to configure number of worker threads, which performs non blocking read and write for one or more channels in non-blocking mode.(Number of available processors)*2Any integer
clientBootstrapClientGroupSizeproperty to configure number of client threads, which performs non blocking read and write for one or more channels in non-blocking mode.(Number of available processors)*2Any integer
trustStoreLocationThe default truststore file path.${carbon.home}/resources/security/client-truststore.jksPath to client-truststore.jks
trustStorePasswordThe default truststore password.wso2carbonTruststore password
- -Examples -EXAMPLE 1 -``` -@sink(type='http',publisher.url='http://localhost:8009/foo', method='{{method}}',headers="'content-type:xml','content-length:94'", client.bootstrap.configuration="'client.bootstrap.socket.timeout:20', 'client.bootstrap.worker.group.size:10'", client.pool.configuration="'client.connection.pool.count:10','client.max.active.connections.per.pool:1'", @map(type='xml', @payload('{{payloadBody}}'))) -define stream FooStream (payloadBody String, method string, headers string); - -``` -

If it is xml mapping expected input should be in following format for FooStream:
{
<events>
    <event>
        <symbol>WSO2</symbol>
        <price>55.6</price>
        <volume>100</volume>
    </event>
</events>,
POST,
Content-Length:24#Content-Location:USA#Retry-After:120
}

Above event will generate output as below.
~Output http event payload
<events>
    <event>
        <symbol>WSO2</symbol>
        <price>55.6</price>
        <volume>100</volume>
    </event>
</events>

~Output http event headers
Content-Length:24,
Content-Location:'USA',
Retry-After:120,
Content-Type:'application/xml',
HTTP_METHOD:'POST',

~Output http event properties
HTTP_METHOD:'POST',
HOST:'localhost',
PORT:8009,
PROTOCOL:'http',
TO:'/foo'

- -### http-request *(Sink)* - -

This extension publish the HTTP events in any HTTP method POST, GET, PUT, DELETE via HTTP or https protocols. As the additional features this component can provide basic authentication as well as user can publish events using custom client truststore files when publishing events via https protocol. And also user can add any number of headers including HTTP_METHOD header for each event dynamically.
Following content types will be set by default according to the type of sink mapper used.
You can override them by setting the new content types in headers.
     - TEXT : text/plain
     - XML : application/xml
     - JSON : application/json
     - KEYVALUE : application/x-www-form-urlencoded

HTTP request sink is correlated with the The HTTP reponse source, through a unique sink.id.It sends the request to the defined url and the response is received by the response source which has the same 'sink.id'.

- -Syntax -``` -@sink(type="http-request", publisher.url="", basic.auth.username="", basic.auth.password="", https.truststore.file="", https.truststore.password="", headers="", method="", socket.idle.timeout="", chunk.disabled="", ssl.protocol="", parameters="", ciphers="", ssl.enabled.protocols="", client.enable.session.creation="", follow.redirect="", max.redirect.count="", tls.store.type="", proxy.host="", proxy.port="", proxy.username="", proxy.password="", client.bootstrap.configuration="", client.bootstrap.nodelay="", client.bootstrap.keepalive="", client.bootstrap.sendbuffersize="", client.bootstrap.recievebuffersize="", client.bootstrap.connect.timeout="", client.bootstrap.socket.reuse="", client.bootstrap.socket.timeout="", client.threadpool.configurations="", client.connection.pool.count="", client.max.active.connections.per.pool="", client.min.idle.connections.per.pool="", client.max.idle.connections.per.pool="", client.min.eviction.idle.time="", sender.thread.count="", event.group.executor.thread.size="", max.wait.for.client.connection.pool="", sink.id="", downloading.enabled="", download.path="", @map(...))) -``` - -QUERY PARAMETERS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
publisher.urlThe URL to which the outgoing events should be published via HTTP. This is a mandatory parameter and if this is not specified, an error is logged in the CLI. If user wants to enable SSL for the events, use https instead of http in the publisher.url.
e.g., http://localhost:8080/endpoint, https://localhost:8080/endpoint
This can be used as a dynamic parameter as well.
STRINGNoYes
basic.auth.usernameThe username to be included in the authentication header of the basic authentication enabled events. It is required to specify both username and password to enable basic authentication. If one of the parameter is not given by user then an error is logged in the CLI. STRINGYesNo
basic.auth.passwordThe password to include in the authentication header of the basic authentication enabled events. It is required to specify both username and password to enable basic authentication. If one of the parameter is not given by user then an error is logged in the CLI. STRINGYesNo
https.truststore.fileThe file path to the location of the truststore of the client that sends the HTTP events through 'https' protocol. A custom client-truststore can be specified if required.${carbon.home}/resources/security/client-truststore.jksSTRINGYesNo
https.truststore.passwordThe password for the client-truststore. A custom password can be specified if required. If no custom password is specified and the protocol of URL is 'https' then, the system uses default password.wso2carbonSTRINGYesNo
headersThe headers that should be included as HTTP request headers.
There can be any number of headers concatenated in following format. "'header1:value1','header2:value2'". User can include Content-Type header if he needs to use a specific content-type for the payload. Or else, system decides the Content-Type by considering the type of sink mapper, in following way.
 - @map(xml):application/xml
 - @map(json):application/json
 - @map(text):plain/text )
 - if user does not include any mapping type then the system gets 'plain/text' as default Content-Type header.
Note that providing content-length as a header is not supported. The size of the payload will be automatically calculated and included in the content-length header.
STRINGYesNo
methodFor HTTP events, HTTP_METHOD header should be included as a request header. If the parameter is null then system uses 'POST' as a default header.POSTSTRINGYesNo
socket.idle.timeoutSocket timeout value in millisecond6000INTYesNo
chunk.disabledport: Port number of the remote servicefalseBOOLYesNo
ssl.protocolThe SSL protocol versionTLSSTRINGYesNo
parametersParameters other than basics such as ciphers,sslEnabledProtocols,client.enable.session.creation. Expected format of these parameters is as follows: "'ciphers:xxx','sslEnabledProtocols,client.enable:xxx'"nullSTRINGYesNo
ciphersList of ciphers to be used. This parameter should include under parameters Ex: 'ciphers:TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256'nullSTRINGYesNo
ssl.enabled.protocolsSSL/TLS protocols to be enabled. This parameter should be in camel case format(sslEnabledProtocols) under parameters. Ex 'sslEnabledProtocols:true'nullSTRINGYesNo
client.enable.session.creationEnable HTTP session creation.This parameter should include under parameters Ex: 'client.enable.session.creation:true'nullSTRINGYesNo
follow.redirectRedirect related enabled.trueBOOLYesNo
max.redirect.countMaximum redirect count.5INTYesNo
tls.store.typeTLS store type to be used.JKSSTRINGYesNo
proxy.hostProxy server hostnullSTRINGYesNo
proxy.portProxy server portnullSTRINGYesNo
proxy.usernameProxy server usernamenullSTRINGYesNo
proxy.passwordProxy server passwordnullSTRINGYesNo
client.bootstrap.configurationClient bootsrap configurations. Expected format of these parameters is as follows: "'client.bootstrap.nodelay:xxx','client.bootstrap.keepalive:xxx'"TODOSTRINGYesNo
client.bootstrap.nodelayHttp client no delay.trueBOOLYesNo
client.bootstrap.keepaliveHttp client keep alive.trueBOOLYesNo
client.bootstrap.sendbuffersizeHttp client send buffer size.1048576INTYesNo
client.bootstrap.recievebuffersizeHttp client receive buffer size.1048576INTYesNo
client.bootstrap.connect.timeoutHttp client connection timeout.15000INTYesNo
client.bootstrap.socket.reuseTo enable http socket reuse.falseBOOLYesNo
client.bootstrap.socket.timeoutHttp client socket timeout.15STRINGYesNo
client.threadpool.configurationsThread pool configuration. Expected format of these parameters is as follows: "'client.connection.pool.count:xxx','client.max.active.connections.per.pool:xxx'"TODOSTRINGYesNo
client.connection.pool.countConnection pool count.0INTYesNo
client.max.active.connections.per.poolActive connections per pool.-1INTYesNo
client.min.idle.connections.per.poolMinimum ideal connection per pool.0INTYesNo
client.max.idle.connections.per.poolMaximum ideal connection per pool.100INTYesNo
client.min.eviction.idle.timeMinimum eviction idle time.5 * 60 * 1000STRINGYesNo
sender.thread.countHttp sender thread count.20STRINGYesNo
event.group.executor.thread.sizeEvent group executor thread size.15STRINGYesNo
max.wait.for.client.connection.poolMaximum wait for client connection pool.60000STRINGYesNo
sink.idIdentifier of the sink. This is used to co-relate with the corresponding http-response source which needs to process the repose for the request sent by this sink.STRINGNoNo
downloading.enabledIf this is set to 'true' then the response received by the response source will be written to a file. If downloading is enabled, the download.path parameter is mandatory.falseBOOLYesNo
download.pathIf downloading is enabled, the path of the file which is going to be downloaded should be specified using 'download.path' parameter. This should be an absolute path including the file name.nullSTRINGYesYes
- -Examples -EXAMPLE 1 -``` -@sink(type='http-request', sink.id='foo', publisher.url='http://localhost:8009/foo', @map(type='xml', @payload('{{payloadBody}}'))) -define stream FooStream (payloadBody String, method string, headers string); -@source(type='http-response', sink.id='foo', http.status.code='2\\d+', -@map(type='text', regex.A='((.|\n)*)', @attributes(headers='trp:headers', fileName='A[1]'))) -define stream responseStream2xx(fileName string, headers string); - -@source(type='http-response', sink.id='foo', http.status.code='4\\d+', -@map(type='text', regex.A='((.|\n)*)', @attributes(errorMsg='A[1]'))) -define stream responseStream4xx(errorMsg string); -``` -

In above example, the payload body for 'FooStream' will be in following format.
{
<events>
    <event>
        <symbol>WSO2</symbol>
        <price>55.6</price>
        <volume>100</volume>
    </event>
</events>,
This message will sent as the body of a POST request with the content-type 'application/xml' to the endpoint defined as the 'publisher.url' and in order to process the responses for these requests, there should be a source of type 'http-response' defined with the same sink id 'foo' in the siddhi app.
The responses with 2xx status codes will be received by the http-response source which has the http.status.code defined by the regex '2\\d+'.
If the response has a 4xx status code, it will be received by the http-response source which has the http.status.code defined by the regex '4\\d+'.

- -EXAMPLE 2 -``` -define stream FooStream (name String, id int, headers String, downloadPath string); -@sink(type='http-request', -downloading.enabled='true', -download.path='{{downloadPath}}',publisher.url='http://localhost:8005/files', -method='GET', headers='{{headers}}',sink.id='download-sink', -@map(type='json')) -define stream BarStream (name String, id int, headers String, downloadPath string); - -@source(type='http-response', sink.id='download-sink', http.status.code='2\\d+', -@map(type='text', regex.A='((.|\n)*)', @attributes(headers='trp:headers', fileName='A[1]'))) -define stream responseStream2xx(fileName string, headers string); - -@source(type='http-response', sink.id='download-sink', http.status.code='4\\d+', -@map(type='text', regex.A='((.|\n)*)', @attributes(errorMsg='A[1]'))) -define stream responseStream4xx(errorMsg string); -``` -

In above example, http-request sink will send a GET request to the publisher url and the requested file will be received as the response by a corresponding http-response source.
If the http status code of the response is a successful one (2xx), it will be received by the http-response source which has the http.status.code '2\\d+' and downloaded as a local file. Then the event received to the responseStream2xx will have the headers included in the request and the downloaded file name.
If the http status code of the response is a 4xx code, it will be received by the http-response source which has the http.status.code '4\\d+'. Then the event received to the responseStream4xx will have the response message body in text format.

- -### http-response *(Sink)* - -

HTTP response sink is correlated with the The HTTP request source, through a unique source.id, and it send a response to the HTTP request source having the same source.id. The response message can be formatted in text, XML or JSON and can be sent with appropriate headers.

- -Syntax -``` -@sink(type="http-response", source.id="", message.id="", headers="", @map(...))) -``` - -QUERY PARAMETERS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
source.idIdentifier of the source.STRINGNoNo
message.idIdentifier of the message.STRINGNoYes
headersThe headers that should be included as HTTP response headers. There can be any number of headers concatenated on following format. "'header1:value1','header2:value2'" User can include content-type header if he/she need to have any specific type for payload. If not system get the mapping type as the content-Type header (ie.@map(xml):application/xml, @map(json):application/json, @map(text):plain/text) and if user does not include any mapping type then system gets the plain/text as default Content-Type header. If user does not include Content-Length header then system calculate the bytes size of payload and include it as content-length header. STRINGYesNo
- -Examples -EXAMPLE 1 -``` -@sink(type='http-response', source.id='sampleSourceId', message.id='{{messageId}}', headers="'content-type:json','content-length:94'"@map(type='json', @payload('{{payloadBody}}'))) -define stream FooStream (payloadBody String, messageId string, headers string); - -``` -

If it is json mapping expected input should be in following format for FooStream:
{
{"events":
    {"event":
        "symbol":WSO2,
        "price":55.6,
        "volume":100,
    }
},
0cf708b1-7eae-440b-a93e-e72f801b486a,
Content-Length:24#Content-Location:USA
}

Above event will generate response for the matching source message as below.

~Output http event payload
{"events":
    {"event":
        "symbol":WSO2,
        "price":55.6,
        "volume":100,
    }
}

~Output http event headers
Content-Length:24,
Content-Location:'USA',
Content-Type:'application/json'

- -## Source - -### http *(Source)* - -

The HTTP source receives POST requests via HTTP or HTTPS in format such as text, XML and JSON. In WSO2 SP, if required, you can enable basic authentication to ensure that events are received only from users who are authorized to access the service.

- -Syntax -``` -@source(type="http", receiver.url="", basic.auth.enabled="", worker.count="", socket.idle.timeout="", ssl.verify.client="", ssl.protocol="", tls.store.type="", parameters="", ciphers="", ssl.enabled.protocols="", server.enable.session.creation="", server.supported.snimatchers="", server.suported.server.names="", request.size.validation.configuration="", request.size.validation="", request.size.validation.maximum.value="", request.size.validation.reject.status.code="", request.size.validation.reject.message="", request.size.validation.reject.message.content.type="", header.size.validation="", header.validation.maximum.request.line="", header.validation.maximum.size="", header.validation.maximum.chunk.size="", header.validation.reject.status.code="", header.validation.reject.message="", header.validation.reject.message.content.type="", server.bootstrap.configuration="", server.bootstrap.nodelay="", server.bootstrap.keepalive="", server.bootstrap.sendbuffersize="", server.bootstrap.recievebuffersize="", server.bootstrap.connect.timeout="", server.bootstrap.socket.reuse="", server.bootstrap.socket.timeout="", server.bootstrap.socket.backlog="", trace.log.enabled="", @map(...))) -``` - -QUERY PARAMETERS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
receiver.urlThe URL to which the events should be received. User can provide any valid url and if the url is not provided the system will use the following format http://0.0.0.0:9763/<appNAme>/<streamName>If the user want to use SSL the url should be given in following format https://localhost:8080/<streamName>http://0.0.0.0:9763//STRINGYesNo
basic.auth.enabledThis works only in WSO2 SP. If this is set to true, basic authentication is enabled for incoming events, and the credentials with which each event is sent are verified to ensure that the user is authorized to access the service. If basic authentication fails, the event is not authenticated and an authentication error is logged in the CLI.falseSTRINGYesNo
worker.countThe number of active worker threads to serve the incoming events. The value is 1 by default. This will ensure that the events are directed to the event stream in the same order in which they arrive. By increasing this value the performance might increase at the cost of loosing event ordering.1STRINGYesNo
socket.idle.timeoutIdle timeout for HTTP connection.120000INTYesNo
ssl.verify.clientThe type of client certificate verification.nullSTRINGYesNo
ssl.protocolssl/tls related optionsTLSSTRINGYesNo
tls.store.typeTLS store type.JKSSTRINGYesNo
parametersParameters other than basics such as ciphers,sslEnabledProtocols,client.enable.session.creation. Expected format of these parameters is as follows: "'ciphers:xxx','sslEnabledProtocols,client.enable:xxx'"nullSTRINGYesNo
ciphersList of ciphers to be used. This parameter should include under parameters Ex: 'ciphers:TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256'nullSTRINGYesNo
ssl.enabled.protocolsSSL/TLS protocols to be enabled. This parameter should be in camel case format(sslEnabledProtocols) under parameters. Ex 'sslEnabledProtocols:true'nullSTRINGYesNo
server.enable.session.creationEnable HTTP session creation.This parameter should include under parameters Ex: 'client.enable.session.creation:true'nullSTRINGYesNo
server.supported.snimatchersHttp SNIMatcher to be added. This parameter should include under parameters Ex: 'server.supported.snimatchers:SNIMatcher'nullSTRINGYesNo
server.suported.server.namesHttp supported servers. This parameter should include under parameters Ex: 'server.suported.server.names:server'nullSTRINGYesNo
request.size.validation.configurationParameters that responsible for validating the http request and request headers. Expected format of these parameters is as follows: "'request.size.validation:xxx','request.size.validation.maximum.value:xxx'"nullSTRINGYesNo
request.size.validationTo enable the request size validation.falseSTRINGYesNo
request.size.validation.maximum.valueIf request size is validated then maximum size.Integer.MAX_VALUESTRINGYesNo
request.size.validation.reject.status.codeIf request is exceed maximum size and request.size.validation is enabled then status code to be send as response.401STRINGYesNo
request.size.validation.reject.messageIf request is exceed maximum size and request.size.validation is enabled then status message to be send as response.Message is bigger than the valid sizeSTRINGYesNo
request.size.validation.reject.message.content.typeIf request is exceed maximum size and request.size.validation is enabled then content type to be send as response.plain/textSTRINGYesNo
header.size.validationTo enable the header size validation.falseSTRINGYesNo
header.validation.maximum.request.lineIf header header validation is enabled then the maximum request line.4096STRINGYesNo
header.validation.maximum.sizeIf header header validation is enabled then the maximum expected header size.8192STRINGYesNo
header.validation.maximum.chunk.sizeIf header header validation is enabled then the maximum expected chunk size.8192STRINGYesNo
header.validation.reject.status.code401If header is exceed maximum size and header.size.validation is enabled then status code to be send as response.STRINGYesNo
header.validation.reject.messageIf header is exceed maximum size and header.size.validation is enabled then message to be send as response.Message header is bigger than the valid sizeSTRINGYesNo
header.validation.reject.message.content.typeIf header is exceed maximum size and header.size.validation is enabled then content type to be send as response.plain/textSTRINGYesNo
server.bootstrap.configurationParameters that for bootstrap configurations of the server. Expected format of these parameters is as follows: "'ciphers:xxx','sslEnabledProtocols,client.enable:xxx'"nullOBJECTYesNo
server.bootstrap.nodelayHttp server no delay.trueBOOLYesNo
server.bootstrap.keepaliveHttp server keep alive.trueBOOLYesNo
server.bootstrap.sendbuffersizeHttp server send buffer size.1048576INTYesNo
server.bootstrap.recievebuffersizeHttp server receive buffer size.1048576INTYesNo
server.bootstrap.connect.timeoutHttp server connection timeout.15000INTYesNo
server.bootstrap.socket.reuseTo enable http socket reuse.falseBOOLYesNo
server.bootstrap.socket.timeoutHttp server socket timeout.15BOOLYesNo
server.bootstrap.socket.backlogTHttp server socket backlog.100BOOLYesNo
trace.log.enabledHttp traffic monitoring.falseBOOLYesNo
- -System Parameters - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Parameters
serverBootstrapBossGroupSizeproperty to configure number of boss threads, which accepts incoming connections until the ports are unbound. Once connection accepts successfully, boss thread passes the accepted channel to one of the worker threads.Number of available processorsAny integer
serverBootstrapWorkerGroupSizeproperty to configure number of worker threads, which performs non blocking read and write for one or more channels in non-blocking mode.(Number of available processors)*2Any integer
serverBootstrapClientGroupSizeproperty to configure number of client threads, which performs non blocking read and write for one or more channels in non-blocking mode.(Number of available processors)*2Any integer
defaultHostThe default host of the transport.0.0.0.0Any valid host
defaultHttpPortThe default port if the default scheme is 'http'.8280Any valid port
defaultHttpsPortThe default port if the default scheme is 'https'.8243Any valid port
defaultSchemeThe default protocol.httphttp
https
keyStoreLocationThe default keystore file path.${carbon.home}/resources/security/wso2carbon.jksPath to wso2carbon.jks file
keyStorePasswordThe default keystore password.wso2carbonString of keystore password
certPasswordThe default cert password.wso2carbonString of cert password
- -Examples -EXAMPLE 1 -``` -@source(type='http', receiver.url='http://localhost:9055/endpoints/RecPro', socketIdleTimeout='150000', parameters="'ciphers : TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256', 'sslEnabledProtocols:TLSv1.1,TLSv1.2'",request.size.validation.configuration="request.size.validation:true",server.bootstrap.configuration="server.bootstrap.socket.timeout:25" @map(type='xml')) -define stream FooStream (symbol string, price float, volume long); - -``` -

Above source listenerConfiguration performs a default XML input mapping. The expected input is as follows:
<events>
    <event>
        <symbol>WSO2</symbol>
        <price>55.6</price>
        <volume>100</volume>
    </event>
</events>
If basic authentication is enabled via the basic.auth.enabled='true setting, each input event is also expected to contain the Authorization:'Basic encodeBase64(username:Password)' header.

- -### http-request *(Source)* - -

The HTTP request is correlated with the HTTP response sink, through a unique source.id, and for each POST requests it receives via HTTP or HTTPS in format such as text, XML and JSON it sends the response via the HTTP response sink. The individual request and response messages are correlated at the sink using the message.id of the events. If required, you can enable basic authentication at the source to ensure that events are received only from users who are authorized to access the service.

- -Syntax -``` -@source(type="http-request", receiver.url="", source.id="", connection.timeout="", basic.auth.enabled="", worker.count="", socket.idle.timeout="", ssl.verify.client="", ssl.protocol="", tls.store.type="", parameters="", ciphers="", ssl.enabled.protocols="", server.enable.session.creation="", server.supported.snimatchers="", server.suported.server.names="", request.size.validation.configuration="", request.size.validation="", request.size.validation.maximum.value="", request.size.validation.reject.status.code="", request.size.validation.reject.message="", request.size.validation.reject.message.content.type="", header.size.validation="", header.validation.maximum.request.line="", header.validation.maximum.size="", header.validation.maximum.chunk.size="", header.validation.reject.status.code="", header.validation.reject.message="", header.validation.reject.message.content.type="", server.bootstrap.configuration="", server.bootstrap.nodelay="", server.bootstrap.keepalive="", server.bootstrap.sendbuffersize="", server.bootstrap.recievebuffersize="", server.bootstrap.connect.timeout="", server.bootstrap.socket.reuse="", server.bootstrap.socket.timeout="", server.bootstrap.socket.backlog="", trace.log.enabled="", @map(...))) -``` - -QUERY PARAMETERS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
receiver.urlThe URL to which the events should be received. User can provide any valid url and if the url is not provided the system will use the following format http://0.0.0.0:9763/<appNAme>/<streamName>If the user want to use SSL the url should be given in following format https://localhost:8080/<streamName>http://0.0.0.0:9763//STRINGYesNo
source.idIdentifier need to map the source to sink.STRINGNoNo
connection.timeoutConnection timeout in milliseconds. If the mapped http-response sink does not get a correlated message, after this timeout value, a timeout response is sent120000INTYesNo
basic.auth.enabledIf this is set to true, basic authentication is enabled for incoming events, and the credentials with which each event is sent are verified to ensure that the user is authorized to access the service. If basic authentication fails, the event is not authenticated and an authentication error is logged in the CLI. By default this values 'false' falseSTRINGYesNo
worker.countThe number of active worker threads to serve the incoming events. The value is 1 by default. This will ensure that the events are directed to the event stream in the same order in which they arrive. By increasing this value the performance might increase at the cost of loosing event ordering.1STRINGYesNo
socket.idle.timeoutIdle timeout for HTTP connection.120000INTYesNo
ssl.verify.clientThe type of client certificate verification.nullSTRINGYesNo
ssl.protocolssl/tls related optionsTLSSTRINGYesNo
tls.store.typeTLS store type.JKSSTRINGYesNo
parametersParameters other than basics such as ciphers,sslEnabledProtocols,client.enable.session.creation. Expected format of these parameters is as follows: "'ciphers:xxx','sslEnabledProtocols,client.enable:xxx'"nullSTRINGYesNo
ciphersList of ciphers to be used. This parameter should include under parameters Ex: 'ciphers:TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256'nullSTRINGYesNo
ssl.enabled.protocolsSSL/TLS protocols to be enabled. This parameter should be in camel case format(sslEnabledProtocols) under parameters. Ex 'sslEnabledProtocols:true'nullSTRINGYesNo
server.enable.session.creationEnable HTTP session creation.This parameter should include under parameters Ex: 'client.enable.session.creation:true'nullSTRINGYesNo
server.supported.snimatchersHttp SNIMatcher to be added. This parameter should include under parameters Ex: 'server.supported.snimatchers:SNIMatcher'nullSTRINGYesNo
server.suported.server.namesHttp supported servers. This parameter should include under parameters Ex: 'server.suported.server.names:server'nullSTRINGYesNo
request.size.validation.configurationParameters that responsible for validating the http request and request headers. Expected format of these parameters is as follows: "'request.size.validation:xxx','request.size.validation.maximum.value:xxx'"nullSTRINGYesNo
request.size.validationTo enable the request size validation.falseSTRINGYesNo
request.size.validation.maximum.valueIf request size is validated then maximum size.Integer.MAX_VALUESTRINGYesNo
request.size.validation.reject.status.codeIf request is exceed maximum size and request.size.validation is enabled then status code to be send as response.401STRINGYesNo
request.size.validation.reject.messageIf request is exceed maximum size and request.size.validation is enabled then status message to be send as response.Message is bigger than the valid sizeSTRINGYesNo
request.size.validation.reject.message.content.typeIf request is exceed maximum size and request.size.validation is enabled then content type to be send as response.plain/textSTRINGYesNo
header.size.validationTo enable the header size validation.falseSTRINGYesNo
header.validation.maximum.request.lineIf header header validation is enabled then the maximum request line.4096STRINGYesNo
header.validation.maximum.sizeIf header header validation is enabled then the maximum expected header size.8192STRINGYesNo
header.validation.maximum.chunk.sizeIf header header validation is enabled then the maximum expected chunk size.8192STRINGYesNo
header.validation.reject.status.code401If header is exceed maximum size and header.size.validation is enabled then status code to be send as response.STRINGYesNo
header.validation.reject.messageIf header is exceed maximum size and header.size.validation is enabled then message to be send as response.Message header is bigger than the valid sizeSTRINGYesNo
header.validation.reject.message.content.typeIf header is exceed maximum size and header.size.validation is enabled then content type to be send as response.plain/textSTRINGYesNo
server.bootstrap.configurationParameters that for bootstrap configurations of the server. Expected format of these parameters is as follows: "'ciphers:xxx','sslEnabledProtocols,client.enable:xxx'"nullOBJECTYesNo
server.bootstrap.nodelayHttp server no delay.trueBOOLYesNo
server.bootstrap.keepaliveHttp server keep alive.trueBOOLYesNo
server.bootstrap.sendbuffersizeHttp server send buffer size.1048576INTYesNo
server.bootstrap.recievebuffersizeHttp server receive buffer size.1048576INTYesNo
server.bootstrap.connect.timeoutHttp server connection timeout.15000INTYesNo
server.bootstrap.socket.reuseTo enable http socket reuse.falseBOOLYesNo
server.bootstrap.socket.timeoutHttp server socket timeout.15BOOLYesNo
server.bootstrap.socket.backlogTHttp server socket backlog.100BOOLYesNo
trace.log.enabledHttp traffic monitoring.falseBOOLYesNo
- -System Parameters - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Parameters
serverBootstrapBossGroupSizeproperty to configure number of boss threads, which accepts incoming connections until the ports are unbound. Once connection accepts successfully, boss thread passes the accepted channel to one of the worker threads.Number of available processorsAny integer
serverBootstrapWorkerGroupSizeproperty to configure number of worker threads, which performs non blocking read and write for one or more channels in non-blocking mode.(Number of available processors)*2Any integer
serverBootstrapClientGroupSizeproperty to configure number of client threads, which performs non blocking read and write for one or more channels in non-blocking mode.(Number of available processors)*2Any integer
defaultHostThe default host of the transport.0.0.0.0Any valid host
defaultHttpPortThe default port if the default scheme is 'http'.8280Any valid port
defaultHttpsPortThe default port if the default scheme is 'https'.8243Any valid port
defaultSchemeThe default protocol.httphttp
https
keyStoreLocationThe default keystore file path.${carbon.home}/resources/security/wso2carbon.jksPath to wso2carbon.jks file
keyStorePasswordThe default keystore password.wso2carbonString of keystore password
certPasswordThe default cert password.wso2carbonString of cert password
- -Examples -EXAMPLE 1 -``` -@source(type='http-request', source.id='sampleSourceId, receiver.url='http://localhost:9055/endpoints/RecPro', connection.timeout='150000', parameters="'ciphers : TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256', 'sslEnabledProtocols:TLSv1.1,TLSv1.2'", request.size.validation.configuration="request.size.validation:true", server.bootstrap.configuration="server.bootstrap.socket.timeout:25", @map(type='json, @attributes(messageId='trp:messageId', symbol='$.events.event.symbol', price='$.events.event.price', volume='$.events.event.volume'))) -define stream FooStream (messageId string, symbol string, price float, volume long); - -``` -

The expected input is as follows:
{"events":
    {"event":
        "symbol":WSO2,
        "price":55.6,
        "volume":100,
    }
}
If basic authentication is enabled via the basic.auth.enabled='true setting, each input event is also expected to contain the Authorization:'Basic encodeBase64(username:Password)' header.

- -### http-response *(Source)* - -

The http-response source co-relates with http-request sink with the parameter 'sink.id'.
This receives responses for the requests sent by the http-request sink which has the same sink id.
Response messages can be in formats such as TEXT, JSON and XML.
In order to handle the responses with different http status codes, user is allowed to defined the acceptable response source code using the parameter 'http.status.code'

- -Syntax -``` -@source(type="http-response", sink.id="", http.status.code="", allow.streaming.responses="", @map(...))) -``` - -QUERY PARAMETERS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
sink.idThis parameter is used to map the http-response source to a http-request sink. Then this source will accepts the response messages for the requests sent by corresponding http-request sink.STRINGNoNo
http.status.codeAcceptable http status code for the responses.
This can be a complete string or a regex.
Only the responses with matching status codes to the defined value, will be received by the http-response source.
Eg: 'http.status.code = '200', http.status.code = '2\\d+''
STRINGNoNo
allow.streaming.responsesIf responses can be received multiple times for a single request, this option should be enabled. If this is not enabled, for every request, response will be extracted only once.BOOLNoNo
- -Examples -EXAMPLE 1 -``` -@sink(type='http-request', -downloading.enabled='true', -publisher.url='http://localhost:8005/registry/employee', -method='POST', headers='{{headers}}',sink.id='employee-info', -@map(type='json')) -define stream BarStream (name String, id int, headers String, downloadPath string); - -@source(type='http-response' , sink.id='employee-info', http.status.code='2\\d+', -@map(type='text', regex.A='((.|\n)*)', @attributes(message='A[1]'))) -define stream responseStream2xx(message string);@source(type='http-response' , sink.id='employee-info', http.status.code='4\\d+' , -@map(type='text', regex.A='((.|\n)*)', @attributes(message='A[1]'))) -define stream responseStream4xx(message string); -``` -

In above example, the defined http-request sink will send a POST requests to the endpoint defined by 'publisher.url'.
Then for those requests, the source with the response code '2\\d+' and sink.id 'employee-info' will receive the responses with 2xx status codes.
The http-response source which has 'employee-info' as the 'sink.id' and '4\\d+' as the http.response.code will receive all the responses with 4xx status codes.
. Then the body of the response message will be extracted using text mapper and converted into siddhi events.
.

- diff --git a/docs/api/1.0.41.md b/docs/api/1.0.41.md deleted file mode 100644 index a27969f3..00000000 --- a/docs/api/1.0.41.md +++ /dev/null @@ -1,1673 +0,0 @@ -# API Docs - v1.0.41 - -## Sink - -### http *(Sink)* - -

This extension publish the HTTP events in any HTTP method POST, GET, PUT, DELETE via HTTP or https protocols. As the additional features this component can provide basic authentication as well as user can publish events using custom client truststore files when publishing events via https protocol. And also user can add any number of headers including HTTP_METHOD header for each event dynamically.
Following content types will be set by default according to the type of sink mapper used.
You can override them by setting the new content types in headers.
     - TEXT : text/plain
     - XML : application/xml
     - JSON : application/json
     - KEYVALUE : application/x-www-form-urlencoded

- -Syntax -``` -@sink(type="http", publisher.url="", basic.auth.username="", basic.auth.password="", https.truststore.file="", https.truststore.password="", headers="", method="", socket.idle.timeout="", chunk.disabled="", ssl.protocol="", parameters="", ciphers="", ssl.enabled.protocols="", client.enable.session.creation="", follow.redirect="", max.redirect.count="", tls.store.type="", proxy.host="", proxy.port="", proxy.username="", proxy.password="", client.bootstrap.configuration="", client.bootstrap.nodelay="", client.bootstrap.keepalive="", client.bootstrap.sendbuffersize="", client.bootstrap.recievebuffersize="", client.bootstrap.connect.timeout="", client.bootstrap.socket.reuse="", client.bootstrap.socket.timeout="", client.threadpool.configurations="", client.connection.pool.count="", client.max.active.connections.per.pool="", client.min.idle.connections.per.pool="", client.max.idle.connections.per.pool="", client.min.eviction.idle.time="", sender.thread.count="", event.group.executor.thread.size="", max.wait.for.client.connection.pool="", @map(...))) -``` - -QUERY PARAMETERS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
publisher.urlThe URL to which the outgoing events should be published via HTTP. This is a mandatory parameter and if this is not specified, an error is logged in the CLI. If user wants to enable SSL for the events, use https instead of http in the publisher.url.e.g., http://localhost:8080/endpoint, https://localhost:8080/endpointSTRINGNoNo
basic.auth.usernameThe username to be included in the authentication header of the basic authentication enabled events. It is required to specify both username and password to enable basic authentication. If one of the parameter is not given by user then an error is logged in the CLI. STRINGYesNo
basic.auth.passwordThe password to include in the authentication header of the basic authentication enabled events. It is required to specify both username and password to enable basic authentication. If one of the parameter is not given by user then an error is logged in the CLI. STRINGYesNo
https.truststore.fileThe file path to the location of the truststore of the client that sends the HTTP events through 'https' protocol. A custom client-truststore can be specified if required.${carbon.home}/resources/security/client-truststore.jksSTRINGYesNo
https.truststore.passwordThe password for the client-truststore. A custom password can be specified if required. If no custom password is specified and the protocol of URL is 'https' then, the system uses default password.wso2carbonSTRINGYesNo
headersThe headers that should be included as HTTP request headers.
There can be any number of headers concatenated in following format. "'header1:value1','header2:value2'". User can include Content-Type header if he needs to use a specific content-type for the payload. Or else, system decides the Content-Type by considering the type of sink mapper, in following way.
 - @map(xml):application/xml
 - @map(json):application/json
 - @map(text):plain/text )
 - if user does not include any mapping type then the system gets 'plain/text' as default Content-Type header.
Note that providing content-length as a header is not supported. The size of the payload will be automatically calculated and included in the content-length header.
STRINGYesNo
methodFor HTTP events, HTTP_METHOD header should be included as a request header. If the parameter is null then system uses 'POST' as a default header.POSTSTRINGYesNo
socket.idle.timeoutSocket timeout value in millisecond6000INTYesNo
chunk.disabledThis parameter is used to disable/enable chunked transfer encodingfalseBOOLYesNo
ssl.protocolThe SSL protocol versionTLSSTRINGYesNo
parametersParameters other than basics such as ciphers,sslEnabledProtocols,client.enable.session.creation. Expected format of these parameters is as follows: "'ciphers:xxx','sslEnabledProtocols,client.enable:xxx'"nullSTRINGYesNo
ciphersList of ciphers to be used. This parameter should include under parameters Ex: 'ciphers:TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256'nullSTRINGYesNo
ssl.enabled.protocolsSSL/TLS protocols to be enabled. This parameter should be in camel case format(sslEnabledProtocols) under parameters. Ex 'sslEnabledProtocols:true'nullSTRINGYesNo
client.enable.session.creationEnable HTTP session creation.This parameter should include under parameters Ex: 'client.enable.session.creation:true'nullSTRINGYesNo
follow.redirectRedirect related enabled.trueBOOLYesNo
max.redirect.countMaximum redirect count.5INTYesNo
tls.store.typeTLS store type to be used.JKSSTRINGYesNo
proxy.hostProxy server hostnullSTRINGYesNo
proxy.portProxy server portnullSTRINGYesNo
proxy.usernameProxy server usernamenullSTRINGYesNo
proxy.passwordProxy server passwordnullSTRINGYesNo
client.bootstrap.configurationClient bootsrap configurations. Expected format of these parameters is as follows: "'client.bootstrap.nodelay:xxx','client.bootstrap.keepalive:xxx'"TODOSTRINGYesNo
client.bootstrap.nodelayHttp client no delay.trueBOOLYesNo
client.bootstrap.keepaliveHttp client keep alive.trueBOOLYesNo
client.bootstrap.sendbuffersizeHttp client send buffer size.1048576INTYesNo
client.bootstrap.recievebuffersizeHttp client receive buffer size.1048576INTYesNo
client.bootstrap.connect.timeoutHttp client connection timeout.15000INTYesNo
client.bootstrap.socket.reuseTo enable http socket reuse.falseBOOLYesNo
client.bootstrap.socket.timeoutHttp client socket timeout.15STRINGYesNo
client.threadpool.configurationsThread pool configuration. Expected format of these parameters is as follows: "'client.connection.pool.count:xxx','client.max.active.connections.per.pool:xxx'"TODOSTRINGYesNo
client.connection.pool.countConnection pool count.0INTYesNo
client.max.active.connections.per.poolActive connections per pool.-1INTYesNo
client.min.idle.connections.per.poolMinimum ideal connection per pool.0INTYesNo
client.max.idle.connections.per.poolMaximum ideal connection per pool.100INTYesNo
client.min.eviction.idle.timeMinimum eviction idle time.5 * 60 * 1000STRINGYesNo
sender.thread.countHttp sender thread count.20STRINGYesNo
event.group.executor.thread.sizeEvent group executor thread size.15STRINGYesNo
max.wait.for.client.connection.poolMaximum wait for client connection pool.60000STRINGYesNo
- -System Parameters - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Parameters
clientBootstrapBossGroupSizeproperty to configure number of boss threads, which accepts incoming connections until the ports are unbound. Once connection accepts successfully, boss thread passes the accepted channel to one of the worker threads.Number of available processorsAny integer
clientBootstrapWorkerGroupSizeproperty to configure number of worker threads, which performs non blocking read and write for one or more channels in non-blocking mode.(Number of available processors)*2Any integer
clientBootstrapClientGroupSizeproperty to configure number of client threads, which performs non blocking read and write for one or more channels in non-blocking mode.(Number of available processors)*2Any integer
trustStoreLocationThe default truststore file path.${carbon.home}/resources/security/client-truststore.jksPath to client-truststore.jks
trustStorePasswordThe default truststore password.wso2carbonTruststore password
- -Examples -EXAMPLE 1 -``` -@sink(type='http',publisher.url='http://localhost:8009/foo', method='{{method}}',headers="'content-type:xml','content-length:94'", client.bootstrap.configuration="'client.bootstrap.socket.timeout:20', 'client.bootstrap.worker.group.size:10'", client.pool.configuration="'client.connection.pool.count:10','client.max.active.connections.per.pool:1'", @map(type='xml', @payload('{{payloadBody}}'))) -define stream FooStream (payloadBody String, method string, headers string); - -``` -

If it is xml mapping expected input should be in following format for FooStream:
{
<events>
    <event>
        <symbol>WSO2</symbol>
        <price>55.6</price>
        <volume>100</volume>
    </event>
</events>,
POST,
Content-Length:24#Content-Location:USA#Retry-After:120
}

Above event will generate output as below.
~Output http event payload
<events>
    <event>
        <symbol>WSO2</symbol>
        <price>55.6</price>
        <volume>100</volume>
    </event>
</events>

~Output http event headers
Content-Length:24,
Content-Location:'USA',
Retry-After:120,
Content-Type:'application/xml',
HTTP_METHOD:'POST',

~Output http event properties
HTTP_METHOD:'POST',
HOST:'localhost',
PORT:8009,
PROTOCOL:'http',
TO:'/foo'

- -### http-request *(Sink)* - -

This extension publish the HTTP events in any HTTP method POST, GET, PUT, DELETE via HTTP or https protocols. As the additional features this component can provide basic authentication as well as user can publish events using custom client truststore files when publishing events via https protocol. And also user can add any number of headers including HTTP_METHOD header for each event dynamically.
Following content types will be set by default according to the type of sink mapper used.
You can override them by setting the new content types in headers.
     - TEXT : text/plain
     - XML : application/xml
     - JSON : application/json
     - KEYVALUE : application/x-www-form-urlencoded

HTTP request sink is correlated with the The HTTP reponse source, through a unique sink.id.It sends the request to the defined url and the response is received by the response source which has the same 'sink.id'.

- -Syntax -``` -@sink(type="http-request", publisher.url="", basic.auth.username="", basic.auth.password="", https.truststore.file="", https.truststore.password="", headers="", method="", socket.idle.timeout="", chunk.disabled="", ssl.protocol="", parameters="", ciphers="", ssl.enabled.protocols="", client.enable.session.creation="", follow.redirect="", max.redirect.count="", tls.store.type="", proxy.host="", proxy.port="", proxy.username="", proxy.password="", client.bootstrap.configuration="", client.bootstrap.nodelay="", client.bootstrap.keepalive="", client.bootstrap.sendbuffersize="", client.bootstrap.recievebuffersize="", client.bootstrap.connect.timeout="", client.bootstrap.socket.reuse="", client.bootstrap.socket.timeout="", client.threadpool.configurations="", client.connection.pool.count="", client.max.active.connections.per.pool="", client.min.idle.connections.per.pool="", client.max.idle.connections.per.pool="", client.min.eviction.idle.time="", sender.thread.count="", event.group.executor.thread.size="", max.wait.for.client.connection.pool="", sink.id="", downloading.enabled="", download.path="", @map(...))) -``` - -QUERY PARAMETERS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
publisher.urlThe URL to which the outgoing events should be published via HTTP. This is a mandatory parameter and if this is not specified, an error is logged in the CLI. If user wants to enable SSL for the events, use https instead of http in the publisher.url.
e.g., http://localhost:8080/endpoint, https://localhost:8080/endpoint
This can be used as a dynamic parameter as well.
STRINGNoYes
basic.auth.usernameThe username to be included in the authentication header of the basic authentication enabled events. It is required to specify both username and password to enable basic authentication. If one of the parameter is not given by user then an error is logged in the CLI. STRINGYesNo
basic.auth.passwordThe password to include in the authentication header of the basic authentication enabled events. It is required to specify both username and password to enable basic authentication. If one of the parameter is not given by user then an error is logged in the CLI. STRINGYesNo
https.truststore.fileThe file path to the location of the truststore of the client that sends the HTTP events through 'https' protocol. A custom client-truststore can be specified if required.${carbon.home}/resources/security/client-truststore.jksSTRINGYesNo
https.truststore.passwordThe password for the client-truststore. A custom password can be specified if required. If no custom password is specified and the protocol of URL is 'https' then, the system uses default password.wso2carbonSTRINGYesNo
headersThe headers that should be included as HTTP request headers.
There can be any number of headers concatenated in following format. "'header1:value1','header2:value2'". User can include Content-Type header if he needs to use a specific content-type for the payload. Or else, system decides the Content-Type by considering the type of sink mapper, in following way.
 - @map(xml):application/xml
 - @map(json):application/json
 - @map(text):plain/text )
 - if user does not include any mapping type then the system gets 'plain/text' as default Content-Type header.
Note that providing content-length as a header is not supported. The size of the payload will be automatically calculated and included in the content-length header.
STRINGYesNo
methodFor HTTP events, HTTP_METHOD header should be included as a request header. If the parameter is null then system uses 'POST' as a default header.POSTSTRINGYesNo
socket.idle.timeoutSocket timeout value in millisecond6000INTYesNo
chunk.disabledport: Port number of the remote servicefalseBOOLYesNo
ssl.protocolThe SSL protocol versionTLSSTRINGYesNo
parametersParameters other than basics such as ciphers,sslEnabledProtocols,client.enable.session.creation. Expected format of these parameters is as follows: "'ciphers:xxx','sslEnabledProtocols,client.enable:xxx'"nullSTRINGYesNo
ciphersList of ciphers to be used. This parameter should include under parameters Ex: 'ciphers:TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256'nullSTRINGYesNo
ssl.enabled.protocolsSSL/TLS protocols to be enabled. This parameter should be in camel case format(sslEnabledProtocols) under parameters. Ex 'sslEnabledProtocols:true'nullSTRINGYesNo
client.enable.session.creationEnable HTTP session creation.This parameter should include under parameters Ex: 'client.enable.session.creation:true'nullSTRINGYesNo
follow.redirectRedirect related enabled.trueBOOLYesNo
max.redirect.countMaximum redirect count.5INTYesNo
tls.store.typeTLS store type to be used.JKSSTRINGYesNo
proxy.hostProxy server hostnullSTRINGYesNo
proxy.portProxy server portnullSTRINGYesNo
proxy.usernameProxy server usernamenullSTRINGYesNo
proxy.passwordProxy server passwordnullSTRINGYesNo
client.bootstrap.configurationClient bootsrap configurations. Expected format of these parameters is as follows: "'client.bootstrap.nodelay:xxx','client.bootstrap.keepalive:xxx'"TODOSTRINGYesNo
client.bootstrap.nodelayHttp client no delay.trueBOOLYesNo
client.bootstrap.keepaliveHttp client keep alive.trueBOOLYesNo
client.bootstrap.sendbuffersizeHttp client send buffer size.1048576INTYesNo
client.bootstrap.recievebuffersizeHttp client receive buffer size.1048576INTYesNo
client.bootstrap.connect.timeoutHttp client connection timeout.15000INTYesNo
client.bootstrap.socket.reuseTo enable http socket reuse.falseBOOLYesNo
client.bootstrap.socket.timeoutHttp client socket timeout.15STRINGYesNo
client.threadpool.configurationsThread pool configuration. Expected format of these parameters is as follows: "'client.connection.pool.count:xxx','client.max.active.connections.per.pool:xxx'"TODOSTRINGYesNo
client.connection.pool.countConnection pool count.0INTYesNo
client.max.active.connections.per.poolActive connections per pool.-1INTYesNo
client.min.idle.connections.per.poolMinimum ideal connection per pool.0INTYesNo
client.max.idle.connections.per.poolMaximum ideal connection per pool.100INTYesNo
client.min.eviction.idle.timeMinimum eviction idle time.5 * 60 * 1000STRINGYesNo
sender.thread.countHttp sender thread count.20STRINGYesNo
event.group.executor.thread.sizeEvent group executor thread size.15STRINGYesNo
max.wait.for.client.connection.poolMaximum wait for client connection pool.60000STRINGYesNo
sink.idIdentifier of the sink. This is used to co-relate with the corresponding http-response source which needs to process the repose for the request sent by this sink.STRINGNoNo
downloading.enabledIf this is set to 'true' then the response received by the response source will be written to a file. If downloading is enabled, the download.path parameter is mandatory.falseBOOLYesNo
download.pathIf downloading is enabled, the path of the file which is going to be downloaded should be specified using 'download.path' parameter. This should be an absolute path including the file name.nullSTRINGYesYes
- -Examples -EXAMPLE 1 -``` -@sink(type='http-request', sink.id='foo', publisher.url='http://localhost:8009/foo', @map(type='xml', @payload('{{payloadBody}}'))) -define stream FooStream (payloadBody String, method string, headers string); -@source(type='http-response', sink.id='foo', http.status.code='2\\d+', -@map(type='text', regex.A='((.|\n)*)', @attributes(headers='trp:headers', fileName='A[1]'))) -define stream responseStream2xx(fileName string, headers string); - -@source(type='http-response', sink.id='foo', http.status.code='4\\d+', -@map(type='text', regex.A='((.|\n)*)', @attributes(errorMsg='A[1]'))) -define stream responseStream4xx(errorMsg string); -``` -

In above example, the payload body for 'FooStream' will be in following format.
{
<events>
    <event>
        <symbol>WSO2</symbol>
        <price>55.6</price>
        <volume>100</volume>
    </event>
</events>,
This message will sent as the body of a POST request with the content-type 'application/xml' to the endpoint defined as the 'publisher.url' and in order to process the responses for these requests, there should be a source of type 'http-response' defined with the same sink id 'foo' in the siddhi app.
The responses with 2xx status codes will be received by the http-response source which has the http.status.code defined by the regex '2\\d+'.
If the response has a 4xx status code, it will be received by the http-response source which has the http.status.code defined by the regex '4\\d+'.

- -EXAMPLE 2 -``` -define stream FooStream (name String, id int, headers String, downloadPath string); -@sink(type='http-request', -downloading.enabled='true', -download.path='{{downloadPath}}',publisher.url='http://localhost:8005/files', -method='GET', headers='{{headers}}',sink.id='download-sink', -@map(type='json')) -define stream BarStream (name String, id int, headers String, downloadPath string); - -@source(type='http-response', sink.id='download-sink', http.status.code='2\\d+', -@map(type='text', regex.A='((.|\n)*)', @attributes(headers='trp:headers', fileName='A[1]'))) -define stream responseStream2xx(fileName string, headers string); - -@source(type='http-response', sink.id='download-sink', http.status.code='4\\d+', -@map(type='text', regex.A='((.|\n)*)', @attributes(errorMsg='A[1]'))) -define stream responseStream4xx(errorMsg string); -``` -

In above example, http-request sink will send a GET request to the publisher url and the requested file will be received as the response by a corresponding http-response source.
If the http status code of the response is a successful one (2xx), it will be received by the http-response source which has the http.status.code '2\\d+' and downloaded as a local file. Then the event received to the responseStream2xx will have the headers included in the request and the downloaded file name.
If the http status code of the response is a 4xx code, it will be received by the http-response source which has the http.status.code '4\\d+'. Then the event received to the responseStream4xx will have the response message body in text format.

- -### http-response *(Sink)* - -

HTTP response sink is correlated with the The HTTP request source, through a unique source.id, and it send a response to the HTTP request source having the same source.id. The response message can be formatted in text, XML or JSON and can be sent with appropriate headers.

- -Syntax -``` -@sink(type="http-response", source.id="", message.id="", headers="", @map(...))) -``` - -QUERY PARAMETERS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
source.idIdentifier of the source.STRINGNoNo
message.idIdentifier of the message.STRINGNoYes
headersThe headers that should be included as HTTP response headers. There can be any number of headers concatenated on following format. "'header1:value1','header2:value2'" User can include content-type header if he/she need to have any specific type for payload. If not system get the mapping type as the content-Type header (ie.@map(xml):application/xml, @map(json):application/json, @map(text):plain/text) and if user does not include any mapping type then system gets the plain/text as default Content-Type header. If user does not include Content-Length header then system calculate the bytes size of payload and include it as content-length header. STRINGYesNo
- -Examples -EXAMPLE 1 -``` -@sink(type='http-response', source.id='sampleSourceId', message.id='{{messageId}}', headers="'content-type:json','content-length:94'"@map(type='json', @payload('{{payloadBody}}'))) -define stream FooStream (payloadBody String, messageId string, headers string); - -``` -

If it is json mapping expected input should be in following format for FooStream:
{
{"events":
    {"event":
        "symbol":WSO2,
        "price":55.6,
        "volume":100,
    }
},
0cf708b1-7eae-440b-a93e-e72f801b486a,
Content-Length:24#Content-Location:USA
}

Above event will generate response for the matching source message as below.

~Output http event payload
{"events":
    {"event":
        "symbol":WSO2,
        "price":55.6,
        "volume":100,
    }
}

~Output http event headers
Content-Length:24,
Content-Location:'USA',
Content-Type:'application/json'

- -## Source - -### http *(Source)* - -

The HTTP source receives POST requests via HTTP or HTTPS in format such as text, XML and JSON. In WSO2 SP, if required, you can enable basic authentication to ensure that events are received only from users who are authorized to access the service.

- -Syntax -``` -@source(type="http", receiver.url="", basic.auth.enabled="", worker.count="", socket.idle.timeout="", ssl.verify.client="", ssl.protocol="", tls.store.type="", parameters="", ciphers="", ssl.enabled.protocols="", server.enable.session.creation="", server.supported.snimatchers="", server.suported.server.names="", request.size.validation.configuration="", request.size.validation="", request.size.validation.maximum.value="", request.size.validation.reject.status.code="", request.size.validation.reject.message="", request.size.validation.reject.message.content.type="", header.size.validation="", header.validation.maximum.request.line="", header.validation.maximum.size="", header.validation.maximum.chunk.size="", header.validation.reject.status.code="", header.validation.reject.message="", header.validation.reject.message.content.type="", server.bootstrap.configuration="", server.bootstrap.nodelay="", server.bootstrap.keepalive="", server.bootstrap.sendbuffersize="", server.bootstrap.recievebuffersize="", server.bootstrap.connect.timeout="", server.bootstrap.socket.reuse="", server.bootstrap.socket.timeout="", server.bootstrap.socket.backlog="", trace.log.enabled="", @map(...))) -``` - -QUERY PARAMETERS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
receiver.urlThe URL to which the events should be received. User can provide any valid url and if the url is not provided the system will use the following format http://0.0.0.0:9763/<appNAme>/<streamName>If the user want to use SSL the url should be given in following format https://localhost:8080/<streamName>http://0.0.0.0:9763//STRINGYesNo
basic.auth.enabledThis works only in WSO2 SP. If this is set to true, basic authentication is enabled for incoming events, and the credentials with which each event is sent are verified to ensure that the user is authorized to access the service. If basic authentication fails, the event is not authenticated and an authentication error is logged in the CLI.falseSTRINGYesNo
worker.countThe number of active worker threads to serve the incoming events. The value is 1 by default. This will ensure that the events are directed to the event stream in the same order in which they arrive. By increasing this value the performance might increase at the cost of loosing event ordering.1INTYesNo
socket.idle.timeoutIdle timeout for HTTP connection.120000INTYesNo
ssl.verify.clientThe type of client certificate verification.nullSTRINGYesNo
ssl.protocolssl/tls related optionsTLSSTRINGYesNo
tls.store.typeTLS store type.JKSSTRINGYesNo
parametersParameters other than basics such as ciphers,sslEnabledProtocols,client.enable.session.creation. Expected format of these parameters is as follows: "'ciphers:xxx','sslEnabledProtocols,client.enable:xxx'"nullSTRINGYesNo
ciphersList of ciphers to be used. This parameter should include under parameters Ex: 'ciphers:TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256'nullSTRINGYesNo
ssl.enabled.protocolsSSL/TLS protocols to be enabled. This parameter should be in camel case format(sslEnabledProtocols) under parameters. Ex 'sslEnabledProtocols:true'nullSTRINGYesNo
server.enable.session.creationEnable HTTP session creation.This parameter should include under parameters Ex: 'client.enable.session.creation:true'nullSTRINGYesNo
server.supported.snimatchersHttp SNIMatcher to be added. This parameter should include under parameters Ex: 'server.supported.snimatchers:SNIMatcher'nullSTRINGYesNo
server.suported.server.namesHttp supported servers. This parameter should include under parameters Ex: 'server.suported.server.names:server'nullSTRINGYesNo
request.size.validation.configurationParameters that responsible for validating the http request and request headers. Expected format of these parameters is as follows: "'request.size.validation:xxx','request.size.validation.maximum.value:xxx'"nullSTRINGYesNo
request.size.validationTo enable the request size validation.falseSTRINGYesNo
request.size.validation.maximum.valueIf request size is validated then maximum size.Integer.MAX_VALUESTRINGYesNo
request.size.validation.reject.status.codeIf request is exceed maximum size and request.size.validation is enabled then status code to be send as response.401STRINGYesNo
request.size.validation.reject.messageIf request is exceed maximum size and request.size.validation is enabled then status message to be send as response.Message is bigger than the valid sizeSTRINGYesNo
request.size.validation.reject.message.content.typeIf request is exceed maximum size and request.size.validation is enabled then content type to be send as response.plain/textSTRINGYesNo
header.size.validationTo enable the header size validation.falseSTRINGYesNo
header.validation.maximum.request.lineIf header header validation is enabled then the maximum request line.4096STRINGYesNo
header.validation.maximum.sizeIf header header validation is enabled then the maximum expected header size.8192STRINGYesNo
header.validation.maximum.chunk.sizeIf header header validation is enabled then the maximum expected chunk size.8192STRINGYesNo
header.validation.reject.status.code401If header is exceed maximum size and header.size.validation is enabled then status code to be send as response.STRINGYesNo
header.validation.reject.messageIf header is exceed maximum size and header.size.validation is enabled then message to be send as response.Message header is bigger than the valid sizeSTRINGYesNo
header.validation.reject.message.content.typeIf header is exceed maximum size and header.size.validation is enabled then content type to be send as response.plain/textSTRINGYesNo
server.bootstrap.configurationParameters that for bootstrap configurations of the server. Expected format of these parameters is as follows: "'ciphers:xxx','sslEnabledProtocols,client.enable:xxx'"nullOBJECTYesNo
server.bootstrap.nodelayHttp server no delay.trueBOOLYesNo
server.bootstrap.keepaliveHttp server keep alive.trueBOOLYesNo
server.bootstrap.sendbuffersizeHttp server send buffer size.1048576INTYesNo
server.bootstrap.recievebuffersizeHttp server receive buffer size.1048576INTYesNo
server.bootstrap.connect.timeoutHttp server connection timeout.15000INTYesNo
server.bootstrap.socket.reuseTo enable http socket reuse.falseBOOLYesNo
server.bootstrap.socket.timeoutHttp server socket timeout.15BOOLYesNo
server.bootstrap.socket.backlogTHttp server socket backlog.100BOOLYesNo
trace.log.enabledHttp traffic monitoring.falseBOOLYesNo
- -System Parameters - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Parameters
serverBootstrapBossGroupSizeproperty to configure number of boss threads, which accepts incoming connections until the ports are unbound. Once connection accepts successfully, boss thread passes the accepted channel to one of the worker threads.Number of available processorsAny integer
serverBootstrapWorkerGroupSizeproperty to configure number of worker threads, which performs non blocking read and write for one or more channels in non-blocking mode.(Number of available processors)*2Any integer
serverBootstrapClientGroupSizeproperty to configure number of client threads, which performs non blocking read and write for one or more channels in non-blocking mode.(Number of available processors)*2Any integer
defaultHostThe default host of the transport.0.0.0.0Any valid host
defaultHttpPortThe default port if the default scheme is 'http'.8280Any valid port
defaultHttpsPortThe default port if the default scheme is 'https'.8243Any valid port
defaultSchemeThe default protocol.httphttp
https
keyStoreLocationThe default keystore file path.${carbon.home}/resources/security/wso2carbon.jksPath to wso2carbon.jks file
keyStorePasswordThe default keystore password.wso2carbonString of keystore password
certPasswordThe default cert password.wso2carbonString of cert password
- -Examples -EXAMPLE 1 -``` -@source(type='http', receiver.url='http://localhost:9055/endpoints/RecPro', socketIdleTimeout='150000', parameters="'ciphers : TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256', 'sslEnabledProtocols:TLSv1.1,TLSv1.2'",request.size.validation.configuration="request.size.validation:true",server.bootstrap.configuration="server.bootstrap.socket.timeout:25" @map(type='xml')) -define stream FooStream (symbol string, price float, volume long); - -``` -

Above source listenerConfiguration performs a default XML input mapping. The expected input is as follows:
<events>
    <event>
        <symbol>WSO2</symbol>
        <price>55.6</price>
        <volume>100</volume>
    </event>
</events>
If basic authentication is enabled via the basic.auth.enabled='true setting, each input event is also expected to contain the Authorization:'Basic encodeBase64(username:Password)' header.

- -### http-request *(Source)* - -

The HTTP request is correlated with the HTTP response sink, through a unique source.id, and for each POST requests it receives via HTTP or HTTPS in format such as text, XML and JSON it sends the response via the HTTP response sink. The individual request and response messages are correlated at the sink using the message.id of the events. If required, you can enable basic authentication at the source to ensure that events are received only from users who are authorized to access the service.

- -Syntax -``` -@source(type="http-request", receiver.url="", source.id="", connection.timeout="", basic.auth.enabled="", worker.count="", socket.idle.timeout="", ssl.verify.client="", ssl.protocol="", tls.store.type="", parameters="", ciphers="", ssl.enabled.protocols="", server.enable.session.creation="", server.supported.snimatchers="", server.suported.server.names="", request.size.validation.configuration="", request.size.validation="", request.size.validation.maximum.value="", request.size.validation.reject.status.code="", request.size.validation.reject.message="", request.size.validation.reject.message.content.type="", header.size.validation="", header.validation.maximum.request.line="", header.validation.maximum.size="", header.validation.maximum.chunk.size="", header.validation.reject.status.code="", header.validation.reject.message="", header.validation.reject.message.content.type="", server.bootstrap.configuration="", server.bootstrap.nodelay="", server.bootstrap.keepalive="", server.bootstrap.sendbuffersize="", server.bootstrap.recievebuffersize="", server.bootstrap.connect.timeout="", server.bootstrap.socket.reuse="", server.bootstrap.socket.timeout="", server.bootstrap.socket.backlog="", trace.log.enabled="", @map(...))) -``` - -QUERY PARAMETERS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
receiver.urlThe URL to which the events should be received. User can provide any valid url and if the url is not provided the system will use the following format http://0.0.0.0:9763/<appNAme>/<streamName>If the user want to use SSL the url should be given in following format https://localhost:8080/<streamName>http://0.0.0.0:9763//STRINGYesNo
source.idIdentifier need to map the source to sink.STRINGNoNo
connection.timeoutConnection timeout in milliseconds. If the mapped http-response sink does not get a correlated message, after this timeout value, a timeout response is sent120000INTYesNo
basic.auth.enabledIf this is set to true, basic authentication is enabled for incoming events, and the credentials with which each event is sent are verified to ensure that the user is authorized to access the service. If basic authentication fails, the event is not authenticated and an authentication error is logged in the CLI. By default this values 'false' falseSTRINGYesNo
worker.countThe number of active worker threads to serve the incoming events. The value is 1 by default. This will ensure that the events are directed to the event stream in the same order in which they arrive. By increasing this value the performance might increase at the cost of loosing event ordering.1INTYesNo
socket.idle.timeoutIdle timeout for HTTP connection.120000INTYesNo
ssl.verify.clientThe type of client certificate verification.nullSTRINGYesNo
ssl.protocolssl/tls related optionsTLSSTRINGYesNo
tls.store.typeTLS store type.JKSSTRINGYesNo
parametersParameters other than basics such as ciphers,sslEnabledProtocols,client.enable.session.creation. Expected format of these parameters is as follows: "'ciphers:xxx','sslEnabledProtocols,client.enable:xxx'"nullSTRINGYesNo
ciphersList of ciphers to be used. This parameter should include under parameters Ex: 'ciphers:TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256'nullSTRINGYesNo
ssl.enabled.protocolsSSL/TLS protocols to be enabled. This parameter should be in camel case format(sslEnabledProtocols) under parameters. Ex 'sslEnabledProtocols:true'nullSTRINGYesNo
server.enable.session.creationEnable HTTP session creation.This parameter should include under parameters Ex: 'client.enable.session.creation:true'nullSTRINGYesNo
server.supported.snimatchersHttp SNIMatcher to be added. This parameter should include under parameters Ex: 'server.supported.snimatchers:SNIMatcher'nullSTRINGYesNo
server.suported.server.namesHttp supported servers. This parameter should include under parameters Ex: 'server.suported.server.names:server'nullSTRINGYesNo
request.size.validation.configurationParameters that responsible for validating the http request and request headers. Expected format of these parameters is as follows: "'request.size.validation:xxx','request.size.validation.maximum.value:xxx'"nullSTRINGYesNo
request.size.validationTo enable the request size validation.falseSTRINGYesNo
request.size.validation.maximum.valueIf request size is validated then maximum size.Integer.MAX_VALUESTRINGYesNo
request.size.validation.reject.status.codeIf request is exceed maximum size and request.size.validation is enabled then status code to be send as response.401STRINGYesNo
request.size.validation.reject.messageIf request is exceed maximum size and request.size.validation is enabled then status message to be send as response.Message is bigger than the valid sizeSTRINGYesNo
request.size.validation.reject.message.content.typeIf request is exceed maximum size and request.size.validation is enabled then content type to be send as response.plain/textSTRINGYesNo
header.size.validationTo enable the header size validation.falseSTRINGYesNo
header.validation.maximum.request.lineIf header header validation is enabled then the maximum request line.4096STRINGYesNo
header.validation.maximum.sizeIf header header validation is enabled then the maximum expected header size.8192STRINGYesNo
header.validation.maximum.chunk.sizeIf header header validation is enabled then the maximum expected chunk size.8192STRINGYesNo
header.validation.reject.status.code401If header is exceed maximum size and header.size.validation is enabled then status code to be send as response.STRINGYesNo
header.validation.reject.messageIf header is exceed maximum size and header.size.validation is enabled then message to be send as response.Message header is bigger than the valid sizeSTRINGYesNo
header.validation.reject.message.content.typeIf header is exceed maximum size and header.size.validation is enabled then content type to be send as response.plain/textSTRINGYesNo
server.bootstrap.configurationParameters that for bootstrap configurations of the server. Expected format of these parameters is as follows: "'ciphers:xxx','sslEnabledProtocols,client.enable:xxx'"nullOBJECTYesNo
server.bootstrap.nodelayHttp server no delay.trueBOOLYesNo
server.bootstrap.keepaliveHttp server keep alive.trueBOOLYesNo
server.bootstrap.sendbuffersizeHttp server send buffer size.1048576INTYesNo
server.bootstrap.recievebuffersizeHttp server receive buffer size.1048576INTYesNo
server.bootstrap.connect.timeoutHttp server connection timeout.15000INTYesNo
server.bootstrap.socket.reuseTo enable http socket reuse.falseBOOLYesNo
server.bootstrap.socket.timeoutHttp server socket timeout.15BOOLYesNo
server.bootstrap.socket.backlogTHttp server socket backlog.100BOOLYesNo
trace.log.enabledHttp traffic monitoring.falseBOOLYesNo
- -System Parameters - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Parameters
serverBootstrapBossGroupSizeproperty to configure number of boss threads, which accepts incoming connections until the ports are unbound. Once connection accepts successfully, boss thread passes the accepted channel to one of the worker threads.Number of available processorsAny integer
serverBootstrapWorkerGroupSizeproperty to configure number of worker threads, which performs non blocking read and write for one or more channels in non-blocking mode.(Number of available processors)*2Any integer
serverBootstrapClientGroupSizeproperty to configure number of client threads, which performs non blocking read and write for one or more channels in non-blocking mode.(Number of available processors)*2Any integer
defaultHostThe default host of the transport.0.0.0.0Any valid host
defaultHttpPortThe default port if the default scheme is 'http'.8280Any valid port
defaultHttpsPortThe default port if the default scheme is 'https'.8243Any valid port
defaultSchemeThe default protocol.httphttp
https
keyStoreLocationThe default keystore file path.${carbon.home}/resources/security/wso2carbon.jksPath to wso2carbon.jks file
keyStorePasswordThe default keystore password.wso2carbonString of keystore password
certPasswordThe default cert password.wso2carbonString of cert password
- -Examples -EXAMPLE 1 -``` -@source(type='http-request', source.id='sampleSourceId, receiver.url='http://localhost:9055/endpoints/RecPro', connection.timeout='150000', parameters="'ciphers : TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256', 'sslEnabledProtocols:TLSv1.1,TLSv1.2'", request.size.validation.configuration="request.size.validation:true", server.bootstrap.configuration="server.bootstrap.socket.timeout:25", @map(type='json, @attributes(messageId='trp:messageId', symbol='$.events.event.symbol', price='$.events.event.price', volume='$.events.event.volume'))) -define stream FooStream (messageId string, symbol string, price float, volume long); - -``` -

The expected input is as follows:
{"events":
    {"event":
        "symbol":WSO2,
        "price":55.6,
        "volume":100,
    }
}
If basic authentication is enabled via the basic.auth.enabled='true setting, each input event is also expected to contain the Authorization:'Basic encodeBase64(username:Password)' header.

- -### http-response *(Source)* - -

The http-response source co-relates with http-request sink with the parameter 'sink.id'.
This receives responses for the requests sent by the http-request sink which has the same sink id.
Response messages can be in formats such as TEXT, JSON and XML.
In order to handle the responses with different http status codes, user is allowed to defined the acceptable response source code using the parameter 'http.status.code'

- -Syntax -``` -@source(type="http-response", sink.id="", http.status.code="", allow.streaming.responses="", @map(...))) -``` - -QUERY PARAMETERS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
sink.idThis parameter is used to map the http-response source to a http-request sink. Then this source will accepts the response messages for the requests sent by corresponding http-request sink.STRINGNoNo
http.status.codeAcceptable http status code for the responses.
This can be a complete string or a regex.
Only the responses with matching status codes to the defined value, will be received by the http-response source.
Eg: 'http.status.code = '200', http.status.code = '2\\d+''
STRINGNoNo
allow.streaming.responsesIf responses can be received multiple times for a single request, this option should be enabled. If this is not enabled, for every request, response will be extracted only once.BOOLNoNo
- -Examples -EXAMPLE 1 -``` -@sink(type='http-request', -downloading.enabled='true', -publisher.url='http://localhost:8005/registry/employee', -method='POST', headers='{{headers}}',sink.id='employee-info', -@map(type='json')) -define stream BarStream (name String, id int, headers String, downloadPath string); - -@source(type='http-response' , sink.id='employee-info', http.status.code='2\\d+', -@map(type='text', regex.A='((.|\n)*)', @attributes(message='A[1]'))) -define stream responseStream2xx(message string);@source(type='http-response' , sink.id='employee-info', http.status.code='4\\d+' , -@map(type='text', regex.A='((.|\n)*)', @attributes(message='A[1]'))) -define stream responseStream4xx(message string); -``` -

In above example, the defined http-request sink will send a POST requests to the endpoint defined by 'publisher.url'.
Then for those requests, the source with the response code '2\\d+' and sink.id 'employee-info' will receive the responses with 2xx status codes.
The http-response source which has 'employee-info' as the 'sink.id' and '4\\d+' as the http.response.code will receive all the responses with 4xx status codes.
. Then the body of the response message will be extracted using text mapper and converted into siddhi events.
.

- diff --git a/docs/api/1.0.42.md b/docs/api/1.0.42.md deleted file mode 100644 index 1acfda6e..00000000 --- a/docs/api/1.0.42.md +++ /dev/null @@ -1,1673 +0,0 @@ -# API Docs - v1.0.42 - -## Sink - -### http *(Sink)* - -

This extension publish the HTTP events in any HTTP method POST, GET, PUT, DELETE via HTTP or https protocols. As the additional features this component can provide basic authentication as well as user can publish events using custom client truststore files when publishing events via https protocol. And also user can add any number of headers including HTTP_METHOD header for each event dynamically.
Following content types will be set by default according to the type of sink mapper used.
You can override them by setting the new content types in headers.
     - TEXT : text/plain
     - XML : application/xml
     - JSON : application/json
     - KEYVALUE : application/x-www-form-urlencoded

- -Syntax -``` -@sink(type="http", publisher.url="", basic.auth.username="", basic.auth.password="", https.truststore.file="", https.truststore.password="", headers="", method="", socket.idle.timeout="", chunk.disabled="", ssl.protocol="", parameters="", ciphers="", ssl.enabled.protocols="", client.enable.session.creation="", follow.redirect="", max.redirect.count="", tls.store.type="", proxy.host="", proxy.port="", proxy.username="", proxy.password="", client.bootstrap.configuration="", client.bootstrap.nodelay="", client.bootstrap.keepalive="", client.bootstrap.sendbuffersize="", client.bootstrap.recievebuffersize="", client.bootstrap.connect.timeout="", client.bootstrap.socket.reuse="", client.bootstrap.socket.timeout="", client.threadpool.configurations="", client.connection.pool.count="", client.max.active.connections.per.pool="", client.min.idle.connections.per.pool="", client.max.idle.connections.per.pool="", client.min.eviction.idle.time="", sender.thread.count="", event.group.executor.thread.size="", max.wait.for.client.connection.pool="", @map(...))) -``` - -QUERY PARAMETERS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
publisher.urlThe URL to which the outgoing events should be published via HTTP. This is a mandatory parameter and if this is not specified, an error is logged in the CLI. If user wants to enable SSL for the events, use https instead of http in the publisher.url.e.g., http://localhost:8080/endpoint, https://localhost:8080/endpointSTRINGNoNo
basic.auth.usernameThe username to be included in the authentication header of the basic authentication enabled events. It is required to specify both username and password to enable basic authentication. If one of the parameter is not given by user then an error is logged in the CLI. STRINGYesNo
basic.auth.passwordThe password to include in the authentication header of the basic authentication enabled events. It is required to specify both username and password to enable basic authentication. If one of the parameter is not given by user then an error is logged in the CLI. STRINGYesNo
https.truststore.fileThe file path to the location of the truststore of the client that sends the HTTP events through 'https' protocol. A custom client-truststore can be specified if required.${carbon.home}/resources/security/client-truststore.jksSTRINGYesNo
https.truststore.passwordThe password for the client-truststore. A custom password can be specified if required. If no custom password is specified and the protocol of URL is 'https' then, the system uses default password.wso2carbonSTRINGYesNo
headersThe headers that should be included as HTTP request headers.
There can be any number of headers concatenated in following format. "'header1:value1','header2:value2'". User can include Content-Type header if he needs to use a specific content-type for the payload. Or else, system decides the Content-Type by considering the type of sink mapper, in following way.
 - @map(xml):application/xml
 - @map(json):application/json
 - @map(text):plain/text )
 - if user does not include any mapping type then the system gets 'plain/text' as default Content-Type header.
Note that providing content-length as a header is not supported. The size of the payload will be automatically calculated and included in the content-length header.
STRINGYesNo
methodFor HTTP events, HTTP_METHOD header should be included as a request header. If the parameter is null then system uses 'POST' as a default header.POSTSTRINGYesNo
socket.idle.timeoutSocket timeout value in millisecond6000INTYesNo
chunk.disabledThis parameter is used to disable/enable chunked transfer encodingfalseBOOLYesNo
ssl.protocolThe SSL protocol versionTLSSTRINGYesNo
parametersParameters other than basics such as ciphers,sslEnabledProtocols,client.enable.session.creation. Expected format of these parameters is as follows: "'ciphers:xxx','sslEnabledProtocols,client.enable:xxx'"nullSTRINGYesNo
ciphersList of ciphers to be used. This parameter should include under parameters Ex: 'ciphers:TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256'nullSTRINGYesNo
ssl.enabled.protocolsSSL/TLS protocols to be enabled. This parameter should be in camel case format(sslEnabledProtocols) under parameters. Ex 'sslEnabledProtocols:true'nullSTRINGYesNo
client.enable.session.creationEnable HTTP session creation.This parameter should include under parameters Ex: 'client.enable.session.creation:true'nullSTRINGYesNo
follow.redirectRedirect related enabled.trueBOOLYesNo
max.redirect.countMaximum redirect count.5INTYesNo
tls.store.typeTLS store type to be used.JKSSTRINGYesNo
proxy.hostProxy server hostnullSTRINGYesNo
proxy.portProxy server portnullSTRINGYesNo
proxy.usernameProxy server usernamenullSTRINGYesNo
proxy.passwordProxy server passwordnullSTRINGYesNo
client.bootstrap.configurationClient bootsrap configurations. Expected format of these parameters is as follows: "'client.bootstrap.nodelay:xxx','client.bootstrap.keepalive:xxx'"TODOSTRINGYesNo
client.bootstrap.nodelayHttp client no delay.trueBOOLYesNo
client.bootstrap.keepaliveHttp client keep alive.trueBOOLYesNo
client.bootstrap.sendbuffersizeHttp client send buffer size.1048576INTYesNo
client.bootstrap.recievebuffersizeHttp client receive buffer size.1048576INTYesNo
client.bootstrap.connect.timeoutHttp client connection timeout.15000INTYesNo
client.bootstrap.socket.reuseTo enable http socket reuse.falseBOOLYesNo
client.bootstrap.socket.timeoutHttp client socket timeout.15STRINGYesNo
client.threadpool.configurationsThread pool configuration. Expected format of these parameters is as follows: "'client.connection.pool.count:xxx','client.max.active.connections.per.pool:xxx'"TODOSTRINGYesNo
client.connection.pool.countConnection pool count.0INTYesNo
client.max.active.connections.per.poolActive connections per pool.-1INTYesNo
client.min.idle.connections.per.poolMinimum ideal connection per pool.0INTYesNo
client.max.idle.connections.per.poolMaximum ideal connection per pool.100INTYesNo
client.min.eviction.idle.timeMinimum eviction idle time.5 * 60 * 1000STRINGYesNo
sender.thread.countHttp sender thread count.20STRINGYesNo
event.group.executor.thread.sizeEvent group executor thread size.15STRINGYesNo
max.wait.for.client.connection.poolMaximum wait for client connection pool.60000STRINGYesNo
- -System Parameters - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Parameters
clientBootstrapBossGroupSizeproperty to configure number of boss threads, which accepts incoming connections until the ports are unbound. Once connection accepts successfully, boss thread passes the accepted channel to one of the worker threads.Number of available processorsAny integer
clientBootstrapWorkerGroupSizeproperty to configure number of worker threads, which performs non blocking read and write for one or more channels in non-blocking mode.(Number of available processors)*2Any integer
clientBootstrapClientGroupSizeproperty to configure number of client threads, which performs non blocking read and write for one or more channels in non-blocking mode.(Number of available processors)*2Any integer
trustStoreLocationThe default truststore file path.${carbon.home}/resources/security/client-truststore.jksPath to client-truststore.jks
trustStorePasswordThe default truststore password.wso2carbonTruststore password
- -Examples -EXAMPLE 1 -``` -@sink(type='http',publisher.url='http://localhost:8009/foo', method='{{method}}',headers="'content-type:xml','content-length:94'", client.bootstrap.configuration="'client.bootstrap.socket.timeout:20', 'client.bootstrap.worker.group.size:10'", client.pool.configuration="'client.connection.pool.count:10','client.max.active.connections.per.pool:1'", @map(type='xml', @payload('{{payloadBody}}'))) -define stream FooStream (payloadBody String, method string, headers string); - -``` -

If it is xml mapping expected input should be in following format for FooStream:
{
<events>
    <event>
        <symbol>WSO2</symbol>
        <price>55.6</price>
        <volume>100</volume>
    </event>
</events>,
POST,
Content-Length:24#Content-Location:USA#Retry-After:120
}

Above event will generate output as below.
~Output http event payload
<events>
    <event>
        <symbol>WSO2</symbol>
        <price>55.6</price>
        <volume>100</volume>
    </event>
</events>

~Output http event headers
Content-Length:24,
Content-Location:'USA',
Retry-After:120,
Content-Type:'application/xml',
HTTP_METHOD:'POST',

~Output http event properties
HTTP_METHOD:'POST',
HOST:'localhost',
PORT:8009,
PROTOCOL:'http',
TO:'/foo'

- -### http-request *(Sink)* - -

This extension publish the HTTP events in any HTTP method POST, GET, PUT, DELETE via HTTP or https protocols. As the additional features this component can provide basic authentication as well as user can publish events using custom client truststore files when publishing events via https protocol. And also user can add any number of headers including HTTP_METHOD header for each event dynamically.
Following content types will be set by default according to the type of sink mapper used.
You can override them by setting the new content types in headers.
     - TEXT : text/plain
     - XML : application/xml
     - JSON : application/json
     - KEYVALUE : application/x-www-form-urlencoded

HTTP request sink is correlated with the The HTTP reponse source, through a unique sink.id.It sends the request to the defined url and the response is received by the response source which has the same 'sink.id'.

- -Syntax -``` -@sink(type="http-request", publisher.url="", basic.auth.username="", basic.auth.password="", https.truststore.file="", https.truststore.password="", headers="", method="", socket.idle.timeout="", chunk.disabled="", ssl.protocol="", parameters="", ciphers="", ssl.enabled.protocols="", client.enable.session.creation="", follow.redirect="", max.redirect.count="", tls.store.type="", proxy.host="", proxy.port="", proxy.username="", proxy.password="", client.bootstrap.configuration="", client.bootstrap.nodelay="", client.bootstrap.keepalive="", client.bootstrap.sendbuffersize="", client.bootstrap.recievebuffersize="", client.bootstrap.connect.timeout="", client.bootstrap.socket.reuse="", client.bootstrap.socket.timeout="", client.threadpool.configurations="", client.connection.pool.count="", client.max.active.connections.per.pool="", client.min.idle.connections.per.pool="", client.max.idle.connections.per.pool="", client.min.eviction.idle.time="", sender.thread.count="", event.group.executor.thread.size="", max.wait.for.client.connection.pool="", sink.id="", downloading.enabled="", download.path="", @map(...))) -``` - -QUERY PARAMETERS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
publisher.urlThe URL to which the outgoing events should be published via HTTP. This is a mandatory parameter and if this is not specified, an error is logged in the CLI. If user wants to enable SSL for the events, use https instead of http in the publisher.url.
e.g., http://localhost:8080/endpoint, https://localhost:8080/endpoint
This can be used as a dynamic parameter as well.
STRINGNoYes
basic.auth.usernameThe username to be included in the authentication header of the basic authentication enabled events. It is required to specify both username and password to enable basic authentication. If one of the parameter is not given by user then an error is logged in the CLI. STRINGYesNo
basic.auth.passwordThe password to include in the authentication header of the basic authentication enabled events. It is required to specify both username and password to enable basic authentication. If one of the parameter is not given by user then an error is logged in the CLI. STRINGYesNo
https.truststore.fileThe file path to the location of the truststore of the client that sends the HTTP events through 'https' protocol. A custom client-truststore can be specified if required.${carbon.home}/resources/security/client-truststore.jksSTRINGYesNo
https.truststore.passwordThe password for the client-truststore. A custom password can be specified if required. If no custom password is specified and the protocol of URL is 'https' then, the system uses default password.wso2carbonSTRINGYesNo
headersThe headers that should be included as HTTP request headers.
There can be any number of headers concatenated in following format. "'header1:value1','header2:value2'". User can include Content-Type header if he needs to use a specific content-type for the payload. Or else, system decides the Content-Type by considering the type of sink mapper, in following way.
 - @map(xml):application/xml
 - @map(json):application/json
 - @map(text):plain/text )
 - if user does not include any mapping type then the system gets 'plain/text' as default Content-Type header.
Note that providing content-length as a header is not supported. The size of the payload will be automatically calculated and included in the content-length header.
STRINGYesNo
methodFor HTTP events, HTTP_METHOD header should be included as a request header. If the parameter is null then system uses 'POST' as a default header.POSTSTRINGYesNo
socket.idle.timeoutSocket timeout value in millisecond6000INTYesNo
chunk.disabledport: Port number of the remote servicefalseBOOLYesNo
ssl.protocolThe SSL protocol versionTLSSTRINGYesNo
parametersParameters other than basics such as ciphers,sslEnabledProtocols,client.enable.session.creation. Expected format of these parameters is as follows: "'ciphers:xxx','sslEnabledProtocols,client.enable:xxx'"nullSTRINGYesNo
ciphersList of ciphers to be used. This parameter should include under parameters Ex: 'ciphers:TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256'nullSTRINGYesNo
ssl.enabled.protocolsSSL/TLS protocols to be enabled. This parameter should be in camel case format(sslEnabledProtocols) under parameters. Ex 'sslEnabledProtocols:true'nullSTRINGYesNo
client.enable.session.creationEnable HTTP session creation.This parameter should include under parameters Ex: 'client.enable.session.creation:true'nullSTRINGYesNo
follow.redirectRedirect related enabled.trueBOOLYesNo
max.redirect.countMaximum redirect count.5INTYesNo
tls.store.typeTLS store type to be used.JKSSTRINGYesNo
proxy.hostProxy server hostnullSTRINGYesNo
proxy.portProxy server portnullSTRINGYesNo
proxy.usernameProxy server usernamenullSTRINGYesNo
proxy.passwordProxy server passwordnullSTRINGYesNo
client.bootstrap.configurationClient bootsrap configurations. Expected format of these parameters is as follows: "'client.bootstrap.nodelay:xxx','client.bootstrap.keepalive:xxx'"TODOSTRINGYesNo
client.bootstrap.nodelayHttp client no delay.trueBOOLYesNo
client.bootstrap.keepaliveHttp client keep alive.trueBOOLYesNo
client.bootstrap.sendbuffersizeHttp client send buffer size.1048576INTYesNo
client.bootstrap.recievebuffersizeHttp client receive buffer size.1048576INTYesNo
client.bootstrap.connect.timeoutHttp client connection timeout.15000INTYesNo
client.bootstrap.socket.reuseTo enable http socket reuse.falseBOOLYesNo
client.bootstrap.socket.timeoutHttp client socket timeout.15STRINGYesNo
client.threadpool.configurationsThread pool configuration. Expected format of these parameters is as follows: "'client.connection.pool.count:xxx','client.max.active.connections.per.pool:xxx'"TODOSTRINGYesNo
client.connection.pool.countConnection pool count.0INTYesNo
client.max.active.connections.per.poolActive connections per pool.-1INTYesNo
client.min.idle.connections.per.poolMinimum ideal connection per pool.0INTYesNo
client.max.idle.connections.per.poolMaximum ideal connection per pool.100INTYesNo
client.min.eviction.idle.timeMinimum eviction idle time.5 * 60 * 1000STRINGYesNo
sender.thread.countHttp sender thread count.20STRINGYesNo
event.group.executor.thread.sizeEvent group executor thread size.15STRINGYesNo
max.wait.for.client.connection.poolMaximum wait for client connection pool.60000STRINGYesNo
sink.idIdentifier of the sink. This is used to co-relate with the corresponding http-response source which needs to process the repose for the request sent by this sink.STRINGNoNo
downloading.enabledIf this is set to 'true' then the response received by the response source will be written to a file. If downloading is enabled, the download.path parameter is mandatory.falseBOOLYesNo
download.pathIf downloading is enabled, the path of the file which is going to be downloaded should be specified using 'download.path' parameter. This should be an absolute path including the file name.nullSTRINGYesYes
- -Examples -EXAMPLE 1 -``` -@sink(type='http-request', sink.id='foo', publisher.url='http://localhost:8009/foo', @map(type='xml', @payload('{{payloadBody}}'))) -define stream FooStream (payloadBody String, method string, headers string); -@source(type='http-response', sink.id='foo', http.status.code='2\\d+', -@map(type='text', regex.A='((.|\n)*)', @attributes(headers='trp:headers', fileName='A[1]'))) -define stream responseStream2xx(fileName string, headers string); - -@source(type='http-response', sink.id='foo', http.status.code='4\\d+', -@map(type='text', regex.A='((.|\n)*)', @attributes(errorMsg='A[1]'))) -define stream responseStream4xx(errorMsg string); -``` -

In above example, the payload body for 'FooStream' will be in following format.
{
<events>
    <event>
        <symbol>WSO2</symbol>
        <price>55.6</price>
        <volume>100</volume>
    </event>
</events>,
This message will sent as the body of a POST request with the content-type 'application/xml' to the endpoint defined as the 'publisher.url' and in order to process the responses for these requests, there should be a source of type 'http-response' defined with the same sink id 'foo' in the siddhi app.
The responses with 2xx status codes will be received by the http-response source which has the http.status.code defined by the regex '2\\d+'.
If the response has a 4xx status code, it will be received by the http-response source which has the http.status.code defined by the regex '4\\d+'.

- -EXAMPLE 2 -``` -define stream FooStream (name String, id int, headers String, downloadPath string); -@sink(type='http-request', -downloading.enabled='true', -download.path='{{downloadPath}}',publisher.url='http://localhost:8005/files', -method='GET', headers='{{headers}}',sink.id='download-sink', -@map(type='json')) -define stream BarStream (name String, id int, headers String, downloadPath string); - -@source(type='http-response', sink.id='download-sink', http.status.code='2\\d+', -@map(type='text', regex.A='((.|\n)*)', @attributes(headers='trp:headers', fileName='A[1]'))) -define stream responseStream2xx(fileName string, headers string); - -@source(type='http-response', sink.id='download-sink', http.status.code='4\\d+', -@map(type='text', regex.A='((.|\n)*)', @attributes(errorMsg='A[1]'))) -define stream responseStream4xx(errorMsg string); -``` -

In above example, http-request sink will send a GET request to the publisher url and the requested file will be received as the response by a corresponding http-response source.
If the http status code of the response is a successful one (2xx), it will be received by the http-response source which has the http.status.code '2\\d+' and downloaded as a local file. Then the event received to the responseStream2xx will have the headers included in the request and the downloaded file name.
If the http status code of the response is a 4xx code, it will be received by the http-response source which has the http.status.code '4\\d+'. Then the event received to the responseStream4xx will have the response message body in text format.

- -### http-response *(Sink)* - -

HTTP response sink is correlated with the The HTTP request source, through a unique source.id, and it send a response to the HTTP request source having the same source.id. The response message can be formatted in text, XML or JSON and can be sent with appropriate headers.

- -Syntax -``` -@sink(type="http-response", source.id="", message.id="", headers="", @map(...))) -``` - -QUERY PARAMETERS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
source.idIdentifier of the source.STRINGNoNo
message.idIdentifier of the message.STRINGNoYes
headersThe headers that should be included as HTTP response headers. There can be any number of headers concatenated on following format. "'header1:value1','header2:value2'" User can include content-type header if he/she need to have any specific type for payload. If not system get the mapping type as the content-Type header (ie.@map(xml):application/xml, @map(json):application/json, @map(text):plain/text) and if user does not include any mapping type then system gets the plain/text as default Content-Type header. If user does not include Content-Length header then system calculate the bytes size of payload and include it as content-length header. STRINGYesNo
- -Examples -EXAMPLE 1 -``` -@sink(type='http-response', source.id='sampleSourceId', message.id='{{messageId}}', headers="'content-type:json','content-length:94'"@map(type='json', @payload('{{payloadBody}}'))) -define stream FooStream (payloadBody String, messageId string, headers string); - -``` -

If it is json mapping expected input should be in following format for FooStream:
{
{"events":
    {"event":
        "symbol":WSO2,
        "price":55.6,
        "volume":100,
    }
},
0cf708b1-7eae-440b-a93e-e72f801b486a,
Content-Length:24#Content-Location:USA
}

Above event will generate response for the matching source message as below.

~Output http event payload
{"events":
    {"event":
        "symbol":WSO2,
        "price":55.6,
        "volume":100,
    }
}

~Output http event headers
Content-Length:24,
Content-Location:'USA',
Content-Type:'application/json'

- -## Source - -### http *(Source)* - -

The HTTP source receives POST requests via HTTP or HTTPS in format such as text, XML and JSON. In WSO2 SP, if required, you can enable basic authentication to ensure that events are received only from users who are authorized to access the service.

- -Syntax -``` -@source(type="http", receiver.url="", basic.auth.enabled="", worker.count="", socket.idle.timeout="", ssl.verify.client="", ssl.protocol="", tls.store.type="", parameters="", ciphers="", ssl.enabled.protocols="", server.enable.session.creation="", server.supported.snimatchers="", server.suported.server.names="", request.size.validation.configuration="", request.size.validation="", request.size.validation.maximum.value="", request.size.validation.reject.status.code="", request.size.validation.reject.message="", request.size.validation.reject.message.content.type="", header.size.validation="", header.validation.maximum.request.line="", header.validation.maximum.size="", header.validation.maximum.chunk.size="", header.validation.reject.status.code="", header.validation.reject.message="", header.validation.reject.message.content.type="", server.bootstrap.configuration="", server.bootstrap.nodelay="", server.bootstrap.keepalive="", server.bootstrap.sendbuffersize="", server.bootstrap.recievebuffersize="", server.bootstrap.connect.timeout="", server.bootstrap.socket.reuse="", server.bootstrap.socket.timeout="", server.bootstrap.socket.backlog="", trace.log.enabled="", @map(...))) -``` - -QUERY PARAMETERS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
receiver.urlThe URL to which the events should be received. User can provide any valid url and if the url is not provided the system will use the following format http://0.0.0.0:9763/<appNAme>/<streamName>If the user want to use SSL the url should be given in following format https://localhost:8080/<streamName>http://0.0.0.0:9763//STRINGYesNo
basic.auth.enabledThis works only in WSO2 SP. If this is set to true, basic authentication is enabled for incoming events, and the credentials with which each event is sent are verified to ensure that the user is authorized to access the service. If basic authentication fails, the event is not authenticated and an authentication error is logged in the CLI.falseSTRINGYesNo
worker.countThe number of active worker threads to serve the incoming events. The value is 1 by default. This will ensure that the events are directed to the event stream in the same order in which they arrive. By increasing this value the performance might increase at the cost of loosing event ordering.1INTYesNo
socket.idle.timeoutIdle timeout for HTTP connection.120000INTYesNo
ssl.verify.clientThe type of client certificate verification.nullSTRINGYesNo
ssl.protocolssl/tls related optionsTLSSTRINGYesNo
tls.store.typeTLS store type.JKSSTRINGYesNo
parametersParameters other than basics such as ciphers,sslEnabledProtocols,client.enable.session.creation. Expected format of these parameters is as follows: "'ciphers:xxx','sslEnabledProtocols,client.enable:xxx'"nullSTRINGYesNo
ciphersList of ciphers to be used. This parameter should include under parameters Ex: 'ciphers:TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256'nullSTRINGYesNo
ssl.enabled.protocolsSSL/TLS protocols to be enabled. This parameter should be in camel case format(sslEnabledProtocols) under parameters. Ex 'sslEnabledProtocols:true'nullSTRINGYesNo
server.enable.session.creationEnable HTTP session creation.This parameter should include under parameters Ex: 'client.enable.session.creation:true'nullSTRINGYesNo
server.supported.snimatchersHttp SNIMatcher to be added. This parameter should include under parameters Ex: 'server.supported.snimatchers:SNIMatcher'nullSTRINGYesNo
server.suported.server.namesHttp supported servers. This parameter should include under parameters Ex: 'server.suported.server.names:server'nullSTRINGYesNo
request.size.validation.configurationParameters that responsible for validating the http request and request headers. Expected format of these parameters is as follows: "'request.size.validation:xxx','request.size.validation.maximum.value:xxx'"nullSTRINGYesNo
request.size.validationTo enable the request size validation.falseSTRINGYesNo
request.size.validation.maximum.valueIf request size is validated then maximum size.Integer.MAX_VALUESTRINGYesNo
request.size.validation.reject.status.codeIf request is exceed maximum size and request.size.validation is enabled then status code to be send as response.401STRINGYesNo
request.size.validation.reject.messageIf request is exceed maximum size and request.size.validation is enabled then status message to be send as response.Message is bigger than the valid sizeSTRINGYesNo
request.size.validation.reject.message.content.typeIf request is exceed maximum size and request.size.validation is enabled then content type to be send as response.plain/textSTRINGYesNo
header.size.validationTo enable the header size validation.falseSTRINGYesNo
header.validation.maximum.request.lineIf header header validation is enabled then the maximum request line.4096STRINGYesNo
header.validation.maximum.sizeIf header header validation is enabled then the maximum expected header size.8192STRINGYesNo
header.validation.maximum.chunk.sizeIf header header validation is enabled then the maximum expected chunk size.8192STRINGYesNo
header.validation.reject.status.code401If header is exceed maximum size and header.size.validation is enabled then status code to be send as response.STRINGYesNo
header.validation.reject.messageIf header is exceed maximum size and header.size.validation is enabled then message to be send as response.Message header is bigger than the valid sizeSTRINGYesNo
header.validation.reject.message.content.typeIf header is exceed maximum size and header.size.validation is enabled then content type to be send as response.plain/textSTRINGYesNo
server.bootstrap.configurationParameters that for bootstrap configurations of the server. Expected format of these parameters is as follows: "'ciphers:xxx','sslEnabledProtocols,client.enable:xxx'"nullOBJECTYesNo
server.bootstrap.nodelayHttp server no delay.trueBOOLYesNo
server.bootstrap.keepaliveHttp server keep alive.trueBOOLYesNo
server.bootstrap.sendbuffersizeHttp server send buffer size.1048576INTYesNo
server.bootstrap.recievebuffersizeHttp server receive buffer size.1048576INTYesNo
server.bootstrap.connect.timeoutHttp server connection timeout.15000INTYesNo
server.bootstrap.socket.reuseTo enable http socket reuse.falseBOOLYesNo
server.bootstrap.socket.timeoutHttp server socket timeout.15BOOLYesNo
server.bootstrap.socket.backlogTHttp server socket backlog.100BOOLYesNo
trace.log.enabledHttp traffic monitoring.falseBOOLYesNo
- -System Parameters - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Parameters
serverBootstrapBossGroupSizeproperty to configure number of boss threads, which accepts incoming connections until the ports are unbound. Once connection accepts successfully, boss thread passes the accepted channel to one of the worker threads.Number of available processorsAny integer
serverBootstrapWorkerGroupSizeproperty to configure number of worker threads, which performs non blocking read and write for one or more channels in non-blocking mode.(Number of available processors)*2Any integer
serverBootstrapClientGroupSizeproperty to configure number of client threads, which performs non blocking read and write for one or more channels in non-blocking mode.(Number of available processors)*2Any integer
defaultHostThe default host of the transport.0.0.0.0Any valid host
defaultHttpPortThe default port if the default scheme is 'http'.8280Any valid port
defaultHttpsPortThe default port if the default scheme is 'https'.8243Any valid port
defaultSchemeThe default protocol.httphttp
https
keyStoreLocationThe default keystore file path.${carbon.home}/resources/security/wso2carbon.jksPath to wso2carbon.jks file
keyStorePasswordThe default keystore password.wso2carbonString of keystore password
certPasswordThe default cert password.wso2carbonString of cert password
- -Examples -EXAMPLE 1 -``` -@source(type='http', receiver.url='http://localhost:9055/endpoints/RecPro', socketIdleTimeout='150000', parameters="'ciphers : TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256', 'sslEnabledProtocols:TLSv1.1,TLSv1.2'",request.size.validation.configuration="request.size.validation:true",server.bootstrap.configuration="server.bootstrap.socket.timeout:25" @map(type='xml')) -define stream FooStream (symbol string, price float, volume long); - -``` -

Above source listenerConfiguration performs a default XML input mapping. The expected input is as follows:
<events>
    <event>
        <symbol>WSO2</symbol>
        <price>55.6</price>
        <volume>100</volume>
    </event>
</events>
If basic authentication is enabled via the basic.auth.enabled='true setting, each input event is also expected to contain the Authorization:'Basic encodeBase64(username:Password)' header.

- -### http-request *(Source)* - -

The HTTP request is correlated with the HTTP response sink, through a unique source.id, and for each POST requests it receives via HTTP or HTTPS in format such as text, XML and JSON it sends the response via the HTTP response sink. The individual request and response messages are correlated at the sink using the message.id of the events. If required, you can enable basic authentication at the source to ensure that events are received only from users who are authorized to access the service.

- -Syntax -``` -@source(type="http-request", receiver.url="", source.id="", connection.timeout="", basic.auth.enabled="", worker.count="", socket.idle.timeout="", ssl.verify.client="", ssl.protocol="", tls.store.type="", parameters="", ciphers="", ssl.enabled.protocols="", server.enable.session.creation="", server.supported.snimatchers="", server.suported.server.names="", request.size.validation.configuration="", request.size.validation="", request.size.validation.maximum.value="", request.size.validation.reject.status.code="", request.size.validation.reject.message="", request.size.validation.reject.message.content.type="", header.size.validation="", header.validation.maximum.request.line="", header.validation.maximum.size="", header.validation.maximum.chunk.size="", header.validation.reject.status.code="", header.validation.reject.message="", header.validation.reject.message.content.type="", server.bootstrap.configuration="", server.bootstrap.nodelay="", server.bootstrap.keepalive="", server.bootstrap.sendbuffersize="", server.bootstrap.recievebuffersize="", server.bootstrap.connect.timeout="", server.bootstrap.socket.reuse="", server.bootstrap.socket.timeout="", server.bootstrap.socket.backlog="", trace.log.enabled="", @map(...))) -``` - -QUERY PARAMETERS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
receiver.urlThe URL to which the events should be received. User can provide any valid url and if the url is not provided the system will use the following format http://0.0.0.0:9763/<appNAme>/<streamName>If the user want to use SSL the url should be given in following format https://localhost:8080/<streamName>http://0.0.0.0:9763//STRINGYesNo
source.idIdentifier need to map the source to sink.STRINGNoNo
connection.timeoutConnection timeout in milliseconds. If the mapped http-response sink does not get a correlated message, after this timeout value, a timeout response is sent120000INTYesNo
basic.auth.enabledIf this is set to true, basic authentication is enabled for incoming events, and the credentials with which each event is sent are verified to ensure that the user is authorized to access the service. If basic authentication fails, the event is not authenticated and an authentication error is logged in the CLI. By default this values 'false' falseSTRINGYesNo
worker.countThe number of active worker threads to serve the incoming events. The value is 1 by default. This will ensure that the events are directed to the event stream in the same order in which they arrive. By increasing this value the performance might increase at the cost of loosing event ordering.1INTYesNo
socket.idle.timeoutIdle timeout for HTTP connection.120000INTYesNo
ssl.verify.clientThe type of client certificate verification.nullSTRINGYesNo
ssl.protocolssl/tls related optionsTLSSTRINGYesNo
tls.store.typeTLS store type.JKSSTRINGYesNo
parametersParameters other than basics such as ciphers,sslEnabledProtocols,client.enable.session.creation. Expected format of these parameters is as follows: "'ciphers:xxx','sslEnabledProtocols,client.enable:xxx'"nullSTRINGYesNo
ciphersList of ciphers to be used. This parameter should include under parameters Ex: 'ciphers:TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256'nullSTRINGYesNo
ssl.enabled.protocolsSSL/TLS protocols to be enabled. This parameter should be in camel case format(sslEnabledProtocols) under parameters. Ex 'sslEnabledProtocols:true'nullSTRINGYesNo
server.enable.session.creationEnable HTTP session creation.This parameter should include under parameters Ex: 'client.enable.session.creation:true'nullSTRINGYesNo
server.supported.snimatchersHttp SNIMatcher to be added. This parameter should include under parameters Ex: 'server.supported.snimatchers:SNIMatcher'nullSTRINGYesNo
server.suported.server.namesHttp supported servers. This parameter should include under parameters Ex: 'server.suported.server.names:server'nullSTRINGYesNo
request.size.validation.configurationParameters that responsible for validating the http request and request headers. Expected format of these parameters is as follows: "'request.size.validation:xxx','request.size.validation.maximum.value:xxx'"nullSTRINGYesNo
request.size.validationTo enable the request size validation.falseSTRINGYesNo
request.size.validation.maximum.valueIf request size is validated then maximum size.Integer.MAX_VALUESTRINGYesNo
request.size.validation.reject.status.codeIf request is exceed maximum size and request.size.validation is enabled then status code to be send as response.401STRINGYesNo
request.size.validation.reject.messageIf request is exceed maximum size and request.size.validation is enabled then status message to be send as response.Message is bigger than the valid sizeSTRINGYesNo
request.size.validation.reject.message.content.typeIf request is exceed maximum size and request.size.validation is enabled then content type to be send as response.plain/textSTRINGYesNo
header.size.validationTo enable the header size validation.falseSTRINGYesNo
header.validation.maximum.request.lineIf header header validation is enabled then the maximum request line.4096STRINGYesNo
header.validation.maximum.sizeIf header header validation is enabled then the maximum expected header size.8192STRINGYesNo
header.validation.maximum.chunk.sizeIf header header validation is enabled then the maximum expected chunk size.8192STRINGYesNo
header.validation.reject.status.code401If header is exceed maximum size and header.size.validation is enabled then status code to be send as response.STRINGYesNo
header.validation.reject.messageIf header is exceed maximum size and header.size.validation is enabled then message to be send as response.Message header is bigger than the valid sizeSTRINGYesNo
header.validation.reject.message.content.typeIf header is exceed maximum size and header.size.validation is enabled then content type to be send as response.plain/textSTRINGYesNo
server.bootstrap.configurationParameters that for bootstrap configurations of the server. Expected format of these parameters is as follows: "'ciphers:xxx','sslEnabledProtocols,client.enable:xxx'"nullOBJECTYesNo
server.bootstrap.nodelayHttp server no delay.trueBOOLYesNo
server.bootstrap.keepaliveHttp server keep alive.trueBOOLYesNo
server.bootstrap.sendbuffersizeHttp server send buffer size.1048576INTYesNo
server.bootstrap.recievebuffersizeHttp server receive buffer size.1048576INTYesNo
server.bootstrap.connect.timeoutHttp server connection timeout.15000INTYesNo
server.bootstrap.socket.reuseTo enable http socket reuse.falseBOOLYesNo
server.bootstrap.socket.timeoutHttp server socket timeout.15BOOLYesNo
server.bootstrap.socket.backlogTHttp server socket backlog.100BOOLYesNo
trace.log.enabledHttp traffic monitoring.falseBOOLYesNo
- -System Parameters - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Parameters
serverBootstrapBossGroupSizeproperty to configure number of boss threads, which accepts incoming connections until the ports are unbound. Once connection accepts successfully, boss thread passes the accepted channel to one of the worker threads.Number of available processorsAny integer
serverBootstrapWorkerGroupSizeproperty to configure number of worker threads, which performs non blocking read and write for one or more channels in non-blocking mode.(Number of available processors)*2Any integer
serverBootstrapClientGroupSizeproperty to configure number of client threads, which performs non blocking read and write for one or more channels in non-blocking mode.(Number of available processors)*2Any integer
defaultHostThe default host of the transport.0.0.0.0Any valid host
defaultHttpPortThe default port if the default scheme is 'http'.8280Any valid port
defaultHttpsPortThe default port if the default scheme is 'https'.8243Any valid port
defaultSchemeThe default protocol.httphttp
https
keyStoreLocationThe default keystore file path.${carbon.home}/resources/security/wso2carbon.jksPath to wso2carbon.jks file
keyStorePasswordThe default keystore password.wso2carbonString of keystore password
certPasswordThe default cert password.wso2carbonString of cert password
- -Examples -EXAMPLE 1 -``` -@source(type='http-request', source.id='sampleSourceId, receiver.url='http://localhost:9055/endpoints/RecPro', connection.timeout='150000', parameters="'ciphers : TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256', 'sslEnabledProtocols:TLSv1.1,TLSv1.2'", request.size.validation.configuration="request.size.validation:true", server.bootstrap.configuration="server.bootstrap.socket.timeout:25", @map(type='json, @attributes(messageId='trp:messageId', symbol='$.events.event.symbol', price='$.events.event.price', volume='$.events.event.volume'))) -define stream FooStream (messageId string, symbol string, price float, volume long); - -``` -

The expected input is as follows:
{"events":
    {"event":
        "symbol":WSO2,
        "price":55.6,
        "volume":100,
    }
}
If basic authentication is enabled via the basic.auth.enabled='true setting, each input event is also expected to contain the Authorization:'Basic encodeBase64(username:Password)' header.

- -### http-response *(Source)* - -

The http-response source co-relates with http-request sink with the parameter 'sink.id'.
This receives responses for the requests sent by the http-request sink which has the same sink id.
Response messages can be in formats such as TEXT, JSON and XML.
In order to handle the responses with different http status codes, user is allowed to defined the acceptable response source code using the parameter 'http.status.code'

- -Syntax -``` -@source(type="http-response", sink.id="", http.status.code="", allow.streaming.responses="", @map(...))) -``` - -QUERY PARAMETERS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
sink.idThis parameter is used to map the http-response source to a http-request sink. Then this source will accepts the response messages for the requests sent by corresponding http-request sink.STRINGNoNo
http.status.codeAcceptable http status code for the responses.
This can be a complete string or a regex.
Only the responses with matching status codes to the defined value, will be received by the http-response source.
Eg: 'http.status.code = '200', http.status.code = '2\\d+''
200STRINGYesNo
allow.streaming.responsesIf responses can be received multiple times for a single request, this option should be enabled. If this is not enabled, for every request, response will be extracted only once.falseBOOLYesNo
- -Examples -EXAMPLE 1 -``` -@sink(type='http-request', -downloading.enabled='true', -publisher.url='http://localhost:8005/registry/employee', -method='POST', headers='{{headers}}',sink.id='employee-info', -@map(type='json')) -define stream BarStream (name String, id int, headers String, downloadPath string); - -@source(type='http-response' , sink.id='employee-info', http.status.code='2\\d+', -@map(type='text', regex.A='((.|\n)*)', @attributes(message='A[1]'))) -define stream responseStream2xx(message string);@source(type='http-response' , sink.id='employee-info', http.status.code='4\\d+' , -@map(type='text', regex.A='((.|\n)*)', @attributes(message='A[1]'))) -define stream responseStream4xx(message string); -``` -

In above example, the defined http-request sink will send a POST requests to the endpoint defined by 'publisher.url'.
Then for those requests, the source with the response code '2\\d+' and sink.id 'employee-info' will receive the responses with 2xx status codes.
The http-response source which has 'employee-info' as the 'sink.id' and '4\\d+' as the http.response.code will receive all the responses with 4xx status codes.
. Then the body of the response message will be extracted using text mapper and converted into siddhi events.
.

- diff --git a/docs/api/1.0.43.md b/docs/api/1.0.43.md deleted file mode 100644 index 80847288..00000000 --- a/docs/api/1.0.43.md +++ /dev/null @@ -1,1673 +0,0 @@ -# API Docs - v1.0.43 - -## Sink - -### http *(Sink)* - -

This extension publish the HTTP events in any HTTP method POST, GET, PUT, DELETE via HTTP or https protocols. As the additional features this component can provide basic authentication as well as user can publish events using custom client truststore files when publishing events via https protocol. And also user can add any number of headers including HTTP_METHOD header for each event dynamically.
Following content types will be set by default according to the type of sink mapper used.
You can override them by setting the new content types in headers.
     - TEXT : text/plain
     - XML : application/xml
     - JSON : application/json
     - KEYVALUE : application/x-www-form-urlencoded

- -Syntax -``` -@sink(type="http", publisher.url="", basic.auth.username="", basic.auth.password="", https.truststore.file="", https.truststore.password="", headers="", method="", socket.idle.timeout="", chunk.disabled="", ssl.protocol="", parameters="", ciphers="", ssl.enabled.protocols="", client.enable.session.creation="", follow.redirect="", max.redirect.count="", tls.store.type="", proxy.host="", proxy.port="", proxy.username="", proxy.password="", client.bootstrap.configuration="", client.bootstrap.nodelay="", client.bootstrap.keepalive="", client.bootstrap.sendbuffersize="", client.bootstrap.recievebuffersize="", client.bootstrap.connect.timeout="", client.bootstrap.socket.reuse="", client.bootstrap.socket.timeout="", client.threadpool.configurations="", client.connection.pool.count="", client.max.active.connections.per.pool="", client.min.idle.connections.per.pool="", client.max.idle.connections.per.pool="", client.min.eviction.idle.time="", sender.thread.count="", event.group.executor.thread.size="", max.wait.for.client.connection.pool="", @map(...))) -``` - -QUERY PARAMETERS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
publisher.urlThe URL to which the outgoing events should be published via HTTP. This is a mandatory parameter and if this is not specified, an error is logged in the CLI. If user wants to enable SSL for the events, use https instead of http in the publisher.url.e.g., http://localhost:8080/endpoint, https://localhost:8080/endpointSTRINGNoNo
basic.auth.usernameThe username to be included in the authentication header of the basic authentication enabled events. It is required to specify both username and password to enable basic authentication. If one of the parameter is not given by user then an error is logged in the CLI. STRINGYesNo
basic.auth.passwordThe password to include in the authentication header of the basic authentication enabled events. It is required to specify both username and password to enable basic authentication. If one of the parameter is not given by user then an error is logged in the CLI. STRINGYesNo
https.truststore.fileThe file path to the location of the truststore of the client that sends the HTTP events through 'https' protocol. A custom client-truststore can be specified if required.${carbon.home}/resources/security/client-truststore.jksSTRINGYesNo
https.truststore.passwordThe password for the client-truststore. A custom password can be specified if required. If no custom password is specified and the protocol of URL is 'https' then, the system uses default password.wso2carbonSTRINGYesNo
headersThe headers that should be included as HTTP request headers.
There can be any number of headers concatenated in following format. "'header1:value1','header2:value2'". User can include Content-Type header if he needs to use a specific content-type for the payload. Or else, system decides the Content-Type by considering the type of sink mapper, in following way.
 - @map(xml):application/xml
 - @map(json):application/json
 - @map(text):plain/text )
 - if user does not include any mapping type then the system gets 'plain/text' as default Content-Type header.
Note that providing content-length as a header is not supported. The size of the payload will be automatically calculated and included in the content-length header.
STRINGYesNo
methodFor HTTP events, HTTP_METHOD header should be included as a request header. If the parameter is null then system uses 'POST' as a default header.POSTSTRINGYesNo
socket.idle.timeoutSocket timeout value in millisecond6000INTYesNo
chunk.disabledThis parameter is used to disable/enable chunked transfer encodingfalseBOOLYesNo
ssl.protocolThe SSL protocol versionTLSSTRINGYesNo
parametersParameters other than basics such as ciphers,sslEnabledProtocols,client.enable.session.creation. Expected format of these parameters is as follows: "'ciphers:xxx','sslEnabledProtocols,client.enable:xxx'"nullSTRINGYesNo
ciphersList of ciphers to be used. This parameter should include under parameters Ex: 'ciphers:TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256'nullSTRINGYesNo
ssl.enabled.protocolsSSL/TLS protocols to be enabled. This parameter should be in camel case format(sslEnabledProtocols) under parameters. Ex 'sslEnabledProtocols:true'nullSTRINGYesNo
client.enable.session.creationEnable HTTP session creation.This parameter should include under parameters Ex: 'client.enable.session.creation:true'nullSTRINGYesNo
follow.redirectRedirect related enabled.trueBOOLYesNo
max.redirect.countMaximum redirect count.5INTYesNo
tls.store.typeTLS store type to be used.JKSSTRINGYesNo
proxy.hostProxy server hostnullSTRINGYesNo
proxy.portProxy server portnullSTRINGYesNo
proxy.usernameProxy server usernamenullSTRINGYesNo
proxy.passwordProxy server passwordnullSTRINGYesNo
client.bootstrap.configurationClient bootsrap configurations. Expected format of these parameters is as follows: "'client.bootstrap.nodelay:xxx','client.bootstrap.keepalive:xxx'"TODOSTRINGYesNo
client.bootstrap.nodelayHttp client no delay.trueBOOLYesNo
client.bootstrap.keepaliveHttp client keep alive.trueBOOLYesNo
client.bootstrap.sendbuffersizeHttp client send buffer size.1048576INTYesNo
client.bootstrap.recievebuffersizeHttp client receive buffer size.1048576INTYesNo
client.bootstrap.connect.timeoutHttp client connection timeout.15000INTYesNo
client.bootstrap.socket.reuseTo enable http socket reuse.falseBOOLYesNo
client.bootstrap.socket.timeoutHttp client socket timeout.15STRINGYesNo
client.threadpool.configurationsThread pool configuration. Expected format of these parameters is as follows: "'client.connection.pool.count:xxx','client.max.active.connections.per.pool:xxx'"TODOSTRINGYesNo
client.connection.pool.countConnection pool count.0INTYesNo
client.max.active.connections.per.poolActive connections per pool.-1INTYesNo
client.min.idle.connections.per.poolMinimum ideal connection per pool.0INTYesNo
client.max.idle.connections.per.poolMaximum ideal connection per pool.100INTYesNo
client.min.eviction.idle.timeMinimum eviction idle time.5 * 60 * 1000STRINGYesNo
sender.thread.countHttp sender thread count.20STRINGYesNo
event.group.executor.thread.sizeEvent group executor thread size.15STRINGYesNo
max.wait.for.client.connection.poolMaximum wait for client connection pool.60000STRINGYesNo
- -System Parameters - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Parameters
clientBootstrapBossGroupSizeproperty to configure number of boss threads, which accepts incoming connections until the ports are unbound. Once connection accepts successfully, boss thread passes the accepted channel to one of the worker threads.Number of available processorsAny integer
clientBootstrapWorkerGroupSizeproperty to configure number of worker threads, which performs non blocking read and write for one or more channels in non-blocking mode.(Number of available processors)*2Any integer
clientBootstrapClientGroupSizeproperty to configure number of client threads, which performs non blocking read and write for one or more channels in non-blocking mode.(Number of available processors)*2Any integer
trustStoreLocationThe default truststore file path.${carbon.home}/resources/security/client-truststore.jksPath to client-truststore.jks
trustStorePasswordThe default truststore password.wso2carbonTruststore password
- -Examples -EXAMPLE 1 -``` -@sink(type='http',publisher.url='http://localhost:8009/foo', method='{{method}}',headers="'content-type:xml','content-length:94'", client.bootstrap.configuration="'client.bootstrap.socket.timeout:20', 'client.bootstrap.worker.group.size:10'", client.pool.configuration="'client.connection.pool.count:10','client.max.active.connections.per.pool:1'", @map(type='xml', @payload('{{payloadBody}}'))) -define stream FooStream (payloadBody String, method string, headers string); - -``` -

If it is xml mapping expected input should be in following format for FooStream:
{
<events>
    <event>
        <symbol>WSO2</symbol>
        <price>55.6</price>
        <volume>100</volume>
    </event>
</events>,
POST,
Content-Length:24#Content-Location:USA#Retry-After:120
}

Above event will generate output as below.
~Output http event payload
<events>
    <event>
        <symbol>WSO2</symbol>
        <price>55.6</price>
        <volume>100</volume>
    </event>
</events>

~Output http event headers
Content-Length:24,
Content-Location:'USA',
Retry-After:120,
Content-Type:'application/xml',
HTTP_METHOD:'POST',

~Output http event properties
HTTP_METHOD:'POST',
HOST:'localhost',
PORT:8009,
PROTOCOL:'http',
TO:'/foo'

- -### http-request *(Sink)* - -

This extension publish the HTTP events in any HTTP method POST, GET, PUT, DELETE via HTTP or https protocols. As the additional features this component can provide basic authentication as well as user can publish events using custom client truststore files when publishing events via https protocol. And also user can add any number of headers including HTTP_METHOD header for each event dynamically.
Following content types will be set by default according to the type of sink mapper used.
You can override them by setting the new content types in headers.
     - TEXT : text/plain
     - XML : application/xml
     - JSON : application/json
     - KEYVALUE : application/x-www-form-urlencoded

HTTP request sink is correlated with the The HTTP reponse source, through a unique sink.id.It sends the request to the defined url and the response is received by the response source which has the same 'sink.id'.

- -Syntax -``` -@sink(type="http-request", publisher.url="", basic.auth.username="", basic.auth.password="", https.truststore.file="", https.truststore.password="", headers="", method="", socket.idle.timeout="", chunk.disabled="", ssl.protocol="", parameters="", ciphers="", ssl.enabled.protocols="", client.enable.session.creation="", follow.redirect="", max.redirect.count="", tls.store.type="", proxy.host="", proxy.port="", proxy.username="", proxy.password="", client.bootstrap.configuration="", client.bootstrap.nodelay="", client.bootstrap.keepalive="", client.bootstrap.sendbuffersize="", client.bootstrap.recievebuffersize="", client.bootstrap.connect.timeout="", client.bootstrap.socket.reuse="", client.bootstrap.socket.timeout="", client.threadpool.configurations="", client.connection.pool.count="", client.max.active.connections.per.pool="", client.min.idle.connections.per.pool="", client.max.idle.connections.per.pool="", client.min.eviction.idle.time="", sender.thread.count="", event.group.executor.thread.size="", max.wait.for.client.connection.pool="", sink.id="", downloading.enabled="", download.path="", @map(...))) -``` - -QUERY PARAMETERS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
publisher.urlThe URL to which the outgoing events should be published via HTTP. This is a mandatory parameter and if this is not specified, an error is logged in the CLI. If user wants to enable SSL for the events, use https instead of http in the publisher.url.
e.g., http://localhost:8080/endpoint, https://localhost:8080/endpoint
This can be used as a dynamic parameter as well.
STRINGNoYes
basic.auth.usernameThe username to be included in the authentication header of the basic authentication enabled events. It is required to specify both username and password to enable basic authentication. If one of the parameter is not given by user then an error is logged in the CLI. STRINGYesNo
basic.auth.passwordThe password to include in the authentication header of the basic authentication enabled events. It is required to specify both username and password to enable basic authentication. If one of the parameter is not given by user then an error is logged in the CLI. STRINGYesNo
https.truststore.fileThe file path to the location of the truststore of the client that sends the HTTP events through 'https' protocol. A custom client-truststore can be specified if required.${carbon.home}/resources/security/client-truststore.jksSTRINGYesNo
https.truststore.passwordThe password for the client-truststore. A custom password can be specified if required. If no custom password is specified and the protocol of URL is 'https' then, the system uses default password.wso2carbonSTRINGYesNo
headersThe headers that should be included as HTTP request headers.
There can be any number of headers concatenated in following format. "'header1:value1','header2:value2'". User can include Content-Type header if he needs to use a specific content-type for the payload. Or else, system decides the Content-Type by considering the type of sink mapper, in following way.
 - @map(xml):application/xml
 - @map(json):application/json
 - @map(text):plain/text )
 - if user does not include any mapping type then the system gets 'plain/text' as default Content-Type header.
Note that providing content-length as a header is not supported. The size of the payload will be automatically calculated and included in the content-length header.
STRINGYesNo
methodFor HTTP events, HTTP_METHOD header should be included as a request header. If the parameter is null then system uses 'POST' as a default header.POSTSTRINGYesNo
socket.idle.timeoutSocket timeout value in millisecond6000INTYesNo
chunk.disabledport: Port number of the remote servicefalseBOOLYesNo
ssl.protocolThe SSL protocol versionTLSSTRINGYesNo
parametersParameters other than basics such as ciphers,sslEnabledProtocols,client.enable.session.creation. Expected format of these parameters is as follows: "'ciphers:xxx','sslEnabledProtocols,client.enable:xxx'"nullSTRINGYesNo
ciphersList of ciphers to be used. This parameter should include under parameters Ex: 'ciphers:TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256'nullSTRINGYesNo
ssl.enabled.protocolsSSL/TLS protocols to be enabled. This parameter should be in camel case format(sslEnabledProtocols) under parameters. Ex 'sslEnabledProtocols:true'nullSTRINGYesNo
client.enable.session.creationEnable HTTP session creation.This parameter should include under parameters Ex: 'client.enable.session.creation:true'nullSTRINGYesNo
follow.redirectRedirect related enabled.trueBOOLYesNo
max.redirect.countMaximum redirect count.5INTYesNo
tls.store.typeTLS store type to be used.JKSSTRINGYesNo
proxy.hostProxy server hostnullSTRINGYesNo
proxy.portProxy server portnullSTRINGYesNo
proxy.usernameProxy server usernamenullSTRINGYesNo
proxy.passwordProxy server passwordnullSTRINGYesNo
client.bootstrap.configurationClient bootsrap configurations. Expected format of these parameters is as follows: "'client.bootstrap.nodelay:xxx','client.bootstrap.keepalive:xxx'"TODOSTRINGYesNo
client.bootstrap.nodelayHttp client no delay.trueBOOLYesNo
client.bootstrap.keepaliveHttp client keep alive.trueBOOLYesNo
client.bootstrap.sendbuffersizeHttp client send buffer size.1048576INTYesNo
client.bootstrap.recievebuffersizeHttp client receive buffer size.1048576INTYesNo
client.bootstrap.connect.timeoutHttp client connection timeout.15000INTYesNo
client.bootstrap.socket.reuseTo enable http socket reuse.falseBOOLYesNo
client.bootstrap.socket.timeoutHttp client socket timeout.15STRINGYesNo
client.threadpool.configurationsThread pool configuration. Expected format of these parameters is as follows: "'client.connection.pool.count:xxx','client.max.active.connections.per.pool:xxx'"TODOSTRINGYesNo
client.connection.pool.countConnection pool count.0INTYesNo
client.max.active.connections.per.poolActive connections per pool.-1INTYesNo
client.min.idle.connections.per.poolMinimum ideal connection per pool.0INTYesNo
client.max.idle.connections.per.poolMaximum ideal connection per pool.100INTYesNo
client.min.eviction.idle.timeMinimum eviction idle time.5 * 60 * 1000STRINGYesNo
sender.thread.countHttp sender thread count.20STRINGYesNo
event.group.executor.thread.sizeEvent group executor thread size.15STRINGYesNo
max.wait.for.client.connection.poolMaximum wait for client connection pool.60000STRINGYesNo
sink.idIdentifier of the sink. This is used to co-relate with the corresponding http-response source which needs to process the repose for the request sent by this sink.STRINGNoNo
downloading.enabledIf this is set to 'true' then the response received by the response source will be written to a file. If downloading is enabled, the download.path parameter is mandatory.falseBOOLYesNo
download.pathIf downloading is enabled, the path of the file which is going to be downloaded should be specified using 'download.path' parameter. This should be an absolute path including the file name.nullSTRINGYesYes
- -Examples -EXAMPLE 1 -``` -@sink(type='http-request', sink.id='foo', publisher.url='http://localhost:8009/foo', @map(type='xml', @payload('{{payloadBody}}'))) -define stream FooStream (payloadBody String, method string, headers string); -@source(type='http-response', sink.id='foo', http.status.code='2\\d+', -@map(type='text', regex.A='((.|\n)*)', @attributes(headers='trp:headers', fileName='A[1]'))) -define stream responseStream2xx(fileName string, headers string); - -@source(type='http-response', sink.id='foo', http.status.code='4\\d+', -@map(type='text', regex.A='((.|\n)*)', @attributes(errorMsg='A[1]'))) -define stream responseStream4xx(errorMsg string); -``` -

In above example, the payload body for 'FooStream' will be in following format.
{
<events>
    <event>
        <symbol>WSO2</symbol>
        <price>55.6</price>
        <volume>100</volume>
    </event>
</events>,
This message will sent as the body of a POST request with the content-type 'application/xml' to the endpoint defined as the 'publisher.url' and in order to process the responses for these requests, there should be a source of type 'http-response' defined with the same sink id 'foo' in the siddhi app.
The responses with 2xx status codes will be received by the http-response source which has the http.status.code defined by the regex '2\\d+'.
If the response has a 4xx status code, it will be received by the http-response source which has the http.status.code defined by the regex '4\\d+'.

- -EXAMPLE 2 -``` -define stream FooStream (name String, id int, headers String, downloadPath string); -@sink(type='http-request', -downloading.enabled='true', -download.path='{{downloadPath}}',publisher.url='http://localhost:8005/files', -method='GET', headers='{{headers}}',sink.id='download-sink', -@map(type='json')) -define stream BarStream (name String, id int, headers String, downloadPath string); - -@source(type='http-response', sink.id='download-sink', http.status.code='2\\d+', -@map(type='text', regex.A='((.|\n)*)', @attributes(headers='trp:headers', fileName='A[1]'))) -define stream responseStream2xx(fileName string, headers string); - -@source(type='http-response', sink.id='download-sink', http.status.code='4\\d+', -@map(type='text', regex.A='((.|\n)*)', @attributes(errorMsg='A[1]'))) -define stream responseStream4xx(errorMsg string); -``` -

In above example, http-request sink will send a GET request to the publisher url and the requested file will be received as the response by a corresponding http-response source.
If the http status code of the response is a successful one (2xx), it will be received by the http-response source which has the http.status.code '2\\d+' and downloaded as a local file. Then the event received to the responseStream2xx will have the headers included in the request and the downloaded file name.
If the http status code of the response is a 4xx code, it will be received by the http-response source which has the http.status.code '4\\d+'. Then the event received to the responseStream4xx will have the response message body in text format.

- -### http-response *(Sink)* - -

HTTP response sink is correlated with the The HTTP request source, through a unique source.id, and it send a response to the HTTP request source having the same source.id. The response message can be formatted in text, XML or JSON and can be sent with appropriate headers.

- -Syntax -``` -@sink(type="http-response", source.id="", message.id="", headers="", @map(...))) -``` - -QUERY PARAMETERS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
source.idIdentifier of the source.STRINGNoNo
message.idIdentifier of the message.STRINGNoYes
headersThe headers that should be included as HTTP response headers. There can be any number of headers concatenated on following format. "'header1:value1','header2:value2'" User can include content-type header if he/she need to have any specific type for payload. If not system get the mapping type as the content-Type header (ie.@map(xml):application/xml, @map(json):application/json, @map(text):plain/text) and if user does not include any mapping type then system gets the plain/text as default Content-Type header. If user does not include Content-Length header then system calculate the bytes size of payload and include it as content-length header. STRINGYesNo
- -Examples -EXAMPLE 1 -``` -@sink(type='http-response', source.id='sampleSourceId', message.id='{{messageId}}', headers="'content-type:json','content-length:94'"@map(type='json', @payload('{{payloadBody}}'))) -define stream FooStream (payloadBody String, messageId string, headers string); - -``` -

If it is json mapping expected input should be in following format for FooStream:
{
{"events":
    {"event":
        "symbol":WSO2,
        "price":55.6,
        "volume":100,
    }
},
0cf708b1-7eae-440b-a93e-e72f801b486a,
Content-Length:24#Content-Location:USA
}

Above event will generate response for the matching source message as below.

~Output http event payload
{"events":
    {"event":
        "symbol":WSO2,
        "price":55.6,
        "volume":100,
    }
}

~Output http event headers
Content-Length:24,
Content-Location:'USA',
Content-Type:'application/json'

- -## Source - -### http *(Source)* - -

The HTTP source receives POST requests via HTTP or HTTPS in format such as text, XML and JSON. In WSO2 SP, if required, you can enable basic authentication to ensure that events are received only from users who are authorized to access the service.

- -Syntax -``` -@source(type="http", receiver.url="", basic.auth.enabled="", worker.count="", socket.idle.timeout="", ssl.verify.client="", ssl.protocol="", tls.store.type="", parameters="", ciphers="", ssl.enabled.protocols="", server.enable.session.creation="", server.supported.snimatchers="", server.suported.server.names="", request.size.validation.configuration="", request.size.validation="", request.size.validation.maximum.value="", request.size.validation.reject.status.code="", request.size.validation.reject.message="", request.size.validation.reject.message.content.type="", header.size.validation="", header.validation.maximum.request.line="", header.validation.maximum.size="", header.validation.maximum.chunk.size="", header.validation.reject.status.code="", header.validation.reject.message="", header.validation.reject.message.content.type="", server.bootstrap.configuration="", server.bootstrap.nodelay="", server.bootstrap.keepalive="", server.bootstrap.sendbuffersize="", server.bootstrap.recievebuffersize="", server.bootstrap.connect.timeout="", server.bootstrap.socket.reuse="", server.bootstrap.socket.timeout="", server.bootstrap.socket.backlog="", trace.log.enabled="", @map(...))) -``` - -QUERY PARAMETERS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
receiver.urlThe URL to which the events should be received. User can provide any valid url and if the url is not provided the system will use the following format http://0.0.0.0:9763/<appNAme>/<streamName>If the user want to use SSL the url should be given in following format https://localhost:8080/<streamName>http://0.0.0.0:9763//STRINGYesNo
basic.auth.enabledThis works only in WSO2 SP. If this is set to true, basic authentication is enabled for incoming events, and the credentials with which each event is sent are verified to ensure that the user is authorized to access the service. If basic authentication fails, the event is not authenticated and an authentication error is logged in the CLI.falseSTRINGYesNo
worker.countThe number of active worker threads to serve the incoming events. The value is 1 by default. This will ensure that the events are directed to the event stream in the same order in which they arrive. By increasing this value the performance might increase at the cost of loosing event ordering.1INTYesNo
socket.idle.timeoutIdle timeout for HTTP connection.120000INTYesNo
ssl.verify.clientThe type of client certificate verification.nullSTRINGYesNo
ssl.protocolssl/tls related optionsTLSSTRINGYesNo
tls.store.typeTLS store type.JKSSTRINGYesNo
parametersParameters other than basics such as ciphers,sslEnabledProtocols,client.enable.session.creation. Expected format of these parameters is as follows: "'ciphers:xxx','sslEnabledProtocols,client.enable:xxx'"nullSTRINGYesNo
ciphersList of ciphers to be used. This parameter should include under parameters Ex: 'ciphers:TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256'nullSTRINGYesNo
ssl.enabled.protocolsSSL/TLS protocols to be enabled. This parameter should be in camel case format(sslEnabledProtocols) under parameters. Ex 'sslEnabledProtocols:true'nullSTRINGYesNo
server.enable.session.creationEnable HTTP session creation.This parameter should include under parameters Ex: 'client.enable.session.creation:true'nullSTRINGYesNo
server.supported.snimatchersHttp SNIMatcher to be added. This parameter should include under parameters Ex: 'server.supported.snimatchers:SNIMatcher'nullSTRINGYesNo
server.suported.server.namesHttp supported servers. This parameter should include under parameters Ex: 'server.suported.server.names:server'nullSTRINGYesNo
request.size.validation.configurationParameters that responsible for validating the http request and request headers. Expected format of these parameters is as follows: "'request.size.validation:xxx','request.size.validation.maximum.value:xxx'"nullSTRINGYesNo
request.size.validationTo enable the request size validation.falseSTRINGYesNo
request.size.validation.maximum.valueIf request size is validated then maximum size.Integer.MAX_VALUESTRINGYesNo
request.size.validation.reject.status.codeIf request is exceed maximum size and request.size.validation is enabled then status code to be send as response.401STRINGYesNo
request.size.validation.reject.messageIf request is exceed maximum size and request.size.validation is enabled then status message to be send as response.Message is bigger than the valid sizeSTRINGYesNo
request.size.validation.reject.message.content.typeIf request is exceed maximum size and request.size.validation is enabled then content type to be send as response.plain/textSTRINGYesNo
header.size.validationTo enable the header size validation.falseSTRINGYesNo
header.validation.maximum.request.lineIf header header validation is enabled then the maximum request line.4096STRINGYesNo
header.validation.maximum.sizeIf header header validation is enabled then the maximum expected header size.8192STRINGYesNo
header.validation.maximum.chunk.sizeIf header header validation is enabled then the maximum expected chunk size.8192STRINGYesNo
header.validation.reject.status.code401If header is exceed maximum size and header.size.validation is enabled then status code to be send as response.STRINGYesNo
header.validation.reject.messageIf header is exceed maximum size and header.size.validation is enabled then message to be send as response.Message header is bigger than the valid sizeSTRINGYesNo
header.validation.reject.message.content.typeIf header is exceed maximum size and header.size.validation is enabled then content type to be send as response.plain/textSTRINGYesNo
server.bootstrap.configurationParameters that for bootstrap configurations of the server. Expected format of these parameters is as follows: "'ciphers:xxx','sslEnabledProtocols,client.enable:xxx'"nullOBJECTYesNo
server.bootstrap.nodelayHttp server no delay.trueBOOLYesNo
server.bootstrap.keepaliveHttp server keep alive.trueBOOLYesNo
server.bootstrap.sendbuffersizeHttp server send buffer size.1048576INTYesNo
server.bootstrap.recievebuffersizeHttp server receive buffer size.1048576INTYesNo
server.bootstrap.connect.timeoutHttp server connection timeout.15000INTYesNo
server.bootstrap.socket.reuseTo enable http socket reuse.falseBOOLYesNo
server.bootstrap.socket.timeoutHttp server socket timeout.15BOOLYesNo
server.bootstrap.socket.backlogTHttp server socket backlog.100BOOLYesNo
trace.log.enabledHttp traffic monitoring.falseBOOLYesNo
- -System Parameters - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Parameters
serverBootstrapBossGroupSizeproperty to configure number of boss threads, which accepts incoming connections until the ports are unbound. Once connection accepts successfully, boss thread passes the accepted channel to one of the worker threads.Number of available processorsAny integer
serverBootstrapWorkerGroupSizeproperty to configure number of worker threads, which performs non blocking read and write for one or more channels in non-blocking mode.(Number of available processors)*2Any integer
serverBootstrapClientGroupSizeproperty to configure number of client threads, which performs non blocking read and write for one or more channels in non-blocking mode.(Number of available processors)*2Any integer
defaultHostThe default host of the transport.0.0.0.0Any valid host
defaultHttpPortThe default port if the default scheme is 'http'.8280Any valid port
defaultHttpsPortThe default port if the default scheme is 'https'.8243Any valid port
defaultSchemeThe default protocol.httphttp
https
keyStoreLocationThe default keystore file path.${carbon.home}/resources/security/wso2carbon.jksPath to wso2carbon.jks file
keyStorePasswordThe default keystore password.wso2carbonString of keystore password
certPasswordThe default cert password.wso2carbonString of cert password
- -Examples -EXAMPLE 1 -``` -@source(type='http', receiver.url='http://localhost:9055/endpoints/RecPro', socketIdleTimeout='150000', parameters="'ciphers : TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256', 'sslEnabledProtocols:TLSv1.1,TLSv1.2'",request.size.validation.configuration="request.size.validation:true",server.bootstrap.configuration="server.bootstrap.socket.timeout:25" @map(type='xml')) -define stream FooStream (symbol string, price float, volume long); - -``` -

Above source listenerConfiguration performs a default XML input mapping. The expected input is as follows:
<events>
    <event>
        <symbol>WSO2</symbol>
        <price>55.6</price>
        <volume>100</volume>
    </event>
</events>
If basic authentication is enabled via the basic.auth.enabled='true setting, each input event is also expected to contain the Authorization:'Basic encodeBase64(username:Password)' header.

- -### http-request *(Source)* - -

The HTTP request is correlated with the HTTP response sink, through a unique source.id, and for each POST requests it receives via HTTP or HTTPS in format such as text, XML and JSON it sends the response via the HTTP response sink. The individual request and response messages are correlated at the sink using the message.id of the events. If required, you can enable basic authentication at the source to ensure that events are received only from users who are authorized to access the service.

- -Syntax -``` -@source(type="http-request", receiver.url="", source.id="", connection.timeout="", basic.auth.enabled="", worker.count="", socket.idle.timeout="", ssl.verify.client="", ssl.protocol="", tls.store.type="", parameters="", ciphers="", ssl.enabled.protocols="", server.enable.session.creation="", server.supported.snimatchers="", server.suported.server.names="", request.size.validation.configuration="", request.size.validation="", request.size.validation.maximum.value="", request.size.validation.reject.status.code="", request.size.validation.reject.message="", request.size.validation.reject.message.content.type="", header.size.validation="", header.validation.maximum.request.line="", header.validation.maximum.size="", header.validation.maximum.chunk.size="", header.validation.reject.status.code="", header.validation.reject.message="", header.validation.reject.message.content.type="", server.bootstrap.configuration="", server.bootstrap.nodelay="", server.bootstrap.keepalive="", server.bootstrap.sendbuffersize="", server.bootstrap.recievebuffersize="", server.bootstrap.connect.timeout="", server.bootstrap.socket.reuse="", server.bootstrap.socket.timeout="", server.bootstrap.socket.backlog="", trace.log.enabled="", @map(...))) -``` - -QUERY PARAMETERS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
receiver.urlThe URL to which the events should be received. User can provide any valid url and if the url is not provided the system will use the following format http://0.0.0.0:9763/<appNAme>/<streamName>If the user want to use SSL the url should be given in following format https://localhost:8080/<streamName>http://0.0.0.0:9763//STRINGYesNo
source.idIdentifier need to map the source to sink.STRINGNoNo
connection.timeoutConnection timeout in milliseconds. If the mapped http-response sink does not get a correlated message, after this timeout value, a timeout response is sent120000INTYesNo
basic.auth.enabledIf this is set to true, basic authentication is enabled for incoming events, and the credentials with which each event is sent are verified to ensure that the user is authorized to access the service. If basic authentication fails, the event is not authenticated and an authentication error is logged in the CLI. By default this values 'false' falseSTRINGYesNo
worker.countThe number of active worker threads to serve the incoming events. The value is 1 by default. This will ensure that the events are directed to the event stream in the same order in which they arrive. By increasing this value the performance might increase at the cost of loosing event ordering.1INTYesNo
socket.idle.timeoutIdle timeout for HTTP connection.120000INTYesNo
ssl.verify.clientThe type of client certificate verification.nullSTRINGYesNo
ssl.protocolssl/tls related optionsTLSSTRINGYesNo
tls.store.typeTLS store type.JKSSTRINGYesNo
parametersParameters other than basics such as ciphers,sslEnabledProtocols,client.enable.session.creation. Expected format of these parameters is as follows: "'ciphers:xxx','sslEnabledProtocols,client.enable:xxx'"nullSTRINGYesNo
ciphersList of ciphers to be used. This parameter should include under parameters Ex: 'ciphers:TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256'nullSTRINGYesNo
ssl.enabled.protocolsSSL/TLS protocols to be enabled. This parameter should be in camel case format(sslEnabledProtocols) under parameters. Ex 'sslEnabledProtocols:true'nullSTRINGYesNo
server.enable.session.creationEnable HTTP session creation.This parameter should include under parameters Ex: 'client.enable.session.creation:true'nullSTRINGYesNo
server.supported.snimatchersHttp SNIMatcher to be added. This parameter should include under parameters Ex: 'server.supported.snimatchers:SNIMatcher'nullSTRINGYesNo
server.suported.server.namesHttp supported servers. This parameter should include under parameters Ex: 'server.suported.server.names:server'nullSTRINGYesNo
request.size.validation.configurationParameters that responsible for validating the http request and request headers. Expected format of these parameters is as follows: "'request.size.validation:xxx','request.size.validation.maximum.value:xxx'"nullSTRINGYesNo
request.size.validationTo enable the request size validation.falseSTRINGYesNo
request.size.validation.maximum.valueIf request size is validated then maximum size.Integer.MAX_VALUESTRINGYesNo
request.size.validation.reject.status.codeIf request is exceed maximum size and request.size.validation is enabled then status code to be send as response.401STRINGYesNo
request.size.validation.reject.messageIf request is exceed maximum size and request.size.validation is enabled then status message to be send as response.Message is bigger than the valid sizeSTRINGYesNo
request.size.validation.reject.message.content.typeIf request is exceed maximum size and request.size.validation is enabled then content type to be send as response.plain/textSTRINGYesNo
header.size.validationTo enable the header size validation.falseSTRINGYesNo
header.validation.maximum.request.lineIf header header validation is enabled then the maximum request line.4096STRINGYesNo
header.validation.maximum.sizeIf header header validation is enabled then the maximum expected header size.8192STRINGYesNo
header.validation.maximum.chunk.sizeIf header header validation is enabled then the maximum expected chunk size.8192STRINGYesNo
header.validation.reject.status.code401If header is exceed maximum size and header.size.validation is enabled then status code to be send as response.STRINGYesNo
header.validation.reject.messageIf header is exceed maximum size and header.size.validation is enabled then message to be send as response.Message header is bigger than the valid sizeSTRINGYesNo
header.validation.reject.message.content.typeIf header is exceed maximum size and header.size.validation is enabled then content type to be send as response.plain/textSTRINGYesNo
server.bootstrap.configurationParameters that for bootstrap configurations of the server. Expected format of these parameters is as follows: "'ciphers:xxx','sslEnabledProtocols,client.enable:xxx'"nullOBJECTYesNo
server.bootstrap.nodelayHttp server no delay.trueBOOLYesNo
server.bootstrap.keepaliveHttp server keep alive.trueBOOLYesNo
server.bootstrap.sendbuffersizeHttp server send buffer size.1048576INTYesNo
server.bootstrap.recievebuffersizeHttp server receive buffer size.1048576INTYesNo
server.bootstrap.connect.timeoutHttp server connection timeout.15000INTYesNo
server.bootstrap.socket.reuseTo enable http socket reuse.falseBOOLYesNo
server.bootstrap.socket.timeoutHttp server socket timeout.15BOOLYesNo
server.bootstrap.socket.backlogTHttp server socket backlog.100BOOLYesNo
trace.log.enabledHttp traffic monitoring.falseBOOLYesNo
- -System Parameters - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Parameters
serverBootstrapBossGroupSizeproperty to configure number of boss threads, which accepts incoming connections until the ports are unbound. Once connection accepts successfully, boss thread passes the accepted channel to one of the worker threads.Number of available processorsAny integer
serverBootstrapWorkerGroupSizeproperty to configure number of worker threads, which performs non blocking read and write for one or more channels in non-blocking mode.(Number of available processors)*2Any integer
serverBootstrapClientGroupSizeproperty to configure number of client threads, which performs non blocking read and write for one or more channels in non-blocking mode.(Number of available processors)*2Any integer
defaultHostThe default host of the transport.0.0.0.0Any valid host
defaultHttpPortThe default port if the default scheme is 'http'.8280Any valid port
defaultHttpsPortThe default port if the default scheme is 'https'.8243Any valid port
defaultSchemeThe default protocol.httphttp
https
keyStoreLocationThe default keystore file path.${carbon.home}/resources/security/wso2carbon.jksPath to wso2carbon.jks file
keyStorePasswordThe default keystore password.wso2carbonString of keystore password
certPasswordThe default cert password.wso2carbonString of cert password
- -Examples -EXAMPLE 1 -``` -@source(type='http-request', source.id='sampleSourceId, receiver.url='http://localhost:9055/endpoints/RecPro', connection.timeout='150000', parameters="'ciphers : TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256', 'sslEnabledProtocols:TLSv1.1,TLSv1.2'", request.size.validation.configuration="request.size.validation:true", server.bootstrap.configuration="server.bootstrap.socket.timeout:25", @map(type='json, @attributes(messageId='trp:messageId', symbol='$.events.event.symbol', price='$.events.event.price', volume='$.events.event.volume'))) -define stream FooStream (messageId string, symbol string, price float, volume long); - -``` -

The expected input is as follows:
{"events":
    {"event":
        "symbol":WSO2,
        "price":55.6,
        "volume":100,
    }
}
If basic authentication is enabled via the basic.auth.enabled='true setting, each input event is also expected to contain the Authorization:'Basic encodeBase64(username:Password)' header.

- -### http-response *(Source)* - -

The http-response source co-relates with http-request sink with the parameter 'sink.id'.
This receives responses for the requests sent by the http-request sink which has the same sink id.
Response messages can be in formats such as TEXT, JSON and XML.
In order to handle the responses with different http status codes, user is allowed to defined the acceptable response source code using the parameter 'http.status.code'

- -Syntax -``` -@source(type="http-response", sink.id="", http.status.code="", allow.streaming.responses="", @map(...))) -``` - -QUERY PARAMETERS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
sink.idThis parameter is used to map the http-response source to a http-request sink. Then this source will accepts the response messages for the requests sent by corresponding http-request sink.STRINGNoNo
http.status.codeAcceptable http status code for the responses.
This can be a complete string or a regex.
Only the responses with matching status codes to the defined value, will be received by the http-response source.
Eg: 'http.status.code = '200', http.status.code = '2\\d+''
200STRINGYesNo
allow.streaming.responsesIf responses can be received multiple times for a single request, this option should be enabled. If this is not enabled, for every request, response will be extracted only once.falseBOOLYesNo
- -Examples -EXAMPLE 1 -``` -@sink(type='http-request', -downloading.enabled='true', -publisher.url='http://localhost:8005/registry/employee', -method='POST', headers='{{headers}}',sink.id='employee-info', -@map(type='json')) -define stream BarStream (name String, id int, headers String, downloadPath string); - -@source(type='http-response' , sink.id='employee-info', http.status.code='2\\d+', -@map(type='text', regex.A='((.|\n)*)', @attributes(message='A[1]'))) -define stream responseStream2xx(message string);@source(type='http-response' , sink.id='employee-info', http.status.code='4\\d+' , -@map(type='text', regex.A='((.|\n)*)', @attributes(message='A[1]'))) -define stream responseStream4xx(message string); -``` -

In above example, the defined http-request sink will send a POST requests to the endpoint defined by 'publisher.url'.
Then for those requests, the source with the response code '2\\d+' and sink.id 'employee-info' will receive the responses with 2xx status codes.
The http-response source which has 'employee-info' as the 'sink.id' and '4\\d+' as the http.response.code will receive all the responses with 4xx status codes.
. Then the body of the response message will be extracted using text mapper and converted into siddhi events.
.

- diff --git a/docs/api/1.0.44.md b/docs/api/1.0.44.md deleted file mode 100644 index c804e735..00000000 --- a/docs/api/1.0.44.md +++ /dev/null @@ -1,1761 +0,0 @@ -# API Docs - v1.0.44 - -## Sink - -### http *(Sink)* - -

This extension publish the HTTP events in any HTTP method POST, GET, PUT, DELETE via HTTP or https protocols. As the additional features this component can provide basic authentication as well as user can publish events using custom client truststore files when publishing events via https protocol. And also user can add any number of headers including HTTP_METHOD header for each event dynamically.
Following content types will be set by default according to the type of sink mapper used.
You can override them by setting the new content types in headers.
     - TEXT : text/plain
     - XML : application/xml
     - JSON : application/json
     - KEYVALUE : application/x-www-form-urlencoded

- -Syntax -``` -@sink(type="http", publisher.url="", basic.auth.username="", basic.auth.password="", https.truststore.file="", https.truststore.password="", headers="", method="", socket.idle.timeout="", chunk.disabled="", ssl.protocol="", parameters="", ciphers="", ssl.enabled.protocols="", client.enable.session.creation="", follow.redirect="", max.redirect.count="", tls.store.type="", proxy.host="", proxy.port="", proxy.username="", proxy.password="", client.bootstrap.configuration="", client.bootstrap.nodelay="", client.bootstrap.keepalive="", client.bootstrap.sendbuffersize="", client.bootstrap.recievebuffersize="", client.bootstrap.connect.timeout="", client.bootstrap.socket.reuse="", client.bootstrap.socket.timeout="", client.threadpool.configurations="", client.connection.pool.count="", client.max.active.connections.per.pool="", client.min.idle.connections.per.pool="", client.max.idle.connections.per.pool="", client.min.eviction.idle.time="", sender.thread.count="", event.group.executor.thread.size="", max.wait.for.client.connection.pool="", oauth.username="", oauth.password="", consumer.key="", consumer.secret="", refresh.token="", token.url="", @map(...))) -``` - -QUERY PARAMETERS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
publisher.urlThe URL to which the outgoing events should be published via HTTP. This is a mandatory parameter and if this is not specified, an error is logged in the CLI. If user wants to enable SSL for the events, use https instead of http in the publisher.url.e.g., http://localhost:8080/endpoint, https://localhost:8080/endpointSTRINGNoNo
basic.auth.usernameThe username to be included in the authentication header of the basic authentication enabled events. It is required to specify both username and password to enable basic authentication. If one of the parameter is not given by user then an error is logged in the CLI. STRINGYesNo
basic.auth.passwordThe password to include in the authentication header of the basic authentication enabled events. It is required to specify both username and password to enable basic authentication. If one of the parameter is not given by user then an error is logged in the CLI. STRINGYesNo
https.truststore.fileThe file path to the location of the truststore of the client that sends the HTTP events through 'https' protocol. A custom client-truststore can be specified if required.${carbon.home}/resources/security/client-truststore.jksSTRINGYesNo
https.truststore.passwordThe password for the client-truststore. A custom password can be specified if required. If no custom password is specified and the protocol of URL is 'https' then, the system uses default password.wso2carbonSTRINGYesNo
headersThe headers that should be included as HTTP request headers.
There can be any number of headers concatenated in following format. "'header1:value1','header2:value2'". User can include Content-Type header if he needs to use a specific content-type for the payload. Or else, system decides the Content-Type by considering the type of sink mapper, in following way.
 - @map(xml):application/xml
 - @map(json):application/json
 - @map(text):plain/text )
 - if user does not include any mapping type then the system gets 'plain/text' as default Content-Type header.
Note that providing content-length as a header is not supported. The size of the payload will be automatically calculated and included in the content-length header.
STRINGYesNo
methodFor HTTP events, HTTP_METHOD header should be included as a request header. If the parameter is null then system uses 'POST' as a default header.POSTSTRINGYesNo
socket.idle.timeoutSocket timeout value in millisecond6000INTYesNo
chunk.disabledThis parameter is used to disable/enable chunked transfer encodingfalseBOOLYesNo
ssl.protocolThe SSL protocol versionTLSSTRINGYesNo
parametersParameters other than basics such as ciphers,sslEnabledProtocols,client.enable.session.creation. Expected format of these parameters is as follows: "'ciphers:xxx','sslEnabledProtocols,client.enable:xxx'"nullSTRINGYesNo
ciphersList of ciphers to be used. This parameter should include under parameters Ex: 'ciphers:TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256'nullSTRINGYesNo
ssl.enabled.protocolsSSL/TLS protocols to be enabled. This parameter should be in camel case format(sslEnabledProtocols) under parameters. Ex 'sslEnabledProtocols:true'nullSTRINGYesNo
client.enable.session.creationEnable HTTP session creation.This parameter should include under parameters Ex: 'client.enable.session.creation:true'nullSTRINGYesNo
follow.redirectRedirect related enabled.trueBOOLYesNo
max.redirect.countMaximum redirect count.5INTYesNo
tls.store.typeTLS store type to be used.JKSSTRINGYesNo
proxy.hostProxy server hostnullSTRINGYesNo
proxy.portProxy server portnullSTRINGYesNo
proxy.usernameProxy server usernamenullSTRINGYesNo
proxy.passwordProxy server passwordnullSTRINGYesNo
client.bootstrap.configurationClient bootsrap configurations. Expected format of these parameters is as follows: "'client.bootstrap.nodelay:xxx','client.bootstrap.keepalive:xxx'"TODOSTRINGYesNo
client.bootstrap.nodelayHttp client no delay.trueBOOLYesNo
client.bootstrap.keepaliveHttp client keep alive.trueBOOLYesNo
client.bootstrap.sendbuffersizeHttp client send buffer size.1048576INTYesNo
client.bootstrap.recievebuffersizeHttp client receive buffer size.1048576INTYesNo
client.bootstrap.connect.timeoutHttp client connection timeout.15000INTYesNo
client.bootstrap.socket.reuseTo enable http socket reuse.falseBOOLYesNo
client.bootstrap.socket.timeoutHttp client socket timeout.15STRINGYesNo
client.threadpool.configurationsThread pool configuration. Expected format of these parameters is as follows: "'client.connection.pool.count:xxx','client.max.active.connections.per.pool:xxx'"TODOSTRINGYesNo
client.connection.pool.countConnection pool count.0INTYesNo
client.max.active.connections.per.poolActive connections per pool.-1INTYesNo
client.min.idle.connections.per.poolMinimum ideal connection per pool.0INTYesNo
client.max.idle.connections.per.poolMaximum ideal connection per pool.100INTYesNo
client.min.eviction.idle.timeMinimum eviction idle time.5 * 60 * 1000STRINGYesNo
sender.thread.countHttp sender thread count.20STRINGYesNo
event.group.executor.thread.sizeEvent group executor thread size.15STRINGYesNo
max.wait.for.client.connection.poolMaximum wait for client connection pool.60000STRINGYesNo
oauth.usernameThe username to be included in the authentication header of the oauth authentication enabled events. It is required to specify both username and password to enable oauth authentication. If one of the parameter is not given by user then an error is logged in the CLI. It is only applicable for for Oauth requests STRINGYesNo
oauth.passwordThe password to be included in the authentication header of the oauth authentication enabled events. It is required to specify both username and password to enable oauth authentication. If one of the parameter is not given by user then an error is logged in the CLI. It is only applicable for for Oauth requests STRINGYesNo
consumer.keyconsumer key for the Http request. It is only applicable for for Oauth requests STRINGYesNo
consumer.secretconsumer secret for the Http request. It is only applicable for for Oauth requests STRINGYesNo
refresh.tokenrefresh token for the Http request. It is only applicable for for Oauth requests STRINGYesNo
token.urltoken url for generate a new access token. It is only applicable for for Oauth requests STRINGYesNo
- -System Parameters - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Parameters
clientBootstrapBossGroupSizeproperty to configure number of boss threads, which accepts incoming connections until the ports are unbound. Once connection accepts successfully, boss thread passes the accepted channel to one of the worker threads.Number of available processorsAny integer
clientBootstrapWorkerGroupSizeproperty to configure number of worker threads, which performs non blocking read and write for one or more channels in non-blocking mode.(Number of available processors)*2Any integer
clientBootstrapClientGroupSizeproperty to configure number of client threads, which performs non blocking read and write for one or more channels in non-blocking mode.(Number of available processors)*2Any integer
trustStoreLocationThe default truststore file path.${carbon.home}/resources/security/client-truststore.jksPath to client-truststore.jks
trustStorePasswordThe default truststore password.wso2carbonTruststore password
- -Examples -EXAMPLE 1 -``` -@sink(type='http',publisher.url='http://localhost:8009/foo', method='{{method}}',headers="'content-type:xml','content-length:94'", client.bootstrap.configuration="'client.bootstrap.socket.timeout:20', 'client.bootstrap.worker.group.size:10'", client.pool.configuration="'client.connection.pool.count:10','client.max.active.connections.per.pool:1'", @map(type='xml', @payload('{{payloadBody}}'))) -define stream FooStream (payloadBody String, method string, headers string); - -``` -

If it is xml mapping expected input should be in following format for FooStream:
{
<events>
    <event>
        <symbol>WSO2</symbol>
        <price>55.6</price>
        <volume>100</volume>
    </event>
</events>,
POST,
Content-Length:24#Content-Location:USA#Retry-After:120
}

Above event will generate output as below.
~Output http event payload
<events>
    <event>
        <symbol>WSO2</symbol>
        <price>55.6</price>
        <volume>100</volume>
    </event>
</events>

~Output http event headers
Content-Length:24,
Content-Location:'USA',
Retry-After:120,
Content-Type:'application/xml',
HTTP_METHOD:'POST',

~Output http event properties
HTTP_METHOD:'POST',
HOST:'localhost',
PORT:8009,
PROTOCOL:'http',
TO:'/foo'

- -### http-request *(Sink)* - -

This extension publish the HTTP events in any HTTP method POST, GET, PUT, DELETE via HTTP or https protocols. As the additional features this component can provide basic authentication as well as user can publish events using custom client truststore files when publishing events via https protocol. And also user can add any number of headers including HTTP_METHOD header for each event dynamically.
Following content types will be set by default according to the type of sink mapper used.
You can override them by setting the new content types in headers.
     - TEXT : text/plain
     - XML : application/xml
     - JSON : application/json
     - KEYVALUE : application/x-www-form-urlencoded

HTTP request sink is correlated with the The HTTP reponse source, through a unique sink.id.It sends the request to the defined url and the response is received by the response source which has the same 'sink.id'.

- -Syntax -``` -@sink(type="http-request", publisher.url="", basic.auth.username="", basic.auth.password="", https.truststore.file="", https.truststore.password="", headers="", method="", socket.idle.timeout="", chunk.disabled="", ssl.protocol="", parameters="", ciphers="", ssl.enabled.protocols="", client.enable.session.creation="", follow.redirect="", max.redirect.count="", tls.store.type="", proxy.host="", proxy.port="", proxy.username="", proxy.password="", client.bootstrap.configuration="", client.bootstrap.nodelay="", client.bootstrap.keepalive="", client.bootstrap.sendbuffersize="", client.bootstrap.recievebuffersize="", client.bootstrap.connect.timeout="", client.bootstrap.socket.reuse="", client.bootstrap.socket.timeout="", client.threadpool.configurations="", client.connection.pool.count="", client.max.active.connections.per.pool="", client.min.idle.connections.per.pool="", client.max.idle.connections.per.pool="", client.min.eviction.idle.time="", sender.thread.count="", event.group.executor.thread.size="", max.wait.for.client.connection.pool="", sink.id="", downloading.enabled="", download.path="", oauth.username="", oauth.password="", consumer.key="", consumer.secret="", refresh.token="", @map(...))) -``` - -QUERY PARAMETERS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
publisher.urlThe URL to which the outgoing events should be published via HTTP. This is a mandatory parameter and if this is not specified, an error is logged in the CLI. If user wants to enable SSL for the events, use https instead of http in the publisher.url.
e.g., http://localhost:8080/endpoint, https://localhost:8080/endpoint
This can be used as a dynamic parameter as well.
STRINGNoYes
basic.auth.usernameThe username to be included in the authentication header of the basic authentication enabled events. It is required to specify both username and password to enable basic authentication. If one of the parameter is not given by user then an error is logged in the CLI. STRINGYesNo
basic.auth.passwordThe password to include in the authentication header of the basic authentication enabled events. It is required to specify both username and password to enable basic authentication. If one of the parameter is not given by user then an error is logged in the CLI. STRINGYesNo
https.truststore.fileThe file path to the location of the truststore of the client that sends the HTTP events through 'https' protocol. A custom client-truststore can be specified if required.${carbon.home}/resources/security/client-truststore.jksSTRINGYesNo
https.truststore.passwordThe password for the client-truststore. A custom password can be specified if required. If no custom password is specified and the protocol of URL is 'https' then, the system uses default password.wso2carbonSTRINGYesNo
headersThe headers that should be included as HTTP request headers.
There can be any number of headers concatenated in following format. "'header1:value1','header2:value2'". User can include Content-Type header if he needs to use a specific content-type for the payload. Or else, system decides the Content-Type by considering the type of sink mapper, in following way.
 - @map(xml):application/xml
 - @map(json):application/json
 - @map(text):plain/text )
 - if user does not include any mapping type then the system gets 'plain/text' as default Content-Type header.
Note that providing content-length as a header is not supported. The size of the payload will be automatically calculated and included in the content-length header.
STRINGYesNo
methodFor HTTP events, HTTP_METHOD header should be included as a request header. If the parameter is null then system uses 'POST' as a default header.POSTSTRINGYesNo
socket.idle.timeoutSocket timeout value in millisecond6000INTYesNo
chunk.disabledport: Port number of the remote servicefalseBOOLYesNo
ssl.protocolThe SSL protocol versionTLSSTRINGYesNo
parametersParameters other than basics such as ciphers,sslEnabledProtocols,client.enable.session.creation. Expected format of these parameters is as follows: "'ciphers:xxx','sslEnabledProtocols,client.enable:xxx'"nullSTRINGYesNo
ciphersList of ciphers to be used. This parameter should include under parameters Ex: 'ciphers:TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256'nullSTRINGYesNo
ssl.enabled.protocolsSSL/TLS protocols to be enabled. This parameter should be in camel case format(sslEnabledProtocols) under parameters. Ex 'sslEnabledProtocols:true'nullSTRINGYesNo
client.enable.session.creationEnable HTTP session creation.This parameter should include under parameters Ex: 'client.enable.session.creation:true'nullSTRINGYesNo
follow.redirectRedirect related enabled.trueBOOLYesNo
max.redirect.countMaximum redirect count.5INTYesNo
tls.store.typeTLS store type to be used.JKSSTRINGYesNo
proxy.hostProxy server hostnullSTRINGYesNo
proxy.portProxy server portnullSTRINGYesNo
proxy.usernameProxy server usernamenullSTRINGYesNo
proxy.passwordProxy server passwordnullSTRINGYesNo
client.bootstrap.configurationClient bootsrap configurations. Expected format of these parameters is as follows: "'client.bootstrap.nodelay:xxx','client.bootstrap.keepalive:xxx'"TODOSTRINGYesNo
client.bootstrap.nodelayHttp client no delay.trueBOOLYesNo
client.bootstrap.keepaliveHttp client keep alive.trueBOOLYesNo
client.bootstrap.sendbuffersizeHttp client send buffer size.1048576INTYesNo
client.bootstrap.recievebuffersizeHttp client receive buffer size.1048576INTYesNo
client.bootstrap.connect.timeoutHttp client connection timeout.15000INTYesNo
client.bootstrap.socket.reuseTo enable http socket reuse.falseBOOLYesNo
client.bootstrap.socket.timeoutHttp client socket timeout.15STRINGYesNo
client.threadpool.configurationsThread pool configuration. Expected format of these parameters is as follows: "'client.connection.pool.count:xxx','client.max.active.connections.per.pool:xxx'"TODOSTRINGYesNo
client.connection.pool.countConnection pool count.0INTYesNo
client.max.active.connections.per.poolActive connections per pool.-1INTYesNo
client.min.idle.connections.per.poolMinimum ideal connection per pool.0INTYesNo
client.max.idle.connections.per.poolMaximum ideal connection per pool.100INTYesNo
client.min.eviction.idle.timeMinimum eviction idle time.5 * 60 * 1000STRINGYesNo
sender.thread.countHttp sender thread count.20STRINGYesNo
event.group.executor.thread.sizeEvent group executor thread size.15STRINGYesNo
max.wait.for.client.connection.poolMaximum wait for client connection pool.60000STRINGYesNo
sink.idIdentifier of the sink. This is used to co-relate with the corresponding http-response source which needs to process the repose for the request sent by this sink.STRINGNoNo
downloading.enabledIf this is set to 'true' then the response received by the response source will be written to a file. If downloading is enabled, the download.path parameter is mandatory.falseBOOLYesNo
download.pathIf downloading is enabled, the path of the file which is going to be downloaded should be specified using 'download.path' parameter. This should be an absolute path including the file name.nullSTRINGYesYes
oauth.usernameThe username to be included in the authentication header of the oauth authentication enabled events. It is required to specify both username and password to enable oauth authentication. If one of the parameter is not given by user then an error is logged in the CLI. It is only applicable for for Oauth requests STRINGYesNo
oauth.passwordThe password to be included in the authentication header of the oauth authentication enabled events. It is required to specify both username and password to enable oauth authentication. If one of the parameter is not given by user then an error is logged in the CLI. It is only applicable for for Oauth requests STRINGYesNo
consumer.keyconsumer key for the Http request. It is only applicable for for Oauth requests STRINGYesNo
consumer.secretconsumer secret for the Http request. It is only applicable for for Oauth requests STRINGYesNo
refresh.tokenrefresh token for the Http request. It is only applicable for for Oauth requests STRINGYesNo
- -Examples -EXAMPLE 1 -``` -@sink(type='http-request', sink.id='foo', publisher.url='http://localhost:8009/foo', @map(type='xml', @payload('{{payloadBody}}'))) -define stream FooStream (payloadBody String, method string, headers string); -@source(type='http-response', sink.id='foo', http.status.code='2\\d+', -@map(type='text', regex.A='((.|\n)*)', @attributes(headers='trp:headers', fileName='A[1]'))) -define stream responseStream2xx(fileName string, headers string); - -@source(type='http-response', sink.id='foo', http.status.code='4\\d+', -@map(type='text', regex.A='((.|\n)*)', @attributes(errorMsg='A[1]'))) -define stream responseStream4xx(errorMsg string); -``` -

In above example, the payload body for 'FooStream' will be in following format.
{
<events>
    <event>
        <symbol>WSO2</symbol>
        <price>55.6</price>
        <volume>100</volume>
    </event>
</events>,
This message will sent as the body of a POST request with the content-type 'application/xml' to the endpoint defined as the 'publisher.url' and in order to process the responses for these requests, there should be a source of type 'http-response' defined with the same sink id 'foo' in the siddhi app.
 The responses with 2xx status codes will be received by the http-response source which has the http.status.code defined by the regex '2\\d+'.
If the response has a 4xx status code, it will be received by the http-response source which has the http.status.code defined by the regex '4\\d+'.

- -EXAMPLE 2 -``` -define stream FooStream (name String, id int, headers String, downloadPath string); -@sink(type='http-request', -downloading.enabled='true', -download.path='{{downloadPath}}',publisher.url='http://localhost:8005/files', -method='GET', headers='{{headers}}',sink.id='download-sink', -@map(type='json')) -define stream BarStream (name String, id int, headers String, downloadPath string); - -@source(type='http-response', sink.id='download-sink', http.status.code='2\\d+', -@map(type='text', regex.A='((.|\n)*)', @attributes(headers='trp:headers', fileName='A[1]'))) -define stream responseStream2xx(fileName string, headers string); - -@source(type='http-response', sink.id='download-sink', http.status.code='4\\d+', -@map(type='text', regex.A='((.|\n)*)', @attributes(errorMsg='A[1]'))) -define stream responseStream4xx(errorMsg string); -``` -

In above example, http-request sink will send a GET request to the publisher url and the requested file will be received as the response by a corresponding http-response source.
If the http status code of the response is a successful one (2xx), it will be received by the http-response source which has the http.status.code '2\\d+' and downloaded as a local file. Then the event received to the responseStream2xx will have the headers included in the request and the downloaded file name.
If the http status code of the response is a 4xx code, it will be received by the http-response source which has the http.status.code '4\\d+'. Then the event received to the responseStream4xx will have the response message body in text format.

- -### http-response *(Sink)* - -

HTTP response sink is correlated with the The HTTP request source, through a unique source.id, and it send a response to the HTTP request source having the same source.id. The response message can be formatted in text, XML or JSON and can be sent with appropriate headers.

- -Syntax -``` -@sink(type="http-response", source.id="", message.id="", headers="", @map(...))) -``` - -QUERY PARAMETERS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
source.idIdentifier of the source.STRINGNoNo
message.idIdentifier of the message.STRINGNoYes
headersThe headers that should be included as HTTP response headers. There can be any number of headers concatenated on following format. "'header1:value1','header2:value2'" User can include content-type header if he/she need to have any specific type for payload. If not system get the mapping type as the content-Type header (ie.@map(xml):application/xml, @map(json):application/json, @map(text):plain/text) and if user does not include any mapping type then system gets the plain/text as default Content-Type header. If user does not include Content-Length header then system calculate the bytes size of payload and include it as content-length header. STRINGYesNo
- -Examples -EXAMPLE 1 -``` -@sink(type='http-response', source.id='sampleSourceId', message.id='{{messageId}}', headers="'content-type:json','content-length:94'"@map(type='json', @payload('{{payloadBody}}'))) -define stream FooStream (payloadBody String, messageId string, headers string); - -``` -

If it is json mapping expected input should be in following format for FooStream:
{
{"events":
    {"event":
        "symbol":WSO2,
        "price":55.6,
        "volume":100,
    }
},
0cf708b1-7eae-440b-a93e-e72f801b486a,
Content-Length:24#Content-Location:USA
}

Above event will generate response for the matching source message as below.

~Output http event payload
{"events":
    {"event":
        "symbol":WSO2,
        "price":55.6,
        "volume":100,
    }
}

~Output http event headers
Content-Length:24,
Content-Location:'USA',
Content-Type:'application/json'

- -## Source - -### http *(Source)* - -

The HTTP source receives POST requests via HTTP or HTTPS in format such as text, XML and JSON. In WSO2 SP, if required, you can enable basic authentication to ensure that events are received only from users who are authorized to access the service.

- -Syntax -``` -@source(type="http", receiver.url="", basic.auth.enabled="", worker.count="", socket.idle.timeout="", ssl.verify.client="", ssl.protocol="", tls.store.type="", parameters="", ciphers="", ssl.enabled.protocols="", server.enable.session.creation="", server.supported.snimatchers="", server.suported.server.names="", request.size.validation.configuration="", request.size.validation="", request.size.validation.maximum.value="", request.size.validation.reject.status.code="", request.size.validation.reject.message="", request.size.validation.reject.message.content.type="", header.size.validation="", header.validation.maximum.request.line="", header.validation.maximum.size="", header.validation.maximum.chunk.size="", header.validation.reject.status.code="", header.validation.reject.message="", header.validation.reject.message.content.type="", server.bootstrap.configuration="", server.bootstrap.nodelay="", server.bootstrap.keepalive="", server.bootstrap.sendbuffersize="", server.bootstrap.recievebuffersize="", server.bootstrap.connect.timeout="", server.bootstrap.socket.reuse="", server.bootstrap.socket.timeout="", server.bootstrap.socket.backlog="", trace.log.enabled="", @map(...))) -``` - -QUERY PARAMETERS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
receiver.urlThe URL to which the events should be received. User can provide any valid url and if the url is not provided the system will use the following format http://0.0.0.0:9763/<appNAme>/<streamName>If the user want to use SSL the url should be given in following format https://localhost:8080/<streamName>http://0.0.0.0:9763//STRINGYesNo
basic.auth.enabledThis works only in WSO2 SP. If this is set to true, basic authentication is enabled for incoming events, and the credentials with which each event is sent are verified to ensure that the user is authorized to access the service. If basic authentication fails, the event is not authenticated and an authentication error is logged in the CLI.falseSTRINGYesNo
worker.countThe number of active worker threads to serve the incoming events. The value is 1 by default. This will ensure that the events are directed to the event stream in the same order in which they arrive. By increasing this value the performance might increase at the cost of loosing event ordering.1INTYesNo
socket.idle.timeoutIdle timeout for HTTP connection.120000INTYesNo
ssl.verify.clientThe type of client certificate verification.nullSTRINGYesNo
ssl.protocolssl/tls related optionsTLSSTRINGYesNo
tls.store.typeTLS store type.JKSSTRINGYesNo
parametersParameters other than basics such as ciphers,sslEnabledProtocols,client.enable.session.creation. Expected format of these parameters is as follows: "'ciphers:xxx','sslEnabledProtocols,client.enable:xxx'"nullSTRINGYesNo
ciphersList of ciphers to be used. This parameter should include under parameters Ex: 'ciphers:TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256'nullSTRINGYesNo
ssl.enabled.protocolsSSL/TLS protocols to be enabled. This parameter should be in camel case format(sslEnabledProtocols) under parameters. Ex 'sslEnabledProtocols:true'nullSTRINGYesNo
server.enable.session.creationEnable HTTP session creation.This parameter should include under parameters Ex: 'client.enable.session.creation:true'nullSTRINGYesNo
server.supported.snimatchersHttp SNIMatcher to be added. This parameter should include under parameters Ex: 'server.supported.snimatchers:SNIMatcher'nullSTRINGYesNo
server.suported.server.namesHttp supported servers. This parameter should include under parameters Ex: 'server.suported.server.names:server'nullSTRINGYesNo
request.size.validation.configurationParameters that responsible for validating the http request and request headers. Expected format of these parameters is as follows: "'request.size.validation:xxx','request.size.validation.maximum.value:xxx'"nullSTRINGYesNo
request.size.validationTo enable the request size validation.falseSTRINGYesNo
request.size.validation.maximum.valueIf request size is validated then maximum size.Integer.MAX_VALUESTRINGYesNo
request.size.validation.reject.status.codeIf request is exceed maximum size and request.size.validation is enabled then status code to be send as response.401STRINGYesNo
request.size.validation.reject.messageIf request is exceed maximum size and request.size.validation is enabled then status message to be send as response.Message is bigger than the valid sizeSTRINGYesNo
request.size.validation.reject.message.content.typeIf request is exceed maximum size and request.size.validation is enabled then content type to be send as response.plain/textSTRINGYesNo
header.size.validationTo enable the header size validation.falseSTRINGYesNo
header.validation.maximum.request.lineIf header header validation is enabled then the maximum request line.4096STRINGYesNo
header.validation.maximum.sizeIf header header validation is enabled then the maximum expected header size.8192STRINGYesNo
header.validation.maximum.chunk.sizeIf header header validation is enabled then the maximum expected chunk size.8192STRINGYesNo
header.validation.reject.status.code401If header is exceed maximum size and header.size.validation is enabled then status code to be send as response.STRINGYesNo
header.validation.reject.messageIf header is exceed maximum size and header.size.validation is enabled then message to be send as response.Message header is bigger than the valid sizeSTRINGYesNo
header.validation.reject.message.content.typeIf header is exceed maximum size and header.size.validation is enabled then content type to be send as response.plain/textSTRINGYesNo
server.bootstrap.configurationParameters that for bootstrap configurations of the server. Expected format of these parameters is as follows: "'ciphers:xxx','sslEnabledProtocols,client.enable:xxx'"nullOBJECTYesNo
server.bootstrap.nodelayHttp server no delay.trueBOOLYesNo
server.bootstrap.keepaliveHttp server keep alive.trueBOOLYesNo
server.bootstrap.sendbuffersizeHttp server send buffer size.1048576INTYesNo
server.bootstrap.recievebuffersizeHttp server receive buffer size.1048576INTYesNo
server.bootstrap.connect.timeoutHttp server connection timeout.15000INTYesNo
server.bootstrap.socket.reuseTo enable http socket reuse.falseBOOLYesNo
server.bootstrap.socket.timeoutHttp server socket timeout.15BOOLYesNo
server.bootstrap.socket.backlogTHttp server socket backlog.100BOOLYesNo
trace.log.enabledHttp traffic monitoring.falseBOOLYesNo
- -System Parameters - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Parameters
serverBootstrapBossGroupSizeproperty to configure number of boss threads, which accepts incoming connections until the ports are unbound. Once connection accepts successfully, boss thread passes the accepted channel to one of the worker threads.Number of available processorsAny integer
serverBootstrapWorkerGroupSizeproperty to configure number of worker threads, which performs non blocking read and write for one or more channels in non-blocking mode.(Number of available processors)*2Any integer
serverBootstrapClientGroupSizeproperty to configure number of client threads, which performs non blocking read and write for one or more channels in non-blocking mode.(Number of available processors)*2Any integer
defaultHostThe default host of the transport.0.0.0.0Any valid host
defaultHttpPortThe default port if the default scheme is 'http'.8280Any valid port
defaultHttpsPortThe default port if the default scheme is 'https'.8243Any valid port
defaultSchemeThe default protocol.httphttp
https
keyStoreLocationThe default keystore file path.${carbon.home}/resources/security/wso2carbon.jksPath to wso2carbon.jks file
keyStorePasswordThe default keystore password.wso2carbonString of keystore password
certPasswordThe default cert password.wso2carbonString of cert password
- -Examples -EXAMPLE 1 -``` -@source(type='http', receiver.url='http://localhost:9055/endpoints/RecPro', socketIdleTimeout='150000', parameters="'ciphers : TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256', 'sslEnabledProtocols:TLSv1.1,TLSv1.2'",request.size.validation.configuration="request.size.validation:true",server.bootstrap.configuration="server.bootstrap.socket.timeout:25" @map(type='xml')) -define stream FooStream (symbol string, price float, volume long); - -``` -

Above source listenerConfiguration performs a default XML input mapping. The expected input is as follows:
<events>
    <event>
        <symbol>WSO2</symbol>
        <price>55.6</price>
        <volume>100</volume>
    </event>
</events>
If basic authentication is enabled via the basic.auth.enabled='true setting, each input event is also expected to contain the Authorization:'Basic encodeBase64(username:Password)' header.

- -### http-request *(Source)* - -

The HTTP request is correlated with the HTTP response sink, through a unique source.id, and for each POST requests it receives via HTTP or HTTPS in format such as text, XML and JSON it sends the response via the HTTP response sink. The individual request and response messages are correlated at the sink using the message.id of the events. If required, you can enable basic authentication at the source to ensure that events are received only from users who are authorized to access the service.

- -Syntax -``` -@source(type="http-request", receiver.url="", source.id="", connection.timeout="", basic.auth.enabled="", worker.count="", socket.idle.timeout="", ssl.verify.client="", ssl.protocol="", tls.store.type="", parameters="", ciphers="", ssl.enabled.protocols="", server.enable.session.creation="", server.supported.snimatchers="", server.suported.server.names="", request.size.validation.configuration="", request.size.validation="", request.size.validation.maximum.value="", request.size.validation.reject.status.code="", request.size.validation.reject.message="", request.size.validation.reject.message.content.type="", header.size.validation="", header.validation.maximum.request.line="", header.validation.maximum.size="", header.validation.maximum.chunk.size="", header.validation.reject.status.code="", header.validation.reject.message="", header.validation.reject.message.content.type="", server.bootstrap.configuration="", server.bootstrap.nodelay="", server.bootstrap.keepalive="", server.bootstrap.sendbuffersize="", server.bootstrap.recievebuffersize="", server.bootstrap.connect.timeout="", server.bootstrap.socket.reuse="", server.bootstrap.socket.timeout="", server.bootstrap.socket.backlog="", trace.log.enabled="", @map(...))) -``` - -QUERY PARAMETERS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
receiver.urlThe URL to which the events should be received. User can provide any valid url and if the url is not provided the system will use the following format http://0.0.0.0:9763/<appNAme>/<streamName>If the user want to use SSL the url should be given in following format https://localhost:8080/<streamName>http://0.0.0.0:9763//STRINGYesNo
source.idIdentifier need to map the source to sink.STRINGNoNo
connection.timeoutConnection timeout in milliseconds. If the mapped http-response sink does not get a correlated message, after this timeout value, a timeout response is sent120000INTYesNo
basic.auth.enabledIf this is set to true, basic authentication is enabled for incoming events, and the credentials with which each event is sent are verified to ensure that the user is authorized to access the service. If basic authentication fails, the event is not authenticated and an authentication error is logged in the CLI. By default this values 'false' falseSTRINGYesNo
worker.countThe number of active worker threads to serve the incoming events. The value is 1 by default. This will ensure that the events are directed to the event stream in the same order in which they arrive. By increasing this value the performance might increase at the cost of loosing event ordering.1INTYesNo
socket.idle.timeoutIdle timeout for HTTP connection.120000INTYesNo
ssl.verify.clientThe type of client certificate verification.nullSTRINGYesNo
ssl.protocolssl/tls related optionsTLSSTRINGYesNo
tls.store.typeTLS store type.JKSSTRINGYesNo
parametersParameters other than basics such as ciphers,sslEnabledProtocols,client.enable.session.creation. Expected format of these parameters is as follows: "'ciphers:xxx','sslEnabledProtocols,client.enable:xxx'"nullSTRINGYesNo
ciphersList of ciphers to be used. This parameter should include under parameters Ex: 'ciphers:TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256'nullSTRINGYesNo
ssl.enabled.protocolsSSL/TLS protocols to be enabled. This parameter should be in camel case format(sslEnabledProtocols) under parameters. Ex 'sslEnabledProtocols:true'nullSTRINGYesNo
server.enable.session.creationEnable HTTP session creation.This parameter should include under parameters Ex: 'client.enable.session.creation:true'nullSTRINGYesNo
server.supported.snimatchersHttp SNIMatcher to be added. This parameter should include under parameters Ex: 'server.supported.snimatchers:SNIMatcher'nullSTRINGYesNo
server.suported.server.namesHttp supported servers. This parameter should include under parameters Ex: 'server.suported.server.names:server'nullSTRINGYesNo
request.size.validation.configurationParameters that responsible for validating the http request and request headers. Expected format of these parameters is as follows: "'request.size.validation:xxx','request.size.validation.maximum.value:xxx'"nullSTRINGYesNo
request.size.validationTo enable the request size validation.falseSTRINGYesNo
request.size.validation.maximum.valueIf request size is validated then maximum size.Integer.MAX_VALUESTRINGYesNo
request.size.validation.reject.status.codeIf request is exceed maximum size and request.size.validation is enabled then status code to be send as response.401STRINGYesNo
request.size.validation.reject.messageIf request is exceed maximum size and request.size.validation is enabled then status message to be send as response.Message is bigger than the valid sizeSTRINGYesNo
request.size.validation.reject.message.content.typeIf request is exceed maximum size and request.size.validation is enabled then content type to be send as response.plain/textSTRINGYesNo
header.size.validationTo enable the header size validation.falseSTRINGYesNo
header.validation.maximum.request.lineIf header header validation is enabled then the maximum request line.4096STRINGYesNo
header.validation.maximum.sizeIf header header validation is enabled then the maximum expected header size.8192STRINGYesNo
header.validation.maximum.chunk.sizeIf header header validation is enabled then the maximum expected chunk size.8192STRINGYesNo
header.validation.reject.status.code401If header is exceed maximum size and header.size.validation is enabled then status code to be send as response.STRINGYesNo
header.validation.reject.messageIf header is exceed maximum size and header.size.validation is enabled then message to be send as response.Message header is bigger than the valid sizeSTRINGYesNo
header.validation.reject.message.content.typeIf header is exceed maximum size and header.size.validation is enabled then content type to be send as response.plain/textSTRINGYesNo
server.bootstrap.configurationParameters that for bootstrap configurations of the server. Expected format of these parameters is as follows: "'ciphers:xxx','sslEnabledProtocols,client.enable:xxx'"nullOBJECTYesNo
server.bootstrap.nodelayHttp server no delay.trueBOOLYesNo
server.bootstrap.keepaliveHttp server keep alive.trueBOOLYesNo
server.bootstrap.sendbuffersizeHttp server send buffer size.1048576INTYesNo
server.bootstrap.recievebuffersizeHttp server receive buffer size.1048576INTYesNo
server.bootstrap.connect.timeoutHttp server connection timeout.15000INTYesNo
server.bootstrap.socket.reuseTo enable http socket reuse.falseBOOLYesNo
server.bootstrap.socket.timeoutHttp server socket timeout.15BOOLYesNo
server.bootstrap.socket.backlogTHttp server socket backlog.100BOOLYesNo
trace.log.enabledHttp traffic monitoring.falseBOOLYesNo
- -System Parameters - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Parameters
serverBootstrapBossGroupSizeproperty to configure number of boss threads, which accepts incoming connections until the ports are unbound. Once connection accepts successfully, boss thread passes the accepted channel to one of the worker threads.Number of available processorsAny integer
serverBootstrapWorkerGroupSizeproperty to configure number of worker threads, which performs non blocking read and write for one or more channels in non-blocking mode.(Number of available processors)*2Any integer
serverBootstrapClientGroupSizeproperty to configure number of client threads, which performs non blocking read and write for one or more channels in non-blocking mode.(Number of available processors)*2Any integer
defaultHostThe default host of the transport.0.0.0.0Any valid host
defaultHttpPortThe default port if the default scheme is 'http'.8280Any valid port
defaultHttpsPortThe default port if the default scheme is 'https'.8243Any valid port
defaultSchemeThe default protocol.httphttp
https
keyStoreLocationThe default keystore file path.${carbon.home}/resources/security/wso2carbon.jksPath to wso2carbon.jks file
keyStorePasswordThe default keystore password.wso2carbonString of keystore password
certPasswordThe default cert password.wso2carbonString of cert password
- -Examples -EXAMPLE 1 -``` -@source(type='http-request', source.id='sampleSourceId, receiver.url='http://localhost:9055/endpoints/RecPro', connection.timeout='150000', parameters="'ciphers : TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256', 'sslEnabledProtocols:TLSv1.1,TLSv1.2'", request.size.validation.configuration="request.size.validation:true", server.bootstrap.configuration="server.bootstrap.socket.timeout:25", @map(type='json, @attributes(messageId='trp:messageId', symbol='$.events.event.symbol', price='$.events.event.price', volume='$.events.event.volume'))) -define stream FooStream (messageId string, symbol string, price float, volume long); - -``` -

The expected input is as follows:
{"events":
    {"event":
        "symbol":WSO2,
        "price":55.6,
        "volume":100,
    }
}
If basic authentication is enabled via the basic.auth.enabled='true setting, each input event is also expected to contain the Authorization:'Basic encodeBase64(username:Password)' header.

- -### http-response *(Source)* - -

The http-response source co-relates with http-request sink with the parameter 'sink.id'.
This receives responses for the requests sent by the http-request sink which has the same sink id.
Response messages can be in formats such as TEXT, JSON and XML.
In order to handle the responses with different http status codes, user is allowed to defined the acceptable response source code using the parameter 'http.status.code'

- -Syntax -``` -@source(type="http-response", sink.id="", http.status.code="", allow.streaming.responses="", @map(...))) -``` - -QUERY PARAMETERS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
sink.idThis parameter is used to map the http-response source to a http-request sink. Then this source will accepts the response messages for the requests sent by corresponding http-request sink.STRINGNoNo
http.status.codeAcceptable http status code for the responses.
This can be a complete string or a regex.
Only the responses with matching status codes to the defined value, will be received by the http-response source.
Eg: 'http.status.code = '200', http.status.code = '2\\d+''
200STRINGYesNo
allow.streaming.responsesIf responses can be received multiple times for a single request, this option should be enabled. If this is not enabled, for every request, response will be extracted only once.falseBOOLYesNo
- -Examples -EXAMPLE 1 -``` -@sink(type='http-request', -downloading.enabled='true', -publisher.url='http://localhost:8005/registry/employee', -method='POST', headers='{{headers}}',sink.id='employee-info', -@map(type='json')) -define stream BarStream (name String, id int, headers String, downloadPath string); - -@source(type='http-response' , sink.id='employee-info', http.status.code='2\\d+', -@map(type='text', regex.A='((.|\n)*)', @attributes(message='A[1]'))) -define stream responseStream2xx(message string);@source(type='http-response' , sink.id='employee-info', http.status.code='4\\d+' , -@map(type='text', regex.A='((.|\n)*)', @attributes(message='A[1]'))) -define stream responseStream4xx(message string); -``` -

In above example, the defined http-request sink will send a POST requests to the endpoint defined by 'publisher.url'.
Then for those requests, the source with the response code '2\\d+' and sink.id 'employee-info' will receive the responses with 2xx status codes.
The http-response source which has 'employee-info' as the 'sink.id' and '4\\d+' as the http.response.code will receive all the responses with 4xx status codes.
. Then the body of the response message will be extracted using text mapper and converted into siddhi events.
.

- diff --git a/docs/api/1.1.1.md b/docs/api/1.1.1.md deleted file mode 100644 index fd81e68f..00000000 --- a/docs/api/1.1.1.md +++ /dev/null @@ -1,1755 +0,0 @@ -# API Docs - v1.1.1 - -## Sink - -### http *(Sink)* - -

This extension publish the HTTP events in any HTTP method POST, GET, PUT, DELETE via HTTP or https protocols. As the additional features this component can provide basic authentication as well as user can publish events using custom client truststore files when publishing events via https protocol. And also user can add any number of headers including HTTP_METHOD header for each event dynamically.
Following content types will be set by default according to the type of sink mapper used.
You can override them by setting the new content types in headers.
     - TEXT : text/plain
     - XML : application/xml
     - JSON : application/json
     - KEYVALUE : application/x-www-form-urlencoded

- -Syntax -``` -@sink(type="http", publisher.url="", basic.auth.username="", basic.auth.password="", https.truststore.file="", https.truststore.password="", headers="", method="", socket.idle.timeout="", chunk.disabled="", ssl.protocol="", parameters="", ciphers="", ssl.enabled.protocols="", client.enable.session.creation="", follow.redirect="", max.redirect.count="", tls.store.type="", proxy.host="", proxy.port="", proxy.username="", proxy.password="", client.bootstrap.configuration="", client.bootstrap.nodelay="", client.bootstrap.keepalive="", client.bootstrap.sendbuffersize="", client.bootstrap.recievebuffersize="", client.bootstrap.connect.timeout="", client.bootstrap.socket.reuse="", client.bootstrap.socket.timeout="", client.threadpool.configurations="", client.connection.pool.count="", client.max.active.connections.per.pool="", client.min.idle.connections.per.pool="", client.max.idle.connections.per.pool="", client.min.eviction.idle.time="", sender.thread.count="", event.group.executor.thread.size="", max.wait.for.client.connection.pool="", oauth.username="", oauth.password="", consumer.key="", consumer.secret="", refresh.token="", token.url="", @map(...))) -``` - -QUERY PARAMETERS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
publisher.urlThe URL to which the outgoing events should be published via HTTP. This is a mandatory parameter and if this is not specified, an error is logged in the CLI. If user wants to enable SSL for the events, use https instead of http in the publisher.url.e.g., http://localhost:8080/endpoint, https://localhost:8080/endpointSTRINGNoNo
basic.auth.usernameThe username to be included in the authentication header of the basic authentication enabled events. It is required to specify both username and password to enable basic authentication. If one of the parameter is not given by user then an error is logged in the CLI. STRINGYesNo
basic.auth.passwordThe password to include in the authentication header of the basic authentication enabled events. It is required to specify both username and password to enable basic authentication. If one of the parameter is not given by user then an error is logged in the CLI. STRINGYesNo
https.truststore.fileThe file path to the location of the truststore of the client that sends the HTTP events through 'https' protocol. A custom client-truststore can be specified if required.${carbon.home}/resources/security/client-truststore.jksSTRINGYesNo
https.truststore.passwordThe password for the client-truststore. A custom password can be specified if required. If no custom password is specified and the protocol of URL is 'https' then, the system uses default password.wso2carbonSTRINGYesNo
headersThe headers that should be included as HTTP request headers.
There can be any number of headers concatenated in following format. "'header1:value1','header2:value2'". User can include Content-Type header if he needs to use a specific content-type for the payload. Or else, system decides the Content-Type by considering the type of sink mapper, in following way.
 - @map(xml):application/xml
 - @map(json):application/json
 - @map(text):plain/text )
 - if user does not include any mapping type then the system gets 'plain/text' as default Content-Type header.
Note that providing content-length as a header is not supported. The size of the payload will be automatically calculated and included in the content-length header.
STRINGYesNo
methodFor HTTP events, HTTP_METHOD header should be included as a request header. If the parameter is null then system uses 'POST' as a default header.POSTSTRINGYesNo
socket.idle.timeoutSocket timeout value in millisecond6000INTYesNo
chunk.disabledThis parameter is used to disable/enable chunked transfer encodingfalseBOOLYesNo
ssl.protocolThe SSL protocol versionTLSSTRINGYesNo
parametersParameters other than basics such as ciphers,sslEnabledProtocols,client.enable.session.creation. Expected format of these parameters is as follows: "'ciphers:xxx','sslEnabledProtocols,client.enable:xxx'"nullSTRINGYesNo
ciphersList of ciphers to be used. This parameter should include under parameters Ex: 'ciphers:TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256'nullSTRINGYesNo
ssl.enabled.protocolsSSL/TLS protocols to be enabled. This parameter should be in camel case format(sslEnabledProtocols) under parameters. Ex 'sslEnabledProtocols:true'nullSTRINGYesNo
client.enable.session.creationEnable HTTP session creation.This parameter should include under parameters Ex: 'client.enable.session.creation:true'nullSTRINGYesNo
follow.redirectRedirect related enabled.trueBOOLYesNo
max.redirect.countMaximum redirect count.5INTYesNo
tls.store.typeTLS store type to be used.JKSSTRINGYesNo
proxy.hostProxy server hostnullSTRINGYesNo
proxy.portProxy server portnullSTRINGYesNo
proxy.usernameProxy server usernamenullSTRINGYesNo
proxy.passwordProxy server passwordnullSTRINGYesNo
client.bootstrap.configurationClient bootsrap configurations. Expected format of these parameters is as follows: "'client.bootstrap.nodelay:xxx','client.bootstrap.keepalive:xxx'"TODOSTRINGYesNo
client.bootstrap.nodelayHttp client no delay.trueBOOLYesNo
client.bootstrap.keepaliveHttp client keep alive.trueBOOLYesNo
client.bootstrap.sendbuffersizeHttp client send buffer size.1048576INTYesNo
client.bootstrap.recievebuffersizeHttp client receive buffer size.1048576INTYesNo
client.bootstrap.connect.timeoutHttp client connection timeout.15000INTYesNo
client.bootstrap.socket.reuseTo enable http socket reuse.falseBOOLYesNo
client.bootstrap.socket.timeoutHttp client socket timeout.15STRINGYesNo
client.threadpool.configurationsThread pool configuration. Expected format of these parameters is as follows: "'client.connection.pool.count:xxx','client.max.active.connections.per.pool:xxx'"TODOSTRINGYesNo
client.connection.pool.countConnection pool count.0INTYesNo
client.max.active.connections.per.poolActive connections per pool.-1INTYesNo
client.min.idle.connections.per.poolMinimum ideal connection per pool.0INTYesNo
client.max.idle.connections.per.poolMaximum ideal connection per pool.100INTYesNo
client.min.eviction.idle.timeMinimum eviction idle time.5 * 60 * 1000STRINGYesNo
sender.thread.countHttp sender thread count.20STRINGYesNo
event.group.executor.thread.sizeEvent group executor thread size.15STRINGYesNo
max.wait.for.client.connection.poolMaximum wait for client connection pool.60000STRINGYesNo
oauth.usernameThe username to be included in the authentication header of the oauth authentication enabled events. It is required to specify both username and password to enable oauth authentication. If one of the parameter is not given by user then an error is logged in the CLI. It is only applicable for for Oauth requests STRINGYesNo
oauth.passwordThe password to be included in the authentication header of the oauth authentication enabled events. It is required to specify both username and password to enable oauth authentication. If one of the parameter is not given by user then an error is logged in the CLI. It is only applicable for for Oauth requests STRINGYesNo
consumer.keyconsumer key for the Http request. It is only applicable for for Oauth requests STRINGYesNo
consumer.secretconsumer secret for the Http request. It is only applicable for for Oauth requests STRINGYesNo
refresh.tokenrefresh token for the Http request. It is only applicable for for Oauth requests STRINGYesNo
token.urltoken url for generate a new access token. It is only applicable for for Oauth requests STRINGYesNo
- -System Parameters - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Parameters
clientBootstrapBossGroupSizeproperty to configure number of boss threads, which accepts incoming connections until the ports are unbound. Once connection accepts successfully, boss thread passes the accepted channel to one of the worker threads.Number of available processorsAny integer
clientBootstrapWorkerGroupSizeproperty to configure number of worker threads, which performs non blocking read and write for one or more channels in non-blocking mode.(Number of available processors)*2Any integer
clientBootstrapClientGroupSizeproperty to configure number of client threads, which performs non blocking read and write for one or more channels in non-blocking mode.(Number of available processors)*2Any integer
trustStoreLocationThe default truststore file path.${carbon.home}/resources/security/client-truststore.jksPath to client-truststore.jks
trustStorePasswordThe default truststore password.wso2carbonTruststore password
- -Examples -EXAMPLE 1 -``` -@sink(type='http',publisher.url='http://localhost:8009/foo', method='{{method}}',headers="'content-type:xml','content-length:94'", client.bootstrap.configuration="'client.bootstrap.socket.timeout:20', 'client.bootstrap.worker.group.size:10'", client.pool.configuration="'client.connection.pool.count:10','client.max.active.connections.per.pool:1'", @map(type='xml', @payload('{{payloadBody}}'))) -define stream FooStream (payloadBody String, method string, headers string); - -``` -

If it is xml mapping expected input should be in following format for FooStream:
{
<events>
    <event>
        <symbol>WSO2</symbol>
        <price>55.6</price>
        <volume>100</volume>
    </event>
</events>,
POST,
Content-Length:24#Content-Location:USA#Retry-After:120
}

Above event will generate output as below.
~Output http event payload
<events>
    <event>
        <symbol>WSO2</symbol>
        <price>55.6</price>
        <volume>100</volume>
    </event>
</events>

~Output http event headers
Content-Length:24,
Content-Location:'USA',
Retry-After:120,
Content-Type:'application/xml',
HTTP_METHOD:'POST',

~Output http event properties
HTTP_METHOD:'POST',
HOST:'localhost',
PORT:8009,
PROTOCOL:'http',
TO:'/foo'

- -### http-request *(Sink)* - -

This extension publish the HTTP events in any HTTP method POST, GET, PUT, DELETE via HTTP or https protocols. As the additional features this component can provide basic authentication as well as user can publish events using custom client truststore files when publishing events via https protocol. And also user can add any number of headers including HTTP_METHOD header for each event dynamically.
Following content types will be set by default according to the type of sink mapper used.
You can override them by setting the new content types in headers.
     - TEXT : text/plain
     - XML : application/xml
     - JSON : application/json
     - KEYVALUE : application/x-www-form-urlencoded

HTTP request sink is correlated with the The HTTP reponse source, through a unique sink.id.It sends the request to the defined url and the response is received by the response source which has the same 'sink.id'.

- -Syntax -``` -@sink(type="http-request", publisher.url="", basic.auth.username="", basic.auth.password="", https.truststore.file="", https.truststore.password="", headers="", method="", socket.idle.timeout="", chunk.disabled="", ssl.protocol="", parameters="", ciphers="", ssl.enabled.protocols="", client.enable.session.creation="", follow.redirect="", max.redirect.count="", tls.store.type="", proxy.host="", proxy.port="", proxy.username="", proxy.password="", client.bootstrap.configuration="", client.bootstrap.nodelay="", client.bootstrap.keepalive="", client.bootstrap.sendbuffersize="", client.bootstrap.recievebuffersize="", client.bootstrap.connect.timeout="", client.bootstrap.socket.reuse="", client.bootstrap.socket.timeout="", client.threadpool.configurations="", client.connection.pool.count="", client.max.active.connections.per.pool="", client.min.idle.connections.per.pool="", client.max.idle.connections.per.pool="", client.min.eviction.idle.time="", sender.thread.count="", event.group.executor.thread.size="", max.wait.for.client.connection.pool="", sink.id="", downloading.enabled="", download.path="", oauth.username="", oauth.password="", consumer.key="", consumer.secret="", refresh.token="", @map(...))) -``` - -QUERY PARAMETERS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
publisher.urlThe URL to which the outgoing events should be published via HTTP. This is a mandatory parameter and if this is not specified, an error is logged in the CLI. If user wants to enable SSL for the events, use https instead of http in the publisher.url.
e.g., http://localhost:8080/endpoint, https://localhost:8080/endpoint
This can be used as a dynamic parameter as well.
STRINGNoYes
basic.auth.usernameThe username to be included in the authentication header of the basic authentication enabled events. It is required to specify both username and password to enable basic authentication. If one of the parameter is not given by user then an error is logged in the CLI. STRINGYesNo
basic.auth.passwordThe password to include in the authentication header of the basic authentication enabled events. It is required to specify both username and password to enable basic authentication. If one of the parameter is not given by user then an error is logged in the CLI. STRINGYesNo
https.truststore.fileThe file path to the location of the truststore of the client that sends the HTTP events through 'https' protocol. A custom client-truststore can be specified if required.${carbon.home}/resources/security/client-truststore.jksSTRINGYesNo
https.truststore.passwordThe password for the client-truststore. A custom password can be specified if required. If no custom password is specified and the protocol of URL is 'https' then, the system uses default password.wso2carbonSTRINGYesNo
headersThe headers that should be included as HTTP request headers.
There can be any number of headers concatenated in following format. "'header1:value1','header2:value2'". User can include Content-Type header if he needs to use a specific content-type for the payload. Or else, system decides the Content-Type by considering the type of sink mapper, in following way.
 - @map(xml):application/xml
 - @map(json):application/json
 - @map(text):plain/text )
 - if user does not include any mapping type then the system gets 'plain/text' as default Content-Type header.
Note that providing content-length as a header is not supported. The size of the payload will be automatically calculated and included in the content-length header.
STRINGYesNo
methodFor HTTP events, HTTP_METHOD header should be included as a request header. If the parameter is null then system uses 'POST' as a default header.POSTSTRINGYesNo
socket.idle.timeoutSocket timeout value in millisecond6000INTYesNo
chunk.disabledport: Port number of the remote servicefalseBOOLYesNo
ssl.protocolThe SSL protocol versionTLSSTRINGYesNo
parametersParameters other than basics such as ciphers,sslEnabledProtocols,client.enable.session.creation. Expected format of these parameters is as follows: "'ciphers:xxx','sslEnabledProtocols,client.enable:xxx'"nullSTRINGYesNo
ciphersList of ciphers to be used. This parameter should include under parameters Ex: 'ciphers:TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256'nullSTRINGYesNo
ssl.enabled.protocolsSSL/TLS protocols to be enabled. This parameter should be in camel case format(sslEnabledProtocols) under parameters. Ex 'sslEnabledProtocols:true'nullSTRINGYesNo
client.enable.session.creationEnable HTTP session creation.This parameter should include under parameters Ex: 'client.enable.session.creation:true'nullSTRINGYesNo
follow.redirectRedirect related enabled.trueBOOLYesNo
max.redirect.countMaximum redirect count.5INTYesNo
tls.store.typeTLS store type to be used.JKSSTRINGYesNo
proxy.hostProxy server hostnullSTRINGYesNo
proxy.portProxy server portnullSTRINGYesNo
proxy.usernameProxy server usernamenullSTRINGYesNo
proxy.passwordProxy server passwordnullSTRINGYesNo
client.bootstrap.configurationClient bootsrap configurations. Expected format of these parameters is as follows: "'client.bootstrap.nodelay:xxx','client.bootstrap.keepalive:xxx'"TODOSTRINGYesNo
client.bootstrap.nodelayHttp client no delay.trueBOOLYesNo
client.bootstrap.keepaliveHttp client keep alive.trueBOOLYesNo
client.bootstrap.sendbuffersizeHttp client send buffer size.1048576INTYesNo
client.bootstrap.recievebuffersizeHttp client receive buffer size.1048576INTYesNo
client.bootstrap.connect.timeoutHttp client connection timeout.15000INTYesNo
client.bootstrap.socket.reuseTo enable http socket reuse.falseBOOLYesNo
client.bootstrap.socket.timeoutHttp client socket timeout.15STRINGYesNo
client.threadpool.configurationsThread pool configuration. Expected format of these parameters is as follows: "'client.connection.pool.count:xxx','client.max.active.connections.per.pool:xxx'"TODOSTRINGYesNo
client.connection.pool.countConnection pool count.0INTYesNo
client.max.active.connections.per.poolActive connections per pool.-1INTYesNo
client.min.idle.connections.per.poolMinimum ideal connection per pool.0INTYesNo
client.max.idle.connections.per.poolMaximum ideal connection per pool.100INTYesNo
client.min.eviction.idle.timeMinimum eviction idle time.5 * 60 * 1000STRINGYesNo
sender.thread.countHttp sender thread count.20STRINGYesNo
event.group.executor.thread.sizeEvent group executor thread size.15STRINGYesNo
max.wait.for.client.connection.poolMaximum wait for client connection pool.60000STRINGYesNo
sink.idIdentifier of the sink. This is used to co-relate with the corresponding http-response source which needs to process the repose for the request sent by this sink.STRINGNoNo
downloading.enabledIf this is set to 'true' then the response received by the response source will be written to a file. If downloading is enabled, the download.path parameter is mandatory.falseBOOLYesNo
download.pathIf downloading is enabled, the path of the file which is going to be downloaded should be specified using 'download.path' parameter. This should be an absolute path including the file name.nullSTRINGYesYes
oauth.usernameThe username to be included in the authentication header of the oauth authentication enabled events. It is required to specify both username and password to enable oauth authentication. If one of the parameter is not given by user then an error is logged in the CLI. It is only applicable for for Oauth requests STRINGYesNo
oauth.passwordThe password to be included in the authentication header of the oauth authentication enabled events. It is required to specify both username and password to enable oauth authentication. If one of the parameter is not given by user then an error is logged in the CLI. It is only applicable for for Oauth requests STRINGYesNo
consumer.keyconsumer key for the Http request. It is only applicable for for Oauth requests STRINGYesNo
consumer.secretconsumer secret for the Http request. It is only applicable for for Oauth requests STRINGYesNo
refresh.tokenrefresh token for the Http request. It is only applicable for for Oauth requests STRINGYesNo
- -Examples -EXAMPLE 1 -``` -@sink(type='http-request', sink.id='foo', publisher.url='http://localhost:8009/foo', @map(type='xml', @payload('{{payloadBody}}'))) -define stream FooStream (payloadBody String, method string, headers string); -@source(type='http-response', sink.id='foo', http.status.code='2\\d+', -@map(type='text', regex.A='((.|\n)*)', @attributes(headers='trp:headers', fileName='A[1]'))) -define stream responseStream2xx(fileName string, headers string); - -@source(type='http-response', sink.id='foo', http.status.code='4\\d+', -@map(type='text', regex.A='((.|\n)*)', @attributes(errorMsg='A[1]'))) -define stream responseStream4xx(errorMsg string); -``` -

In above example, the payload body for 'FooStream' will be in following format.
{
<events>
    <event>
        <symbol>WSO2</symbol>
        <price>55.6</price>
        <volume>100</volume>
    </event>
</events>,
This message will sent as the body of a POST request with the content-type 'application/xml' to the endpoint defined as the 'publisher.url' and in order to process the responses for these requests, there should be a source of type 'http-response' defined with the same sink id 'foo' in the siddhi app.
 The responses with 2xx status codes will be received by the http-response source which has the http.status.code defined by the regex '2\\d+'.
If the response has a 4xx status code, it will be received by the http-response source which has the http.status.code defined by the regex '4\\d+'.

- -EXAMPLE 2 -``` -define stream FooStream (name String, id int, headers String, downloadPath string); -@sink(type='http-request', -downloading.enabled='true', -download.path='{{downloadPath}}',publisher.url='http://localhost:8005/files', -method='GET', headers='{{headers}}',sink.id='download-sink', -@map(type='json')) -define stream BarStream (name String, id int, headers String, downloadPath string); - -@source(type='http-response', sink.id='download-sink', http.status.code='2\\d+', -@map(type='text', regex.A='((.|\n)*)', @attributes(headers='trp:headers', fileName='A[1]'))) -define stream responseStream2xx(fileName string, headers string); - -@source(type='http-response', sink.id='download-sink', http.status.code='4\\d+', -@map(type='text', regex.A='((.|\n)*)', @attributes(errorMsg='A[1]'))) -define stream responseStream4xx(errorMsg string); -``` -

In above example, http-request sink will send a GET request to the publisher url and the requested file will be received as the response by a corresponding http-response source.
If the http status code of the response is a successful one (2xx), it will be received by the http-response source which has the http.status.code '2\\d+' and downloaded as a local file. Then the event received to the responseStream2xx will have the headers included in the request and the downloaded file name.
If the http status code of the response is a 4xx code, it will be received by the http-response source which has the http.status.code '4\\d+'. Then the event received to the responseStream4xx will have the response message body in text format.

- -### http-response *(Sink)* - -

HTTP response sink is correlated with the The HTTP request source, through a unique source.id, and it send a response to the HTTP request source having the same source.id. The response message can be formatted in text, XML or JSON and can be sent with appropriate headers.

- -Syntax -``` -@sink(type="http-response", source.id="", message.id="", headers="", @map(...))) -``` - -QUERY PARAMETERS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
source.idIdentifier of the source.STRINGNoNo
message.idIdentifier of the message.STRINGNoYes
headersThe headers that should be included as HTTP response headers. There can be any number of headers concatenated on following format. "'header1:value1','header2:value2'" User can include content-type header if he/she need to have any specific type for payload. If not system get the mapping type as the content-Type header (ie.@map(xml):application/xml, @map(json):application/json, @map(text):plain/text) and if user does not include any mapping type then system gets the plain/text as default Content-Type header. If user does not include Content-Length header then system calculate the bytes size of payload and include it as content-length header. STRINGYesNo
- -Examples -EXAMPLE 1 -``` -@sink(type='http-response', source.id='sampleSourceId', message.id='{{messageId}}', headers="'content-type:json','content-length:94'"@map(type='json', @payload('{{payloadBody}}'))) -define stream FooStream (payloadBody String, messageId string, headers string); - -``` -

If it is json mapping expected input should be in following format for FooStream:
{
{"events":
    {"event":
        "symbol":WSO2,
        "price":55.6,
        "volume":100,
    }
},
0cf708b1-7eae-440b-a93e-e72f801b486a,
Content-Length:24#Content-Location:USA
}

Above event will generate response for the matching source message as below.

~Output http event payload
{"events":
    {"event":
        "symbol":WSO2,
        "price":55.6,
        "volume":100,
    }
}

~Output http event headers
Content-Length:24,
Content-Location:'USA',
Content-Type:'application/json'

- -## Source - -### http *(Source)* - -

The HTTP source receives POST requests via HTTP or HTTPS in format such as text, XML and JSON. In WSO2 SP, if required, you can enable basic authentication to ensure that events are received only from users who are authorized to access the service.

- -Syntax -``` -@source(type="http", receiver.url="", basic.auth.enabled="", worker.count="", socket.idle.timeout="", ssl.verify.client="", ssl.protocol="", tls.store.type="", parameters="", ciphers="", ssl.enabled.protocols="", server.enable.session.creation="", server.supported.snimatchers="", server.suported.server.names="", request.size.validation.configuration="", request.size.validation="", request.size.validation.maximum.value="", request.size.validation.reject.status.code="", request.size.validation.reject.message="", request.size.validation.reject.message.content.type="", header.size.validation="", header.validation.maximum.request.line="", header.validation.maximum.size="", header.validation.maximum.chunk.size="", header.validation.reject.status.code="", header.validation.reject.message="", header.validation.reject.message.content.type="", server.bootstrap.configuration="", server.bootstrap.nodelay="", server.bootstrap.keepalive="", server.bootstrap.sendbuffersize="", server.bootstrap.recievebuffersize="", server.bootstrap.connect.timeout="", server.bootstrap.socket.reuse="", server.bootstrap.socket.timeout="", server.bootstrap.socket.backlog="", trace.log.enabled="", @map(...))) -``` - -QUERY PARAMETERS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
receiver.urlThe URL to which the events should be received. User can provide any valid url and if the url is not provided the system will use the following format http://0.0.0.0:9763/<appNAme>/<streamName>If the user want to use SSL the url should be given in following format https://localhost:8080/<streamName>http://0.0.0.0:9763//STRINGYesNo
basic.auth.enabledThis works only in WSO2 SP. If this is set to true, basic authentication is enabled for incoming events, and the credentials with which each event is sent are verified to ensure that the user is authorized to access the service. If basic authentication fails, the event is not authenticated and an authentication error is logged in the CLI.falseSTRINGYesNo
worker.countThe number of active worker threads to serve the incoming events. The value is 1 by default. This will ensure that the events are directed to the event stream in the same order in which they arrive. By increasing this value the performance might increase at the cost of loosing event ordering.1INTYesNo
socket.idle.timeoutIdle timeout for HTTP connection.120000INTYesNo
ssl.verify.clientThe type of client certificate verification.nullSTRINGYesNo
ssl.protocolssl/tls related optionsTLSSTRINGYesNo
tls.store.typeTLS store type.JKSSTRINGYesNo
parametersParameters other than basics such as ciphers,sslEnabledProtocols,client.enable.session.creation. Expected format of these parameters is as follows: "'ciphers:xxx','sslEnabledProtocols,client.enable:xxx'"nullSTRINGYesNo
ciphersList of ciphers to be used. This parameter should include under parameters Ex: 'ciphers:TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256'nullSTRINGYesNo
ssl.enabled.protocolsSSL/TLS protocols to be enabled. This parameter should be in camel case format(sslEnabledProtocols) under parameters. Ex 'sslEnabledProtocols:true'nullSTRINGYesNo
server.enable.session.creationEnable HTTP session creation.This parameter should include under parameters Ex: 'client.enable.session.creation:true'nullSTRINGYesNo
server.supported.snimatchersHttp SNIMatcher to be added. This parameter should include under parameters Ex: 'server.supported.snimatchers:SNIMatcher'nullSTRINGYesNo
server.suported.server.namesHttp supported servers. This parameter should include under parameters Ex: 'server.suported.server.names:server'nullSTRINGYesNo
request.size.validation.configurationParameters that responsible for validating the http request and request headers. Expected format of these parameters is as follows: "'request.size.validation:xxx','request.size.validation.maximum.value:xxx'"nullSTRINGYesNo
request.size.validationTo enable the request size validation.falseSTRINGYesNo
request.size.validation.maximum.valueIf request size is validated then maximum size.Integer.MAX_VALUESTRINGYesNo
request.size.validation.reject.status.codeIf request is exceed maximum size and request.size.validation is enabled then status code to be send as response.401STRINGYesNo
request.size.validation.reject.messageIf request is exceed maximum size and request.size.validation is enabled then status message to be send as response.Message is bigger than the valid sizeSTRINGYesNo
request.size.validation.reject.message.content.typeIf request is exceed maximum size and request.size.validation is enabled then content type to be send as response.plain/textSTRINGYesNo
header.size.validationTo enable the header size validation.falseSTRINGYesNo
header.validation.maximum.request.lineIf header header validation is enabled then the maximum request line.4096STRINGYesNo
header.validation.maximum.sizeIf header header validation is enabled then the maximum expected header size.8192STRINGYesNo
header.validation.maximum.chunk.sizeIf header header validation is enabled then the maximum expected chunk size.8192STRINGYesNo
header.validation.reject.status.code401If header is exceed maximum size and header.size.validation is enabled then status code to be send as response.STRINGYesNo
header.validation.reject.messageIf header is exceed maximum size and header.size.validation is enabled then message to be send as response.Message header is bigger than the valid sizeSTRINGYesNo
header.validation.reject.message.content.typeIf header is exceed maximum size and header.size.validation is enabled then content type to be send as response.plain/textSTRINGYesNo
server.bootstrap.configurationParameters that for bootstrap configurations of the server. Expected format of these parameters is as follows: "'ciphers:xxx','sslEnabledProtocols,client.enable:xxx'"nullOBJECTYesNo
server.bootstrap.nodelayHttp server no delay.trueBOOLYesNo
server.bootstrap.keepaliveHttp server keep alive.trueBOOLYesNo
server.bootstrap.sendbuffersizeHttp server send buffer size.1048576INTYesNo
server.bootstrap.recievebuffersizeHttp server receive buffer size.1048576INTYesNo
server.bootstrap.connect.timeoutHttp server connection timeout.15000INTYesNo
server.bootstrap.socket.reuseTo enable http socket reuse.falseBOOLYesNo
server.bootstrap.socket.timeoutHttp server socket timeout.15BOOLYesNo
server.bootstrap.socket.backlogTHttp server socket backlog.100BOOLYesNo
trace.log.enabledHttp traffic monitoring.falseBOOLYesNo
- -System Parameters - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Parameters
serverBootstrapBossGroupSizeproperty to configure number of boss threads, which accepts incoming connections until the ports are unbound. Once connection accepts successfully, boss thread passes the accepted channel to one of the worker threads.Number of available processorsAny integer
serverBootstrapWorkerGroupSizeproperty to configure number of worker threads, which performs non blocking read and write for one or more channels in non-blocking mode.(Number of available processors)*2Any integer
serverBootstrapClientGroupSizeproperty to configure number of client threads, which performs non blocking read and write for one or more channels in non-blocking mode.(Number of available processors)*2Any integer
defaultHostThe default host of the transport.0.0.0.0Any valid host
defaultHttpPortThe default port if the default scheme is 'http'.8280Any valid port
defaultHttpsPortThe default port if the default scheme is 'https'.8243Any valid port
defaultSchemeThe default protocol.httphttp
https
keyStoreLocationThe default keystore file path.${carbon.home}/resources/security/wso2carbon.jksPath to wso2carbon.jks file
keyStorePasswordThe default keystore password.wso2carbonString of keystore password
- -Examples -EXAMPLE 1 -``` -@source(type='http', receiver.url='http://localhost:9055/endpoints/RecPro', socketIdleTimeout='150000', parameters="'ciphers : TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256', 'sslEnabledProtocols:TLSv1.1,TLSv1.2'",request.size.validation.configuration="request.size.validation:true",server.bootstrap.configuration="server.bootstrap.socket.timeout:25" @map(type='xml')) -define stream FooStream (symbol string, price float, volume long); - -``` -

Above source listenerConfiguration performs a default XML input mapping. The expected input is as follows:
<events>
    <event>
        <symbol>WSO2</symbol>
        <price>55.6</price>
        <volume>100</volume>
    </event>
</events>
If basic authentication is enabled via the basic.auth.enabled='true setting, each input event is also expected to contain the Authorization:'Basic encodeBase64(username:Password)' header.

- -### http-request *(Source)* - -

The HTTP request is correlated with the HTTP response sink, through a unique source.id, and for each POST requests it receives via HTTP or HTTPS in format such as text, XML and JSON it sends the response via the HTTP response sink. The individual request and response messages are correlated at the sink using the message.id of the events. If required, you can enable basic authentication at the source to ensure that events are received only from users who are authorized to access the service.

- -Syntax -``` -@source(type="http-request", receiver.url="", source.id="", connection.timeout="", basic.auth.enabled="", worker.count="", socket.idle.timeout="", ssl.verify.client="", ssl.protocol="", tls.store.type="", parameters="", ciphers="", ssl.enabled.protocols="", server.enable.session.creation="", server.supported.snimatchers="", server.suported.server.names="", request.size.validation.configuration="", request.size.validation="", request.size.validation.maximum.value="", request.size.validation.reject.status.code="", request.size.validation.reject.message="", request.size.validation.reject.message.content.type="", header.size.validation="", header.validation.maximum.request.line="", header.validation.maximum.size="", header.validation.maximum.chunk.size="", header.validation.reject.status.code="", header.validation.reject.message="", header.validation.reject.message.content.type="", server.bootstrap.configuration="", server.bootstrap.nodelay="", server.bootstrap.keepalive="", server.bootstrap.sendbuffersize="", server.bootstrap.recievebuffersize="", server.bootstrap.connect.timeout="", server.bootstrap.socket.reuse="", server.bootstrap.socket.timeout="", server.bootstrap.socket.backlog="", trace.log.enabled="", @map(...))) -``` - -QUERY PARAMETERS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
receiver.urlThe URL to which the events should be received. User can provide any valid url and if the url is not provided the system will use the following format http://0.0.0.0:9763/<appNAme>/<streamName>If the user want to use SSL the url should be given in following format https://localhost:8080/<streamName>http://0.0.0.0:9763//STRINGYesNo
source.idIdentifier need to map the source to sink.STRINGNoNo
connection.timeoutConnection timeout in milliseconds. If the mapped http-response sink does not get a correlated message, after this timeout value, a timeout response is sent120000INTYesNo
basic.auth.enabledIf this is set to true, basic authentication is enabled for incoming events, and the credentials with which each event is sent are verified to ensure that the user is authorized to access the service. If basic authentication fails, the event is not authenticated and an authentication error is logged in the CLI. By default this values 'false' falseSTRINGYesNo
worker.countThe number of active worker threads to serve the incoming events. The value is 1 by default. This will ensure that the events are directed to the event stream in the same order in which they arrive. By increasing this value the performance might increase at the cost of loosing event ordering.1INTYesNo
socket.idle.timeoutIdle timeout for HTTP connection.120000INTYesNo
ssl.verify.clientThe type of client certificate verification.nullSTRINGYesNo
ssl.protocolssl/tls related optionsTLSSTRINGYesNo
tls.store.typeTLS store type.JKSSTRINGYesNo
parametersParameters other than basics such as ciphers,sslEnabledProtocols,client.enable.session.creation. Expected format of these parameters is as follows: "'ciphers:xxx','sslEnabledProtocols,client.enable:xxx'"nullSTRINGYesNo
ciphersList of ciphers to be used. This parameter should include under parameters Ex: 'ciphers:TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256'nullSTRINGYesNo
ssl.enabled.protocolsSSL/TLS protocols to be enabled. This parameter should be in camel case format(sslEnabledProtocols) under parameters. Ex 'sslEnabledProtocols:true'nullSTRINGYesNo
server.enable.session.creationEnable HTTP session creation.This parameter should include under parameters Ex: 'client.enable.session.creation:true'nullSTRINGYesNo
server.supported.snimatchersHttp SNIMatcher to be added. This parameter should include under parameters Ex: 'server.supported.snimatchers:SNIMatcher'nullSTRINGYesNo
server.suported.server.namesHttp supported servers. This parameter should include under parameters Ex: 'server.suported.server.names:server'nullSTRINGYesNo
request.size.validation.configurationParameters that responsible for validating the http request and request headers. Expected format of these parameters is as follows: "'request.size.validation:xxx','request.size.validation.maximum.value:xxx'"nullSTRINGYesNo
request.size.validationTo enable the request size validation.falseSTRINGYesNo
request.size.validation.maximum.valueIf request size is validated then maximum size.Integer.MAX_VALUESTRINGYesNo
request.size.validation.reject.status.codeIf request is exceed maximum size and request.size.validation is enabled then status code to be send as response.401STRINGYesNo
request.size.validation.reject.messageIf request is exceed maximum size and request.size.validation is enabled then status message to be send as response.Message is bigger than the valid sizeSTRINGYesNo
request.size.validation.reject.message.content.typeIf request is exceed maximum size and request.size.validation is enabled then content type to be send as response.plain/textSTRINGYesNo
header.size.validationTo enable the header size validation.falseSTRINGYesNo
header.validation.maximum.request.lineIf header header validation is enabled then the maximum request line.4096STRINGYesNo
header.validation.maximum.sizeIf header header validation is enabled then the maximum expected header size.8192STRINGYesNo
header.validation.maximum.chunk.sizeIf header header validation is enabled then the maximum expected chunk size.8192STRINGYesNo
header.validation.reject.status.code401If header is exceed maximum size and header.size.validation is enabled then status code to be send as response.STRINGYesNo
header.validation.reject.messageIf header is exceed maximum size and header.size.validation is enabled then message to be send as response.Message header is bigger than the valid sizeSTRINGYesNo
header.validation.reject.message.content.typeIf header is exceed maximum size and header.size.validation is enabled then content type to be send as response.plain/textSTRINGYesNo
server.bootstrap.configurationParameters that for bootstrap configurations of the server. Expected format of these parameters is as follows: "'ciphers:xxx','sslEnabledProtocols,client.enable:xxx'"nullOBJECTYesNo
server.bootstrap.nodelayHttp server no delay.trueBOOLYesNo
server.bootstrap.keepaliveHttp server keep alive.trueBOOLYesNo
server.bootstrap.sendbuffersizeHttp server send buffer size.1048576INTYesNo
server.bootstrap.recievebuffersizeHttp server receive buffer size.1048576INTYesNo
server.bootstrap.connect.timeoutHttp server connection timeout.15000INTYesNo
server.bootstrap.socket.reuseTo enable http socket reuse.falseBOOLYesNo
server.bootstrap.socket.timeoutHttp server socket timeout.15BOOLYesNo
server.bootstrap.socket.backlogTHttp server socket backlog.100BOOLYesNo
trace.log.enabledHttp traffic monitoring.falseBOOLYesNo
- -System Parameters - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Parameters
serverBootstrapBossGroupSizeproperty to configure number of boss threads, which accepts incoming connections until the ports are unbound. Once connection accepts successfully, boss thread passes the accepted channel to one of the worker threads.Number of available processorsAny integer
serverBootstrapWorkerGroupSizeproperty to configure number of worker threads, which performs non blocking read and write for one or more channels in non-blocking mode.(Number of available processors)*2Any integer
serverBootstrapClientGroupSizeproperty to configure number of client threads, which performs non blocking read and write for one or more channels in non-blocking mode.(Number of available processors)*2Any integer
defaultHostThe default host of the transport.0.0.0.0Any valid host
defaultHttpPortThe default port if the default scheme is 'http'.8280Any valid port
defaultHttpsPortThe default port if the default scheme is 'https'.8243Any valid port
defaultSchemeThe default protocol.httphttp
https
keyStoreLocationThe default keystore file path.${carbon.home}/resources/security/wso2carbon.jksPath to wso2carbon.jks file
keyStorePasswordThe default keystore password.wso2carbonString of keystore password
certPasswordThe default cert password.wso2carbonString of cert password
- -Examples -EXAMPLE 1 -``` -@source(type='http-request', source.id='sampleSourceId, receiver.url='http://localhost:9055/endpoints/RecPro', connection.timeout='150000', parameters="'ciphers : TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256', 'sslEnabledProtocols:TLSv1.1,TLSv1.2'", request.size.validation.configuration="request.size.validation:true", server.bootstrap.configuration="server.bootstrap.socket.timeout:25", @map(type='json, @attributes(messageId='trp:messageId', symbol='$.events.event.symbol', price='$.events.event.price', volume='$.events.event.volume'))) -define stream FooStream (messageId string, symbol string, price float, volume long); - -``` -

The expected input is as follows:
{"events":
    {"event":
        "symbol":WSO2,
        "price":55.6,
        "volume":100,
    }
}
If basic authentication is enabled via the basic.auth.enabled='true setting, each input event is also expected to contain the Authorization:'Basic encodeBase64(username:Password)' header.

- -### http-response *(Source)* - -

The http-response source co-relates with http-request sink with the parameter 'sink.id'.
This receives responses for the requests sent by the http-request sink which has the same sink id.
Response messages can be in formats such as TEXT, JSON and XML.
In order to handle the responses with different http status codes, user is allowed to defined the acceptable response source code using the parameter 'http.status.code'

- -Syntax -``` -@source(type="http-response", sink.id="", http.status.code="", allow.streaming.responses="", @map(...))) -``` - -QUERY PARAMETERS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
sink.idThis parameter is used to map the http-response source to a http-request sink. Then this source will accepts the response messages for the requests sent by corresponding http-request sink.STRINGNoNo
http.status.codeAcceptable http status code for the responses.
This can be a complete string or a regex.
Only the responses with matching status codes to the defined value, will be received by the http-response source.
Eg: 'http.status.code = '200', http.status.code = '2\\d+''
200STRINGYesNo
allow.streaming.responsesIf responses can be received multiple times for a single request, this option should be enabled. If this is not enabled, for every request, response will be extracted only once.falseBOOLYesNo
- -Examples -EXAMPLE 1 -``` -@sink(type='http-request', -downloading.enabled='true', -publisher.url='http://localhost:8005/registry/employee', -method='POST', headers='{{headers}}',sink.id='employee-info', -@map(type='json')) -define stream BarStream (name String, id int, headers String, downloadPath string); - -@source(type='http-response' , sink.id='employee-info', http.status.code='2\\d+', -@map(type='text', regex.A='((.|\n)*)', @attributes(message='A[1]'))) -define stream responseStream2xx(message string);@source(type='http-response' , sink.id='employee-info', http.status.code='4\\d+' , -@map(type='text', regex.A='((.|\n)*)', @attributes(message='A[1]'))) -define stream responseStream4xx(message string); -``` -

In above example, the defined http-request sink will send a POST requests to the endpoint defined by 'publisher.url'.
Then for those requests, the source with the response code '2\\d+' and sink.id 'employee-info' will receive the responses with 2xx status codes.
The http-response source which has 'employee-info' as the 'sink.id' and '4\\d+' as the http.response.code will receive all the responses with 4xx status codes.
. Then the body of the response message will be extracted using text mapper and converted into siddhi events.
.

- diff --git a/docs/api/1.1.3.md b/docs/api/1.1.3.md deleted file mode 100644 index 32e41759..00000000 --- a/docs/api/1.1.3.md +++ /dev/null @@ -1,1755 +0,0 @@ -# API Docs - v1.1.3 - -## Sink - -### http *(Sink)* - -

This extension publish the HTTP events in any HTTP method POST, GET, PUT, DELETE via HTTP or https protocols. As the additional features this component can provide basic authentication as well as user can publish events using custom client truststore files when publishing events via https protocol. And also user can add any number of headers including HTTP_METHOD header for each event dynamically.
Following content types will be set by default according to the type of sink mapper used.
You can override them by setting the new content types in headers.
     - TEXT : text/plain
     - XML : application/xml
     - JSON : application/json
     - KEYVALUE : application/x-www-form-urlencoded

- -Syntax -``` -@sink(type="http", publisher.url="", basic.auth.username="", basic.auth.password="", https.truststore.file="", https.truststore.password="", headers="", method="", socket.idle.timeout="", chunk.disabled="", ssl.protocol="", parameters="", ciphers="", ssl.enabled.protocols="", client.enable.session.creation="", follow.redirect="", max.redirect.count="", tls.store.type="", proxy.host="", proxy.port="", proxy.username="", proxy.password="", client.bootstrap.configuration="", client.bootstrap.nodelay="", client.bootstrap.keepalive="", client.bootstrap.sendbuffersize="", client.bootstrap.recievebuffersize="", client.bootstrap.connect.timeout="", client.bootstrap.socket.reuse="", client.bootstrap.socket.timeout="", client.threadpool.configurations="", client.connection.pool.count="", client.max.active.connections.per.pool="", client.min.idle.connections.per.pool="", client.max.idle.connections.per.pool="", client.min.eviction.idle.time="", sender.thread.count="", event.group.executor.thread.size="", max.wait.for.client.connection.pool="", oauth.username="", oauth.password="", consumer.key="", consumer.secret="", refresh.token="", token.url="", @map(...))) -``` - -QUERY PARAMETERS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
publisher.urlThe URL to which the outgoing events should be published via HTTP. This is a mandatory parameter and if this is not specified, an error is logged in the CLI. If user wants to enable SSL for the events, use https instead of http in the publisher.url.e.g., http://localhost:8080/endpoint, https://localhost:8080/endpointSTRINGNoNo
basic.auth.usernameThe username to be included in the authentication header of the basic authentication enabled events. It is required to specify both username and password to enable basic authentication. If one of the parameter is not given by user then an error is logged in the CLI. STRINGYesNo
basic.auth.passwordThe password to include in the authentication header of the basic authentication enabled events. It is required to specify both username and password to enable basic authentication. If one of the parameter is not given by user then an error is logged in the CLI. STRINGYesNo
https.truststore.fileThe file path to the location of the truststore of the client that sends the HTTP events through 'https' protocol. A custom client-truststore can be specified if required.${carbon.home}/resources/security/client-truststore.jksSTRINGYesNo
https.truststore.passwordThe password for the client-truststore. A custom password can be specified if required. If no custom password is specified and the protocol of URL is 'https' then, the system uses default password.wso2carbonSTRINGYesNo
headersThe headers that should be included as HTTP request headers.
There can be any number of headers concatenated in following format. "'header1:value1','header2:value2'". User can include Content-Type header if he needs to use a specific content-type for the payload. Or else, system decides the Content-Type by considering the type of sink mapper, in following way.
 - @map(xml):application/xml
 - @map(json):application/json
 - @map(text):plain/text )
 - if user does not include any mapping type then the system gets 'plain/text' as default Content-Type header.
Note that providing content-length as a header is not supported. The size of the payload will be automatically calculated and included in the content-length header.
STRINGYesNo
methodFor HTTP events, HTTP_METHOD header should be included as a request header. If the parameter is null then system uses 'POST' as a default header.POSTSTRINGYesNo
socket.idle.timeoutSocket timeout value in millisecond6000INTYesNo
chunk.disabledThis parameter is used to disable/enable chunked transfer encodingfalseBOOLYesNo
ssl.protocolThe SSL protocol versionTLSSTRINGYesNo
parametersParameters other than basics such as ciphers,sslEnabledProtocols,client.enable.session.creation. Expected format of these parameters is as follows: "'ciphers:xxx','sslEnabledProtocols,client.enable:xxx'"nullSTRINGYesNo
ciphersList of ciphers to be used. This parameter should include under parameters Ex: 'ciphers:TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256'nullSTRINGYesNo
ssl.enabled.protocolsSSL/TLS protocols to be enabled. This parameter should be in camel case format(sslEnabledProtocols) under parameters. Ex 'sslEnabledProtocols:true'nullSTRINGYesNo
client.enable.session.creationEnable HTTP session creation.This parameter should include under parameters Ex: 'client.enable.session.creation:true'nullSTRINGYesNo
follow.redirectRedirect related enabled.trueBOOLYesNo
max.redirect.countMaximum redirect count.5INTYesNo
tls.store.typeTLS store type to be used.JKSSTRINGYesNo
proxy.hostProxy server hostnullSTRINGYesNo
proxy.portProxy server portnullSTRINGYesNo
proxy.usernameProxy server usernamenullSTRINGYesNo
proxy.passwordProxy server passwordnullSTRINGYesNo
client.bootstrap.configurationClient bootsrap configurations. Expected format of these parameters is as follows: "'client.bootstrap.nodelay:xxx','client.bootstrap.keepalive:xxx'"TODOSTRINGYesNo
client.bootstrap.nodelayHttp client no delay.trueBOOLYesNo
client.bootstrap.keepaliveHttp client keep alive.trueBOOLYesNo
client.bootstrap.sendbuffersizeHttp client send buffer size.1048576INTYesNo
client.bootstrap.recievebuffersizeHttp client receive buffer size.1048576INTYesNo
client.bootstrap.connect.timeoutHttp client connection timeout.15000INTYesNo
client.bootstrap.socket.reuseTo enable http socket reuse.falseBOOLYesNo
client.bootstrap.socket.timeoutHttp client socket timeout.15STRINGYesNo
client.threadpool.configurationsThread pool configuration. Expected format of these parameters is as follows: "'client.connection.pool.count:xxx','client.max.active.connections.per.pool:xxx'"TODOSTRINGYesNo
client.connection.pool.countConnection pool count.0INTYesNo
client.max.active.connections.per.poolActive connections per pool.-1INTYesNo
client.min.idle.connections.per.poolMinimum ideal connection per pool.0INTYesNo
client.max.idle.connections.per.poolMaximum ideal connection per pool.100INTYesNo
client.min.eviction.idle.timeMinimum eviction idle time.5 * 60 * 1000STRINGYesNo
sender.thread.countHttp sender thread count.20STRINGYesNo
event.group.executor.thread.sizeEvent group executor thread size.15STRINGYesNo
max.wait.for.client.connection.poolMaximum wait for client connection pool.60000STRINGYesNo
oauth.usernameThe username to be included in the authentication header of the oauth authentication enabled events. It is required to specify both username and password to enable oauth authentication. If one of the parameter is not given by user then an error is logged in the CLI. It is only applicable for for Oauth requests STRINGYesNo
oauth.passwordThe password to be included in the authentication header of the oauth authentication enabled events. It is required to specify both username and password to enable oauth authentication. If one of the parameter is not given by user then an error is logged in the CLI. It is only applicable for for Oauth requests STRINGYesNo
consumer.keyconsumer key for the Http request. It is only applicable for for Oauth requests STRINGYesNo
consumer.secretconsumer secret for the Http request. It is only applicable for for Oauth requests STRINGYesNo
refresh.tokenrefresh token for the Http request. It is only applicable for for Oauth requests STRINGYesNo
token.urltoken url for generate a new access token. It is only applicable for for Oauth requests STRINGYesNo
- -System Parameters - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Parameters
clientBootstrapBossGroupSizeproperty to configure number of boss threads, which accepts incoming connections until the ports are unbound. Once connection accepts successfully, boss thread passes the accepted channel to one of the worker threads.Number of available processorsAny integer
clientBootstrapWorkerGroupSizeproperty to configure number of worker threads, which performs non blocking read and write for one or more channels in non-blocking mode.(Number of available processors)*2Any integer
clientBootstrapClientGroupSizeproperty to configure number of client threads, which performs non blocking read and write for one or more channels in non-blocking mode.(Number of available processors)*2Any integer
trustStoreLocationThe default truststore file path.${carbon.home}/resources/security/client-truststore.jksPath to client-truststore.jks
trustStorePasswordThe default truststore password.wso2carbonTruststore password
- -Examples -EXAMPLE 1 -``` -@sink(type='http',publisher.url='http://localhost:8009/foo', method='{{method}}',headers="'content-type:xml','content-length:94'", client.bootstrap.configuration="'client.bootstrap.socket.timeout:20', 'client.bootstrap.worker.group.size:10'", client.pool.configuration="'client.connection.pool.count:10','client.max.active.connections.per.pool:1'", @map(type='xml', @payload('{{payloadBody}}'))) -define stream FooStream (payloadBody String, method string, headers string); - -``` -

If it is xml mapping expected input should be in following format for FooStream:
{
<events>
    <event>
        <symbol>WSO2</symbol>
        <price>55.6</price>
        <volume>100</volume>
    </event>
</events>,
POST,
Content-Length:24#Content-Location:USA#Retry-After:120
}

Above event will generate output as below.
~Output http event payload
<events>
    <event>
        <symbol>WSO2</symbol>
        <price>55.6</price>
        <volume>100</volume>
    </event>
</events>

~Output http event headers
Content-Length:24,
Content-Location:'USA',
Retry-After:120,
Content-Type:'application/xml',
HTTP_METHOD:'POST',

~Output http event properties
HTTP_METHOD:'POST',
HOST:'localhost',
PORT:8009,
PROTOCOL:'http',
TO:'/foo'

- -### http-request *(Sink)* - -

This extension publish the HTTP events in any HTTP method POST, GET, PUT, DELETE via HTTP or https protocols. As the additional features this component can provide basic authentication as well as user can publish events using custom client truststore files when publishing events via https protocol. And also user can add any number of headers including HTTP_METHOD header for each event dynamically.
Following content types will be set by default according to the type of sink mapper used.
You can override them by setting the new content types in headers.
     - TEXT : text/plain
     - XML : application/xml
     - JSON : application/json
     - KEYVALUE : application/x-www-form-urlencoded

HTTP request sink is correlated with the The HTTP reponse source, through a unique sink.id.It sends the request to the defined url and the response is received by the response source which has the same 'sink.id'.

- -Syntax -``` -@sink(type="http-request", publisher.url="", basic.auth.username="", basic.auth.password="", https.truststore.file="", https.truststore.password="", headers="", method="", socket.idle.timeout="", chunk.disabled="", ssl.protocol="", parameters="", ciphers="", ssl.enabled.protocols="", client.enable.session.creation="", follow.redirect="", max.redirect.count="", tls.store.type="", proxy.host="", proxy.port="", proxy.username="", proxy.password="", client.bootstrap.configuration="", client.bootstrap.nodelay="", client.bootstrap.keepalive="", client.bootstrap.sendbuffersize="", client.bootstrap.recievebuffersize="", client.bootstrap.connect.timeout="", client.bootstrap.socket.reuse="", client.bootstrap.socket.timeout="", client.threadpool.configurations="", client.connection.pool.count="", client.max.active.connections.per.pool="", client.min.idle.connections.per.pool="", client.max.idle.connections.per.pool="", client.min.eviction.idle.time="", sender.thread.count="", event.group.executor.thread.size="", max.wait.for.client.connection.pool="", sink.id="", downloading.enabled="", download.path="", oauth.username="", oauth.password="", consumer.key="", consumer.secret="", refresh.token="", @map(...))) -``` - -QUERY PARAMETERS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
publisher.urlThe URL to which the outgoing events should be published via HTTP. This is a mandatory parameter and if this is not specified, an error is logged in the CLI. If user wants to enable SSL for the events, use https instead of http in the publisher.url.
e.g., http://localhost:8080/endpoint, https://localhost:8080/endpoint
This can be used as a dynamic parameter as well.
STRINGNoYes
basic.auth.usernameThe username to be included in the authentication header of the basic authentication enabled events. It is required to specify both username and password to enable basic authentication. If one of the parameter is not given by user then an error is logged in the CLI. STRINGYesNo
basic.auth.passwordThe password to include in the authentication header of the basic authentication enabled events. It is required to specify both username and password to enable basic authentication. If one of the parameter is not given by user then an error is logged in the CLI. STRINGYesNo
https.truststore.fileThe file path to the location of the truststore of the client that sends the HTTP events through 'https' protocol. A custom client-truststore can be specified if required.${carbon.home}/resources/security/client-truststore.jksSTRINGYesNo
https.truststore.passwordThe password for the client-truststore. A custom password can be specified if required. If no custom password is specified and the protocol of URL is 'https' then, the system uses default password.wso2carbonSTRINGYesNo
headersThe headers that should be included as HTTP request headers.
There can be any number of headers concatenated in following format. "'header1:value1','header2:value2'". User can include Content-Type header if he needs to use a specific content-type for the payload. Or else, system decides the Content-Type by considering the type of sink mapper, in following way.
 - @map(xml):application/xml
 - @map(json):application/json
 - @map(text):plain/text )
 - if user does not include any mapping type then the system gets 'plain/text' as default Content-Type header.
Note that providing content-length as a header is not supported. The size of the payload will be automatically calculated and included in the content-length header.
STRINGYesNo
methodFor HTTP events, HTTP_METHOD header should be included as a request header. If the parameter is null then system uses 'POST' as a default header.POSTSTRINGYesNo
socket.idle.timeoutSocket timeout value in millisecond6000INTYesNo
chunk.disabledport: Port number of the remote servicefalseBOOLYesNo
ssl.protocolThe SSL protocol versionTLSSTRINGYesNo
parametersParameters other than basics such as ciphers,sslEnabledProtocols,client.enable.session.creation. Expected format of these parameters is as follows: "'ciphers:xxx','sslEnabledProtocols,client.enable:xxx'"nullSTRINGYesNo
ciphersList of ciphers to be used. This parameter should include under parameters Ex: 'ciphers:TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256'nullSTRINGYesNo
ssl.enabled.protocolsSSL/TLS protocols to be enabled. This parameter should be in camel case format(sslEnabledProtocols) under parameters. Ex 'sslEnabledProtocols:true'nullSTRINGYesNo
client.enable.session.creationEnable HTTP session creation.This parameter should include under parameters Ex: 'client.enable.session.creation:true'nullSTRINGYesNo
follow.redirectRedirect related enabled.trueBOOLYesNo
max.redirect.countMaximum redirect count.5INTYesNo
tls.store.typeTLS store type to be used.JKSSTRINGYesNo
proxy.hostProxy server hostnullSTRINGYesNo
proxy.portProxy server portnullSTRINGYesNo
proxy.usernameProxy server usernamenullSTRINGYesNo
proxy.passwordProxy server passwordnullSTRINGYesNo
client.bootstrap.configurationClient bootsrap configurations. Expected format of these parameters is as follows: "'client.bootstrap.nodelay:xxx','client.bootstrap.keepalive:xxx'"TODOSTRINGYesNo
client.bootstrap.nodelayHttp client no delay.trueBOOLYesNo
client.bootstrap.keepaliveHttp client keep alive.trueBOOLYesNo
client.bootstrap.sendbuffersizeHttp client send buffer size.1048576INTYesNo
client.bootstrap.recievebuffersizeHttp client receive buffer size.1048576INTYesNo
client.bootstrap.connect.timeoutHttp client connection timeout.15000INTYesNo
client.bootstrap.socket.reuseTo enable http socket reuse.falseBOOLYesNo
client.bootstrap.socket.timeoutHttp client socket timeout.15STRINGYesNo
client.threadpool.configurationsThread pool configuration. Expected format of these parameters is as follows: "'client.connection.pool.count:xxx','client.max.active.connections.per.pool:xxx'"TODOSTRINGYesNo
client.connection.pool.countConnection pool count.0INTYesNo
client.max.active.connections.per.poolActive connections per pool.-1INTYesNo
client.min.idle.connections.per.poolMinimum ideal connection per pool.0INTYesNo
client.max.idle.connections.per.poolMaximum ideal connection per pool.100INTYesNo
client.min.eviction.idle.timeMinimum eviction idle time.5 * 60 * 1000STRINGYesNo
sender.thread.countHttp sender thread count.20STRINGYesNo
event.group.executor.thread.sizeEvent group executor thread size.15STRINGYesNo
max.wait.for.client.connection.poolMaximum wait for client connection pool.60000STRINGYesNo
sink.idIdentifier of the sink. This is used to co-relate with the corresponding http-response source which needs to process the repose for the request sent by this sink.STRINGNoNo
downloading.enabledIf this is set to 'true' then the response received by the response source will be written to a file. If downloading is enabled, the download.path parameter is mandatory.falseBOOLYesNo
download.pathIf downloading is enabled, the path of the file which is going to be downloaded should be specified using 'download.path' parameter. This should be an absolute path including the file name.nullSTRINGYesYes
oauth.usernameThe username to be included in the authentication header of the oauth authentication enabled events. It is required to specify both username and password to enable oauth authentication. If one of the parameter is not given by user then an error is logged in the CLI. It is only applicable for for Oauth requests STRINGYesNo
oauth.passwordThe password to be included in the authentication header of the oauth authentication enabled events. It is required to specify both username and password to enable oauth authentication. If one of the parameter is not given by user then an error is logged in the CLI. It is only applicable for for Oauth requests STRINGYesNo
consumer.keyconsumer key for the Http request. It is only applicable for for Oauth requests STRINGYesNo
consumer.secretconsumer secret for the Http request. It is only applicable for for Oauth requests STRINGYesNo
refresh.tokenrefresh token for the Http request. It is only applicable for for Oauth requests STRINGYesNo
- -Examples -EXAMPLE 1 -``` -@sink(type='http-request', sink.id='foo', publisher.url='http://localhost:8009/foo', @map(type='xml', @payload('{{payloadBody}}'))) -define stream FooStream (payloadBody String, method string, headers string); -@source(type='http-response', sink.id='foo', http.status.code='2\\d+', -@map(type='text', regex.A='((.|\n)*)', @attributes(headers='trp:headers', fileName='A[1]'))) -define stream responseStream2xx(fileName string, headers string); - -@source(type='http-response', sink.id='foo', http.status.code='4\\d+', -@map(type='text', regex.A='((.|\n)*)', @attributes(errorMsg='A[1]'))) -define stream responseStream4xx(errorMsg string); -``` -

In above example, the payload body for 'FooStream' will be in following format.
{
<events>
    <event>
        <symbol>WSO2</symbol>
        <price>55.6</price>
        <volume>100</volume>
    </event>
</events>,
This message will sent as the body of a POST request with the content-type 'application/xml' to the endpoint defined as the 'publisher.url' and in order to process the responses for these requests, there should be a source of type 'http-response' defined with the same sink id 'foo' in the siddhi app.
 The responses with 2xx status codes will be received by the http-response source which has the http.status.code defined by the regex '2\\d+'.
If the response has a 4xx status code, it will be received by the http-response source which has the http.status.code defined by the regex '4\\d+'.

- -EXAMPLE 2 -``` -define stream FooStream (name String, id int, headers String, downloadPath string); -@sink(type='http-request', -downloading.enabled='true', -download.path='{{downloadPath}}',publisher.url='http://localhost:8005/files', -method='GET', headers='{{headers}}',sink.id='download-sink', -@map(type='json')) -define stream BarStream (name String, id int, headers String, downloadPath string); - -@source(type='http-response', sink.id='download-sink', http.status.code='2\\d+', -@map(type='text', regex.A='((.|\n)*)', @attributes(headers='trp:headers', fileName='A[1]'))) -define stream responseStream2xx(fileName string, headers string); - -@source(type='http-response', sink.id='download-sink', http.status.code='4\\d+', -@map(type='text', regex.A='((.|\n)*)', @attributes(errorMsg='A[1]'))) -define stream responseStream4xx(errorMsg string); -``` -

In above example, http-request sink will send a GET request to the publisher url and the requested file will be received as the response by a corresponding http-response source.
If the http status code of the response is a successful one (2xx), it will be received by the http-response source which has the http.status.code '2\\d+' and downloaded as a local file. Then the event received to the responseStream2xx will have the headers included in the request and the downloaded file name.
If the http status code of the response is a 4xx code, it will be received by the http-response source which has the http.status.code '4\\d+'. Then the event received to the responseStream4xx will have the response message body in text format.

- -### http-response *(Sink)* - -

HTTP response sink is correlated with the The HTTP request source, through a unique source.id, and it send a response to the HTTP request source having the same source.id. The response message can be formatted in text, XML or JSON and can be sent with appropriate headers.

- -Syntax -``` -@sink(type="http-response", source.id="", message.id="", headers="", @map(...))) -``` - -QUERY PARAMETERS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
source.idIdentifier of the source.STRINGNoNo
message.idIdentifier of the message.STRINGNoYes
headersThe headers that should be included as HTTP response headers. There can be any number of headers concatenated on following format. "'header1:value1','header2:value2'" User can include content-type header if he/she need to have any specific type for payload. If not system get the mapping type as the content-Type header (ie.@map(xml):application/xml, @map(json):application/json, @map(text):plain/text) and if user does not include any mapping type then system gets the plain/text as default Content-Type header. If user does not include Content-Length header then system calculate the bytes size of payload and include it as content-length header. STRINGYesNo
- -Examples -EXAMPLE 1 -``` -@sink(type='http-response', source.id='sampleSourceId', message.id='{{messageId}}', headers="'content-type:json','content-length:94'"@map(type='json', @payload('{{payloadBody}}'))) -define stream FooStream (payloadBody String, messageId string, headers string); - -``` -

If it is json mapping expected input should be in following format for FooStream:
{
{"events":
    {"event":
        "symbol":WSO2,
        "price":55.6,
        "volume":100,
    }
},
0cf708b1-7eae-440b-a93e-e72f801b486a,
Content-Length:24#Content-Location:USA
}

Above event will generate response for the matching source message as below.

~Output http event payload
{"events":
    {"event":
        "symbol":WSO2,
        "price":55.6,
        "volume":100,
    }
}

~Output http event headers
Content-Length:24,
Content-Location:'USA',
Content-Type:'application/json'

- -## Source - -### http *(Source)* - -

The HTTP source receives POST requests via HTTP or HTTPS in format such as text, XML and JSON. In WSO2 SP, if required, you can enable basic authentication to ensure that events are received only from users who are authorized to access the service.

- -Syntax -``` -@source(type="http", receiver.url="", basic.auth.enabled="", worker.count="", socket.idle.timeout="", ssl.verify.client="", ssl.protocol="", tls.store.type="", parameters="", ciphers="", ssl.enabled.protocols="", server.enable.session.creation="", server.supported.snimatchers="", server.suported.server.names="", request.size.validation.configuration="", request.size.validation="", request.size.validation.maximum.value="", request.size.validation.reject.status.code="", request.size.validation.reject.message="", request.size.validation.reject.message.content.type="", header.size.validation="", header.validation.maximum.request.line="", header.validation.maximum.size="", header.validation.maximum.chunk.size="", header.validation.reject.status.code="", header.validation.reject.message="", header.validation.reject.message.content.type="", server.bootstrap.configuration="", server.bootstrap.nodelay="", server.bootstrap.keepalive="", server.bootstrap.sendbuffersize="", server.bootstrap.recievebuffersize="", server.bootstrap.connect.timeout="", server.bootstrap.socket.reuse="", server.bootstrap.socket.timeout="", server.bootstrap.socket.backlog="", trace.log.enabled="", @map(...))) -``` - -QUERY PARAMETERS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
receiver.urlThe URL to which the events should be received. User can provide any valid url and if the url is not provided the system will use the following format http://0.0.0.0:9763/<appNAme>/<streamName>If the user want to use SSL the url should be given in following format https://localhost:8080/<streamName>http://0.0.0.0:9763//STRINGYesNo
basic.auth.enabledThis works only in WSO2 SP. If this is set to true, basic authentication is enabled for incoming events, and the credentials with which each event is sent are verified to ensure that the user is authorized to access the service. If basic authentication fails, the event is not authenticated and an authentication error is logged in the CLI.falseSTRINGYesNo
worker.countThe number of active worker threads to serve the incoming events. The value is 1 by default. This will ensure that the events are directed to the event stream in the same order in which they arrive. By increasing this value the performance might increase at the cost of loosing event ordering.1INTYesNo
socket.idle.timeoutIdle timeout for HTTP connection.120000INTYesNo
ssl.verify.clientThe type of client certificate verification.nullSTRINGYesNo
ssl.protocolssl/tls related optionsTLSSTRINGYesNo
tls.store.typeTLS store type.JKSSTRINGYesNo
parametersParameters other than basics such as ciphers,sslEnabledProtocols,client.enable.session.creation. Expected format of these parameters is as follows: "'ciphers:xxx','sslEnabledProtocols,client.enable:xxx'"nullSTRINGYesNo
ciphersList of ciphers to be used. This parameter should include under parameters Ex: 'ciphers:TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256'nullSTRINGYesNo
ssl.enabled.protocolsSSL/TLS protocols to be enabled. This parameter should be in camel case format(sslEnabledProtocols) under parameters. Ex 'sslEnabledProtocols:true'nullSTRINGYesNo
server.enable.session.creationEnable HTTP session creation.This parameter should include under parameters Ex: 'client.enable.session.creation:true'nullSTRINGYesNo
server.supported.snimatchersHttp SNIMatcher to be added. This parameter should include under parameters Ex: 'server.supported.snimatchers:SNIMatcher'nullSTRINGYesNo
server.suported.server.namesHttp supported servers. This parameter should include under parameters Ex: 'server.suported.server.names:server'nullSTRINGYesNo
request.size.validation.configurationParameters that responsible for validating the http request and request headers. Expected format of these parameters is as follows: "'request.size.validation:xxx','request.size.validation.maximum.value:xxx'"nullSTRINGYesNo
request.size.validationTo enable the request size validation.falseSTRINGYesNo
request.size.validation.maximum.valueIf request size is validated then maximum size.Integer.MAX_VALUESTRINGYesNo
request.size.validation.reject.status.codeIf request is exceed maximum size and request.size.validation is enabled then status code to be send as response.401STRINGYesNo
request.size.validation.reject.messageIf request is exceed maximum size and request.size.validation is enabled then status message to be send as response.Message is bigger than the valid sizeSTRINGYesNo
request.size.validation.reject.message.content.typeIf request is exceed maximum size and request.size.validation is enabled then content type to be send as response.plain/textSTRINGYesNo
header.size.validationTo enable the header size validation.falseSTRINGYesNo
header.validation.maximum.request.lineIf header header validation is enabled then the maximum request line.4096STRINGYesNo
header.validation.maximum.sizeIf header header validation is enabled then the maximum expected header size.8192STRINGYesNo
header.validation.maximum.chunk.sizeIf header header validation is enabled then the maximum expected chunk size.8192STRINGYesNo
header.validation.reject.status.code401If header is exceed maximum size and header.size.validation is enabled then status code to be send as response.STRINGYesNo
header.validation.reject.messageIf header is exceed maximum size and header.size.validation is enabled then message to be send as response.Message header is bigger than the valid sizeSTRINGYesNo
header.validation.reject.message.content.typeIf header is exceed maximum size and header.size.validation is enabled then content type to be send as response.plain/textSTRINGYesNo
server.bootstrap.configurationParameters that for bootstrap configurations of the server. Expected format of these parameters is as follows: "'ciphers:xxx','sslEnabledProtocols,client.enable:xxx'"nullOBJECTYesNo
server.bootstrap.nodelayHttp server no delay.trueBOOLYesNo
server.bootstrap.keepaliveHttp server keep alive.trueBOOLYesNo
server.bootstrap.sendbuffersizeHttp server send buffer size.1048576INTYesNo
server.bootstrap.recievebuffersizeHttp server receive buffer size.1048576INTYesNo
server.bootstrap.connect.timeoutHttp server connection timeout.15000INTYesNo
server.bootstrap.socket.reuseTo enable http socket reuse.falseBOOLYesNo
server.bootstrap.socket.timeoutHttp server socket timeout.15BOOLYesNo
server.bootstrap.socket.backlogTHttp server socket backlog.100BOOLYesNo
trace.log.enabledHttp traffic monitoring.falseBOOLYesNo
- -System Parameters - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Parameters
serverBootstrapBossGroupSizeproperty to configure number of boss threads, which accepts incoming connections until the ports are unbound. Once connection accepts successfully, boss thread passes the accepted channel to one of the worker threads.Number of available processorsAny integer
serverBootstrapWorkerGroupSizeproperty to configure number of worker threads, which performs non blocking read and write for one or more channels in non-blocking mode.(Number of available processors)*2Any integer
serverBootstrapClientGroupSizeproperty to configure number of client threads, which performs non blocking read and write for one or more channels in non-blocking mode.(Number of available processors)*2Any integer
defaultHostThe default host of the transport.0.0.0.0Any valid host
defaultHttpPortThe default port if the default scheme is 'http'.8280Any valid port
defaultHttpsPortThe default port if the default scheme is 'https'.8243Any valid port
defaultSchemeThe default protocol.httphttp
https
keyStoreLocationThe default keystore file path.${carbon.home}/resources/security/wso2carbon.jksPath to wso2carbon.jks file
keyStorePasswordThe default keystore password.wso2carbonString of keystore password
- -Examples -EXAMPLE 1 -``` -@source(type='http', receiver.url='http://localhost:9055/endpoints/RecPro', socketIdleTimeout='150000', parameters="'ciphers : TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256', 'sslEnabledProtocols:TLSv1.1,TLSv1.2'",request.size.validation.configuration="request.size.validation:true",server.bootstrap.configuration="server.bootstrap.socket.timeout:25" @map(type='xml')) -define stream FooStream (symbol string, price float, volume long); - -``` -

Above source listenerConfiguration performs a default XML input mapping. The expected input is as follows:
<events>
    <event>
        <symbol>WSO2</symbol>
        <price>55.6</price>
        <volume>100</volume>
    </event>
</events>
If basic authentication is enabled via the basic.auth.enabled='true setting, each input event is also expected to contain the Authorization:'Basic encodeBase64(username:Password)' header.

- -### http-request *(Source)* - -

The HTTP request is correlated with the HTTP response sink, through a unique source.id, and for each POST requests it receives via HTTP or HTTPS in format such as text, XML and JSON it sends the response via the HTTP response sink. The individual request and response messages are correlated at the sink using the message.id of the events. If required, you can enable basic authentication at the source to ensure that events are received only from users who are authorized to access the service.

- -Syntax -``` -@source(type="http-request", receiver.url="", source.id="", connection.timeout="", basic.auth.enabled="", worker.count="", socket.idle.timeout="", ssl.verify.client="", ssl.protocol="", tls.store.type="", parameters="", ciphers="", ssl.enabled.protocols="", server.enable.session.creation="", server.supported.snimatchers="", server.suported.server.names="", request.size.validation.configuration="", request.size.validation="", request.size.validation.maximum.value="", request.size.validation.reject.status.code="", request.size.validation.reject.message="", request.size.validation.reject.message.content.type="", header.size.validation="", header.validation.maximum.request.line="", header.validation.maximum.size="", header.validation.maximum.chunk.size="", header.validation.reject.status.code="", header.validation.reject.message="", header.validation.reject.message.content.type="", server.bootstrap.configuration="", server.bootstrap.nodelay="", server.bootstrap.keepalive="", server.bootstrap.sendbuffersize="", server.bootstrap.recievebuffersize="", server.bootstrap.connect.timeout="", server.bootstrap.socket.reuse="", server.bootstrap.socket.timeout="", server.bootstrap.socket.backlog="", trace.log.enabled="", @map(...))) -``` - -QUERY PARAMETERS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
receiver.urlThe URL to which the events should be received. User can provide any valid url and if the url is not provided the system will use the following format http://0.0.0.0:9763/<appNAme>/<streamName>If the user want to use SSL the url should be given in following format https://localhost:8080/<streamName>http://0.0.0.0:9763//STRINGYesNo
source.idIdentifier need to map the source to sink.STRINGNoNo
connection.timeoutConnection timeout in milliseconds. If the mapped http-response sink does not get a correlated message, after this timeout value, a timeout response is sent120000INTYesNo
basic.auth.enabledIf this is set to true, basic authentication is enabled for incoming events, and the credentials with which each event is sent are verified to ensure that the user is authorized to access the service. If basic authentication fails, the event is not authenticated and an authentication error is logged in the CLI. By default this values 'false' falseSTRINGYesNo
worker.countThe number of active worker threads to serve the incoming events. The value is 1 by default. This will ensure that the events are directed to the event stream in the same order in which they arrive. By increasing this value the performance might increase at the cost of loosing event ordering.1INTYesNo
socket.idle.timeoutIdle timeout for HTTP connection.120000INTYesNo
ssl.verify.clientThe type of client certificate verification.nullSTRINGYesNo
ssl.protocolssl/tls related optionsTLSSTRINGYesNo
tls.store.typeTLS store type.JKSSTRINGYesNo
parametersParameters other than basics such as ciphers,sslEnabledProtocols,client.enable.session.creation. Expected format of these parameters is as follows: "'ciphers:xxx','sslEnabledProtocols,client.enable:xxx'"nullSTRINGYesNo
ciphersList of ciphers to be used. This parameter should include under parameters Ex: 'ciphers:TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256'nullSTRINGYesNo
ssl.enabled.protocolsSSL/TLS protocols to be enabled. This parameter should be in camel case format(sslEnabledProtocols) under parameters. Ex 'sslEnabledProtocols:true'nullSTRINGYesNo
server.enable.session.creationEnable HTTP session creation.This parameter should include under parameters Ex: 'client.enable.session.creation:true'nullSTRINGYesNo
server.supported.snimatchersHttp SNIMatcher to be added. This parameter should include under parameters Ex: 'server.supported.snimatchers:SNIMatcher'nullSTRINGYesNo
server.suported.server.namesHttp supported servers. This parameter should include under parameters Ex: 'server.suported.server.names:server'nullSTRINGYesNo
request.size.validation.configurationParameters that responsible for validating the http request and request headers. Expected format of these parameters is as follows: "'request.size.validation:xxx','request.size.validation.maximum.value:xxx'"nullSTRINGYesNo
request.size.validationTo enable the request size validation.falseSTRINGYesNo
request.size.validation.maximum.valueIf request size is validated then maximum size.Integer.MAX_VALUESTRINGYesNo
request.size.validation.reject.status.codeIf request is exceed maximum size and request.size.validation is enabled then status code to be send as response.401STRINGYesNo
request.size.validation.reject.messageIf request is exceed maximum size and request.size.validation is enabled then status message to be send as response.Message is bigger than the valid sizeSTRINGYesNo
request.size.validation.reject.message.content.typeIf request is exceed maximum size and request.size.validation is enabled then content type to be send as response.plain/textSTRINGYesNo
header.size.validationTo enable the header size validation.falseSTRINGYesNo
header.validation.maximum.request.lineIf header header validation is enabled then the maximum request line.4096STRINGYesNo
header.validation.maximum.sizeIf header header validation is enabled then the maximum expected header size.8192STRINGYesNo
header.validation.maximum.chunk.sizeIf header header validation is enabled then the maximum expected chunk size.8192STRINGYesNo
header.validation.reject.status.code401If header is exceed maximum size and header.size.validation is enabled then status code to be send as response.STRINGYesNo
header.validation.reject.messageIf header is exceed maximum size and header.size.validation is enabled then message to be send as response.Message header is bigger than the valid sizeSTRINGYesNo
header.validation.reject.message.content.typeIf header is exceed maximum size and header.size.validation is enabled then content type to be send as response.plain/textSTRINGYesNo
server.bootstrap.configurationParameters that for bootstrap configurations of the server. Expected format of these parameters is as follows: "'ciphers:xxx','sslEnabledProtocols,client.enable:xxx'"nullOBJECTYesNo
server.bootstrap.nodelayHttp server no delay.trueBOOLYesNo
server.bootstrap.keepaliveHttp server keep alive.trueBOOLYesNo
server.bootstrap.sendbuffersizeHttp server send buffer size.1048576INTYesNo
server.bootstrap.recievebuffersizeHttp server receive buffer size.1048576INTYesNo
server.bootstrap.connect.timeoutHttp server connection timeout.15000INTYesNo
server.bootstrap.socket.reuseTo enable http socket reuse.falseBOOLYesNo
server.bootstrap.socket.timeoutHttp server socket timeout.15BOOLYesNo
server.bootstrap.socket.backlogTHttp server socket backlog.100BOOLYesNo
trace.log.enabledHttp traffic monitoring.falseBOOLYesNo
- -System Parameters - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Parameters
serverBootstrapBossGroupSizeproperty to configure number of boss threads, which accepts incoming connections until the ports are unbound. Once connection accepts successfully, boss thread passes the accepted channel to one of the worker threads.Number of available processorsAny integer
serverBootstrapWorkerGroupSizeproperty to configure number of worker threads, which performs non blocking read and write for one or more channels in non-blocking mode.(Number of available processors)*2Any integer
serverBootstrapClientGroupSizeproperty to configure number of client threads, which performs non blocking read and write for one or more channels in non-blocking mode.(Number of available processors)*2Any integer
defaultHostThe default host of the transport.0.0.0.0Any valid host
defaultHttpPortThe default port if the default scheme is 'http'.8280Any valid port
defaultHttpsPortThe default port if the default scheme is 'https'.8243Any valid port
defaultSchemeThe default protocol.httphttp
https
keyStoreLocationThe default keystore file path.${carbon.home}/resources/security/wso2carbon.jksPath to wso2carbon.jks file
keyStorePasswordThe default keystore password.wso2carbonString of keystore password
certPasswordThe default cert password.wso2carbonString of cert password
- -Examples -EXAMPLE 1 -``` -@source(type='http-request', source.id='sampleSourceId, receiver.url='http://localhost:9055/endpoints/RecPro', connection.timeout='150000', parameters="'ciphers : TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256', 'sslEnabledProtocols:TLSv1.1,TLSv1.2'", request.size.validation.configuration="request.size.validation:true", server.bootstrap.configuration="server.bootstrap.socket.timeout:25", @map(type='json, @attributes(messageId='trp:messageId', symbol='$.events.event.symbol', price='$.events.event.price', volume='$.events.event.volume'))) -define stream FooStream (messageId string, symbol string, price float, volume long); - -``` -

The expected input is as follows:
{"events":
    {"event":
        "symbol":WSO2,
        "price":55.6,
        "volume":100,
    }
}
If basic authentication is enabled via the basic.auth.enabled='true setting, each input event is also expected to contain the Authorization:'Basic encodeBase64(username:Password)' header.

- -### http-response *(Source)* - -

The http-response source co-relates with http-request sink with the parameter 'sink.id'.
This receives responses for the requests sent by the http-request sink which has the same sink id.
Response messages can be in formats such as TEXT, JSON and XML.
In order to handle the responses with different http status codes, user is allowed to defined the acceptable response source code using the parameter 'http.status.code'

- -Syntax -``` -@source(type="http-response", sink.id="", http.status.code="", allow.streaming.responses="", @map(...))) -``` - -QUERY PARAMETERS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
sink.idThis parameter is used to map the http-response source to a http-request sink. Then this source will accepts the response messages for the requests sent by corresponding http-request sink.STRINGNoNo
http.status.codeAcceptable http status code for the responses.
This can be a complete string or a regex.
Only the responses with matching status codes to the defined value, will be received by the http-response source.
Eg: 'http.status.code = '200', http.status.code = '2\\d+''
200STRINGYesNo
allow.streaming.responsesIf responses can be received multiple times for a single request, this option should be enabled. If this is not enabled, for every request, response will be extracted only once.falseBOOLYesNo
- -Examples -EXAMPLE 1 -``` -@sink(type='http-request', -downloading.enabled='true', -publisher.url='http://localhost:8005/registry/employee', -method='POST', headers='{{headers}}',sink.id='employee-info', -@map(type='json')) -define stream BarStream (name String, id int, headers String, downloadPath string); - -@source(type='http-response' , sink.id='employee-info', http.status.code='2\\d+', -@map(type='text', regex.A='((.|\n)*)', @attributes(message='A[1]'))) -define stream responseStream2xx(message string);@source(type='http-response' , sink.id='employee-info', http.status.code='4\\d+' , -@map(type='text', regex.A='((.|\n)*)', @attributes(message='A[1]'))) -define stream responseStream4xx(message string); -``` -

In above example, the defined http-request sink will send a POST requests to the endpoint defined by 'publisher.url'.
Then for those requests, the source with the response code '2\\d+' and sink.id 'employee-info' will receive the responses with 2xx status codes.
The http-response source which has 'employee-info' as the 'sink.id' and '4\\d+' as the http.response.code will receive all the responses with 4xx status codes.
. Then the body of the response message will be extracted using text mapper and converted into siddhi events.
.

- diff --git a/docs/api/1.1.4.md b/docs/api/1.1.4.md deleted file mode 100644 index be2a8cc7..00000000 --- a/docs/api/1.1.4.md +++ /dev/null @@ -1,1755 +0,0 @@ -# API Docs - v1.1.4 - -## Sink - -### http *(Sink)* - -

This extension publish the HTTP events in any HTTP method POST, GET, PUT, DELETE via HTTP or https protocols. As the additional features this component can provide basic authentication as well as user can publish events using custom client truststore files when publishing events via https protocol. And also user can add any number of headers including HTTP_METHOD header for each event dynamically.
Following content types will be set by default according to the type of sink mapper used.
You can override them by setting the new content types in headers.
     - TEXT : text/plain
     - XML : application/xml
     - JSON : application/json
     - KEYVALUE : application/x-www-form-urlencoded

- -Syntax -``` -@sink(type="http", publisher.url="", basic.auth.username="", basic.auth.password="", https.truststore.file="", https.truststore.password="", headers="", method="", socket.idle.timeout="", chunk.disabled="", ssl.protocol="", parameters="", ciphers="", ssl.enabled.protocols="", client.enable.session.creation="", follow.redirect="", max.redirect.count="", tls.store.type="", proxy.host="", proxy.port="", proxy.username="", proxy.password="", client.bootstrap.configuration="", client.bootstrap.nodelay="", client.bootstrap.keepalive="", client.bootstrap.sendbuffersize="", client.bootstrap.recievebuffersize="", client.bootstrap.connect.timeout="", client.bootstrap.socket.reuse="", client.bootstrap.socket.timeout="", client.threadpool.configurations="", client.connection.pool.count="", client.max.active.connections.per.pool="", client.min.idle.connections.per.pool="", client.max.idle.connections.per.pool="", client.min.eviction.idle.time="", sender.thread.count="", event.group.executor.thread.size="", max.wait.for.client.connection.pool="", oauth.username="", oauth.password="", consumer.key="", consumer.secret="", refresh.token="", token.url="", @map(...))) -``` - -QUERY PARAMETERS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
publisher.urlThe URL to which the outgoing events should be published via HTTP. This is a mandatory parameter and if this is not specified, an error is logged in the CLI. If user wants to enable SSL for the events, use https instead of http in the publisher.url.e.g., http://localhost:8080/endpoint, https://localhost:8080/endpointSTRINGNoNo
basic.auth.usernameThe username to be included in the authentication header of the basic authentication enabled events. It is required to specify both username and password to enable basic authentication. If one of the parameter is not given by user then an error is logged in the CLI. STRINGYesNo
basic.auth.passwordThe password to include in the authentication header of the basic authentication enabled events. It is required to specify both username and password to enable basic authentication. If one of the parameter is not given by user then an error is logged in the CLI. STRINGYesNo
https.truststore.fileThe file path to the location of the truststore of the client that sends the HTTP events through 'https' protocol. A custom client-truststore can be specified if required.${carbon.home}/resources/security/client-truststore.jksSTRINGYesNo
https.truststore.passwordThe password for the client-truststore. A custom password can be specified if required. If no custom password is specified and the protocol of URL is 'https' then, the system uses default password.wso2carbonSTRINGYesNo
headersThe headers that should be included as HTTP request headers.
There can be any number of headers concatenated in following format. "'header1:value1','header2:value2'". User can include Content-Type header if he needs to use a specific content-type for the payload. Or else, system decides the Content-Type by considering the type of sink mapper, in following way.
 - @map(xml):application/xml
 - @map(json):application/json
 - @map(text):plain/text )
 - if user does not include any mapping type then the system gets 'plain/text' as default Content-Type header.
Note that providing content-length as a header is not supported. The size of the payload will be automatically calculated and included in the content-length header.
STRINGYesNo
methodFor HTTP events, HTTP_METHOD header should be included as a request header. If the parameter is null then system uses 'POST' as a default header.POSTSTRINGYesNo
socket.idle.timeoutSocket timeout value in millisecond6000INTYesNo
chunk.disabledThis parameter is used to disable/enable chunked transfer encodingfalseBOOLYesNo
ssl.protocolThe SSL protocol versionTLSSTRINGYesNo
parametersParameters other than basics such as ciphers,sslEnabledProtocols,client.enable.session.creation. Expected format of these parameters is as follows: "'ciphers:xxx','sslEnabledProtocols,client.enable:xxx'"nullSTRINGYesNo
ciphersList of ciphers to be used. This parameter should include under parameters Ex: 'ciphers:TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256'nullSTRINGYesNo
ssl.enabled.protocolsSSL/TLS protocols to be enabled. This parameter should be in camel case format(sslEnabledProtocols) under parameters. Ex 'sslEnabledProtocols:true'nullSTRINGYesNo
client.enable.session.creationEnable HTTP session creation.This parameter should include under parameters Ex: 'client.enable.session.creation:true'nullSTRINGYesNo
follow.redirectRedirect related enabled.trueBOOLYesNo
max.redirect.countMaximum redirect count.5INTYesNo
tls.store.typeTLS store type to be used.JKSSTRINGYesNo
proxy.hostProxy server hostnullSTRINGYesNo
proxy.portProxy server portnullSTRINGYesNo
proxy.usernameProxy server usernamenullSTRINGYesNo
proxy.passwordProxy server passwordnullSTRINGYesNo
client.bootstrap.configurationClient bootsrap configurations. Expected format of these parameters is as follows: "'client.bootstrap.nodelay:xxx','client.bootstrap.keepalive:xxx'"TODOSTRINGYesNo
client.bootstrap.nodelayHttp client no delay.trueBOOLYesNo
client.bootstrap.keepaliveHttp client keep alive.trueBOOLYesNo
client.bootstrap.sendbuffersizeHttp client send buffer size.1048576INTYesNo
client.bootstrap.recievebuffersizeHttp client receive buffer size.1048576INTYesNo
client.bootstrap.connect.timeoutHttp client connection timeout.15000INTYesNo
client.bootstrap.socket.reuseTo enable http socket reuse.falseBOOLYesNo
client.bootstrap.socket.timeoutHttp client socket timeout.15STRINGYesNo
client.threadpool.configurationsThread pool configuration. Expected format of these parameters is as follows: "'client.connection.pool.count:xxx','client.max.active.connections.per.pool:xxx'"TODOSTRINGYesNo
client.connection.pool.countConnection pool count.0INTYesNo
client.max.active.connections.per.poolActive connections per pool.-1INTYesNo
client.min.idle.connections.per.poolMinimum ideal connection per pool.0INTYesNo
client.max.idle.connections.per.poolMaximum ideal connection per pool.100INTYesNo
client.min.eviction.idle.timeMinimum eviction idle time.5 * 60 * 1000STRINGYesNo
sender.thread.countHttp sender thread count.20STRINGYesNo
event.group.executor.thread.sizeEvent group executor thread size.15STRINGYesNo
max.wait.for.client.connection.poolMaximum wait for client connection pool.60000STRINGYesNo
oauth.usernameThe username to be included in the authentication header of the oauth authentication enabled events. It is required to specify both username and password to enable oauth authentication. If one of the parameter is not given by user then an error is logged in the CLI. It is only applicable for for Oauth requests STRINGYesNo
oauth.passwordThe password to be included in the authentication header of the oauth authentication enabled events. It is required to specify both username and password to enable oauth authentication. If one of the parameter is not given by user then an error is logged in the CLI. It is only applicable for for Oauth requests STRINGYesNo
consumer.keyconsumer key for the Http request. It is only applicable for for Oauth requests STRINGYesNo
consumer.secretconsumer secret for the Http request. It is only applicable for for Oauth requests STRINGYesNo
refresh.tokenrefresh token for the Http request. It is only applicable for for Oauth requests STRINGYesNo
token.urltoken url for generate a new access token. It is only applicable for for Oauth requests STRINGYesNo
- -System Parameters - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Parameters
clientBootstrapBossGroupSizeproperty to configure number of boss threads, which accepts incoming connections until the ports are unbound. Once connection accepts successfully, boss thread passes the accepted channel to one of the worker threads.Number of available processorsAny integer
clientBootstrapWorkerGroupSizeproperty to configure number of worker threads, which performs non blocking read and write for one or more channels in non-blocking mode.(Number of available processors)*2Any integer
clientBootstrapClientGroupSizeproperty to configure number of client threads, which performs non blocking read and write for one or more channels in non-blocking mode.(Number of available processors)*2Any integer
trustStoreLocationThe default truststore file path.${carbon.home}/resources/security/client-truststore.jksPath to client-truststore.jks
trustStorePasswordThe default truststore password.wso2carbonTruststore password
- -Examples -EXAMPLE 1 -``` -@sink(type='http',publisher.url='http://localhost:8009/foo', method='{{method}}',headers="'content-type:xml','content-length:94'", client.bootstrap.configuration="'client.bootstrap.socket.timeout:20', 'client.bootstrap.worker.group.size:10'", client.pool.configuration="'client.connection.pool.count:10','client.max.active.connections.per.pool:1'", @map(type='xml', @payload('{{payloadBody}}'))) -define stream FooStream (payloadBody String, method string, headers string); - -``` -

If it is xml mapping expected input should be in following format for FooStream:
{
<events>
    <event>
        <symbol>WSO2</symbol>
        <price>55.6</price>
        <volume>100</volume>
    </event>
</events>,
POST,
Content-Length:24#Content-Location:USA#Retry-After:120
}

Above event will generate output as below.
~Output http event payload
<events>
    <event>
        <symbol>WSO2</symbol>
        <price>55.6</price>
        <volume>100</volume>
    </event>
</events>

~Output http event headers
Content-Length:24,
Content-Location:'USA',
Retry-After:120,
Content-Type:'application/xml',
HTTP_METHOD:'POST',

~Output http event properties
HTTP_METHOD:'POST',
HOST:'localhost',
PORT:8009,
PROTOCOL:'http',
TO:'/foo'

- -### http-request *(Sink)* - -

This extension publish the HTTP events in any HTTP method POST, GET, PUT, DELETE via HTTP or https protocols. As the additional features this component can provide basic authentication as well as user can publish events using custom client truststore files when publishing events via https protocol. And also user can add any number of headers including HTTP_METHOD header for each event dynamically.
Following content types will be set by default according to the type of sink mapper used.
You can override them by setting the new content types in headers.
     - TEXT : text/plain
     - XML : application/xml
     - JSON : application/json
     - KEYVALUE : application/x-www-form-urlencoded

HTTP request sink is correlated with the The HTTP reponse source, through a unique sink.id.It sends the request to the defined url and the response is received by the response source which has the same 'sink.id'.

- -Syntax -``` -@sink(type="http-request", publisher.url="", basic.auth.username="", basic.auth.password="", https.truststore.file="", https.truststore.password="", headers="", method="", socket.idle.timeout="", chunk.disabled="", ssl.protocol="", parameters="", ciphers="", ssl.enabled.protocols="", client.enable.session.creation="", follow.redirect="", max.redirect.count="", tls.store.type="", proxy.host="", proxy.port="", proxy.username="", proxy.password="", client.bootstrap.configuration="", client.bootstrap.nodelay="", client.bootstrap.keepalive="", client.bootstrap.sendbuffersize="", client.bootstrap.recievebuffersize="", client.bootstrap.connect.timeout="", client.bootstrap.socket.reuse="", client.bootstrap.socket.timeout="", client.threadpool.configurations="", client.connection.pool.count="", client.max.active.connections.per.pool="", client.min.idle.connections.per.pool="", client.max.idle.connections.per.pool="", client.min.eviction.idle.time="", sender.thread.count="", event.group.executor.thread.size="", max.wait.for.client.connection.pool="", sink.id="", downloading.enabled="", download.path="", oauth.username="", oauth.password="", consumer.key="", consumer.secret="", refresh.token="", @map(...))) -``` - -QUERY PARAMETERS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
publisher.urlThe URL to which the outgoing events should be published via HTTP. This is a mandatory parameter and if this is not specified, an error is logged in the CLI. If user wants to enable SSL for the events, use https instead of http in the publisher.url.
e.g., http://localhost:8080/endpoint, https://localhost:8080/endpoint
This can be used as a dynamic parameter as well.
STRINGNoYes
basic.auth.usernameThe username to be included in the authentication header of the basic authentication enabled events. It is required to specify both username and password to enable basic authentication. If one of the parameter is not given by user then an error is logged in the CLI. STRINGYesNo
basic.auth.passwordThe password to include in the authentication header of the basic authentication enabled events. It is required to specify both username and password to enable basic authentication. If one of the parameter is not given by user then an error is logged in the CLI. STRINGYesNo
https.truststore.fileThe file path to the location of the truststore of the client that sends the HTTP events through 'https' protocol. A custom client-truststore can be specified if required.${carbon.home}/resources/security/client-truststore.jksSTRINGYesNo
https.truststore.passwordThe password for the client-truststore. A custom password can be specified if required. If no custom password is specified and the protocol of URL is 'https' then, the system uses default password.wso2carbonSTRINGYesNo
headersThe headers that should be included as HTTP request headers.
There can be any number of headers concatenated in following format. "'header1:value1','header2:value2'". User can include Content-Type header if he needs to use a specific content-type for the payload. Or else, system decides the Content-Type by considering the type of sink mapper, in following way.
 - @map(xml):application/xml
 - @map(json):application/json
 - @map(text):plain/text )
 - if user does not include any mapping type then the system gets 'plain/text' as default Content-Type header.
Note that providing content-length as a header is not supported. The size of the payload will be automatically calculated and included in the content-length header.
STRINGYesNo
methodFor HTTP events, HTTP_METHOD header should be included as a request header. If the parameter is null then system uses 'POST' as a default header.POSTSTRINGYesNo
socket.idle.timeoutSocket timeout value in millisecond6000INTYesNo
chunk.disabledport: Port number of the remote servicefalseBOOLYesNo
ssl.protocolThe SSL protocol versionTLSSTRINGYesNo
parametersParameters other than basics such as ciphers,sslEnabledProtocols,client.enable.session.creation. Expected format of these parameters is as follows: "'ciphers:xxx','sslEnabledProtocols,client.enable:xxx'"nullSTRINGYesNo
ciphersList of ciphers to be used. This parameter should include under parameters Ex: 'ciphers:TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256'nullSTRINGYesNo
ssl.enabled.protocolsSSL/TLS protocols to be enabled. This parameter should be in camel case format(sslEnabledProtocols) under parameters. Ex 'sslEnabledProtocols:true'nullSTRINGYesNo
client.enable.session.creationEnable HTTP session creation.This parameter should include under parameters Ex: 'client.enable.session.creation:true'nullSTRINGYesNo
follow.redirectRedirect related enabled.trueBOOLYesNo
max.redirect.countMaximum redirect count.5INTYesNo
tls.store.typeTLS store type to be used.JKSSTRINGYesNo
proxy.hostProxy server hostnullSTRINGYesNo
proxy.portProxy server portnullSTRINGYesNo
proxy.usernameProxy server usernamenullSTRINGYesNo
proxy.passwordProxy server passwordnullSTRINGYesNo
client.bootstrap.configurationClient bootsrap configurations. Expected format of these parameters is as follows: "'client.bootstrap.nodelay:xxx','client.bootstrap.keepalive:xxx'"TODOSTRINGYesNo
client.bootstrap.nodelayHttp client no delay.trueBOOLYesNo
client.bootstrap.keepaliveHttp client keep alive.trueBOOLYesNo
client.bootstrap.sendbuffersizeHttp client send buffer size.1048576INTYesNo
client.bootstrap.recievebuffersizeHttp client receive buffer size.1048576INTYesNo
client.bootstrap.connect.timeoutHttp client connection timeout.15000INTYesNo
client.bootstrap.socket.reuseTo enable http socket reuse.falseBOOLYesNo
client.bootstrap.socket.timeoutHttp client socket timeout.15STRINGYesNo
client.threadpool.configurationsThread pool configuration. Expected format of these parameters is as follows: "'client.connection.pool.count:xxx','client.max.active.connections.per.pool:xxx'"TODOSTRINGYesNo
client.connection.pool.countConnection pool count.0INTYesNo
client.max.active.connections.per.poolActive connections per pool.-1INTYesNo
client.min.idle.connections.per.poolMinimum ideal connection per pool.0INTYesNo
client.max.idle.connections.per.poolMaximum ideal connection per pool.100INTYesNo
client.min.eviction.idle.timeMinimum eviction idle time.5 * 60 * 1000STRINGYesNo
sender.thread.countHttp sender thread count.20STRINGYesNo
event.group.executor.thread.sizeEvent group executor thread size.15STRINGYesNo
max.wait.for.client.connection.poolMaximum wait for client connection pool.60000STRINGYesNo
sink.idIdentifier of the sink. This is used to co-relate with the corresponding http-response source which needs to process the repose for the request sent by this sink.STRINGNoNo
downloading.enabledIf this is set to 'true' then the response received by the response source will be written to a file. If downloading is enabled, the download.path parameter is mandatory.falseBOOLYesNo
download.pathIf downloading is enabled, the path of the file which is going to be downloaded should be specified using 'download.path' parameter. This should be an absolute path including the file name.nullSTRINGYesYes
oauth.usernameThe username to be included in the authentication header of the oauth authentication enabled events. It is required to specify both username and password to enable oauth authentication. If one of the parameter is not given by user then an error is logged in the CLI. It is only applicable for for Oauth requests STRINGYesNo
oauth.passwordThe password to be included in the authentication header of the oauth authentication enabled events. It is required to specify both username and password to enable oauth authentication. If one of the parameter is not given by user then an error is logged in the CLI. It is only applicable for for Oauth requests STRINGYesNo
consumer.keyconsumer key for the Http request. It is only applicable for for Oauth requests STRINGYesNo
consumer.secretconsumer secret for the Http request. It is only applicable for for Oauth requests STRINGYesNo
refresh.tokenrefresh token for the Http request. It is only applicable for for Oauth requests STRINGYesNo
- -Examples -EXAMPLE 1 -``` -@sink(type='http-request', sink.id='foo', publisher.url='http://localhost:8009/foo', @map(type='xml', @payload('{{payloadBody}}'))) -define stream FooStream (payloadBody String, method string, headers string); -@source(type='http-response', sink.id='foo', http.status.code='2\\d+', -@map(type='text', regex.A='((.|\n)*)', @attributes(headers='trp:headers', fileName='A[1]'))) -define stream responseStream2xx(fileName string, headers string); - -@source(type='http-response', sink.id='foo', http.status.code='4\\d+', -@map(type='text', regex.A='((.|\n)*)', @attributes(errorMsg='A[1]'))) -define stream responseStream4xx(errorMsg string); -``` -

In above example, the payload body for 'FooStream' will be in following format.
{
<events>
    <event>
        <symbol>WSO2</symbol>
        <price>55.6</price>
        <volume>100</volume>
    </event>
</events>,
This message will sent as the body of a POST request with the content-type 'application/xml' to the endpoint defined as the 'publisher.url' and in order to process the responses for these requests, there should be a source of type 'http-response' defined with the same sink id 'foo' in the siddhi app.
 The responses with 2xx status codes will be received by the http-response source which has the http.status.code defined by the regex '2\\d+'.
If the response has a 4xx status code, it will be received by the http-response source which has the http.status.code defined by the regex '4\\d+'.

- -EXAMPLE 2 -``` -define stream FooStream (name String, id int, headers String, downloadPath string); -@sink(type='http-request', -downloading.enabled='true', -download.path='{{downloadPath}}',publisher.url='http://localhost:8005/files', -method='GET', headers='{{headers}}',sink.id='download-sink', -@map(type='json')) -define stream BarStream (name String, id int, headers String, downloadPath string); - -@source(type='http-response', sink.id='download-sink', http.status.code='2\\d+', -@map(type='text', regex.A='((.|\n)*)', @attributes(headers='trp:headers', fileName='A[1]'))) -define stream responseStream2xx(fileName string, headers string); - -@source(type='http-response', sink.id='download-sink', http.status.code='4\\d+', -@map(type='text', regex.A='((.|\n)*)', @attributes(errorMsg='A[1]'))) -define stream responseStream4xx(errorMsg string); -``` -

In above example, http-request sink will send a GET request to the publisher url and the requested file will be received as the response by a corresponding http-response source.
If the http status code of the response is a successful one (2xx), it will be received by the http-response source which has the http.status.code '2\\d+' and downloaded as a local file. Then the event received to the responseStream2xx will have the headers included in the request and the downloaded file name.
If the http status code of the response is a 4xx code, it will be received by the http-response source which has the http.status.code '4\\d+'. Then the event received to the responseStream4xx will have the response message body in text format.

- -### http-response *(Sink)* - -

HTTP response sink is correlated with the The HTTP request source, through a unique source.id, and it send a response to the HTTP request source having the same source.id. The response message can be formatted in text, XML or JSON and can be sent with appropriate headers.

- -Syntax -``` -@sink(type="http-response", source.id="", message.id="", headers="", @map(...))) -``` - -QUERY PARAMETERS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
source.idIdentifier of the source.STRINGNoNo
message.idIdentifier of the message.STRINGNoYes
headersThe headers that should be included as HTTP response headers. There can be any number of headers concatenated on following format. "'header1:value1','header2:value2'" User can include content-type header if he/she need to have any specific type for payload. If not system get the mapping type as the content-Type header (ie.@map(xml):application/xml, @map(json):application/json, @map(text):plain/text) and if user does not include any mapping type then system gets the plain/text as default Content-Type header. If user does not include Content-Length header then system calculate the bytes size of payload and include it as content-length header. STRINGYesNo
- -Examples -EXAMPLE 1 -``` -@sink(type='http-response', source.id='sampleSourceId', message.id='{{messageId}}', headers="'content-type:json','content-length:94'"@map(type='json', @payload('{{payloadBody}}'))) -define stream FooStream (payloadBody String, messageId string, headers string); - -``` -

If it is json mapping expected input should be in following format for FooStream:
{
{"events":
    {"event":
        "symbol":WSO2,
        "price":55.6,
        "volume":100,
    }
},
0cf708b1-7eae-440b-a93e-e72f801b486a,
Content-Length:24#Content-Location:USA
}

Above event will generate response for the matching source message as below.

~Output http event payload
{"events":
    {"event":
        "symbol":WSO2,
        "price":55.6,
        "volume":100,
    }
}

~Output http event headers
Content-Length:24,
Content-Location:'USA',
Content-Type:'application/json'

- -## Source - -### http *(Source)* - -

The HTTP source receives POST requests via HTTP or HTTPS in format such as text, XML and JSON. In WSO2 SP, if required, you can enable basic authentication to ensure that events are received only from users who are authorized to access the service.

- -Syntax -``` -@source(type="http", receiver.url="", basic.auth.enabled="", worker.count="", socket.idle.timeout="", ssl.verify.client="", ssl.protocol="", tls.store.type="", parameters="", ciphers="", ssl.enabled.protocols="", server.enable.session.creation="", server.supported.snimatchers="", server.suported.server.names="", request.size.validation.configuration="", request.size.validation="", request.size.validation.maximum.value="", request.size.validation.reject.status.code="", request.size.validation.reject.message="", request.size.validation.reject.message.content.type="", header.size.validation="", header.validation.maximum.request.line="", header.validation.maximum.size="", header.validation.maximum.chunk.size="", header.validation.reject.status.code="", header.validation.reject.message="", header.validation.reject.message.content.type="", server.bootstrap.configuration="", server.bootstrap.nodelay="", server.bootstrap.keepalive="", server.bootstrap.sendbuffersize="", server.bootstrap.recievebuffersize="", server.bootstrap.connect.timeout="", server.bootstrap.socket.reuse="", server.bootstrap.socket.timeout="", server.bootstrap.socket.backlog="", trace.log.enabled="", @map(...))) -``` - -QUERY PARAMETERS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
receiver.urlThe URL to which the events should be received. User can provide any valid url and if the url is not provided the system will use the following format http://0.0.0.0:9763/<appNAme>/<streamName>If the user want to use SSL the url should be given in following format https://localhost:8080/<streamName>http://0.0.0.0:9763//STRINGYesNo
basic.auth.enabledThis works only in WSO2 SP. If this is set to true, basic authentication is enabled for incoming events, and the credentials with which each event is sent are verified to ensure that the user is authorized to access the service. If basic authentication fails, the event is not authenticated and an authentication error is logged in the CLI.falseSTRINGYesNo
worker.countThe number of active worker threads to serve the incoming events. The value is 1 by default. This will ensure that the events are directed to the event stream in the same order in which they arrive. By increasing this value the performance might increase at the cost of loosing event ordering.1INTYesNo
socket.idle.timeoutIdle timeout for HTTP connection.120000INTYesNo
ssl.verify.clientThe type of client certificate verification.nullSTRINGYesNo
ssl.protocolssl/tls related optionsTLSSTRINGYesNo
tls.store.typeTLS store type.JKSSTRINGYesNo
parametersParameters other than basics such as ciphers,sslEnabledProtocols,client.enable.session.creation. Expected format of these parameters is as follows: "'ciphers:xxx','sslEnabledProtocols,client.enable:xxx'"nullSTRINGYesNo
ciphersList of ciphers to be used. This parameter should include under parameters Ex: 'ciphers:TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256'nullSTRINGYesNo
ssl.enabled.protocolsSSL/TLS protocols to be enabled. This parameter should be in camel case format(sslEnabledProtocols) under parameters. Ex 'sslEnabledProtocols:true'nullSTRINGYesNo
server.enable.session.creationEnable HTTP session creation.This parameter should include under parameters Ex: 'client.enable.session.creation:true'nullSTRINGYesNo
server.supported.snimatchersHttp SNIMatcher to be added. This parameter should include under parameters Ex: 'server.supported.snimatchers:SNIMatcher'nullSTRINGYesNo
server.suported.server.namesHttp supported servers. This parameter should include under parameters Ex: 'server.suported.server.names:server'nullSTRINGYesNo
request.size.validation.configurationParameters that responsible for validating the http request and request headers. Expected format of these parameters is as follows: "'request.size.validation:xxx','request.size.validation.maximum.value:xxx'"nullSTRINGYesNo
request.size.validationTo enable the request size validation.falseSTRINGYesNo
request.size.validation.maximum.valueIf request size is validated then maximum size.Integer.MAX_VALUESTRINGYesNo
request.size.validation.reject.status.codeIf request is exceed maximum size and request.size.validation is enabled then status code to be send as response.401STRINGYesNo
request.size.validation.reject.messageIf request is exceed maximum size and request.size.validation is enabled then status message to be send as response.Message is bigger than the valid sizeSTRINGYesNo
request.size.validation.reject.message.content.typeIf request is exceed maximum size and request.size.validation is enabled then content type to be send as response.plain/textSTRINGYesNo
header.size.validationTo enable the header size validation.falseSTRINGYesNo
header.validation.maximum.request.lineIf header header validation is enabled then the maximum request line.4096STRINGYesNo
header.validation.maximum.sizeIf header header validation is enabled then the maximum expected header size.8192STRINGYesNo
header.validation.maximum.chunk.sizeIf header header validation is enabled then the maximum expected chunk size.8192STRINGYesNo
header.validation.reject.status.code401If header is exceed maximum size and header.size.validation is enabled then status code to be send as response.STRINGYesNo
header.validation.reject.messageIf header is exceed maximum size and header.size.validation is enabled then message to be send as response.Message header is bigger than the valid sizeSTRINGYesNo
header.validation.reject.message.content.typeIf header is exceed maximum size and header.size.validation is enabled then content type to be send as response.plain/textSTRINGYesNo
server.bootstrap.configurationParameters that for bootstrap configurations of the server. Expected format of these parameters is as follows: "'ciphers:xxx','sslEnabledProtocols,client.enable:xxx'"nullOBJECTYesNo
server.bootstrap.nodelayHttp server no delay.trueBOOLYesNo
server.bootstrap.keepaliveHttp server keep alive.trueBOOLYesNo
server.bootstrap.sendbuffersizeHttp server send buffer size.1048576INTYesNo
server.bootstrap.recievebuffersizeHttp server receive buffer size.1048576INTYesNo
server.bootstrap.connect.timeoutHttp server connection timeout.15000INTYesNo
server.bootstrap.socket.reuseTo enable http socket reuse.falseBOOLYesNo
server.bootstrap.socket.timeoutHttp server socket timeout.15BOOLYesNo
server.bootstrap.socket.backlogTHttp server socket backlog.100BOOLYesNo
trace.log.enabledHttp traffic monitoring.falseBOOLYesNo
- -System Parameters - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Parameters
serverBootstrapBossGroupSizeproperty to configure number of boss threads, which accepts incoming connections until the ports are unbound. Once connection accepts successfully, boss thread passes the accepted channel to one of the worker threads.Number of available processorsAny integer
serverBootstrapWorkerGroupSizeproperty to configure number of worker threads, which performs non blocking read and write for one or more channels in non-blocking mode.(Number of available processors)*2Any integer
serverBootstrapClientGroupSizeproperty to configure number of client threads, which performs non blocking read and write for one or more channels in non-blocking mode.(Number of available processors)*2Any integer
defaultHostThe default host of the transport.0.0.0.0Any valid host
defaultHttpPortThe default port if the default scheme is 'http'.8280Any valid port
defaultHttpsPortThe default port if the default scheme is 'https'.8243Any valid port
defaultSchemeThe default protocol.httphttp
https
keyStoreLocationThe default keystore file path.${carbon.home}/resources/security/wso2carbon.jksPath to wso2carbon.jks file
keyStorePasswordThe default keystore password.wso2carbonString of keystore password
- -Examples -EXAMPLE 1 -``` -@source(type='http', receiver.url='http://localhost:9055/endpoints/RecPro', socketIdleTimeout='150000', parameters="'ciphers : TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256', 'sslEnabledProtocols:TLSv1.1,TLSv1.2'",request.size.validation.configuration="request.size.validation:true",server.bootstrap.configuration="server.bootstrap.socket.timeout:25" @map(type='xml')) -define stream FooStream (symbol string, price float, volume long); - -``` -

Above source listenerConfiguration performs a default XML input mapping. The expected input is as follows:
<events>
    <event>
        <symbol>WSO2</symbol>
        <price>55.6</price>
        <volume>100</volume>
    </event>
</events>
If basic authentication is enabled via the basic.auth.enabled='true setting, each input event is also expected to contain the Authorization:'Basic encodeBase64(username:Password)' header.

- -### http-request *(Source)* - -

The HTTP request is correlated with the HTTP response sink, through a unique source.id, and for each POST requests it receives via HTTP or HTTPS in format such as text, XML and JSON it sends the response via the HTTP response sink. The individual request and response messages are correlated at the sink using the message.id of the events. If required, you can enable basic authentication at the source to ensure that events are received only from users who are authorized to access the service.

- -Syntax -``` -@source(type="http-request", receiver.url="", source.id="", connection.timeout="", basic.auth.enabled="", worker.count="", socket.idle.timeout="", ssl.verify.client="", ssl.protocol="", tls.store.type="", parameters="", ciphers="", ssl.enabled.protocols="", server.enable.session.creation="", server.supported.snimatchers="", server.suported.server.names="", request.size.validation.configuration="", request.size.validation="", request.size.validation.maximum.value="", request.size.validation.reject.status.code="", request.size.validation.reject.message="", request.size.validation.reject.message.content.type="", header.size.validation="", header.validation.maximum.request.line="", header.validation.maximum.size="", header.validation.maximum.chunk.size="", header.validation.reject.status.code="", header.validation.reject.message="", header.validation.reject.message.content.type="", server.bootstrap.configuration="", server.bootstrap.nodelay="", server.bootstrap.keepalive="", server.bootstrap.sendbuffersize="", server.bootstrap.recievebuffersize="", server.bootstrap.connect.timeout="", server.bootstrap.socket.reuse="", server.bootstrap.socket.timeout="", server.bootstrap.socket.backlog="", trace.log.enabled="", @map(...))) -``` - -QUERY PARAMETERS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
receiver.urlThe URL to which the events should be received. User can provide any valid url and if the url is not provided the system will use the following format http://0.0.0.0:9763/<appNAme>/<streamName>If the user want to use SSL the url should be given in following format https://localhost:8080/<streamName>http://0.0.0.0:9763//STRINGYesNo
source.idIdentifier need to map the source to sink.STRINGNoNo
connection.timeoutConnection timeout in milliseconds. If the mapped http-response sink does not get a correlated message, after this timeout value, a timeout response is sent120000INTYesNo
basic.auth.enabledIf this is set to true, basic authentication is enabled for incoming events, and the credentials with which each event is sent are verified to ensure that the user is authorized to access the service. If basic authentication fails, the event is not authenticated and an authentication error is logged in the CLI. By default this values 'false' falseSTRINGYesNo
worker.countThe number of active worker threads to serve the incoming events. The value is 1 by default. This will ensure that the events are directed to the event stream in the same order in which they arrive. By increasing this value the performance might increase at the cost of loosing event ordering.1INTYesNo
socket.idle.timeoutIdle timeout for HTTP connection.120000INTYesNo
ssl.verify.clientThe type of client certificate verification.nullSTRINGYesNo
ssl.protocolssl/tls related optionsTLSSTRINGYesNo
tls.store.typeTLS store type.JKSSTRINGYesNo
parametersParameters other than basics such as ciphers,sslEnabledProtocols,client.enable.session.creation. Expected format of these parameters is as follows: "'ciphers:xxx','sslEnabledProtocols,client.enable:xxx'"nullSTRINGYesNo
ciphersList of ciphers to be used. This parameter should include under parameters Ex: 'ciphers:TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256'nullSTRINGYesNo
ssl.enabled.protocolsSSL/TLS protocols to be enabled. This parameter should be in camel case format(sslEnabledProtocols) under parameters. Ex 'sslEnabledProtocols:true'nullSTRINGYesNo
server.enable.session.creationEnable HTTP session creation.This parameter should include under parameters Ex: 'client.enable.session.creation:true'nullSTRINGYesNo
server.supported.snimatchersHttp SNIMatcher to be added. This parameter should include under parameters Ex: 'server.supported.snimatchers:SNIMatcher'nullSTRINGYesNo
server.suported.server.namesHttp supported servers. This parameter should include under parameters Ex: 'server.suported.server.names:server'nullSTRINGYesNo
request.size.validation.configurationParameters that responsible for validating the http request and request headers. Expected format of these parameters is as follows: "'request.size.validation:xxx','request.size.validation.maximum.value:xxx'"nullSTRINGYesNo
request.size.validationTo enable the request size validation.falseSTRINGYesNo
request.size.validation.maximum.valueIf request size is validated then maximum size.Integer.MAX_VALUESTRINGYesNo
request.size.validation.reject.status.codeIf request is exceed maximum size and request.size.validation is enabled then status code to be send as response.401STRINGYesNo
request.size.validation.reject.messageIf request is exceed maximum size and request.size.validation is enabled then status message to be send as response.Message is bigger than the valid sizeSTRINGYesNo
request.size.validation.reject.message.content.typeIf request is exceed maximum size and request.size.validation is enabled then content type to be send as response.plain/textSTRINGYesNo
header.size.validationTo enable the header size validation.falseSTRINGYesNo
header.validation.maximum.request.lineIf header header validation is enabled then the maximum request line.4096STRINGYesNo
header.validation.maximum.sizeIf header header validation is enabled then the maximum expected header size.8192STRINGYesNo
header.validation.maximum.chunk.sizeIf header header validation is enabled then the maximum expected chunk size.8192STRINGYesNo
header.validation.reject.status.code401If header is exceed maximum size and header.size.validation is enabled then status code to be send as response.STRINGYesNo
header.validation.reject.messageIf header is exceed maximum size and header.size.validation is enabled then message to be send as response.Message header is bigger than the valid sizeSTRINGYesNo
header.validation.reject.message.content.typeIf header is exceed maximum size and header.size.validation is enabled then content type to be send as response.plain/textSTRINGYesNo
server.bootstrap.configurationParameters that for bootstrap configurations of the server. Expected format of these parameters is as follows: "'ciphers:xxx','sslEnabledProtocols,client.enable:xxx'"nullOBJECTYesNo
server.bootstrap.nodelayHttp server no delay.trueBOOLYesNo
server.bootstrap.keepaliveHttp server keep alive.trueBOOLYesNo
server.bootstrap.sendbuffersizeHttp server send buffer size.1048576INTYesNo
server.bootstrap.recievebuffersizeHttp server receive buffer size.1048576INTYesNo
server.bootstrap.connect.timeoutHttp server connection timeout.15000INTYesNo
server.bootstrap.socket.reuseTo enable http socket reuse.falseBOOLYesNo
server.bootstrap.socket.timeoutHttp server socket timeout.15BOOLYesNo
server.bootstrap.socket.backlogTHttp server socket backlog.100BOOLYesNo
trace.log.enabledHttp traffic monitoring.falseBOOLYesNo
- -System Parameters - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Parameters
serverBootstrapBossGroupSizeproperty to configure number of boss threads, which accepts incoming connections until the ports are unbound. Once connection accepts successfully, boss thread passes the accepted channel to one of the worker threads.Number of available processorsAny integer
serverBootstrapWorkerGroupSizeproperty to configure number of worker threads, which performs non blocking read and write for one or more channels in non-blocking mode.(Number of available processors)*2Any integer
serverBootstrapClientGroupSizeproperty to configure number of client threads, which performs non blocking read and write for one or more channels in non-blocking mode.(Number of available processors)*2Any integer
defaultHostThe default host of the transport.0.0.0.0Any valid host
defaultHttpPortThe default port if the default scheme is 'http'.8280Any valid port
defaultHttpsPortThe default port if the default scheme is 'https'.8243Any valid port
defaultSchemeThe default protocol.httphttp
https
keyStoreLocationThe default keystore file path.${carbon.home}/resources/security/wso2carbon.jksPath to wso2carbon.jks file
keyStorePasswordThe default keystore password.wso2carbonString of keystore password
certPasswordThe default cert password.wso2carbonString of cert password
- -Examples -EXAMPLE 1 -``` -@source(type='http-request', source.id='sampleSourceId, receiver.url='http://localhost:9055/endpoints/RecPro', connection.timeout='150000', parameters="'ciphers : TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256', 'sslEnabledProtocols:TLSv1.1,TLSv1.2'", request.size.validation.configuration="request.size.validation:true", server.bootstrap.configuration="server.bootstrap.socket.timeout:25", @map(type='json, @attributes(messageId='trp:messageId', symbol='$.events.event.symbol', price='$.events.event.price', volume='$.events.event.volume'))) -define stream FooStream (messageId string, symbol string, price float, volume long); - -``` -

The expected input is as follows:
{"events":
    {"event":
        "symbol":WSO2,
        "price":55.6,
        "volume":100,
    }
}
If basic authentication is enabled via the basic.auth.enabled='true setting, each input event is also expected to contain the Authorization:'Basic encodeBase64(username:Password)' header.

- -### http-response *(Source)* - -

The http-response source co-relates with http-request sink with the parameter 'sink.id'.
This receives responses for the requests sent by the http-request sink which has the same sink id.
Response messages can be in formats such as TEXT, JSON and XML.
In order to handle the responses with different http status codes, user is allowed to defined the acceptable response source code using the parameter 'http.status.code'

- -Syntax -``` -@source(type="http-response", sink.id="", http.status.code="", allow.streaming.responses="", @map(...))) -``` - -QUERY PARAMETERS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
sink.idThis parameter is used to map the http-response source to a http-request sink. Then this source will accepts the response messages for the requests sent by corresponding http-request sink.STRINGNoNo
http.status.codeAcceptable http status code for the responses.
This can be a complete string or a regex.
Only the responses with matching status codes to the defined value, will be received by the http-response source.
Eg: 'http.status.code = '200', http.status.code = '2\\d+''
200STRINGYesNo
allow.streaming.responsesIf responses can be received multiple times for a single request, this option should be enabled. If this is not enabled, for every request, response will be extracted only once.falseBOOLYesNo
- -Examples -EXAMPLE 1 -``` -@sink(type='http-request', -downloading.enabled='true', -publisher.url='http://localhost:8005/registry/employee', -method='POST', headers='{{headers}}',sink.id='employee-info', -@map(type='json')) -define stream BarStream (name String, id int, headers String, downloadPath string); - -@source(type='http-response' , sink.id='employee-info', http.status.code='2\\d+', -@map(type='text', regex.A='((.|\n)*)', @attributes(message='A[1]'))) -define stream responseStream2xx(message string);@source(type='http-response' , sink.id='employee-info', http.status.code='4\\d+' , -@map(type='text', regex.A='((.|\n)*)', @attributes(message='A[1]'))) -define stream responseStream4xx(message string); -``` -

In above example, the defined http-request sink will send a POST requests to the endpoint defined by 'publisher.url'.
Then for those requests, the source with the response code '2\\d+' and sink.id 'employee-info' will receive the responses with 2xx status codes.
The http-response source which has 'employee-info' as the 'sink.id' and '4\\d+' as the http.response.code will receive all the responses with 4xx status codes.
. Then the body of the response message will be extracted using text mapper and converted into siddhi events.
.

- diff --git a/docs/api/2.0.1.md b/docs/api/2.0.1.md deleted file mode 100644 index 4cd6399b..00000000 --- a/docs/api/2.0.1.md +++ /dev/null @@ -1,1755 +0,0 @@ -# API Docs - v2.0.1 - -## Sink - -### http *(Sink)* - -

This extension publish the HTTP events in any HTTP method POST, GET, PUT, DELETE via HTTP or https protocols. As the additional features this component can provide basic authentication as well as user can publish events using custom client truststore files when publishing events via https protocol. And also user can add any number of headers including HTTP_METHOD header for each event dynamically.
Following content types will be set by default according to the type of sink mapper used.
You can override them by setting the new content types in headers.
     - TEXT : text/plain
     - XML : application/xml
     - JSON : application/json
     - KEYVALUE : application/x-www-form-urlencoded

- -Syntax -``` -@sink(type="http", publisher.url="", basic.auth.username="", basic.auth.password="", https.truststore.file="", https.truststore.password="", headers="", method="", socket.idle.timeout="", chunk.disabled="", ssl.protocol="", parameters="", ciphers="", ssl.enabled.protocols="", client.enable.session.creation="", follow.redirect="", max.redirect.count="", tls.store.type="", proxy.host="", proxy.port="", proxy.username="", proxy.password="", client.bootstrap.configuration="", client.bootstrap.nodelay="", client.bootstrap.keepalive="", client.bootstrap.sendbuffersize="", client.bootstrap.recievebuffersize="", client.bootstrap.connect.timeout="", client.bootstrap.socket.reuse="", client.bootstrap.socket.timeout="", client.threadpool.configurations="", client.connection.pool.count="", client.max.active.connections.per.pool="", client.min.idle.connections.per.pool="", client.max.idle.connections.per.pool="", client.min.eviction.idle.time="", sender.thread.count="", event.group.executor.thread.size="", max.wait.for.client.connection.pool="", oauth.username="", oauth.password="", consumer.key="", consumer.secret="", refresh.token="", token.url="", @map(...))) -``` - -QUERY PARAMETERS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
publisher.urlThe URL to which the outgoing events should be published via HTTP. This is a mandatory parameter and if this is not specified, an error is logged in the CLI. If user wants to enable SSL for the events, use https instead of http in the publisher.url.e.g., http://localhost:8080/endpoint, https://localhost:8080/endpointSTRINGNoNo
basic.auth.usernameThe username to be included in the authentication header of the basic authentication enabled events. It is required to specify both username and password to enable basic authentication. If one of the parameter is not given by user then an error is logged in the CLI. STRINGYesNo
basic.auth.passwordThe password to include in the authentication header of the basic authentication enabled events. It is required to specify both username and password to enable basic authentication. If one of the parameter is not given by user then an error is logged in the CLI. STRINGYesNo
https.truststore.fileThe file path to the location of the truststore of the client that sends the HTTP events through 'https' protocol. A custom client-truststore can be specified if required.${carbon.home}/resources/security/client-truststore.jksSTRINGYesNo
https.truststore.passwordThe password for the client-truststore. A custom password can be specified if required. If no custom password is specified and the protocol of URL is 'https' then, the system uses default password.wso2carbonSTRINGYesNo
headersThe headers that should be included as HTTP request headers.
There can be any number of headers concatenated in following format. "'header1:value1','header2:value2'". User can include Content-Type header if he needs to use a specific content-type for the payload. Or else, system decides the Content-Type by considering the type of sink mapper, in following way.
 - @map(xml):application/xml
 - @map(json):application/json
 - @map(text):plain/text )
 - if user does not include any mapping type then the system gets 'plain/text' as default Content-Type header.
Note that providing content-length as a header is not supported. The size of the payload will be automatically calculated and included in the content-length header.
STRINGYesNo
methodFor HTTP events, HTTP_METHOD header should be included as a request header. If the parameter is null then system uses 'POST' as a default header.POSTSTRINGYesNo
socket.idle.timeoutSocket timeout value in millisecond6000INTYesNo
chunk.disabledThis parameter is used to disable/enable chunked transfer encodingfalseBOOLYesNo
ssl.protocolThe SSL protocol versionTLSSTRINGYesNo
parametersParameters other than basics such as ciphers,sslEnabledProtocols,client.enable.session.creation. Expected format of these parameters is as follows: "'ciphers:xxx','sslEnabledProtocols,client.enable:xxx'"nullSTRINGYesNo
ciphersList of ciphers to be used. This parameter should include under parameters Ex: 'ciphers:TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256'nullSTRINGYesNo
ssl.enabled.protocolsSSL/TLS protocols to be enabled. This parameter should be in camel case format(sslEnabledProtocols) under parameters. Ex 'sslEnabledProtocols:true'nullSTRINGYesNo
client.enable.session.creationEnable HTTP session creation.This parameter should include under parameters Ex: 'client.enable.session.creation:true'nullSTRINGYesNo
follow.redirectRedirect related enabled.trueBOOLYesNo
max.redirect.countMaximum redirect count.5INTYesNo
tls.store.typeTLS store type to be used.JKSSTRINGYesNo
proxy.hostProxy server hostnullSTRINGYesNo
proxy.portProxy server portnullSTRINGYesNo
proxy.usernameProxy server usernamenullSTRINGYesNo
proxy.passwordProxy server passwordnullSTRINGYesNo
client.bootstrap.configurationClient bootsrap configurations. Expected format of these parameters is as follows: "'client.bootstrap.nodelay:xxx','client.bootstrap.keepalive:xxx'"TODOSTRINGYesNo
client.bootstrap.nodelayHttp client no delay.trueBOOLYesNo
client.bootstrap.keepaliveHttp client keep alive.trueBOOLYesNo
client.bootstrap.sendbuffersizeHttp client send buffer size.1048576INTYesNo
client.bootstrap.recievebuffersizeHttp client receive buffer size.1048576INTYesNo
client.bootstrap.connect.timeoutHttp client connection timeout.15000INTYesNo
client.bootstrap.socket.reuseTo enable http socket reuse.falseBOOLYesNo
client.bootstrap.socket.timeoutHttp client socket timeout.15STRINGYesNo
client.threadpool.configurationsThread pool configuration. Expected format of these parameters is as follows: "'client.connection.pool.count:xxx','client.max.active.connections.per.pool:xxx'"TODOSTRINGYesNo
client.connection.pool.countConnection pool count.0INTYesNo
client.max.active.connections.per.poolActive connections per pool.-1INTYesNo
client.min.idle.connections.per.poolMinimum ideal connection per pool.0INTYesNo
client.max.idle.connections.per.poolMaximum ideal connection per pool.100INTYesNo
client.min.eviction.idle.timeMinimum eviction idle time.5 * 60 * 1000STRINGYesNo
sender.thread.countHttp sender thread count.20STRINGYesNo
event.group.executor.thread.sizeEvent group executor thread size.15STRINGYesNo
max.wait.for.client.connection.poolMaximum wait for client connection pool.60000STRINGYesNo
oauth.usernameThe username to be included in the authentication header of the oauth authentication enabled events. It is required to specify both username and password to enable oauth authentication. If one of the parameter is not given by user then an error is logged in the CLI. It is only applicable for for Oauth requests STRINGYesNo
oauth.passwordThe password to be included in the authentication header of the oauth authentication enabled events. It is required to specify both username and password to enable oauth authentication. If one of the parameter is not given by user then an error is logged in the CLI. It is only applicable for for Oauth requests STRINGYesNo
consumer.keyconsumer key for the Http request. It is only applicable for for Oauth requests STRINGYesNo
consumer.secretconsumer secret for the Http request. It is only applicable for for Oauth requests STRINGYesNo
refresh.tokenrefresh token for the Http request. It is only applicable for for Oauth requests STRINGYesNo
token.urltoken url for generate a new access token. It is only applicable for for Oauth requests STRINGYesNo
- -System Parameters - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Parameters
clientBootstrapBossGroupSizeproperty to configure number of boss threads, which accepts incoming connections until the ports are unbound. Once connection accepts successfully, boss thread passes the accepted channel to one of the worker threads.Number of available processorsAny integer
clientBootstrapWorkerGroupSizeproperty to configure number of worker threads, which performs non blocking read and write for one or more channels in non-blocking mode.(Number of available processors)*2Any integer
clientBootstrapClientGroupSizeproperty to configure number of client threads, which performs non blocking read and write for one or more channels in non-blocking mode.(Number of available processors)*2Any integer
trustStoreLocationThe default truststore file path.${carbon.home}/resources/security/client-truststore.jksPath to client-truststore.jks
trustStorePasswordThe default truststore password.wso2carbonTruststore password
- -Examples -EXAMPLE 1 -``` -@sink(type='http',publisher.url='http://localhost:8009/foo', method='{{method}}',headers="'content-type:xml','content-length:94'", client.bootstrap.configuration="'client.bootstrap.socket.timeout:20', 'client.bootstrap.worker.group.size:10'", client.pool.configuration="'client.connection.pool.count:10','client.max.active.connections.per.pool:1'", @map(type='xml', @payload('{{payloadBody}}'))) -define stream FooStream (payloadBody String, method string, headers string); - -``` -

If it is xml mapping expected input should be in following format for FooStream:
{
<events>
    <event>
        <symbol>WSO2</symbol>
        <price>55.6</price>
        <volume>100</volume>
    </event>
</events>,
POST,
Content-Length:24#Content-Location:USA#Retry-After:120
}

Above event will generate output as below.
~Output http event payload
<events>
    <event>
        <symbol>WSO2</symbol>
        <price>55.6</price>
        <volume>100</volume>
    </event>
</events>

~Output http event headers
Content-Length:24,
Content-Location:'USA',
Retry-After:120,
Content-Type:'application/xml',
HTTP_METHOD:'POST',

~Output http event properties
HTTP_METHOD:'POST',
HOST:'localhost',
PORT:8009,
PROTOCOL:'http',
TO:'/foo'

- -### http-request *(Sink)* - -

This extension publish the HTTP events in any HTTP method POST, GET, PUT, DELETE via HTTP or https protocols. As the additional features this component can provide basic authentication as well as user can publish events using custom client truststore files when publishing events via https protocol. And also user can add any number of headers including HTTP_METHOD header for each event dynamically.
Following content types will be set by default according to the type of sink mapper used.
You can override them by setting the new content types in headers.
     - TEXT : text/plain
     - XML : application/xml
     - JSON : application/json
     - KEYVALUE : application/x-www-form-urlencoded

HTTP request sink is correlated with the The HTTP reponse source, through a unique sink.id.It sends the request to the defined url and the response is received by the response source which has the same 'sink.id'.

- -Syntax -``` -@sink(type="http-request", publisher.url="", basic.auth.username="", basic.auth.password="", https.truststore.file="", https.truststore.password="", headers="", method="", socket.idle.timeout="", chunk.disabled="", ssl.protocol="", parameters="", ciphers="", ssl.enabled.protocols="", client.enable.session.creation="", follow.redirect="", max.redirect.count="", tls.store.type="", proxy.host="", proxy.port="", proxy.username="", proxy.password="", client.bootstrap.configuration="", client.bootstrap.nodelay="", client.bootstrap.keepalive="", client.bootstrap.sendbuffersize="", client.bootstrap.recievebuffersize="", client.bootstrap.connect.timeout="", client.bootstrap.socket.reuse="", client.bootstrap.socket.timeout="", client.threadpool.configurations="", client.connection.pool.count="", client.max.active.connections.per.pool="", client.min.idle.connections.per.pool="", client.max.idle.connections.per.pool="", client.min.eviction.idle.time="", sender.thread.count="", event.group.executor.thread.size="", max.wait.for.client.connection.pool="", sink.id="", downloading.enabled="", download.path="", oauth.username="", oauth.password="", consumer.key="", consumer.secret="", refresh.token="", @map(...))) -``` - -QUERY PARAMETERS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
publisher.urlThe URL to which the outgoing events should be published via HTTP. This is a mandatory parameter and if this is not specified, an error is logged in the CLI. If user wants to enable SSL for the events, use https instead of http in the publisher.url.
e.g., http://localhost:8080/endpoint, https://localhost:8080/endpoint
This can be used as a dynamic parameter as well.
STRINGNoYes
basic.auth.usernameThe username to be included in the authentication header of the basic authentication enabled events. It is required to specify both username and password to enable basic authentication. If one of the parameter is not given by user then an error is logged in the CLI. STRINGYesNo
basic.auth.passwordThe password to include in the authentication header of the basic authentication enabled events. It is required to specify both username and password to enable basic authentication. If one of the parameter is not given by user then an error is logged in the CLI. STRINGYesNo
https.truststore.fileThe file path to the location of the truststore of the client that sends the HTTP events through 'https' protocol. A custom client-truststore can be specified if required.${carbon.home}/resources/security/client-truststore.jksSTRINGYesNo
https.truststore.passwordThe password for the client-truststore. A custom password can be specified if required. If no custom password is specified and the protocol of URL is 'https' then, the system uses default password.wso2carbonSTRINGYesNo
headersThe headers that should be included as HTTP request headers.
There can be any number of headers concatenated in following format. "'header1:value1','header2:value2'". User can include Content-Type header if he needs to use a specific content-type for the payload. Or else, system decides the Content-Type by considering the type of sink mapper, in following way.
 - @map(xml):application/xml
 - @map(json):application/json
 - @map(text):plain/text )
 - if user does not include any mapping type then the system gets 'plain/text' as default Content-Type header.
Note that providing content-length as a header is not supported. The size of the payload will be automatically calculated and included in the content-length header.
STRINGYesNo
methodFor HTTP events, HTTP_METHOD header should be included as a request header. If the parameter is null then system uses 'POST' as a default header.POSTSTRINGYesNo
socket.idle.timeoutSocket timeout value in millisecond6000INTYesNo
chunk.disabledport: Port number of the remote servicefalseBOOLYesNo
ssl.protocolThe SSL protocol versionTLSSTRINGYesNo
parametersParameters other than basics such as ciphers,sslEnabledProtocols,client.enable.session.creation. Expected format of these parameters is as follows: "'ciphers:xxx','sslEnabledProtocols,client.enable:xxx'"nullSTRINGYesNo
ciphersList of ciphers to be used. This parameter should include under parameters Ex: 'ciphers:TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256'nullSTRINGYesNo
ssl.enabled.protocolsSSL/TLS protocols to be enabled. This parameter should be in camel case format(sslEnabledProtocols) under parameters. Ex 'sslEnabledProtocols:true'nullSTRINGYesNo
client.enable.session.creationEnable HTTP session creation.This parameter should include under parameters Ex: 'client.enable.session.creation:true'nullSTRINGYesNo
follow.redirectRedirect related enabled.trueBOOLYesNo
max.redirect.countMaximum redirect count.5INTYesNo
tls.store.typeTLS store type to be used.JKSSTRINGYesNo
proxy.hostProxy server hostnullSTRINGYesNo
proxy.portProxy server portnullSTRINGYesNo
proxy.usernameProxy server usernamenullSTRINGYesNo
proxy.passwordProxy server passwordnullSTRINGYesNo
client.bootstrap.configurationClient bootsrap configurations. Expected format of these parameters is as follows: "'client.bootstrap.nodelay:xxx','client.bootstrap.keepalive:xxx'"TODOSTRINGYesNo
client.bootstrap.nodelayHttp client no delay.trueBOOLYesNo
client.bootstrap.keepaliveHttp client keep alive.trueBOOLYesNo
client.bootstrap.sendbuffersizeHttp client send buffer size.1048576INTYesNo
client.bootstrap.recievebuffersizeHttp client receive buffer size.1048576INTYesNo
client.bootstrap.connect.timeoutHttp client connection timeout.15000INTYesNo
client.bootstrap.socket.reuseTo enable http socket reuse.falseBOOLYesNo
client.bootstrap.socket.timeoutHttp client socket timeout.15STRINGYesNo
client.threadpool.configurationsThread pool configuration. Expected format of these parameters is as follows: "'client.connection.pool.count:xxx','client.max.active.connections.per.pool:xxx'"TODOSTRINGYesNo
client.connection.pool.countConnection pool count.0INTYesNo
client.max.active.connections.per.poolActive connections per pool.-1INTYesNo
client.min.idle.connections.per.poolMinimum ideal connection per pool.0INTYesNo
client.max.idle.connections.per.poolMaximum ideal connection per pool.100INTYesNo
client.min.eviction.idle.timeMinimum eviction idle time.5 * 60 * 1000STRINGYesNo
sender.thread.countHttp sender thread count.20STRINGYesNo
event.group.executor.thread.sizeEvent group executor thread size.15STRINGYesNo
max.wait.for.client.connection.poolMaximum wait for client connection pool.60000STRINGYesNo
sink.idIdentifier of the sink. This is used to co-relate with the corresponding http-response source which needs to process the repose for the request sent by this sink.STRINGNoNo
downloading.enabledIf this is set to 'true' then the response received by the response source will be written to a file. If downloading is enabled, the download.path parameter is mandatory.falseBOOLYesNo
download.pathIf downloading is enabled, the path of the file which is going to be downloaded should be specified using 'download.path' parameter. This should be an absolute path including the file name.nullSTRINGYesYes
oauth.usernameThe username to be included in the authentication header of the oauth authentication enabled events. It is required to specify both username and password to enable oauth authentication. If one of the parameter is not given by user then an error is logged in the CLI. It is only applicable for for Oauth requests STRINGYesNo
oauth.passwordThe password to be included in the authentication header of the oauth authentication enabled events. It is required to specify both username and password to enable oauth authentication. If one of the parameter is not given by user then an error is logged in the CLI. It is only applicable for for Oauth requests STRINGYesNo
consumer.keyconsumer key for the Http request. It is only applicable for for Oauth requests STRINGYesNo
consumer.secretconsumer secret for the Http request. It is only applicable for for Oauth requests STRINGYesNo
refresh.tokenrefresh token for the Http request. It is only applicable for for Oauth requests STRINGYesNo
- -Examples -EXAMPLE 1 -``` -@sink(type='http-request', sink.id='foo', publisher.url='http://localhost:8009/foo', @map(type='xml', @payload('{{payloadBody}}'))) -define stream FooStream (payloadBody String, method string, headers string); -@source(type='http-response', sink.id='foo', http.status.code='2\\d+', -@map(type='text', regex.A='((.|\n)*)', @attributes(headers='trp:headers', fileName='A[1]'))) -define stream responseStream2xx(fileName string, headers string); - -@source(type='http-response', sink.id='foo', http.status.code='4\\d+', -@map(type='text', regex.A='((.|\n)*)', @attributes(errorMsg='A[1]'))) -define stream responseStream4xx(errorMsg string); -``` -

In above example, the payload body for 'FooStream' will be in following format.
{
<events>
    <event>
        <symbol>WSO2</symbol>
        <price>55.6</price>
        <volume>100</volume>
    </event>
</events>,
This message will sent as the body of a POST request with the content-type 'application/xml' to the endpoint defined as the 'publisher.url' and in order to process the responses for these requests, there should be a source of type 'http-response' defined with the same sink id 'foo' in the siddhi app.
 The responses with 2xx status codes will be received by the http-response source which has the http.status.code defined by the regex '2\\d+'.
If the response has a 4xx status code, it will be received by the http-response source which has the http.status.code defined by the regex '4\\d+'.

- -EXAMPLE 2 -``` -define stream FooStream (name String, id int, headers String, downloadPath string); -@sink(type='http-request', -downloading.enabled='true', -download.path='{{downloadPath}}',publisher.url='http://localhost:8005/files', -method='GET', headers='{{headers}}',sink.id='download-sink', -@map(type='json')) -define stream BarStream (name String, id int, headers String, downloadPath string); - -@source(type='http-response', sink.id='download-sink', http.status.code='2\\d+', -@map(type='text', regex.A='((.|\n)*)', @attributes(headers='trp:headers', fileName='A[1]'))) -define stream responseStream2xx(fileName string, headers string); - -@source(type='http-response', sink.id='download-sink', http.status.code='4\\d+', -@map(type='text', regex.A='((.|\n)*)', @attributes(errorMsg='A[1]'))) -define stream responseStream4xx(errorMsg string); -``` -

In above example, http-request sink will send a GET request to the publisher url and the requested file will be received as the response by a corresponding http-response source.
If the http status code of the response is a successful one (2xx), it will be received by the http-response source which has the http.status.code '2\\d+' and downloaded as a local file. Then the event received to the responseStream2xx will have the headers included in the request and the downloaded file name.
If the http status code of the response is a 4xx code, it will be received by the http-response source which has the http.status.code '4\\d+'. Then the event received to the responseStream4xx will have the response message body in text format.

- -### http-response *(Sink)* - -

HTTP response sink is correlated with the The HTTP request source, through a unique source.id, and it send a response to the HTTP request source having the same source.id. The response message can be formatted in text, XML or JSON and can be sent with appropriate headers.

- -Syntax -``` -@sink(type="http-response", source.id="", message.id="", headers="", @map(...))) -``` - -QUERY PARAMETERS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
source.idIdentifier of the source.STRINGNoNo
message.idIdentifier of the message.STRINGNoYes
headersThe headers that should be included as HTTP response headers. There can be any number of headers concatenated on following format. "'header1:value1','header2:value2'" User can include content-type header if he/she need to have any specific type for payload. If not system get the mapping type as the content-Type header (ie.@map(xml):application/xml, @map(json):application/json, @map(text):plain/text) and if user does not include any mapping type then system gets the plain/text as default Content-Type header. If user does not include Content-Length header then system calculate the bytes size of payload and include it as content-length header. STRINGYesNo
- -Examples -EXAMPLE 1 -``` -@sink(type='http-response', source.id='sampleSourceId', message.id='{{messageId}}', headers="'content-type:json','content-length:94'"@map(type='json', @payload('{{payloadBody}}'))) -define stream FooStream (payloadBody String, messageId string, headers string); - -``` -

If it is json mapping expected input should be in following format for FooStream:
{
{"events":
    {"event":
        "symbol":WSO2,
        "price":55.6,
        "volume":100,
    }
},
0cf708b1-7eae-440b-a93e-e72f801b486a,
Content-Length:24#Content-Location:USA
}

Above event will generate response for the matching source message as below.

~Output http event payload
{"events":
    {"event":
        "symbol":WSO2,
        "price":55.6,
        "volume":100,
    }
}

~Output http event headers
Content-Length:24,
Content-Location:'USA',
Content-Type:'application/json'

- -## Source - -### http *(Source)* - -

The HTTP source receives POST requests via HTTP or HTTPS in format such as text, XML and JSON. In WSO2 SP, if required, you can enable basic authentication to ensure that events are received only from users who are authorized to access the service.

- -Syntax -``` -@source(type="http", receiver.url="", basic.auth.enabled="", worker.count="", socket.idle.timeout="", ssl.verify.client="", ssl.protocol="", tls.store.type="", parameters="", ciphers="", ssl.enabled.protocols="", server.enable.session.creation="", server.supported.snimatchers="", server.suported.server.names="", request.size.validation.configuration="", request.size.validation="", request.size.validation.maximum.value="", request.size.validation.reject.status.code="", request.size.validation.reject.message="", request.size.validation.reject.message.content.type="", header.size.validation="", header.validation.maximum.request.line="", header.validation.maximum.size="", header.validation.maximum.chunk.size="", header.validation.reject.status.code="", header.validation.reject.message="", header.validation.reject.message.content.type="", server.bootstrap.configuration="", server.bootstrap.nodelay="", server.bootstrap.keepalive="", server.bootstrap.sendbuffersize="", server.bootstrap.recievebuffersize="", server.bootstrap.connect.timeout="", server.bootstrap.socket.reuse="", server.bootstrap.socket.timeout="", server.bootstrap.socket.backlog="", trace.log.enabled="", @map(...))) -``` - -QUERY PARAMETERS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
receiver.urlThe URL to which the events should be received. User can provide any valid url and if the url is not provided the system will use the following format http://0.0.0.0:9763/<appNAme>/<streamName>If the user want to use SSL the url should be given in following format https://localhost:8080/<streamName>http://0.0.0.0:9763//STRINGYesNo
basic.auth.enabledThis works only in WSO2 SP. If this is set to true, basic authentication is enabled for incoming events, and the credentials with which each event is sent are verified to ensure that the user is authorized to access the service. If basic authentication fails, the event is not authenticated and an authentication error is logged in the CLI.falseSTRINGYesNo
worker.countThe number of active worker threads to serve the incoming events. The value is 1 by default. This will ensure that the events are directed to the event stream in the same order in which they arrive. By increasing this value the performance might increase at the cost of loosing event ordering.1INTYesNo
socket.idle.timeoutIdle timeout for HTTP connection.120000INTYesNo
ssl.verify.clientThe type of client certificate verification.nullSTRINGYesNo
ssl.protocolssl/tls related optionsTLSSTRINGYesNo
tls.store.typeTLS store type.JKSSTRINGYesNo
parametersParameters other than basics such as ciphers,sslEnabledProtocols,client.enable.session.creation. Expected format of these parameters is as follows: "'ciphers:xxx','sslEnabledProtocols,client.enable:xxx'"nullSTRINGYesNo
ciphersList of ciphers to be used. This parameter should include under parameters Ex: 'ciphers:TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256'nullSTRINGYesNo
ssl.enabled.protocolsSSL/TLS protocols to be enabled. This parameter should be in camel case format(sslEnabledProtocols) under parameters. Ex 'sslEnabledProtocols:true'nullSTRINGYesNo
server.enable.session.creationEnable HTTP session creation.This parameter should include under parameters Ex: 'client.enable.session.creation:true'nullSTRINGYesNo
server.supported.snimatchersHttp SNIMatcher to be added. This parameter should include under parameters Ex: 'server.supported.snimatchers:SNIMatcher'nullSTRINGYesNo
server.suported.server.namesHttp supported servers. This parameter should include under parameters Ex: 'server.suported.server.names:server'nullSTRINGYesNo
request.size.validation.configurationParameters that responsible for validating the http request and request headers. Expected format of these parameters is as follows: "'request.size.validation:xxx','request.size.validation.maximum.value:xxx'"nullSTRINGYesNo
request.size.validationTo enable the request size validation.falseSTRINGYesNo
request.size.validation.maximum.valueIf request size is validated then maximum size.Integer.MAX_VALUESTRINGYesNo
request.size.validation.reject.status.codeIf request is exceed maximum size and request.size.validation is enabled then status code to be send as response.401STRINGYesNo
request.size.validation.reject.messageIf request is exceed maximum size and request.size.validation is enabled then status message to be send as response.Message is bigger than the valid sizeSTRINGYesNo
request.size.validation.reject.message.content.typeIf request is exceed maximum size and request.size.validation is enabled then content type to be send as response.plain/textSTRINGYesNo
header.size.validationTo enable the header size validation.falseSTRINGYesNo
header.validation.maximum.request.lineIf header header validation is enabled then the maximum request line.4096STRINGYesNo
header.validation.maximum.sizeIf header header validation is enabled then the maximum expected header size.8192STRINGYesNo
header.validation.maximum.chunk.sizeIf header header validation is enabled then the maximum expected chunk size.8192STRINGYesNo
header.validation.reject.status.code401If header is exceed maximum size and header.size.validation is enabled then status code to be send as response.STRINGYesNo
header.validation.reject.messageIf header is exceed maximum size and header.size.validation is enabled then message to be send as response.Message header is bigger than the valid sizeSTRINGYesNo
header.validation.reject.message.content.typeIf header is exceed maximum size and header.size.validation is enabled then content type to be send as response.plain/textSTRINGYesNo
server.bootstrap.configurationParameters that for bootstrap configurations of the server. Expected format of these parameters is as follows: "'ciphers:xxx','sslEnabledProtocols,client.enable:xxx'"nullOBJECTYesNo
server.bootstrap.nodelayHttp server no delay.trueBOOLYesNo
server.bootstrap.keepaliveHttp server keep alive.trueBOOLYesNo
server.bootstrap.sendbuffersizeHttp server send buffer size.1048576INTYesNo
server.bootstrap.recievebuffersizeHttp server receive buffer size.1048576INTYesNo
server.bootstrap.connect.timeoutHttp server connection timeout.15000INTYesNo
server.bootstrap.socket.reuseTo enable http socket reuse.falseBOOLYesNo
server.bootstrap.socket.timeoutHttp server socket timeout.15BOOLYesNo
server.bootstrap.socket.backlogTHttp server socket backlog.100BOOLYesNo
trace.log.enabledHttp traffic monitoring.falseBOOLYesNo
- -System Parameters - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Parameters
serverBootstrapBossGroupSizeproperty to configure number of boss threads, which accepts incoming connections until the ports are unbound. Once connection accepts successfully, boss thread passes the accepted channel to one of the worker threads.Number of available processorsAny integer
serverBootstrapWorkerGroupSizeproperty to configure number of worker threads, which performs non blocking read and write for one or more channels in non-blocking mode.(Number of available processors)*2Any integer
serverBootstrapClientGroupSizeproperty to configure number of client threads, which performs non blocking read and write for one or more channels in non-blocking mode.(Number of available processors)*2Any integer
defaultHostThe default host of the transport.0.0.0.0Any valid host
defaultHttpPortThe default port if the default scheme is 'http'.8280Any valid port
defaultHttpsPortThe default port if the default scheme is 'https'.8243Any valid port
defaultSchemeThe default protocol.httphttp
https
keyStoreLocationThe default keystore file path.${carbon.home}/resources/security/wso2carbon.jksPath to wso2carbon.jks file
keyStorePasswordThe default keystore password.wso2carbonString of keystore password
- -Examples -EXAMPLE 1 -``` -@source(type='http', receiver.url='http://localhost:9055/endpoints/RecPro', socketIdleTimeout='150000', parameters="'ciphers : TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256', 'sslEnabledProtocols:TLSv1.1,TLSv1.2'",request.size.validation.configuration="request.size.validation:true",server.bootstrap.configuration="server.bootstrap.socket.timeout:25" @map(type='xml')) -define stream FooStream (symbol string, price float, volume long); - -``` -

Above source listenerConfiguration performs a default XML input mapping. The expected input is as follows:
<events>
    <event>
        <symbol>WSO2</symbol>
        <price>55.6</price>
        <volume>100</volume>
    </event>
</events>
If basic authentication is enabled via the basic.auth.enabled='true setting, each input event is also expected to contain the Authorization:'Basic encodeBase64(username:Password)' header.

- -### http-request *(Source)* - -

The HTTP request is correlated with the HTTP response sink, through a unique source.id, and for each POST requests it receives via HTTP or HTTPS in format such as text, XML and JSON it sends the response via the HTTP response sink. The individual request and response messages are correlated at the sink using the message.id of the events. If required, you can enable basic authentication at the source to ensure that events are received only from users who are authorized to access the service.

- -Syntax -``` -@source(type="http-request", receiver.url="", source.id="", connection.timeout="", basic.auth.enabled="", worker.count="", socket.idle.timeout="", ssl.verify.client="", ssl.protocol="", tls.store.type="", parameters="", ciphers="", ssl.enabled.protocols="", server.enable.session.creation="", server.supported.snimatchers="", server.suported.server.names="", request.size.validation.configuration="", request.size.validation="", request.size.validation.maximum.value="", request.size.validation.reject.status.code="", request.size.validation.reject.message="", request.size.validation.reject.message.content.type="", header.size.validation="", header.validation.maximum.request.line="", header.validation.maximum.size="", header.validation.maximum.chunk.size="", header.validation.reject.status.code="", header.validation.reject.message="", header.validation.reject.message.content.type="", server.bootstrap.configuration="", server.bootstrap.nodelay="", server.bootstrap.keepalive="", server.bootstrap.sendbuffersize="", server.bootstrap.recievebuffersize="", server.bootstrap.connect.timeout="", server.bootstrap.socket.reuse="", server.bootstrap.socket.timeout="", server.bootstrap.socket.backlog="", trace.log.enabled="", @map(...))) -``` - -QUERY PARAMETERS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
receiver.urlThe URL to which the events should be received. User can provide any valid url and if the url is not provided the system will use the following format http://0.0.0.0:9763/<appNAme>/<streamName>If the user want to use SSL the url should be given in following format https://localhost:8080/<streamName>http://0.0.0.0:9763//STRINGYesNo
source.idIdentifier need to map the source to sink.STRINGNoNo
connection.timeoutConnection timeout in milliseconds. If the mapped http-response sink does not get a correlated message, after this timeout value, a timeout response is sent120000INTYesNo
basic.auth.enabledIf this is set to true, basic authentication is enabled for incoming events, and the credentials with which each event is sent are verified to ensure that the user is authorized to access the service. If basic authentication fails, the event is not authenticated and an authentication error is logged in the CLI. By default this values 'false' falseSTRINGYesNo
worker.countThe number of active worker threads to serve the incoming events. The value is 1 by default. This will ensure that the events are directed to the event stream in the same order in which they arrive. By increasing this value the performance might increase at the cost of loosing event ordering.1INTYesNo
socket.idle.timeoutIdle timeout for HTTP connection.120000INTYesNo
ssl.verify.clientThe type of client certificate verification.nullSTRINGYesNo
ssl.protocolssl/tls related optionsTLSSTRINGYesNo
tls.store.typeTLS store type.JKSSTRINGYesNo
parametersParameters other than basics such as ciphers,sslEnabledProtocols,client.enable.session.creation. Expected format of these parameters is as follows: "'ciphers:xxx','sslEnabledProtocols,client.enable:xxx'"nullSTRINGYesNo
ciphersList of ciphers to be used. This parameter should include under parameters Ex: 'ciphers:TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256'nullSTRINGYesNo
ssl.enabled.protocolsSSL/TLS protocols to be enabled. This parameter should be in camel case format(sslEnabledProtocols) under parameters. Ex 'sslEnabledProtocols:true'nullSTRINGYesNo
server.enable.session.creationEnable HTTP session creation.This parameter should include under parameters Ex: 'client.enable.session.creation:true'nullSTRINGYesNo
server.supported.snimatchersHttp SNIMatcher to be added. This parameter should include under parameters Ex: 'server.supported.snimatchers:SNIMatcher'nullSTRINGYesNo
server.suported.server.namesHttp supported servers. This parameter should include under parameters Ex: 'server.suported.server.names:server'nullSTRINGYesNo
request.size.validation.configurationParameters that responsible for validating the http request and request headers. Expected format of these parameters is as follows: "'request.size.validation:xxx','request.size.validation.maximum.value:xxx'"nullSTRINGYesNo
request.size.validationTo enable the request size validation.falseSTRINGYesNo
request.size.validation.maximum.valueIf request size is validated then maximum size.Integer.MAX_VALUESTRINGYesNo
request.size.validation.reject.status.codeIf request is exceed maximum size and request.size.validation is enabled then status code to be send as response.401STRINGYesNo
request.size.validation.reject.messageIf request is exceed maximum size and request.size.validation is enabled then status message to be send as response.Message is bigger than the valid sizeSTRINGYesNo
request.size.validation.reject.message.content.typeIf request is exceed maximum size and request.size.validation is enabled then content type to be send as response.plain/textSTRINGYesNo
header.size.validationTo enable the header size validation.falseSTRINGYesNo
header.validation.maximum.request.lineIf header header validation is enabled then the maximum request line.4096STRINGYesNo
header.validation.maximum.sizeIf header header validation is enabled then the maximum expected header size.8192STRINGYesNo
header.validation.maximum.chunk.sizeIf header header validation is enabled then the maximum expected chunk size.8192STRINGYesNo
header.validation.reject.status.code401If header is exceed maximum size and header.size.validation is enabled then status code to be send as response.STRINGYesNo
header.validation.reject.messageIf header is exceed maximum size and header.size.validation is enabled then message to be send as response.Message header is bigger than the valid sizeSTRINGYesNo
header.validation.reject.message.content.typeIf header is exceed maximum size and header.size.validation is enabled then content type to be send as response.plain/textSTRINGYesNo
server.bootstrap.configurationParameters that for bootstrap configurations of the server. Expected format of these parameters is as follows: "'ciphers:xxx','sslEnabledProtocols,client.enable:xxx'"nullOBJECTYesNo
server.bootstrap.nodelayHttp server no delay.trueBOOLYesNo
server.bootstrap.keepaliveHttp server keep alive.trueBOOLYesNo
server.bootstrap.sendbuffersizeHttp server send buffer size.1048576INTYesNo
server.bootstrap.recievebuffersizeHttp server receive buffer size.1048576INTYesNo
server.bootstrap.connect.timeoutHttp server connection timeout.15000INTYesNo
server.bootstrap.socket.reuseTo enable http socket reuse.falseBOOLYesNo
server.bootstrap.socket.timeoutHttp server socket timeout.15BOOLYesNo
server.bootstrap.socket.backlogTHttp server socket backlog.100BOOLYesNo
trace.log.enabledHttp traffic monitoring.falseBOOLYesNo
- -System Parameters - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Parameters
serverBootstrapBossGroupSizeproperty to configure number of boss threads, which accepts incoming connections until the ports are unbound. Once connection accepts successfully, boss thread passes the accepted channel to one of the worker threads.Number of available processorsAny integer
serverBootstrapWorkerGroupSizeproperty to configure number of worker threads, which performs non blocking read and write for one or more channels in non-blocking mode.(Number of available processors)*2Any integer
serverBootstrapClientGroupSizeproperty to configure number of client threads, which performs non blocking read and write for one or more channels in non-blocking mode.(Number of available processors)*2Any integer
defaultHostThe default host of the transport.0.0.0.0Any valid host
defaultHttpPortThe default port if the default scheme is 'http'.8280Any valid port
defaultHttpsPortThe default port if the default scheme is 'https'.8243Any valid port
defaultSchemeThe default protocol.httphttp
https
keyStoreLocationThe default keystore file path.${carbon.home}/resources/security/wso2carbon.jksPath to wso2carbon.jks file
keyStorePasswordThe default keystore password.wso2carbonString of keystore password
certPasswordThe default cert password.wso2carbonString of cert password
- -Examples -EXAMPLE 1 -``` -@source(type='http-request', source.id='sampleSourceId, receiver.url='http://localhost:9055/endpoints/RecPro', connection.timeout='150000', parameters="'ciphers : TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256', 'sslEnabledProtocols:TLSv1.1,TLSv1.2'", request.size.validation.configuration="request.size.validation:true", server.bootstrap.configuration="server.bootstrap.socket.timeout:25", @map(type='json, @attributes(messageId='trp:messageId', symbol='$.events.event.symbol', price='$.events.event.price', volume='$.events.event.volume'))) -define stream FooStream (messageId string, symbol string, price float, volume long); - -``` -

The expected input is as follows:
{"events":
    {"event":
        "symbol":WSO2,
        "price":55.6,
        "volume":100,
    }
}
If basic authentication is enabled via the basic.auth.enabled='true setting, each input event is also expected to contain the Authorization:'Basic encodeBase64(username:Password)' header.

- -### http-response *(Source)* - -

The http-response source co-relates with http-request sink with the parameter 'sink.id'.
This receives responses for the requests sent by the http-request sink which has the same sink id.
Response messages can be in formats such as TEXT, JSON and XML.
In order to handle the responses with different http status codes, user is allowed to defined the acceptable response source code using the parameter 'http.status.code'

- -Syntax -``` -@source(type="http-response", sink.id="", http.status.code="", allow.streaming.responses="", @map(...))) -``` - -QUERY PARAMETERS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
sink.idThis parameter is used to map the http-response source to a http-request sink. Then this source will accepts the response messages for the requests sent by corresponding http-request sink.STRINGNoNo
http.status.codeAcceptable http status code for the responses.
This can be a complete string or a regex.
Only the responses with matching status codes to the defined value, will be received by the http-response source.
Eg: 'http.status.code = '200', http.status.code = '2\\d+''
200STRINGYesNo
allow.streaming.responsesIf responses can be received multiple times for a single request, this option should be enabled. If this is not enabled, for every request, response will be extracted only once.falseBOOLYesNo
- -Examples -EXAMPLE 1 -``` -@sink(type='http-request', -downloading.enabled='true', -publisher.url='http://localhost:8005/registry/employee', -method='POST', headers='{{headers}}',sink.id='employee-info', -@map(type='json')) -define stream BarStream (name String, id int, headers String, downloadPath string); - -@source(type='http-response' , sink.id='employee-info', http.status.code='2\\d+', -@map(type='text', regex.A='((.|\n)*)', @attributes(message='A[1]'))) -define stream responseStream2xx(message string);@source(type='http-response' , sink.id='employee-info', http.status.code='4\\d+' , -@map(type='text', regex.A='((.|\n)*)', @attributes(message='A[1]'))) -define stream responseStream4xx(message string); -``` -

In above example, the defined http-request sink will send a POST requests to the endpoint defined by 'publisher.url'.
Then for those requests, the source with the response code '2\\d+' and sink.id 'employee-info' will receive the responses with 2xx status codes.
The http-response source which has 'employee-info' as the 'sink.id' and '4\\d+' as the http.response.code will receive all the responses with 4xx status codes.
. Then the body of the response message will be extracted using text mapper and converted into siddhi events.
.

- diff --git a/docs/api/2.0.2.md b/docs/api/2.0.2.md deleted file mode 100644 index 901d2962..00000000 --- a/docs/api/2.0.2.md +++ /dev/null @@ -1,1755 +0,0 @@ -# API Docs - v2.0.2 - -## Sink - -### http *(Sink)* - -

This extension publish the HTTP events in any HTTP method POST, GET, PUT, DELETE via HTTP or https protocols. As the additional features this component can provide basic authentication as well as user can publish events using custom client truststore files when publishing events via https protocol. And also user can add any number of headers including HTTP_METHOD header for each event dynamically.
Following content types will be set by default according to the type of sink mapper used.
You can override them by setting the new content types in headers.
     - TEXT : text/plain
     - XML : application/xml
     - JSON : application/json
     - KEYVALUE : application/x-www-form-urlencoded

- -Syntax -``` -@sink(type="http", publisher.url="", basic.auth.username="", basic.auth.password="", https.truststore.file="", https.truststore.password="", headers="", method="", socket.idle.timeout="", chunk.disabled="", ssl.protocol="", parameters="", ciphers="", ssl.enabled.protocols="", client.enable.session.creation="", follow.redirect="", max.redirect.count="", tls.store.type="", proxy.host="", proxy.port="", proxy.username="", proxy.password="", client.bootstrap.configuration="", client.bootstrap.nodelay="", client.bootstrap.keepalive="", client.bootstrap.sendbuffersize="", client.bootstrap.recievebuffersize="", client.bootstrap.connect.timeout="", client.bootstrap.socket.reuse="", client.bootstrap.socket.timeout="", client.threadpool.configurations="", client.connection.pool.count="", client.max.active.connections.per.pool="", client.min.idle.connections.per.pool="", client.max.idle.connections.per.pool="", client.min.eviction.idle.time="", sender.thread.count="", event.group.executor.thread.size="", max.wait.for.client.connection.pool="", oauth.username="", oauth.password="", consumer.key="", consumer.secret="", refresh.token="", token.url="", @map(...))) -``` - -QUERY PARAMETERS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
publisher.urlThe URL to which the outgoing events should be published via HTTP. This is a mandatory parameter and if this is not specified, an error is logged in the CLI. If user wants to enable SSL for the events, use https instead of http in the publisher.url.e.g., http://localhost:8080/endpoint, https://localhost:8080/endpointSTRINGNoNo
basic.auth.usernameThe username to be included in the authentication header of the basic authentication enabled events. It is required to specify both username and password to enable basic authentication. If one of the parameter is not given by user then an error is logged in the CLI. STRINGYesNo
basic.auth.passwordThe password to include in the authentication header of the basic authentication enabled events. It is required to specify both username and password to enable basic authentication. If one of the parameter is not given by user then an error is logged in the CLI. STRINGYesNo
https.truststore.fileThe file path to the location of the truststore of the client that sends the HTTP events through 'https' protocol. A custom client-truststore can be specified if required.${carbon.home}/resources/security/client-truststore.jksSTRINGYesNo
https.truststore.passwordThe password for the client-truststore. A custom password can be specified if required. If no custom password is specified and the protocol of URL is 'https' then, the system uses default password.wso2carbonSTRINGYesNo
headersThe headers that should be included as HTTP request headers.
There can be any number of headers concatenated in following format. "'header1:value1','header2:value2'". User can include Content-Type header if he needs to use a specific content-type for the payload. Or else, system decides the Content-Type by considering the type of sink mapper, in following way.
 - @map(xml):application/xml
 - @map(json):application/json
 - @map(text):plain/text )
 - if user does not include any mapping type then the system gets 'plain/text' as default Content-Type header.
Note that providing content-length as a header is not supported. The size of the payload will be automatically calculated and included in the content-length header.
STRINGYesNo
methodFor HTTP events, HTTP_METHOD header should be included as a request header. If the parameter is null then system uses 'POST' as a default header.POSTSTRINGYesNo
socket.idle.timeoutSocket timeout value in millisecond6000INTYesNo
chunk.disabledThis parameter is used to disable/enable chunked transfer encodingfalseBOOLYesNo
ssl.protocolThe SSL protocol versionTLSSTRINGYesNo
parametersParameters other than basics such as ciphers,sslEnabledProtocols,client.enable.session.creation. Expected format of these parameters is as follows: "'ciphers:xxx','sslEnabledProtocols,client.enable:xxx'"nullSTRINGYesNo
ciphersList of ciphers to be used. This parameter should include under parameters Ex: 'ciphers:TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256'nullSTRINGYesNo
ssl.enabled.protocolsSSL/TLS protocols to be enabled. This parameter should be in camel case format(sslEnabledProtocols) under parameters. Ex 'sslEnabledProtocols:true'nullSTRINGYesNo
client.enable.session.creationEnable HTTP session creation.This parameter should include under parameters Ex: 'client.enable.session.creation:true'nullSTRINGYesNo
follow.redirectRedirect related enabled.trueBOOLYesNo
max.redirect.countMaximum redirect count.5INTYesNo
tls.store.typeTLS store type to be used.JKSSTRINGYesNo
proxy.hostProxy server hostnullSTRINGYesNo
proxy.portProxy server portnullSTRINGYesNo
proxy.usernameProxy server usernamenullSTRINGYesNo
proxy.passwordProxy server passwordnullSTRINGYesNo
client.bootstrap.configurationClient bootsrap configurations. Expected format of these parameters is as follows: "'client.bootstrap.nodelay:xxx','client.bootstrap.keepalive:xxx'"TODOSTRINGYesNo
client.bootstrap.nodelayHttp client no delay.trueBOOLYesNo
client.bootstrap.keepaliveHttp client keep alive.trueBOOLYesNo
client.bootstrap.sendbuffersizeHttp client send buffer size.1048576INTYesNo
client.bootstrap.recievebuffersizeHttp client receive buffer size.1048576INTYesNo
client.bootstrap.connect.timeoutHttp client connection timeout.15000INTYesNo
client.bootstrap.socket.reuseTo enable http socket reuse.falseBOOLYesNo
client.bootstrap.socket.timeoutHttp client socket timeout.15STRINGYesNo
client.threadpool.configurationsThread pool configuration. Expected format of these parameters is as follows: "'client.connection.pool.count:xxx','client.max.active.connections.per.pool:xxx'"TODOSTRINGYesNo
client.connection.pool.countConnection pool count.0INTYesNo
client.max.active.connections.per.poolActive connections per pool.-1INTYesNo
client.min.idle.connections.per.poolMinimum ideal connection per pool.0INTYesNo
client.max.idle.connections.per.poolMaximum ideal connection per pool.100INTYesNo
client.min.eviction.idle.timeMinimum eviction idle time.5 * 60 * 1000STRINGYesNo
sender.thread.countHttp sender thread count.20STRINGYesNo
event.group.executor.thread.sizeEvent group executor thread size.15STRINGYesNo
max.wait.for.client.connection.poolMaximum wait for client connection pool.60000STRINGYesNo
oauth.usernameThe username to be included in the authentication header of the oauth authentication enabled events. It is required to specify both username and password to enable oauth authentication. If one of the parameter is not given by user then an error is logged in the CLI. It is only applicable for for Oauth requests STRINGYesNo
oauth.passwordThe password to be included in the authentication header of the oauth authentication enabled events. It is required to specify both username and password to enable oauth authentication. If one of the parameter is not given by user then an error is logged in the CLI. It is only applicable for for Oauth requests STRINGYesNo
consumer.keyconsumer key for the Http request. It is only applicable for for Oauth requests STRINGYesNo
consumer.secretconsumer secret for the Http request. It is only applicable for for Oauth requests STRINGYesNo
refresh.tokenrefresh token for the Http request. It is only applicable for for Oauth requests STRINGYesNo
token.urltoken url for generate a new access token. It is only applicable for for Oauth requests STRINGYesNo
- -System Parameters - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Parameters
clientBootstrapBossGroupSizeproperty to configure number of boss threads, which accepts incoming connections until the ports are unbound. Once connection accepts successfully, boss thread passes the accepted channel to one of the worker threads.Number of available processorsAny integer
clientBootstrapWorkerGroupSizeproperty to configure number of worker threads, which performs non blocking read and write for one or more channels in non-blocking mode.(Number of available processors)*2Any integer
clientBootstrapClientGroupSizeproperty to configure number of client threads, which performs non blocking read and write for one or more channels in non-blocking mode.(Number of available processors)*2Any integer
trustStoreLocationThe default truststore file path.${carbon.home}/resources/security/client-truststore.jksPath to client-truststore.jks
trustStorePasswordThe default truststore password.wso2carbonTruststore password
- -Examples -EXAMPLE 1 -``` -@sink(type='http',publisher.url='http://localhost:8009/foo', method='{{method}}',headers="'content-type:xml','content-length:94'", client.bootstrap.configuration="'client.bootstrap.socket.timeout:20', 'client.bootstrap.worker.group.size:10'", client.pool.configuration="'client.connection.pool.count:10','client.max.active.connections.per.pool:1'", @map(type='xml', @payload('{{payloadBody}}'))) -define stream FooStream (payloadBody String, method string, headers string); - -``` -

If it is xml mapping expected input should be in following format for FooStream:
{
<events>
    <event>
        <symbol>WSO2</symbol>
        <price>55.6</price>
        <volume>100</volume>
    </event>
</events>,
POST,
Content-Length:24#Content-Location:USA#Retry-After:120
}

Above event will generate output as below.
~Output http event payload
<events>
    <event>
        <symbol>WSO2</symbol>
        <price>55.6</price>
        <volume>100</volume>
    </event>
</events>

~Output http event headers
Content-Length:24,
Content-Location:'USA',
Retry-After:120,
Content-Type:'application/xml',
HTTP_METHOD:'POST',

~Output http event properties
HTTP_METHOD:'POST',
HOST:'localhost',
PORT:8009,
PROTOCOL:'http',
TO:'/foo'

- -### http-request *(Sink)* - -

This extension publish the HTTP events in any HTTP method POST, GET, PUT, DELETE via HTTP or https protocols. As the additional features this component can provide basic authentication as well as user can publish events using custom client truststore files when publishing events via https protocol. And also user can add any number of headers including HTTP_METHOD header for each event dynamically.
Following content types will be set by default according to the type of sink mapper used.
You can override them by setting the new content types in headers.
     - TEXT : text/plain
     - XML : application/xml
     - JSON : application/json
     - KEYVALUE : application/x-www-form-urlencoded

HTTP request sink is correlated with the The HTTP reponse source, through a unique sink.id.It sends the request to the defined url and the response is received by the response source which has the same 'sink.id'.

- -Syntax -``` -@sink(type="http-request", publisher.url="", basic.auth.username="", basic.auth.password="", https.truststore.file="", https.truststore.password="", headers="", method="", socket.idle.timeout="", chunk.disabled="", ssl.protocol="", parameters="", ciphers="", ssl.enabled.protocols="", client.enable.session.creation="", follow.redirect="", max.redirect.count="", tls.store.type="", proxy.host="", proxy.port="", proxy.username="", proxy.password="", client.bootstrap.configuration="", client.bootstrap.nodelay="", client.bootstrap.keepalive="", client.bootstrap.sendbuffersize="", client.bootstrap.recievebuffersize="", client.bootstrap.connect.timeout="", client.bootstrap.socket.reuse="", client.bootstrap.socket.timeout="", client.threadpool.configurations="", client.connection.pool.count="", client.max.active.connections.per.pool="", client.min.idle.connections.per.pool="", client.max.idle.connections.per.pool="", client.min.eviction.idle.time="", sender.thread.count="", event.group.executor.thread.size="", max.wait.for.client.connection.pool="", sink.id="", downloading.enabled="", download.path="", oauth.username="", oauth.password="", consumer.key="", consumer.secret="", refresh.token="", @map(...))) -``` - -QUERY PARAMETERS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
publisher.urlThe URL to which the outgoing events should be published via HTTP. This is a mandatory parameter and if this is not specified, an error is logged in the CLI. If user wants to enable SSL for the events, use https instead of http in the publisher.url.
e.g., http://localhost:8080/endpoint, https://localhost:8080/endpoint
This can be used as a dynamic parameter as well.
STRINGNoYes
basic.auth.usernameThe username to be included in the authentication header of the basic authentication enabled events. It is required to specify both username and password to enable basic authentication. If one of the parameter is not given by user then an error is logged in the CLI. STRINGYesNo
basic.auth.passwordThe password to include in the authentication header of the basic authentication enabled events. It is required to specify both username and password to enable basic authentication. If one of the parameter is not given by user then an error is logged in the CLI. STRINGYesNo
https.truststore.fileThe file path to the location of the truststore of the client that sends the HTTP events through 'https' protocol. A custom client-truststore can be specified if required.${carbon.home}/resources/security/client-truststore.jksSTRINGYesNo
https.truststore.passwordThe password for the client-truststore. A custom password can be specified if required. If no custom password is specified and the protocol of URL is 'https' then, the system uses default password.wso2carbonSTRINGYesNo
headersThe headers that should be included as HTTP request headers.
There can be any number of headers concatenated in following format. "'header1:value1','header2:value2'". User can include Content-Type header if he needs to use a specific content-type for the payload. Or else, system decides the Content-Type by considering the type of sink mapper, in following way.
 - @map(xml):application/xml
 - @map(json):application/json
 - @map(text):plain/text )
 - if user does not include any mapping type then the system gets 'plain/text' as default Content-Type header.
Note that providing content-length as a header is not supported. The size of the payload will be automatically calculated and included in the content-length header.
STRINGYesNo
methodFor HTTP events, HTTP_METHOD header should be included as a request header. If the parameter is null then system uses 'POST' as a default header.POSTSTRINGYesNo
socket.idle.timeoutSocket timeout value in millisecond6000INTYesNo
chunk.disabledport: Port number of the remote servicefalseBOOLYesNo
ssl.protocolThe SSL protocol versionTLSSTRINGYesNo
parametersParameters other than basics such as ciphers,sslEnabledProtocols,client.enable.session.creation. Expected format of these parameters is as follows: "'ciphers:xxx','sslEnabledProtocols,client.enable:xxx'"nullSTRINGYesNo
ciphersList of ciphers to be used. This parameter should include under parameters Ex: 'ciphers:TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256'nullSTRINGYesNo
ssl.enabled.protocolsSSL/TLS protocols to be enabled. This parameter should be in camel case format(sslEnabledProtocols) under parameters. Ex 'sslEnabledProtocols:true'nullSTRINGYesNo
client.enable.session.creationEnable HTTP session creation.This parameter should include under parameters Ex: 'client.enable.session.creation:true'nullSTRINGYesNo
follow.redirectRedirect related enabled.trueBOOLYesNo
max.redirect.countMaximum redirect count.5INTYesNo
tls.store.typeTLS store type to be used.JKSSTRINGYesNo
proxy.hostProxy server hostnullSTRINGYesNo
proxy.portProxy server portnullSTRINGYesNo
proxy.usernameProxy server usernamenullSTRINGYesNo
proxy.passwordProxy server passwordnullSTRINGYesNo
client.bootstrap.configurationClient bootsrap configurations. Expected format of these parameters is as follows: "'client.bootstrap.nodelay:xxx','client.bootstrap.keepalive:xxx'"TODOSTRINGYesNo
client.bootstrap.nodelayHttp client no delay.trueBOOLYesNo
client.bootstrap.keepaliveHttp client keep alive.trueBOOLYesNo
client.bootstrap.sendbuffersizeHttp client send buffer size.1048576INTYesNo
client.bootstrap.recievebuffersizeHttp client receive buffer size.1048576INTYesNo
client.bootstrap.connect.timeoutHttp client connection timeout.15000INTYesNo
client.bootstrap.socket.reuseTo enable http socket reuse.falseBOOLYesNo
client.bootstrap.socket.timeoutHttp client socket timeout.15STRINGYesNo
client.threadpool.configurationsThread pool configuration. Expected format of these parameters is as follows: "'client.connection.pool.count:xxx','client.max.active.connections.per.pool:xxx'"TODOSTRINGYesNo
client.connection.pool.countConnection pool count.0INTYesNo
client.max.active.connections.per.poolActive connections per pool.-1INTYesNo
client.min.idle.connections.per.poolMinimum ideal connection per pool.0INTYesNo
client.max.idle.connections.per.poolMaximum ideal connection per pool.100INTYesNo
client.min.eviction.idle.timeMinimum eviction idle time.5 * 60 * 1000STRINGYesNo
sender.thread.countHttp sender thread count.20STRINGYesNo
event.group.executor.thread.sizeEvent group executor thread size.15STRINGYesNo
max.wait.for.client.connection.poolMaximum wait for client connection pool.60000STRINGYesNo
sink.idIdentifier of the sink. This is used to co-relate with the corresponding http-response source which needs to process the repose for the request sent by this sink.STRINGNoNo
downloading.enabledIf this is set to 'true' then the response received by the response source will be written to a file. If downloading is enabled, the download.path parameter is mandatory.falseBOOLYesNo
download.pathIf downloading is enabled, the path of the file which is going to be downloaded should be specified using 'download.path' parameter. This should be an absolute path including the file name.nullSTRINGYesYes
oauth.usernameThe username to be included in the authentication header of the oauth authentication enabled events. It is required to specify both username and password to enable oauth authentication. If one of the parameter is not given by user then an error is logged in the CLI. It is only applicable for for Oauth requests STRINGYesNo
oauth.passwordThe password to be included in the authentication header of the oauth authentication enabled events. It is required to specify both username and password to enable oauth authentication. If one of the parameter is not given by user then an error is logged in the CLI. It is only applicable for for Oauth requests STRINGYesNo
consumer.keyconsumer key for the Http request. It is only applicable for for Oauth requests STRINGYesNo
consumer.secretconsumer secret for the Http request. It is only applicable for for Oauth requests STRINGYesNo
refresh.tokenrefresh token for the Http request. It is only applicable for for Oauth requests STRINGYesNo
- -Examples -EXAMPLE 1 -``` -@sink(type='http-request', sink.id='foo', publisher.url='http://localhost:8009/foo', @map(type='xml', @payload('{{payloadBody}}'))) -define stream FooStream (payloadBody String, method string, headers string); -@source(type='http-response', sink.id='foo', http.status.code='2\\d+', -@map(type='text', regex.A='((.|\n)*)', @attributes(headers='trp:headers', fileName='A[1]'))) -define stream responseStream2xx(fileName string, headers string); - -@source(type='http-response', sink.id='foo', http.status.code='4\\d+', -@map(type='text', regex.A='((.|\n)*)', @attributes(errorMsg='A[1]'))) -define stream responseStream4xx(errorMsg string); -``` -

In above example, the payload body for 'FooStream' will be in following format.
{
<events>
    <event>
        <symbol>WSO2</symbol>
        <price>55.6</price>
        <volume>100</volume>
    </event>
</events>,
This message will sent as the body of a POST request with the content-type 'application/xml' to the endpoint defined as the 'publisher.url' and in order to process the responses for these requests, there should be a source of type 'http-response' defined with the same sink id 'foo' in the siddhi app.
 The responses with 2xx status codes will be received by the http-response source which has the http.status.code defined by the regex '2\\d+'.
If the response has a 4xx status code, it will be received by the http-response source which has the http.status.code defined by the regex '4\\d+'.

- -EXAMPLE 2 -``` -define stream FooStream (name String, id int, headers String, downloadPath string); -@sink(type='http-request', -downloading.enabled='true', -download.path='{{downloadPath}}',publisher.url='http://localhost:8005/files', -method='GET', headers='{{headers}}',sink.id='download-sink', -@map(type='json')) -define stream BarStream (name String, id int, headers String, downloadPath string); - -@source(type='http-response', sink.id='download-sink', http.status.code='2\\d+', -@map(type='text', regex.A='((.|\n)*)', @attributes(headers='trp:headers', fileName='A[1]'))) -define stream responseStream2xx(fileName string, headers string); - -@source(type='http-response', sink.id='download-sink', http.status.code='4\\d+', -@map(type='text', regex.A='((.|\n)*)', @attributes(errorMsg='A[1]'))) -define stream responseStream4xx(errorMsg string); -``` -

In above example, http-request sink will send a GET request to the publisher url and the requested file will be received as the response by a corresponding http-response source.
If the http status code of the response is a successful one (2xx), it will be received by the http-response source which has the http.status.code '2\\d+' and downloaded as a local file. Then the event received to the responseStream2xx will have the headers included in the request and the downloaded file name.
If the http status code of the response is a 4xx code, it will be received by the http-response source which has the http.status.code '4\\d+'. Then the event received to the responseStream4xx will have the response message body in text format.

- -### http-response *(Sink)* - -

HTTP response sink is correlated with the The HTTP request source, through a unique source.id, and it send a response to the HTTP request source having the same source.id. The response message can be formatted in text, XML or JSON and can be sent with appropriate headers.

- -Syntax -``` -@sink(type="http-response", source.id="", message.id="", headers="", @map(...))) -``` - -QUERY PARAMETERS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
source.idIdentifier of the source.STRINGNoNo
message.idIdentifier of the message.STRINGNoYes
headersThe headers that should be included as HTTP response headers. There can be any number of headers concatenated on following format. "'header1:value1','header2:value2'" User can include content-type header if he/she need to have any specific type for payload. If not system get the mapping type as the content-Type header (ie.@map(xml):application/xml, @map(json):application/json, @map(text):plain/text) and if user does not include any mapping type then system gets the plain/text as default Content-Type header. If user does not include Content-Length header then system calculate the bytes size of payload and include it as content-length header. STRINGYesNo
- -Examples -EXAMPLE 1 -``` -@sink(type='http-response', source.id='sampleSourceId', message.id='{{messageId}}', headers="'content-type:json','content-length:94'"@map(type='json', @payload('{{payloadBody}}'))) -define stream FooStream (payloadBody String, messageId string, headers string); - -``` -

If it is json mapping expected input should be in following format for FooStream:
{
{"events":
    {"event":
        "symbol":WSO2,
        "price":55.6,
        "volume":100,
    }
},
0cf708b1-7eae-440b-a93e-e72f801b486a,
Content-Length:24#Content-Location:USA
}

Above event will generate response for the matching source message as below.

~Output http event payload
{"events":
    {"event":
        "symbol":WSO2,
        "price":55.6,
        "volume":100,
    }
}

~Output http event headers
Content-Length:24,
Content-Location:'USA',
Content-Type:'application/json'

- -## Source - -### http *(Source)* - -

The HTTP source receives POST requests via HTTP or HTTPS in format such as text, XML and JSON. In WSO2 SP, if required, you can enable basic authentication to ensure that events are received only from users who are authorized to access the service.

- -Syntax -``` -@source(type="http", receiver.url="", basic.auth.enabled="", worker.count="", socket.idle.timeout="", ssl.verify.client="", ssl.protocol="", tls.store.type="", parameters="", ciphers="", ssl.enabled.protocols="", server.enable.session.creation="", server.supported.snimatchers="", server.suported.server.names="", request.size.validation.configuration="", request.size.validation="", request.size.validation.maximum.value="", request.size.validation.reject.status.code="", request.size.validation.reject.message="", request.size.validation.reject.message.content.type="", header.size.validation="", header.validation.maximum.request.line="", header.validation.maximum.size="", header.validation.maximum.chunk.size="", header.validation.reject.status.code="", header.validation.reject.message="", header.validation.reject.message.content.type="", server.bootstrap.configuration="", server.bootstrap.nodelay="", server.bootstrap.keepalive="", server.bootstrap.sendbuffersize="", server.bootstrap.recievebuffersize="", server.bootstrap.connect.timeout="", server.bootstrap.socket.reuse="", server.bootstrap.socket.timeout="", server.bootstrap.socket.backlog="", trace.log.enabled="", @map(...))) -``` - -QUERY PARAMETERS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
receiver.urlThe URL to which the events should be received. User can provide any valid url and if the url is not provided the system will use the following format http://0.0.0.0:9763/<appNAme>/<streamName>If the user want to use SSL the url should be given in following format https://localhost:8080/<streamName>http://0.0.0.0:9763//STRINGYesNo
basic.auth.enabledThis works only in WSO2 SP. If this is set to true, basic authentication is enabled for incoming events, and the credentials with which each event is sent are verified to ensure that the user is authorized to access the service. If basic authentication fails, the event is not authenticated and an authentication error is logged in the CLI.falseSTRINGYesNo
worker.countThe number of active worker threads to serve the incoming events. The value is 1 by default. This will ensure that the events are directed to the event stream in the same order in which they arrive. By increasing this value the performance might increase at the cost of loosing event ordering.1INTYesNo
socket.idle.timeoutIdle timeout for HTTP connection.120000INTYesNo
ssl.verify.clientThe type of client certificate verification.nullSTRINGYesNo
ssl.protocolssl/tls related optionsTLSSTRINGYesNo
tls.store.typeTLS store type.JKSSTRINGYesNo
parametersParameters other than basics such as ciphers,sslEnabledProtocols,client.enable.session.creation. Expected format of these parameters is as follows: "'ciphers:xxx','sslEnabledProtocols,client.enable:xxx'"nullSTRINGYesNo
ciphersList of ciphers to be used. This parameter should include under parameters Ex: 'ciphers:TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256'nullSTRINGYesNo
ssl.enabled.protocolsSSL/TLS protocols to be enabled. This parameter should be in camel case format(sslEnabledProtocols) under parameters. Ex 'sslEnabledProtocols:true'nullSTRINGYesNo
server.enable.session.creationEnable HTTP session creation.This parameter should include under parameters Ex: 'client.enable.session.creation:true'nullSTRINGYesNo
server.supported.snimatchersHttp SNIMatcher to be added. This parameter should include under parameters Ex: 'server.supported.snimatchers:SNIMatcher'nullSTRINGYesNo
server.suported.server.namesHttp supported servers. This parameter should include under parameters Ex: 'server.suported.server.names:server'nullSTRINGYesNo
request.size.validation.configurationParameters that responsible for validating the http request and request headers. Expected format of these parameters is as follows: "'request.size.validation:xxx','request.size.validation.maximum.value:xxx'"nullSTRINGYesNo
request.size.validationTo enable the request size validation.falseSTRINGYesNo
request.size.validation.maximum.valueIf request size is validated then maximum size.Integer.MAX_VALUESTRINGYesNo
request.size.validation.reject.status.codeIf request is exceed maximum size and request.size.validation is enabled then status code to be send as response.401STRINGYesNo
request.size.validation.reject.messageIf request is exceed maximum size and request.size.validation is enabled then status message to be send as response.Message is bigger than the valid sizeSTRINGYesNo
request.size.validation.reject.message.content.typeIf request is exceed maximum size and request.size.validation is enabled then content type to be send as response.plain/textSTRINGYesNo
header.size.validationTo enable the header size validation.falseSTRINGYesNo
header.validation.maximum.request.lineIf header header validation is enabled then the maximum request line.4096STRINGYesNo
header.validation.maximum.sizeIf header header validation is enabled then the maximum expected header size.8192STRINGYesNo
header.validation.maximum.chunk.sizeIf header header validation is enabled then the maximum expected chunk size.8192STRINGYesNo
header.validation.reject.status.code401If header is exceed maximum size and header.size.validation is enabled then status code to be send as response.STRINGYesNo
header.validation.reject.messageIf header is exceed maximum size and header.size.validation is enabled then message to be send as response.Message header is bigger than the valid sizeSTRINGYesNo
header.validation.reject.message.content.typeIf header is exceed maximum size and header.size.validation is enabled then content type to be send as response.plain/textSTRINGYesNo
server.bootstrap.configurationParameters that for bootstrap configurations of the server. Expected format of these parameters is as follows: "'ciphers:xxx','sslEnabledProtocols,client.enable:xxx'"nullOBJECTYesNo
server.bootstrap.nodelayHttp server no delay.trueBOOLYesNo
server.bootstrap.keepaliveHttp server keep alive.trueBOOLYesNo
server.bootstrap.sendbuffersizeHttp server send buffer size.1048576INTYesNo
server.bootstrap.recievebuffersizeHttp server receive buffer size.1048576INTYesNo
server.bootstrap.connect.timeoutHttp server connection timeout.15000INTYesNo
server.bootstrap.socket.reuseTo enable http socket reuse.falseBOOLYesNo
server.bootstrap.socket.timeoutHttp server socket timeout.15BOOLYesNo
server.bootstrap.socket.backlogTHttp server socket backlog.100BOOLYesNo
trace.log.enabledHttp traffic monitoring.falseBOOLYesNo
- -System Parameters - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Parameters
serverBootstrapBossGroupSizeproperty to configure number of boss threads, which accepts incoming connections until the ports are unbound. Once connection accepts successfully, boss thread passes the accepted channel to one of the worker threads.Number of available processorsAny integer
serverBootstrapWorkerGroupSizeproperty to configure number of worker threads, which performs non blocking read and write for one or more channels in non-blocking mode.(Number of available processors)*2Any integer
serverBootstrapClientGroupSizeproperty to configure number of client threads, which performs non blocking read and write for one or more channels in non-blocking mode.(Number of available processors)*2Any integer
defaultHostThe default host of the transport.0.0.0.0Any valid host
defaultHttpPortThe default port if the default scheme is 'http'.8280Any valid port
defaultHttpsPortThe default port if the default scheme is 'https'.8243Any valid port
defaultSchemeThe default protocol.httphttp
https
keyStoreLocationThe default keystore file path.${carbon.home}/resources/security/wso2carbon.jksPath to wso2carbon.jks file
keyStorePasswordThe default keystore password.wso2carbonString of keystore password
- -Examples -EXAMPLE 1 -``` -@source(type='http', receiver.url='http://localhost:9055/endpoints/RecPro', socketIdleTimeout='150000', parameters="'ciphers : TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256', 'sslEnabledProtocols:TLSv1.1,TLSv1.2'",request.size.validation.configuration="request.size.validation:true",server.bootstrap.configuration="server.bootstrap.socket.timeout:25" @map(type='xml')) -define stream FooStream (symbol string, price float, volume long); - -``` -

Above source listenerConfiguration performs a default XML input mapping. The expected input is as follows:
<events>
    <event>
        <symbol>WSO2</symbol>
        <price>55.6</price>
        <volume>100</volume>
    </event>
</events>
If basic authentication is enabled via the basic.auth.enabled='true setting, each input event is also expected to contain the Authorization:'Basic encodeBase64(username:Password)' header.

- -### http-request *(Source)* - -

The HTTP request is correlated with the HTTP response sink, through a unique source.id, and for each POST requests it receives via HTTP or HTTPS in format such as text, XML and JSON it sends the response via the HTTP response sink. The individual request and response messages are correlated at the sink using the message.id of the events. If required, you can enable basic authentication at the source to ensure that events are received only from users who are authorized to access the service.

- -Syntax -``` -@source(type="http-request", receiver.url="", source.id="", connection.timeout="", basic.auth.enabled="", worker.count="", socket.idle.timeout="", ssl.verify.client="", ssl.protocol="", tls.store.type="", parameters="", ciphers="", ssl.enabled.protocols="", server.enable.session.creation="", server.supported.snimatchers="", server.suported.server.names="", request.size.validation.configuration="", request.size.validation="", request.size.validation.maximum.value="", request.size.validation.reject.status.code="", request.size.validation.reject.message="", request.size.validation.reject.message.content.type="", header.size.validation="", header.validation.maximum.request.line="", header.validation.maximum.size="", header.validation.maximum.chunk.size="", header.validation.reject.status.code="", header.validation.reject.message="", header.validation.reject.message.content.type="", server.bootstrap.configuration="", server.bootstrap.nodelay="", server.bootstrap.keepalive="", server.bootstrap.sendbuffersize="", server.bootstrap.recievebuffersize="", server.bootstrap.connect.timeout="", server.bootstrap.socket.reuse="", server.bootstrap.socket.timeout="", server.bootstrap.socket.backlog="", trace.log.enabled="", @map(...))) -``` - -QUERY PARAMETERS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
receiver.urlThe URL to which the events should be received. User can provide any valid url and if the url is not provided the system will use the following format http://0.0.0.0:9763/<appNAme>/<streamName>If the user want to use SSL the url should be given in following format https://localhost:8080/<streamName>http://0.0.0.0:9763//STRINGYesNo
source.idIdentifier need to map the source to sink.STRINGNoNo
connection.timeoutConnection timeout in milliseconds. If the mapped http-response sink does not get a correlated message, after this timeout value, a timeout response is sent120000INTYesNo
basic.auth.enabledIf this is set to true, basic authentication is enabled for incoming events, and the credentials with which each event is sent are verified to ensure that the user is authorized to access the service. If basic authentication fails, the event is not authenticated and an authentication error is logged in the CLI. By default this values 'false' falseSTRINGYesNo
worker.countThe number of active worker threads to serve the incoming events. The value is 1 by default. This will ensure that the events are directed to the event stream in the same order in which they arrive. By increasing this value the performance might increase at the cost of loosing event ordering.1INTYesNo
socket.idle.timeoutIdle timeout for HTTP connection.120000INTYesNo
ssl.verify.clientThe type of client certificate verification.nullSTRINGYesNo
ssl.protocolssl/tls related optionsTLSSTRINGYesNo
tls.store.typeTLS store type.JKSSTRINGYesNo
parametersParameters other than basics such as ciphers,sslEnabledProtocols,client.enable.session.creation. Expected format of these parameters is as follows: "'ciphers:xxx','sslEnabledProtocols,client.enable:xxx'"nullSTRINGYesNo
ciphersList of ciphers to be used. This parameter should include under parameters Ex: 'ciphers:TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256'nullSTRINGYesNo
ssl.enabled.protocolsSSL/TLS protocols to be enabled. This parameter should be in camel case format(sslEnabledProtocols) under parameters. Ex 'sslEnabledProtocols:true'nullSTRINGYesNo
server.enable.session.creationEnable HTTP session creation.This parameter should include under parameters Ex: 'client.enable.session.creation:true'nullSTRINGYesNo
server.supported.snimatchersHttp SNIMatcher to be added. This parameter should include under parameters Ex: 'server.supported.snimatchers:SNIMatcher'nullSTRINGYesNo
server.suported.server.namesHttp supported servers. This parameter should include under parameters Ex: 'server.suported.server.names:server'nullSTRINGYesNo
request.size.validation.configurationParameters that responsible for validating the http request and request headers. Expected format of these parameters is as follows: "'request.size.validation:xxx','request.size.validation.maximum.value:xxx'"nullSTRINGYesNo
request.size.validationTo enable the request size validation.falseSTRINGYesNo
request.size.validation.maximum.valueIf request size is validated then maximum size.Integer.MAX_VALUESTRINGYesNo
request.size.validation.reject.status.codeIf request is exceed maximum size and request.size.validation is enabled then status code to be send as response.401STRINGYesNo
request.size.validation.reject.messageIf request is exceed maximum size and request.size.validation is enabled then status message to be send as response.Message is bigger than the valid sizeSTRINGYesNo
request.size.validation.reject.message.content.typeIf request is exceed maximum size and request.size.validation is enabled then content type to be send as response.plain/textSTRINGYesNo
header.size.validationTo enable the header size validation.falseSTRINGYesNo
header.validation.maximum.request.lineIf header header validation is enabled then the maximum request line.4096STRINGYesNo
header.validation.maximum.sizeIf header header validation is enabled then the maximum expected header size.8192STRINGYesNo
header.validation.maximum.chunk.sizeIf header header validation is enabled then the maximum expected chunk size.8192STRINGYesNo
header.validation.reject.status.code401If header is exceed maximum size and header.size.validation is enabled then status code to be send as response.STRINGYesNo
header.validation.reject.messageIf header is exceed maximum size and header.size.validation is enabled then message to be send as response.Message header is bigger than the valid sizeSTRINGYesNo
header.validation.reject.message.content.typeIf header is exceed maximum size and header.size.validation is enabled then content type to be send as response.plain/textSTRINGYesNo
server.bootstrap.configurationParameters that for bootstrap configurations of the server. Expected format of these parameters is as follows: "'ciphers:xxx','sslEnabledProtocols,client.enable:xxx'"nullOBJECTYesNo
server.bootstrap.nodelayHttp server no delay.trueBOOLYesNo
server.bootstrap.keepaliveHttp server keep alive.trueBOOLYesNo
server.bootstrap.sendbuffersizeHttp server send buffer size.1048576INTYesNo
server.bootstrap.recievebuffersizeHttp server receive buffer size.1048576INTYesNo
server.bootstrap.connect.timeoutHttp server connection timeout.15000INTYesNo
server.bootstrap.socket.reuseTo enable http socket reuse.falseBOOLYesNo
server.bootstrap.socket.timeoutHttp server socket timeout.15BOOLYesNo
server.bootstrap.socket.backlogTHttp server socket backlog.100BOOLYesNo
trace.log.enabledHttp traffic monitoring.falseBOOLYesNo
- -System Parameters - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Parameters
serverBootstrapBossGroupSizeproperty to configure number of boss threads, which accepts incoming connections until the ports are unbound. Once connection accepts successfully, boss thread passes the accepted channel to one of the worker threads.Number of available processorsAny integer
serverBootstrapWorkerGroupSizeproperty to configure number of worker threads, which performs non blocking read and write for one or more channels in non-blocking mode.(Number of available processors)*2Any integer
serverBootstrapClientGroupSizeproperty to configure number of client threads, which performs non blocking read and write for one or more channels in non-blocking mode.(Number of available processors)*2Any integer
defaultHostThe default host of the transport.0.0.0.0Any valid host
defaultHttpPortThe default port if the default scheme is 'http'.8280Any valid port
defaultHttpsPortThe default port if the default scheme is 'https'.8243Any valid port
defaultSchemeThe default protocol.httphttp
https
keyStoreLocationThe default keystore file path.${carbon.home}/resources/security/wso2carbon.jksPath to wso2carbon.jks file
keyStorePasswordThe default keystore password.wso2carbonString of keystore password
certPasswordThe default cert password.wso2carbonString of cert password
- -Examples -EXAMPLE 1 -``` -@source(type='http-request', source.id='sampleSourceId, receiver.url='http://localhost:9055/endpoints/RecPro', connection.timeout='150000', parameters="'ciphers : TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256', 'sslEnabledProtocols:TLSv1.1,TLSv1.2'", request.size.validation.configuration="request.size.validation:true", server.bootstrap.configuration="server.bootstrap.socket.timeout:25", @map(type='json, @attributes(messageId='trp:messageId', symbol='$.events.event.symbol', price='$.events.event.price', volume='$.events.event.volume'))) -define stream FooStream (messageId string, symbol string, price float, volume long); - -``` -

The expected input is as follows:
{"events":
    {"event":
        "symbol":WSO2,
        "price":55.6,
        "volume":100,
    }
}
If basic authentication is enabled via the basic.auth.enabled='true setting, each input event is also expected to contain the Authorization:'Basic encodeBase64(username:Password)' header.

- -### http-response *(Source)* - -

The http-response source co-relates with http-request sink with the parameter 'sink.id'.
This receives responses for the requests sent by the http-request sink which has the same sink id.
Response messages can be in formats such as TEXT, JSON and XML.
In order to handle the responses with different http status codes, user is allowed to defined the acceptable response source code using the parameter 'http.status.code'

- -Syntax -``` -@source(type="http-response", sink.id="", http.status.code="", allow.streaming.responses="", @map(...))) -``` - -QUERY PARAMETERS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
sink.idThis parameter is used to map the http-response source to a http-request sink. Then this source will accepts the response messages for the requests sent by corresponding http-request sink.STRINGNoNo
http.status.codeAcceptable http status code for the responses.
This can be a complete string or a regex.
Only the responses with matching status codes to the defined value, will be received by the http-response source.
Eg: 'http.status.code = '200', http.status.code = '2\\d+''
200STRINGYesNo
allow.streaming.responsesIf responses can be received multiple times for a single request, this option should be enabled. If this is not enabled, for every request, response will be extracted only once.falseBOOLYesNo
- -Examples -EXAMPLE 1 -``` -@sink(type='http-request', -downloading.enabled='true', -publisher.url='http://localhost:8005/registry/employee', -method='POST', headers='{{headers}}',sink.id='employee-info', -@map(type='json')) -define stream BarStream (name String, id int, headers String, downloadPath string); - -@source(type='http-response' , sink.id='employee-info', http.status.code='2\\d+', -@map(type='text', regex.A='((.|\n)*)', @attributes(message='A[1]'))) -define stream responseStream2xx(message string);@source(type='http-response' , sink.id='employee-info', http.status.code='4\\d+' , -@map(type='text', regex.A='((.|\n)*)', @attributes(message='A[1]'))) -define stream responseStream4xx(message string); -``` -

In above example, the defined http-request sink will send a POST requests to the endpoint defined by 'publisher.url'.
Then for those requests, the source with the response code '2\\d+' and sink.id 'employee-info' will receive the responses with 2xx status codes.
The http-response source which has 'employee-info' as the 'sink.id' and '4\\d+' as the http.response.code will receive all the responses with 4xx status codes.
. Then the body of the response message will be extracted using text mapper and converted into siddhi events.
.

- diff --git a/docs/api/2.0.3.md b/docs/api/2.0.3.md deleted file mode 100644 index 4b4a0bf1..00000000 --- a/docs/api/2.0.3.md +++ /dev/null @@ -1,1755 +0,0 @@ -# API Docs - v2.0.3 - -## Sink - -### http *(Sink)* - -

This extension publish the HTTP events in any HTTP method POST, GET, PUT, DELETE via HTTP or https protocols. As the additional features this component can provide basic authentication as well as user can publish events using custom client truststore files when publishing events via https protocol. And also user can add any number of headers including HTTP_METHOD header for each event dynamically.
Following content types will be set by default according to the type of sink mapper used.
You can override them by setting the new content types in headers.
     - TEXT : text/plain
     - XML : application/xml
     - JSON : application/json
     - KEYVALUE : application/x-www-form-urlencoded

- -Syntax -``` -@sink(type="http", publisher.url="", basic.auth.username="", basic.auth.password="", https.truststore.file="", https.truststore.password="", headers="", method="", socket.idle.timeout="", chunk.disabled="", ssl.protocol="", parameters="", ciphers="", ssl.enabled.protocols="", client.enable.session.creation="", follow.redirect="", max.redirect.count="", tls.store.type="", proxy.host="", proxy.port="", proxy.username="", proxy.password="", client.bootstrap.configuration="", client.bootstrap.nodelay="", client.bootstrap.keepalive="", client.bootstrap.sendbuffersize="", client.bootstrap.recievebuffersize="", client.bootstrap.connect.timeout="", client.bootstrap.socket.reuse="", client.bootstrap.socket.timeout="", client.threadpool.configurations="", client.connection.pool.count="", client.max.active.connections.per.pool="", client.min.idle.connections.per.pool="", client.max.idle.connections.per.pool="", client.min.eviction.idle.time="", sender.thread.count="", event.group.executor.thread.size="", max.wait.for.client.connection.pool="", oauth.username="", oauth.password="", consumer.key="", consumer.secret="", refresh.token="", token.url="", @map(...))) -``` - -QUERY PARAMETERS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
publisher.urlThe URL to which the outgoing events should be published via HTTP. This is a mandatory parameter and if this is not specified, an error is logged in the CLI. If user wants to enable SSL for the events, use https instead of http in the publisher.url.e.g., http://localhost:8080/endpoint, https://localhost:8080/endpointSTRINGNoNo
basic.auth.usernameThe username to be included in the authentication header of the basic authentication enabled events. It is required to specify both username and password to enable basic authentication. If one of the parameter is not given by user then an error is logged in the CLI. STRINGYesNo
basic.auth.passwordThe password to include in the authentication header of the basic authentication enabled events. It is required to specify both username and password to enable basic authentication. If one of the parameter is not given by user then an error is logged in the CLI. STRINGYesNo
https.truststore.fileThe file path to the location of the truststore of the client that sends the HTTP events through 'https' protocol. A custom client-truststore can be specified if required.${carbon.home}/resources/security/client-truststore.jksSTRINGYesNo
https.truststore.passwordThe password for the client-truststore. A custom password can be specified if required. If no custom password is specified and the protocol of URL is 'https' then, the system uses default password.wso2carbonSTRINGYesNo
headersThe headers that should be included as HTTP request headers.
There can be any number of headers concatenated in following format. "'header1:value1','header2:value2'". User can include Content-Type header if he needs to use a specific content-type for the payload. Or else, system decides the Content-Type by considering the type of sink mapper, in following way.
 - @map(xml):application/xml
 - @map(json):application/json
 - @map(text):plain/text )
 - if user does not include any mapping type then the system gets 'plain/text' as default Content-Type header.
Note that providing content-length as a header is not supported. The size of the payload will be automatically calculated and included in the content-length header.
STRINGYesNo
methodFor HTTP events, HTTP_METHOD header should be included as a request header. If the parameter is null then system uses 'POST' as a default header.POSTSTRINGYesNo
socket.idle.timeoutSocket timeout value in millisecond6000INTYesNo
chunk.disabledThis parameter is used to disable/enable chunked transfer encodingfalseBOOLYesNo
ssl.protocolThe SSL protocol versionTLSSTRINGYesNo
parametersParameters other than basics such as ciphers,sslEnabledProtocols,client.enable.session.creation. Expected format of these parameters is as follows: "'ciphers:xxx','sslEnabledProtocols,client.enable:xxx'"nullSTRINGYesNo
ciphersList of ciphers to be used. This parameter should include under parameters Ex: 'ciphers:TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256'nullSTRINGYesNo
ssl.enabled.protocolsSSL/TLS protocols to be enabled. This parameter should be in camel case format(sslEnabledProtocols) under parameters. Ex 'sslEnabledProtocols:true'nullSTRINGYesNo
client.enable.session.creationEnable HTTP session creation.This parameter should include under parameters Ex: 'client.enable.session.creation:true'nullSTRINGYesNo
follow.redirectRedirect related enabled.trueBOOLYesNo
max.redirect.countMaximum redirect count.5INTYesNo
tls.store.typeTLS store type to be used.JKSSTRINGYesNo
proxy.hostProxy server hostnullSTRINGYesNo
proxy.portProxy server portnullSTRINGYesNo
proxy.usernameProxy server usernamenullSTRINGYesNo
proxy.passwordProxy server passwordnullSTRINGYesNo
client.bootstrap.configurationClient bootsrap configurations. Expected format of these parameters is as follows: "'client.bootstrap.nodelay:xxx','client.bootstrap.keepalive:xxx'"TODOSTRINGYesNo
client.bootstrap.nodelayHttp client no delay.trueBOOLYesNo
client.bootstrap.keepaliveHttp client keep alive.trueBOOLYesNo
client.bootstrap.sendbuffersizeHttp client send buffer size.1048576INTYesNo
client.bootstrap.recievebuffersizeHttp client receive buffer size.1048576INTYesNo
client.bootstrap.connect.timeoutHttp client connection timeout.15000INTYesNo
client.bootstrap.socket.reuseTo enable http socket reuse.falseBOOLYesNo
client.bootstrap.socket.timeoutHttp client socket timeout.15STRINGYesNo
client.threadpool.configurationsThread pool configuration. Expected format of these parameters is as follows: "'client.connection.pool.count:xxx','client.max.active.connections.per.pool:xxx'"TODOSTRINGYesNo
client.connection.pool.countConnection pool count.0INTYesNo
client.max.active.connections.per.poolActive connections per pool.-1INTYesNo
client.min.idle.connections.per.poolMinimum ideal connection per pool.0INTYesNo
client.max.idle.connections.per.poolMaximum ideal connection per pool.100INTYesNo
client.min.eviction.idle.timeMinimum eviction idle time.5 * 60 * 1000STRINGYesNo
sender.thread.countHttp sender thread count.20STRINGYesNo
event.group.executor.thread.sizeEvent group executor thread size.15STRINGYesNo
max.wait.for.client.connection.poolMaximum wait for client connection pool.60000STRINGYesNo
oauth.usernameThe username to be included in the authentication header of the oauth authentication enabled events. It is required to specify both username and password to enable oauth authentication. If one of the parameter is not given by user then an error is logged in the CLI. It is only applicable for for Oauth requests STRINGYesNo
oauth.passwordThe password to be included in the authentication header of the oauth authentication enabled events. It is required to specify both username and password to enable oauth authentication. If one of the parameter is not given by user then an error is logged in the CLI. It is only applicable for for Oauth requests STRINGYesNo
consumer.keyconsumer key for the Http request. It is only applicable for for Oauth requests STRINGYesNo
consumer.secretconsumer secret for the Http request. It is only applicable for for Oauth requests STRINGYesNo
refresh.tokenrefresh token for the Http request. It is only applicable for for Oauth requests STRINGYesNo
token.urltoken url for generate a new access token. It is only applicable for for Oauth requests STRINGYesNo
- -System Parameters - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Parameters
clientBootstrapBossGroupSizeproperty to configure number of boss threads, which accepts incoming connections until the ports are unbound. Once connection accepts successfully, boss thread passes the accepted channel to one of the worker threads.Number of available processorsAny integer
clientBootstrapWorkerGroupSizeproperty to configure number of worker threads, which performs non blocking read and write for one or more channels in non-blocking mode.(Number of available processors)*2Any integer
clientBootstrapClientGroupSizeproperty to configure number of client threads, which performs non blocking read and write for one or more channels in non-blocking mode.(Number of available processors)*2Any integer
trustStoreLocationThe default truststore file path.${carbon.home}/resources/security/client-truststore.jksPath to client-truststore.jks
trustStorePasswordThe default truststore password.wso2carbonTruststore password
- -Examples -EXAMPLE 1 -``` -@sink(type='http',publisher.url='http://localhost:8009/foo', method='{{method}}',headers="'content-type:xml','content-length:94'", client.bootstrap.configuration="'client.bootstrap.socket.timeout:20', 'client.bootstrap.worker.group.size:10'", client.pool.configuration="'client.connection.pool.count:10','client.max.active.connections.per.pool:1'", @map(type='xml', @payload('{{payloadBody}}'))) -define stream FooStream (payloadBody String, method string, headers string); - -``` -

If it is xml mapping expected input should be in following format for FooStream:
{
<events>
    <event>
        <symbol>WSO2</symbol>
        <price>55.6</price>
        <volume>100</volume>
    </event>
</events>,
POST,
Content-Length:24#Content-Location:USA#Retry-After:120
}

Above event will generate output as below.
~Output http event payload
<events>
    <event>
        <symbol>WSO2</symbol>
        <price>55.6</price>
        <volume>100</volume>
    </event>
</events>

~Output http event headers
Content-Length:24,
Content-Location:'USA',
Retry-After:120,
Content-Type:'application/xml',
HTTP_METHOD:'POST',

~Output http event properties
HTTP_METHOD:'POST',
HOST:'localhost',
PORT:8009,
PROTOCOL:'http',
TO:'/foo'

- -### http-request *(Sink)* - -

This extension publish the HTTP events in any HTTP method POST, GET, PUT, DELETE via HTTP or https protocols. As the additional features this component can provide basic authentication as well as user can publish events using custom client truststore files when publishing events via https protocol. And also user can add any number of headers including HTTP_METHOD header for each event dynamically.
Following content types will be set by default according to the type of sink mapper used.
You can override them by setting the new content types in headers.
     - TEXT : text/plain
     - XML : application/xml
     - JSON : application/json
     - KEYVALUE : application/x-www-form-urlencoded

HTTP request sink is correlated with the The HTTP reponse source, through a unique sink.id.It sends the request to the defined url and the response is received by the response source which has the same 'sink.id'.

- -Syntax -``` -@sink(type="http-request", publisher.url="", basic.auth.username="", basic.auth.password="", https.truststore.file="", https.truststore.password="", headers="", method="", socket.idle.timeout="", chunk.disabled="", ssl.protocol="", parameters="", ciphers="", ssl.enabled.protocols="", client.enable.session.creation="", follow.redirect="", max.redirect.count="", tls.store.type="", proxy.host="", proxy.port="", proxy.username="", proxy.password="", client.bootstrap.configuration="", client.bootstrap.nodelay="", client.bootstrap.keepalive="", client.bootstrap.sendbuffersize="", client.bootstrap.recievebuffersize="", client.bootstrap.connect.timeout="", client.bootstrap.socket.reuse="", client.bootstrap.socket.timeout="", client.threadpool.configurations="", client.connection.pool.count="", client.max.active.connections.per.pool="", client.min.idle.connections.per.pool="", client.max.idle.connections.per.pool="", client.min.eviction.idle.time="", sender.thread.count="", event.group.executor.thread.size="", max.wait.for.client.connection.pool="", sink.id="", downloading.enabled="", download.path="", oauth.username="", oauth.password="", consumer.key="", consumer.secret="", refresh.token="", @map(...))) -``` - -QUERY PARAMETERS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
publisher.urlThe URL to which the outgoing events should be published via HTTP. This is a mandatory parameter and if this is not specified, an error is logged in the CLI. If user wants to enable SSL for the events, use https instead of http in the publisher.url.
e.g., http://localhost:8080/endpoint, https://localhost:8080/endpoint
This can be used as a dynamic parameter as well.
STRINGNoYes
basic.auth.usernameThe username to be included in the authentication header of the basic authentication enabled events. It is required to specify both username and password to enable basic authentication. If one of the parameter is not given by user then an error is logged in the CLI. STRINGYesNo
basic.auth.passwordThe password to include in the authentication header of the basic authentication enabled events. It is required to specify both username and password to enable basic authentication. If one of the parameter is not given by user then an error is logged in the CLI. STRINGYesNo
https.truststore.fileThe file path to the location of the truststore of the client that sends the HTTP events through 'https' protocol. A custom client-truststore can be specified if required.${carbon.home}/resources/security/client-truststore.jksSTRINGYesNo
https.truststore.passwordThe password for the client-truststore. A custom password can be specified if required. If no custom password is specified and the protocol of URL is 'https' then, the system uses default password.wso2carbonSTRINGYesNo
headersThe headers that should be included as HTTP request headers.
There can be any number of headers concatenated in following format. "'header1:value1','header2:value2'". User can include Content-Type header if he needs to use a specific content-type for the payload. Or else, system decides the Content-Type by considering the type of sink mapper, in following way.
 - @map(xml):application/xml
 - @map(json):application/json
 - @map(text):plain/text )
 - if user does not include any mapping type then the system gets 'plain/text' as default Content-Type header.
Note that providing content-length as a header is not supported. The size of the payload will be automatically calculated and included in the content-length header.
STRINGYesNo
methodFor HTTP events, HTTP_METHOD header should be included as a request header. If the parameter is null then system uses 'POST' as a default header.POSTSTRINGYesNo
socket.idle.timeoutSocket timeout value in millisecond6000INTYesNo
chunk.disabledport: Port number of the remote servicefalseBOOLYesNo
ssl.protocolThe SSL protocol versionTLSSTRINGYesNo
parametersParameters other than basics such as ciphers,sslEnabledProtocols,client.enable.session.creation. Expected format of these parameters is as follows: "'ciphers:xxx','sslEnabledProtocols,client.enable:xxx'"nullSTRINGYesNo
ciphersList of ciphers to be used. This parameter should include under parameters Ex: 'ciphers:TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256'nullSTRINGYesNo
ssl.enabled.protocolsSSL/TLS protocols to be enabled. This parameter should be in camel case format(sslEnabledProtocols) under parameters. Ex 'sslEnabledProtocols:true'nullSTRINGYesNo
client.enable.session.creationEnable HTTP session creation.This parameter should include under parameters Ex: 'client.enable.session.creation:true'nullSTRINGYesNo
follow.redirectRedirect related enabled.trueBOOLYesNo
max.redirect.countMaximum redirect count.5INTYesNo
tls.store.typeTLS store type to be used.JKSSTRINGYesNo
proxy.hostProxy server hostnullSTRINGYesNo
proxy.portProxy server portnullSTRINGYesNo
proxy.usernameProxy server usernamenullSTRINGYesNo
proxy.passwordProxy server passwordnullSTRINGYesNo
client.bootstrap.configurationClient bootsrap configurations. Expected format of these parameters is as follows: "'client.bootstrap.nodelay:xxx','client.bootstrap.keepalive:xxx'"TODOSTRINGYesNo
client.bootstrap.nodelayHttp client no delay.trueBOOLYesNo
client.bootstrap.keepaliveHttp client keep alive.trueBOOLYesNo
client.bootstrap.sendbuffersizeHttp client send buffer size.1048576INTYesNo
client.bootstrap.recievebuffersizeHttp client receive buffer size.1048576INTYesNo
client.bootstrap.connect.timeoutHttp client connection timeout.15000INTYesNo
client.bootstrap.socket.reuseTo enable http socket reuse.falseBOOLYesNo
client.bootstrap.socket.timeoutHttp client socket timeout.15STRINGYesNo
client.threadpool.configurationsThread pool configuration. Expected format of these parameters is as follows: "'client.connection.pool.count:xxx','client.max.active.connections.per.pool:xxx'"TODOSTRINGYesNo
client.connection.pool.countConnection pool count.0INTYesNo
client.max.active.connections.per.poolActive connections per pool.-1INTYesNo
client.min.idle.connections.per.poolMinimum ideal connection per pool.0INTYesNo
client.max.idle.connections.per.poolMaximum ideal connection per pool.100INTYesNo
client.min.eviction.idle.timeMinimum eviction idle time.5 * 60 * 1000STRINGYesNo
sender.thread.countHttp sender thread count.20STRINGYesNo
event.group.executor.thread.sizeEvent group executor thread size.15STRINGYesNo
max.wait.for.client.connection.poolMaximum wait for client connection pool.60000STRINGYesNo
sink.idIdentifier of the sink. This is used to co-relate with the corresponding http-response source which needs to process the repose for the request sent by this sink.STRINGNoNo
downloading.enabledIf this is set to 'true' then the response received by the response source will be written to a file. If downloading is enabled, the download.path parameter is mandatory.falseBOOLYesNo
download.pathIf downloading is enabled, the path of the file which is going to be downloaded should be specified using 'download.path' parameter. This should be an absolute path including the file name.nullSTRINGYesYes
oauth.usernameThe username to be included in the authentication header of the oauth authentication enabled events. It is required to specify both username and password to enable oauth authentication. If one of the parameter is not given by user then an error is logged in the CLI. It is only applicable for for Oauth requests STRINGYesNo
oauth.passwordThe password to be included in the authentication header of the oauth authentication enabled events. It is required to specify both username and password to enable oauth authentication. If one of the parameter is not given by user then an error is logged in the CLI. It is only applicable for for Oauth requests STRINGYesNo
consumer.keyconsumer key for the Http request. It is only applicable for for Oauth requests STRINGYesNo
consumer.secretconsumer secret for the Http request. It is only applicable for for Oauth requests STRINGYesNo
refresh.tokenrefresh token for the Http request. It is only applicable for for Oauth requests STRINGYesNo
- -Examples -EXAMPLE 1 -``` -@sink(type='http-request', sink.id='foo', publisher.url='http://localhost:8009/foo', @map(type='xml', @payload('{{payloadBody}}'))) -define stream FooStream (payloadBody String, method string, headers string); -@source(type='http-response', sink.id='foo', http.status.code='2\\d+', -@map(type='text', regex.A='((.|\n)*)', @attributes(headers='trp:headers', fileName='A[1]'))) -define stream responseStream2xx(fileName string, headers string); - -@source(type='http-response', sink.id='foo', http.status.code='4\\d+', -@map(type='text', regex.A='((.|\n)*)', @attributes(errorMsg='A[1]'))) -define stream responseStream4xx(errorMsg string); -``` -

In above example, the payload body for 'FooStream' will be in following format.
{
<events>
    <event>
        <symbol>WSO2</symbol>
        <price>55.6</price>
        <volume>100</volume>
    </event>
</events>,
This message will sent as the body of a POST request with the content-type 'application/xml' to the endpoint defined as the 'publisher.url' and in order to process the responses for these requests, there should be a source of type 'http-response' defined with the same sink id 'foo' in the siddhi app.
 The responses with 2xx status codes will be received by the http-response source which has the http.status.code defined by the regex '2\\d+'.
If the response has a 4xx status code, it will be received by the http-response source which has the http.status.code defined by the regex '4\\d+'.

- -EXAMPLE 2 -``` -define stream FooStream (name String, id int, headers String, downloadPath string); -@sink(type='http-request', -downloading.enabled='true', -download.path='{{downloadPath}}',publisher.url='http://localhost:8005/files', -method='GET', headers='{{headers}}',sink.id='download-sink', -@map(type='json')) -define stream BarStream (name String, id int, headers String, downloadPath string); - -@source(type='http-response', sink.id='download-sink', http.status.code='2\\d+', -@map(type='text', regex.A='((.|\n)*)', @attributes(headers='trp:headers', fileName='A[1]'))) -define stream responseStream2xx(fileName string, headers string); - -@source(type='http-response', sink.id='download-sink', http.status.code='4\\d+', -@map(type='text', regex.A='((.|\n)*)', @attributes(errorMsg='A[1]'))) -define stream responseStream4xx(errorMsg string); -``` -

In above example, http-request sink will send a GET request to the publisher url and the requested file will be received as the response by a corresponding http-response source.
If the http status code of the response is a successful one (2xx), it will be received by the http-response source which has the http.status.code '2\\d+' and downloaded as a local file. Then the event received to the responseStream2xx will have the headers included in the request and the downloaded file name.
If the http status code of the response is a 4xx code, it will be received by the http-response source which has the http.status.code '4\\d+'. Then the event received to the responseStream4xx will have the response message body in text format.

- -### http-response *(Sink)* - -

HTTP response sink is correlated with the The HTTP request source, through a unique source.id, and it send a response to the HTTP request source having the same source.id. The response message can be formatted in text, XML or JSON and can be sent with appropriate headers.

- -Syntax -``` -@sink(type="http-response", source.id="", message.id="", headers="", @map(...))) -``` - -QUERY PARAMETERS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
source.idIdentifier of the source.STRINGNoNo
message.idIdentifier of the message.STRINGNoYes
headersThe headers that should be included as HTTP response headers. There can be any number of headers concatenated on following format. "'header1:value1','header2:value2'" User can include content-type header if he/she need to have any specific type for payload. If not system get the mapping type as the content-Type header (ie.@map(xml):application/xml, @map(json):application/json, @map(text):plain/text) and if user does not include any mapping type then system gets the plain/text as default Content-Type header. If user does not include Content-Length header then system calculate the bytes size of payload and include it as content-length header. STRINGYesNo
- -Examples -EXAMPLE 1 -``` -@sink(type='http-response', source.id='sampleSourceId', message.id='{{messageId}}', headers="'content-type:json','content-length:94'"@map(type='json', @payload('{{payloadBody}}'))) -define stream FooStream (payloadBody String, messageId string, headers string); - -``` -

If it is json mapping expected input should be in following format for FooStream:
{
{"events":
    {"event":
        "symbol":WSO2,
        "price":55.6,
        "volume":100,
    }
},
0cf708b1-7eae-440b-a93e-e72f801b486a,
Content-Length:24#Content-Location:USA
}

Above event will generate response for the matching source message as below.

~Output http event payload
{"events":
    {"event":
        "symbol":WSO2,
        "price":55.6,
        "volume":100,
    }
}

~Output http event headers
Content-Length:24,
Content-Location:'USA',
Content-Type:'application/json'

- -## Source - -### http *(Source)* - -

The HTTP source receives POST requests via HTTP or HTTPS in format such as text, XML and JSON. In WSO2 SP, if required, you can enable basic authentication to ensure that events are received only from users who are authorized to access the service.

- -Syntax -``` -@source(type="http", receiver.url="", basic.auth.enabled="", worker.count="", socket.idle.timeout="", ssl.verify.client="", ssl.protocol="", tls.store.type="", parameters="", ciphers="", ssl.enabled.protocols="", server.enable.session.creation="", server.supported.snimatchers="", server.suported.server.names="", request.size.validation.configuration="", request.size.validation="", request.size.validation.maximum.value="", request.size.validation.reject.status.code="", request.size.validation.reject.message="", request.size.validation.reject.message.content.type="", header.size.validation="", header.validation.maximum.request.line="", header.validation.maximum.size="", header.validation.maximum.chunk.size="", header.validation.reject.status.code="", header.validation.reject.message="", header.validation.reject.message.content.type="", server.bootstrap.configuration="", server.bootstrap.nodelay="", server.bootstrap.keepalive="", server.bootstrap.sendbuffersize="", server.bootstrap.recievebuffersize="", server.bootstrap.connect.timeout="", server.bootstrap.socket.reuse="", server.bootstrap.socket.timeout="", server.bootstrap.socket.backlog="", trace.log.enabled="", @map(...))) -``` - -QUERY PARAMETERS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
receiver.urlThe URL to which the events should be received. User can provide any valid url and if the url is not provided the system will use the following format http://0.0.0.0:9763/<appNAme>/<streamName>If the user want to use SSL the url should be given in following format https://localhost:8080/<streamName>http://0.0.0.0:9763//STRINGYesNo
basic.auth.enabledThis works only in WSO2 SP. If this is set to true, basic authentication is enabled for incoming events, and the credentials with which each event is sent are verified to ensure that the user is authorized to access the service. If basic authentication fails, the event is not authenticated and an authentication error is logged in the CLI.falseSTRINGYesNo
worker.countThe number of active worker threads to serve the incoming events. The value is 1 by default. This will ensure that the events are directed to the event stream in the same order in which they arrive. By increasing this value the performance might increase at the cost of loosing event ordering.1INTYesNo
socket.idle.timeoutIdle timeout for HTTP connection.120000INTYesNo
ssl.verify.clientThe type of client certificate verification.nullSTRINGYesNo
ssl.protocolssl/tls related optionsTLSSTRINGYesNo
tls.store.typeTLS store type.JKSSTRINGYesNo
parametersParameters other than basics such as ciphers,sslEnabledProtocols,client.enable.session.creation. Expected format of these parameters is as follows: "'ciphers:xxx','sslEnabledProtocols,client.enable:xxx'"nullSTRINGYesNo
ciphersList of ciphers to be used. This parameter should include under parameters Ex: 'ciphers:TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256'nullSTRINGYesNo
ssl.enabled.protocolsSSL/TLS protocols to be enabled. This parameter should be in camel case format(sslEnabledProtocols) under parameters. Ex 'sslEnabledProtocols:true'nullSTRINGYesNo
server.enable.session.creationEnable HTTP session creation.This parameter should include under parameters Ex: 'client.enable.session.creation:true'nullSTRINGYesNo
server.supported.snimatchersHttp SNIMatcher to be added. This parameter should include under parameters Ex: 'server.supported.snimatchers:SNIMatcher'nullSTRINGYesNo
server.suported.server.namesHttp supported servers. This parameter should include under parameters Ex: 'server.suported.server.names:server'nullSTRINGYesNo
request.size.validation.configurationParameters that responsible for validating the http request and request headers. Expected format of these parameters is as follows: "'request.size.validation:xxx','request.size.validation.maximum.value:xxx'"nullSTRINGYesNo
request.size.validationTo enable the request size validation.falseSTRINGYesNo
request.size.validation.maximum.valueIf request size is validated then maximum size.Integer.MAX_VALUESTRINGYesNo
request.size.validation.reject.status.codeIf request is exceed maximum size and request.size.validation is enabled then status code to be send as response.401STRINGYesNo
request.size.validation.reject.messageIf request is exceed maximum size and request.size.validation is enabled then status message to be send as response.Message is bigger than the valid sizeSTRINGYesNo
request.size.validation.reject.message.content.typeIf request is exceed maximum size and request.size.validation is enabled then content type to be send as response.plain/textSTRINGYesNo
header.size.validationTo enable the header size validation.falseSTRINGYesNo
header.validation.maximum.request.lineIf header header validation is enabled then the maximum request line.4096STRINGYesNo
header.validation.maximum.sizeIf header header validation is enabled then the maximum expected header size.8192STRINGYesNo
header.validation.maximum.chunk.sizeIf header header validation is enabled then the maximum expected chunk size.8192STRINGYesNo
header.validation.reject.status.code401If header is exceed maximum size and header.size.validation is enabled then status code to be send as response.STRINGYesNo
header.validation.reject.messageIf header is exceed maximum size and header.size.validation is enabled then message to be send as response.Message header is bigger than the valid sizeSTRINGYesNo
header.validation.reject.message.content.typeIf header is exceed maximum size and header.size.validation is enabled then content type to be send as response.plain/textSTRINGYesNo
server.bootstrap.configurationParameters that for bootstrap configurations of the server. Expected format of these parameters is as follows: "'ciphers:xxx','sslEnabledProtocols,client.enable:xxx'"nullOBJECTYesNo
server.bootstrap.nodelayHttp server no delay.trueBOOLYesNo
server.bootstrap.keepaliveHttp server keep alive.trueBOOLYesNo
server.bootstrap.sendbuffersizeHttp server send buffer size.1048576INTYesNo
server.bootstrap.recievebuffersizeHttp server receive buffer size.1048576INTYesNo
server.bootstrap.connect.timeoutHttp server connection timeout.15000INTYesNo
server.bootstrap.socket.reuseTo enable http socket reuse.falseBOOLYesNo
server.bootstrap.socket.timeoutHttp server socket timeout.15BOOLYesNo
server.bootstrap.socket.backlogTHttp server socket backlog.100BOOLYesNo
trace.log.enabledHttp traffic monitoring.falseBOOLYesNo
- -System Parameters - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Parameters
serverBootstrapBossGroupSizeproperty to configure number of boss threads, which accepts incoming connections until the ports are unbound. Once connection accepts successfully, boss thread passes the accepted channel to one of the worker threads.Number of available processorsAny integer
serverBootstrapWorkerGroupSizeproperty to configure number of worker threads, which performs non blocking read and write for one or more channels in non-blocking mode.(Number of available processors)*2Any integer
serverBootstrapClientGroupSizeproperty to configure number of client threads, which performs non blocking read and write for one or more channels in non-blocking mode.(Number of available processors)*2Any integer
defaultHostThe default host of the transport.0.0.0.0Any valid host
defaultHttpPortThe default port if the default scheme is 'http'.8280Any valid port
defaultHttpsPortThe default port if the default scheme is 'https'.8243Any valid port
defaultSchemeThe default protocol.httphttp
https
keyStoreLocationThe default keystore file path.${carbon.home}/resources/security/wso2carbon.jksPath to wso2carbon.jks file
keyStorePasswordThe default keystore password.wso2carbonString of keystore password
- -Examples -EXAMPLE 1 -``` -@source(type='http', receiver.url='http://localhost:9055/endpoints/RecPro', socketIdleTimeout='150000', parameters="'ciphers : TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256', 'sslEnabledProtocols:TLSv1.1,TLSv1.2'",request.size.validation.configuration="request.size.validation:true",server.bootstrap.configuration="server.bootstrap.socket.timeout:25" @map(type='xml')) -define stream FooStream (symbol string, price float, volume long); - -``` -

Above source listenerConfiguration performs a default XML input mapping. The expected input is as follows:
<events>
    <event>
        <symbol>WSO2</symbol>
        <price>55.6</price>
        <volume>100</volume>
    </event>
</events>
If basic authentication is enabled via the basic.auth.enabled='true setting, each input event is also expected to contain the Authorization:'Basic encodeBase64(username:Password)' header.

- -### http-request *(Source)* - -

The HTTP request is correlated with the HTTP response sink, through a unique source.id, and for each POST requests it receives via HTTP or HTTPS in format such as text, XML and JSON it sends the response via the HTTP response sink. The individual request and response messages are correlated at the sink using the message.id of the events. If required, you can enable basic authentication at the source to ensure that events are received only from users who are authorized to access the service.

- -Syntax -``` -@source(type="http-request", receiver.url="", source.id="", connection.timeout="", basic.auth.enabled="", worker.count="", socket.idle.timeout="", ssl.verify.client="", ssl.protocol="", tls.store.type="", parameters="", ciphers="", ssl.enabled.protocols="", server.enable.session.creation="", server.supported.snimatchers="", server.suported.server.names="", request.size.validation.configuration="", request.size.validation="", request.size.validation.maximum.value="", request.size.validation.reject.status.code="", request.size.validation.reject.message="", request.size.validation.reject.message.content.type="", header.size.validation="", header.validation.maximum.request.line="", header.validation.maximum.size="", header.validation.maximum.chunk.size="", header.validation.reject.status.code="", header.validation.reject.message="", header.validation.reject.message.content.type="", server.bootstrap.configuration="", server.bootstrap.nodelay="", server.bootstrap.keepalive="", server.bootstrap.sendbuffersize="", server.bootstrap.recievebuffersize="", server.bootstrap.connect.timeout="", server.bootstrap.socket.reuse="", server.bootstrap.socket.timeout="", server.bootstrap.socket.backlog="", trace.log.enabled="", @map(...))) -``` - -QUERY PARAMETERS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
receiver.urlThe URL to which the events should be received. User can provide any valid url and if the url is not provided the system will use the following format http://0.0.0.0:9763/<appNAme>/<streamName>If the user want to use SSL the url should be given in following format https://localhost:8080/<streamName>http://0.0.0.0:9763//STRINGYesNo
source.idIdentifier need to map the source to sink.STRINGNoNo
connection.timeoutConnection timeout in milliseconds. If the mapped http-response sink does not get a correlated message, after this timeout value, a timeout response is sent120000INTYesNo
basic.auth.enabledIf this is set to true, basic authentication is enabled for incoming events, and the credentials with which each event is sent are verified to ensure that the user is authorized to access the service. If basic authentication fails, the event is not authenticated and an authentication error is logged in the CLI. By default this values 'false' falseSTRINGYesNo
worker.countThe number of active worker threads to serve the incoming events. The value is 1 by default. This will ensure that the events are directed to the event stream in the same order in which they arrive. By increasing this value the performance might increase at the cost of loosing event ordering.1INTYesNo
socket.idle.timeoutIdle timeout for HTTP connection.120000INTYesNo
ssl.verify.clientThe type of client certificate verification.nullSTRINGYesNo
ssl.protocolssl/tls related optionsTLSSTRINGYesNo
tls.store.typeTLS store type.JKSSTRINGYesNo
parametersParameters other than basics such as ciphers,sslEnabledProtocols,client.enable.session.creation. Expected format of these parameters is as follows: "'ciphers:xxx','sslEnabledProtocols,client.enable:xxx'"nullSTRINGYesNo
ciphersList of ciphers to be used. This parameter should include under parameters Ex: 'ciphers:TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256'nullSTRINGYesNo
ssl.enabled.protocolsSSL/TLS protocols to be enabled. This parameter should be in camel case format(sslEnabledProtocols) under parameters. Ex 'sslEnabledProtocols:true'nullSTRINGYesNo
server.enable.session.creationEnable HTTP session creation.This parameter should include under parameters Ex: 'client.enable.session.creation:true'nullSTRINGYesNo
server.supported.snimatchersHttp SNIMatcher to be added. This parameter should include under parameters Ex: 'server.supported.snimatchers:SNIMatcher'nullSTRINGYesNo
server.suported.server.namesHttp supported servers. This parameter should include under parameters Ex: 'server.suported.server.names:server'nullSTRINGYesNo
request.size.validation.configurationParameters that responsible for validating the http request and request headers. Expected format of these parameters is as follows: "'request.size.validation:xxx','request.size.validation.maximum.value:xxx'"nullSTRINGYesNo
request.size.validationTo enable the request size validation.falseSTRINGYesNo
request.size.validation.maximum.valueIf request size is validated then maximum size.Integer.MAX_VALUESTRINGYesNo
request.size.validation.reject.status.codeIf request is exceed maximum size and request.size.validation is enabled then status code to be send as response.401STRINGYesNo
request.size.validation.reject.messageIf request is exceed maximum size and request.size.validation is enabled then status message to be send as response.Message is bigger than the valid sizeSTRINGYesNo
request.size.validation.reject.message.content.typeIf request is exceed maximum size and request.size.validation is enabled then content type to be send as response.plain/textSTRINGYesNo
header.size.validationTo enable the header size validation.falseSTRINGYesNo
header.validation.maximum.request.lineIf header header validation is enabled then the maximum request line.4096STRINGYesNo
header.validation.maximum.sizeIf header header validation is enabled then the maximum expected header size.8192STRINGYesNo
header.validation.maximum.chunk.sizeIf header header validation is enabled then the maximum expected chunk size.8192STRINGYesNo
header.validation.reject.status.code401If header is exceed maximum size and header.size.validation is enabled then status code to be send as response.STRINGYesNo
header.validation.reject.messageIf header is exceed maximum size and header.size.validation is enabled then message to be send as response.Message header is bigger than the valid sizeSTRINGYesNo
header.validation.reject.message.content.typeIf header is exceed maximum size and header.size.validation is enabled then content type to be send as response.plain/textSTRINGYesNo
server.bootstrap.configurationParameters that for bootstrap configurations of the server. Expected format of these parameters is as follows: "'ciphers:xxx','sslEnabledProtocols,client.enable:xxx'"nullOBJECTYesNo
server.bootstrap.nodelayHttp server no delay.trueBOOLYesNo
server.bootstrap.keepaliveHttp server keep alive.trueBOOLYesNo
server.bootstrap.sendbuffersizeHttp server send buffer size.1048576INTYesNo
server.bootstrap.recievebuffersizeHttp server receive buffer size.1048576INTYesNo
server.bootstrap.connect.timeoutHttp server connection timeout.15000INTYesNo
server.bootstrap.socket.reuseTo enable http socket reuse.falseBOOLYesNo
server.bootstrap.socket.timeoutHttp server socket timeout.15BOOLYesNo
server.bootstrap.socket.backlogTHttp server socket backlog.100BOOLYesNo
trace.log.enabledHttp traffic monitoring.falseBOOLYesNo
- -System Parameters - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Parameters
serverBootstrapBossGroupSizeproperty to configure number of boss threads, which accepts incoming connections until the ports are unbound. Once connection accepts successfully, boss thread passes the accepted channel to one of the worker threads.Number of available processorsAny integer
serverBootstrapWorkerGroupSizeproperty to configure number of worker threads, which performs non blocking read and write for one or more channels in non-blocking mode.(Number of available processors)*2Any integer
serverBootstrapClientGroupSizeproperty to configure number of client threads, which performs non blocking read and write for one or more channels in non-blocking mode.(Number of available processors)*2Any integer
defaultHostThe default host of the transport.0.0.0.0Any valid host
defaultHttpPortThe default port if the default scheme is 'http'.8280Any valid port
defaultHttpsPortThe default port if the default scheme is 'https'.8243Any valid port
defaultSchemeThe default protocol.httphttp
https
keyStoreLocationThe default keystore file path.${carbon.home}/resources/security/wso2carbon.jksPath to wso2carbon.jks file
keyStorePasswordThe default keystore password.wso2carbonString of keystore password
certPasswordThe default cert password.wso2carbonString of cert password
- -Examples -EXAMPLE 1 -``` -@source(type='http-request', source.id='sampleSourceId, receiver.url='http://localhost:9055/endpoints/RecPro', connection.timeout='150000', parameters="'ciphers : TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256', 'sslEnabledProtocols:TLSv1.1,TLSv1.2'", request.size.validation.configuration="request.size.validation:true", server.bootstrap.configuration="server.bootstrap.socket.timeout:25", @map(type='json, @attributes(messageId='trp:messageId', symbol='$.events.event.symbol', price='$.events.event.price', volume='$.events.event.volume'))) -define stream FooStream (messageId string, symbol string, price float, volume long); - -``` -

The expected input is as follows:
{"events":
    {"event":
        "symbol":WSO2,
        "price":55.6,
        "volume":100,
    }
}
If basic authentication is enabled via the basic.auth.enabled='true setting, each input event is also expected to contain the Authorization:'Basic encodeBase64(username:Password)' header.

- -### http-response *(Source)* - -

The http-response source co-relates with http-request sink with the parameter 'sink.id'.
This receives responses for the requests sent by the http-request sink which has the same sink id.
Response messages can be in formats such as TEXT, JSON and XML.
In order to handle the responses with different http status codes, user is allowed to defined the acceptable response source code using the parameter 'http.status.code'

- -Syntax -``` -@source(type="http-response", sink.id="", http.status.code="", allow.streaming.responses="", @map(...))) -``` - -QUERY PARAMETERS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
sink.idThis parameter is used to map the http-response source to a http-request sink. Then this source will accepts the response messages for the requests sent by corresponding http-request sink.STRINGNoNo
http.status.codeAcceptable http status code for the responses.
This can be a complete string or a regex.
Only the responses with matching status codes to the defined value, will be received by the http-response source.
Eg: 'http.status.code = '200', http.status.code = '2\\d+''
200STRINGYesNo
allow.streaming.responsesIf responses can be received multiple times for a single request, this option should be enabled. If this is not enabled, for every request, response will be extracted only once.falseBOOLYesNo
- -Examples -EXAMPLE 1 -``` -@sink(type='http-request', -downloading.enabled='true', -publisher.url='http://localhost:8005/registry/employee', -method='POST', headers='{{headers}}',sink.id='employee-info', -@map(type='json')) -define stream BarStream (name String, id int, headers String, downloadPath string); - -@source(type='http-response' , sink.id='employee-info', http.status.code='2\\d+', -@map(type='text', regex.A='((.|\n)*)', @attributes(message='A[1]'))) -define stream responseStream2xx(message string);@source(type='http-response' , sink.id='employee-info', http.status.code='4\\d+' , -@map(type='text', regex.A='((.|\n)*)', @attributes(message='A[1]'))) -define stream responseStream4xx(message string); -``` -

In above example, the defined http-request sink will send a POST requests to the endpoint defined by 'publisher.url'.
Then for those requests, the source with the response code '2\\d+' and sink.id 'employee-info' will receive the responses with 2xx status codes.
The http-response source which has 'employee-info' as the 'sink.id' and '4\\d+' as the http.response.code will receive all the responses with 4xx status codes.
. Then the body of the response message will be extracted using text mapper and converted into siddhi events.
.

- diff --git a/docs/api/2.0.5.md b/docs/api/2.0.5.md deleted file mode 100644 index 1f2b818e..00000000 --- a/docs/api/2.0.5.md +++ /dev/null @@ -1,1763 +0,0 @@ -# API Docs - v2.0.5 - -## Sink - -### http *(Sink)* - -

This extension publish the HTTP events in any HTTP method POST, GET, PUT, DELETE via HTTP or https protocols. As the additional features this component can provide basic authentication as well as user can publish events using custom client truststore files when publishing events via https protocol. And also user can add any number of headers including HTTP_METHOD header for each event dynamically.
Following content types will be set by default according to the type of sink mapper used.
You can override them by setting the new content types in headers.
     - TEXT : text/plain
     - XML : application/xml
     - JSON : application/json
     - KEYVALUE : application/x-www-form-urlencoded

- -Syntax -``` -@sink(type="http", publisher.url="", basic.auth.username="", basic.auth.password="", https.truststore.file="", https.truststore.password="", headers="", method="", socket.idle.timeout="", chunk.disabled="", ssl.protocol="", parameters="", ciphers="", ssl.enabled.protocols="", client.enable.session.creation="", follow.redirect="", max.redirect.count="", tls.store.type="", proxy.host="", proxy.port="", proxy.username="", proxy.password="", client.bootstrap.configuration="", client.bootstrap.nodelay="", client.bootstrap.keepalive="", client.bootstrap.sendbuffersize="", client.bootstrap.recievebuffersize="", client.bootstrap.connect.timeout="", client.bootstrap.socket.reuse="", client.bootstrap.socket.timeout="", client.threadpool.configurations="", client.connection.pool.count="", client.max.active.connections.per.pool="", client.min.idle.connections.per.pool="", client.max.idle.connections.per.pool="", client.min.eviction.idle.time="", sender.thread.count="", event.group.executor.thread.size="", max.wait.for.client.connection.pool="", oauth.username="", oauth.password="", consumer.key="", consumer.secret="", refresh.token="", token.url="", @map(...))) -``` - -QUERY PARAMETERS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
publisher.urlThe URL to which the outgoing events should be published via HTTP. This is a mandatory parameter and if this is not specified, an error is logged in the CLI. If user wants to enable SSL for the events, use https instead of http in the publisher.url.e.g., http://localhost:8080/endpoint, https://localhost:8080/endpointSTRINGNoNo
basic.auth.usernameThe username to be included in the authentication header of the basic authentication enabled events. It is required to specify both username and password to enable basic authentication. If one of the parameter is not given by user then an error is logged in the CLI. STRINGYesNo
basic.auth.passwordThe password to include in the authentication header of the basic authentication enabled events. It is required to specify both username and password to enable basic authentication. If one of the parameter is not given by user then an error is logged in the CLI. STRINGYesNo
https.truststore.fileThe file path to the location of the truststore of the client that sends the HTTP events through 'https' protocol. A custom client-truststore can be specified if required.${carbon.home}/resources/security/client-truststore.jksSTRINGYesNo
https.truststore.passwordThe password for the client-truststore. A custom password can be specified if required. If no custom password is specified and the protocol of URL is 'https' then, the system uses default password.wso2carbonSTRINGYesNo
headersThe headers that should be included as HTTP request headers.
There can be any number of headers concatenated in following format. "'header1:value1','header2:value2'". User can include Content-Type header if he needs to use a specific content-type for the payload. Or else, system decides the Content-Type by considering the type of sink mapper, in following way.
 - @map(xml):application/xml
 - @map(json):application/json
 - @map(text):plain/text )
 - if user does not include any mapping type then the system gets 'plain/text' as default Content-Type header.
Note that providing content-length as a header is not supported. The size of the payload will be automatically calculated and included in the content-length header.
STRINGYesNo
methodFor HTTP events, HTTP_METHOD header should be included as a request header. If the parameter is null then system uses 'POST' as a default header.POSTSTRINGYesNo
socket.idle.timeoutSocket timeout value in millisecond6000INTYesNo
chunk.disabledThis parameter is used to disable/enable chunked transfer encodingfalseBOOLYesNo
ssl.protocolThe SSL protocol versionTLSSTRINGYesNo
parametersParameters other than basics such as ciphers,sslEnabledProtocols,client.enable.session.creation. Expected format of these parameters is as follows: "'ciphers:xxx','sslEnabledProtocols,client.enable:xxx'"nullSTRINGYesNo
ciphersList of ciphers to be used. This parameter should include under parameters Ex: 'ciphers:TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256'nullSTRINGYesNo
ssl.enabled.protocolsSSL/TLS protocols to be enabled. This parameter should be in camel case format(sslEnabledProtocols) under parameters. Ex 'sslEnabledProtocols:true'nullSTRINGYesNo
client.enable.session.creationEnable HTTP session creation.This parameter should include under parameters Ex: 'client.enable.session.creation:true'nullSTRINGYesNo
follow.redirectRedirect related enabled.trueBOOLYesNo
max.redirect.countMaximum redirect count.5INTYesNo
tls.store.typeTLS store type to be used.JKSSTRINGYesNo
proxy.hostProxy server hostnullSTRINGYesNo
proxy.portProxy server portnullSTRINGYesNo
proxy.usernameProxy server usernamenullSTRINGYesNo
proxy.passwordProxy server passwordnullSTRINGYesNo
client.bootstrap.configurationClient bootsrap configurations. Expected format of these parameters is as follows: "'client.bootstrap.nodelay:xxx','client.bootstrap.keepalive:xxx'"TODOSTRINGYesNo
client.bootstrap.nodelayHttp client no delay.trueBOOLYesNo
client.bootstrap.keepaliveHttp client keep alive.trueBOOLYesNo
client.bootstrap.sendbuffersizeHttp client send buffer size.1048576INTYesNo
client.bootstrap.recievebuffersizeHttp client receive buffer size.1048576INTYesNo
client.bootstrap.connect.timeoutHttp client connection timeout.15000INTYesNo
client.bootstrap.socket.reuseTo enable http socket reuse.falseBOOLYesNo
client.bootstrap.socket.timeoutHttp client socket timeout.15STRINGYesNo
client.threadpool.configurationsThread pool configuration. Expected format of these parameters is as follows: "'client.connection.pool.count:xxx','client.max.active.connections.per.pool:xxx'"TODOSTRINGYesNo
client.connection.pool.countConnection pool count.0INTYesNo
client.max.active.connections.per.poolActive connections per pool.-1INTYesNo
client.min.idle.connections.per.poolMinimum ideal connection per pool.0INTYesNo
client.max.idle.connections.per.poolMaximum ideal connection per pool.100INTYesNo
client.min.eviction.idle.timeMinimum eviction idle time.5 * 60 * 1000STRINGYesNo
sender.thread.countHttp sender thread count.20STRINGYesNo
event.group.executor.thread.sizeEvent group executor thread size.15STRINGYesNo
max.wait.for.client.connection.poolMaximum wait for client connection pool.60000STRINGYesNo
oauth.usernameThe username to be included in the authentication header of the oauth authentication enabled events. It is required to specify both username and password to enable oauth authentication. If one of the parameter is not given by user then an error is logged in the CLI. It is only applicable for for Oauth requests STRINGYesNo
oauth.passwordThe password to be included in the authentication header of the oauth authentication enabled events. It is required to specify both username and password to enable oauth authentication. If one of the parameter is not given by user then an error is logged in the CLI. It is only applicable for for Oauth requests STRINGYesNo
consumer.keyconsumer key for the Http request. It is only applicable for for Oauth requests STRINGYesNo
consumer.secretconsumer secret for the Http request. It is only applicable for for Oauth requests STRINGYesNo
refresh.tokenrefresh token for the Http request. It is only applicable for for Oauth requests STRINGYesNo
token.urltoken url for generate a new access token. It is only applicable for for Oauth requests STRINGYesNo
- -System Parameters - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Parameters
clientBootstrapBossGroupSizeproperty to configure number of boss threads, which accepts incoming connections until the ports are unbound. Once connection accepts successfully, boss thread passes the accepted channel to one of the worker threads.Number of available processorsAny integer
clientBootstrapWorkerGroupSizeproperty to configure number of worker threads, which performs non blocking read and write for one or more channels in non-blocking mode.(Number of available processors)*2Any integer
clientBootstrapClientGroupSizeproperty to configure number of client threads, which performs non blocking read and write for one or more channels in non-blocking mode.(Number of available processors)*2Any integer
trustStoreLocationThe default truststore file path.${carbon.home}/resources/security/client-truststore.jksPath to client-truststore.jks
trustStorePasswordThe default truststore password.wso2carbonTruststore password
- -Examples -EXAMPLE 1 -``` -@sink(type='http',publisher.url='http://localhost:8009/foo', method='{{method}}',headers="'content-type:xml','content-length:94'", client.bootstrap.configuration="'client.bootstrap.socket.timeout:20', 'client.bootstrap.worker.group.size:10'", client.pool.configuration="'client.connection.pool.count:10','client.max.active.connections.per.pool:1'", @map(type='xml', @payload('{{payloadBody}}'))) -define stream FooStream (payloadBody String, method string, headers string); - -``` -

If it is xml mapping expected input should be in following format for FooStream:
{
<events>
    <event>
        <symbol>WSO2</symbol>
        <price>55.6</price>
        <volume>100</volume>
    </event>
</events>,
POST,
Content-Length:24#Content-Location:USA#Retry-After:120
}

Above event will generate output as below.
~Output http event payload
<events>
    <event>
        <symbol>WSO2</symbol>
        <price>55.6</price>
        <volume>100</volume>
    </event>
</events>

~Output http event headers
Content-Length:24,
Content-Location:'USA',
Retry-After:120,
Content-Type:'application/xml',
HTTP_METHOD:'POST',

~Output http event properties
HTTP_METHOD:'POST',
HOST:'localhost',
PORT:8009,
PROTOCOL:'http',
TO:'/foo'

- -### http-request *(Sink)* - -

This extension publish the HTTP events in any HTTP method POST, GET, PUT, DELETE via HTTP or https protocols. As the additional features this component can provide basic authentication as well as user can publish events using custom client truststore files when publishing events via https protocol. And also user can add any number of headers including HTTP_METHOD header for each event dynamically.
Following content types will be set by default according to the type of sink mapper used.
You can override them by setting the new content types in headers.
     - TEXT : text/plain
     - XML : application/xml
     - JSON : application/json
     - KEYVALUE : application/x-www-form-urlencoded

HTTP request sink is correlated with the The HTTP reponse source, through a unique sink.id.It sends the request to the defined url and the response is received by the response source which has the same 'sink.id'.

- -Syntax -``` -@sink(type="http-request", publisher.url="", basic.auth.username="", basic.auth.password="", https.truststore.file="", https.truststore.password="", headers="", method="", socket.idle.timeout="", chunk.disabled="", ssl.protocol="", parameters="", ciphers="", ssl.enabled.protocols="", client.enable.session.creation="", follow.redirect="", max.redirect.count="", tls.store.type="", proxy.host="", proxy.port="", proxy.username="", proxy.password="", client.bootstrap.configuration="", client.bootstrap.nodelay="", client.bootstrap.keepalive="", client.bootstrap.sendbuffersize="", client.bootstrap.recievebuffersize="", client.bootstrap.connect.timeout="", client.bootstrap.socket.reuse="", client.bootstrap.socket.timeout="", client.threadpool.configurations="", client.connection.pool.count="", client.max.active.connections.per.pool="", client.min.idle.connections.per.pool="", client.max.idle.connections.per.pool="", client.min.eviction.idle.time="", sender.thread.count="", event.group.executor.thread.size="", max.wait.for.client.connection.pool="", sink.id="", downloading.enabled="", download.path="", oauth.username="", oauth.password="", consumer.key="", consumer.secret="", refresh.token="", blocking.io="", @map(...))) -``` - -QUERY PARAMETERS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
publisher.urlThe URL to which the outgoing events should be published via HTTP. This is a mandatory parameter and if this is not specified, an error is logged in the CLI. If user wants to enable SSL for the events, use https instead of http in the publisher.url.
e.g., http://localhost:8080/endpoint, https://localhost:8080/endpoint
This can be used as a dynamic parameter as well.
STRINGNoYes
basic.auth.usernameThe username to be included in the authentication header of the basic authentication enabled events. It is required to specify both username and password to enable basic authentication. If one of the parameter is not given by user then an error is logged in the CLI. STRINGYesNo
basic.auth.passwordThe password to include in the authentication header of the basic authentication enabled events. It is required to specify both username and password to enable basic authentication. If one of the parameter is not given by user then an error is logged in the CLI. STRINGYesNo
https.truststore.fileThe file path to the location of the truststore of the client that sends the HTTP events through 'https' protocol. A custom client-truststore can be specified if required.${carbon.home}/resources/security/client-truststore.jksSTRINGYesNo
https.truststore.passwordThe password for the client-truststore. A custom password can be specified if required. If no custom password is specified and the protocol of URL is 'https' then, the system uses default password.wso2carbonSTRINGYesNo
headersThe headers that should be included as HTTP request headers.
There can be any number of headers concatenated in following format. "'header1:value1','header2:value2'". User can include Content-Type header if he needs to use a specific content-type for the payload. Or else, system decides the Content-Type by considering the type of sink mapper, in following way.
 - @map(xml):application/xml
 - @map(json):application/json
 - @map(text):plain/text )
 - if user does not include any mapping type then the system gets 'plain/text' as default Content-Type header.
Note that providing content-length as a header is not supported. The size of the payload will be automatically calculated and included in the content-length header.
STRINGYesNo
methodFor HTTP events, HTTP_METHOD header should be included as a request header. If the parameter is null then system uses 'POST' as a default header.POSTSTRINGYesNo
socket.idle.timeoutSocket timeout value in millisecond6000INTYesNo
chunk.disabledport: Port number of the remote servicefalseBOOLYesNo
ssl.protocolThe SSL protocol versionTLSSTRINGYesNo
parametersParameters other than basics such as ciphers,sslEnabledProtocols,client.enable.session.creation. Expected format of these parameters is as follows: "'ciphers:xxx','sslEnabledProtocols,client.enable:xxx'"nullSTRINGYesNo
ciphersList of ciphers to be used. This parameter should include under parameters Ex: 'ciphers:TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256'nullSTRINGYesNo
ssl.enabled.protocolsSSL/TLS protocols to be enabled. This parameter should be in camel case format(sslEnabledProtocols) under parameters. Ex 'sslEnabledProtocols:true'nullSTRINGYesNo
client.enable.session.creationEnable HTTP session creation.This parameter should include under parameters Ex: 'client.enable.session.creation:true'nullSTRINGYesNo
follow.redirectRedirect related enabled.trueBOOLYesNo
max.redirect.countMaximum redirect count.5INTYesNo
tls.store.typeTLS store type to be used.JKSSTRINGYesNo
proxy.hostProxy server hostnullSTRINGYesNo
proxy.portProxy server portnullSTRINGYesNo
proxy.usernameProxy server usernamenullSTRINGYesNo
proxy.passwordProxy server passwordnullSTRINGYesNo
client.bootstrap.configurationClient bootsrap configurations. Expected format of these parameters is as follows: "'client.bootstrap.nodelay:xxx','client.bootstrap.keepalive:xxx'"TODOSTRINGYesNo
client.bootstrap.nodelayHttp client no delay.trueBOOLYesNo
client.bootstrap.keepaliveHttp client keep alive.trueBOOLYesNo
client.bootstrap.sendbuffersizeHttp client send buffer size.1048576INTYesNo
client.bootstrap.recievebuffersizeHttp client receive buffer size.1048576INTYesNo
client.bootstrap.connect.timeoutHttp client connection timeout.15000INTYesNo
client.bootstrap.socket.reuseTo enable http socket reuse.falseBOOLYesNo
client.bootstrap.socket.timeoutHttp client socket timeout.15STRINGYesNo
client.threadpool.configurationsThread pool configuration. Expected format of these parameters is as follows: "'client.connection.pool.count:xxx','client.max.active.connections.per.pool:xxx'"TODOSTRINGYesNo
client.connection.pool.countConnection pool count.0INTYesNo
client.max.active.connections.per.poolActive connections per pool.-1INTYesNo
client.min.idle.connections.per.poolMinimum ideal connection per pool.0INTYesNo
client.max.idle.connections.per.poolMaximum ideal connection per pool.100INTYesNo
client.min.eviction.idle.timeMinimum eviction idle time.5 * 60 * 1000STRINGYesNo
sender.thread.countHttp sender thread count.20STRINGYesNo
event.group.executor.thread.sizeEvent group executor thread size.15STRINGYesNo
max.wait.for.client.connection.poolMaximum wait for client connection pool.60000STRINGYesNo
sink.idIdentifier of the sink. This is used to co-relate with the corresponding http-response source which needs to process the repose for the request sent by this sink.STRINGNoNo
downloading.enabledIf this is set to 'true' then the response received by the response source will be written to a file. If downloading is enabled, the download.path parameter is mandatory.falseBOOLYesNo
download.pathIf downloading is enabled, the path of the file which is going to be downloaded should be specified using 'download.path' parameter. This should be an absolute path including the file name.nullSTRINGYesYes
oauth.usernameThe username to be included in the authentication header of the oauth authentication enabled events. It is required to specify both username and password to enable oauth authentication. If one of the parameter is not given by user then an error is logged in the CLI. It is only applicable for for Oauth requests STRINGYesNo
oauth.passwordThe password to be included in the authentication header of the oauth authentication enabled events. It is required to specify both username and password to enable oauth authentication. If one of the parameter is not given by user then an error is logged in the CLI. It is only applicable for for Oauth requests STRINGYesNo
consumer.keyconsumer key for the Http request. It is only applicable for for Oauth requests STRINGYesNo
consumer.secretconsumer secret for the Http request. It is only applicable for for Oauth requests STRINGYesNo
refresh.tokenrefresh token for the Http request. It is only applicable for for Oauth requests STRINGYesNo
blocking.ioIf this is set to 'true', after sending a request, http-request sink waits until it receives the response for that request, before sending any other request.falseBOOLYesNo
- -Examples -EXAMPLE 1 -``` -@sink(type='http-request', sink.id='foo', publisher.url='http://localhost:8009/foo', @map(type='xml', @payload('{{payloadBody}}'))) -define stream FooStream (payloadBody String, method string, headers string); -@source(type='http-response', sink.id='foo', http.status.code='2\\d+', -@map(type='text', regex.A='((.|\n)*)', @attributes(headers='trp:headers', fileName='A[1]'))) -define stream responseStream2xx(fileName string, headers string); - -@source(type='http-response', sink.id='foo', http.status.code='4\\d+', -@map(type='text', regex.A='((.|\n)*)', @attributes(errorMsg='A[1]'))) -define stream responseStream4xx(errorMsg string); -``` -

In above example, the payload body for 'FooStream' will be in following format.
{
<events>
    <event>
        <symbol>WSO2</symbol>
        <price>55.6</price>
        <volume>100</volume>
    </event>
</events>,
This message will sent as the body of a POST request with the content-type 'application/xml' to the endpoint defined as the 'publisher.url' and in order to process the responses for these requests, there should be a source of type 'http-response' defined with the same sink id 'foo' in the siddhi app.
 The responses with 2xx status codes will be received by the http-response source which has the http.status.code defined by the regex '2\\d+'.
If the response has a 4xx status code, it will be received by the http-response source which has the http.status.code defined by the regex '4\\d+'.

- -EXAMPLE 2 -``` -define stream FooStream (name String, id int, headers String, downloadPath string); -@sink(type='http-request', -downloading.enabled='true', -download.path='{{downloadPath}}',publisher.url='http://localhost:8005/files', -method='GET', headers='{{headers}}',sink.id='download-sink', -@map(type='json')) -define stream BarStream (name String, id int, headers String, downloadPath string); - -@source(type='http-response', sink.id='download-sink', http.status.code='2\\d+', -@map(type='text', regex.A='((.|\n)*)', @attributes(headers='trp:headers', fileName='A[1]'))) -define stream responseStream2xx(fileName string, headers string); - -@source(type='http-response', sink.id='download-sink', http.status.code='4\\d+', -@map(type='text', regex.A='((.|\n)*)', @attributes(errorMsg='A[1]'))) -define stream responseStream4xx(errorMsg string); -``` -

In above example, http-request sink will send a GET request to the publisher url and the requested file will be received as the response by a corresponding http-response source.
If the http status code of the response is a successful one (2xx), it will be received by the http-response source which has the http.status.code '2\\d+' and downloaded as a local file. Then the event received to the responseStream2xx will have the headers included in the request and the downloaded file name.
If the http status code of the response is a 4xx code, it will be received by the http-response source which has the http.status.code '4\\d+'. Then the event received to the responseStream4xx will have the response message body in text format.

- -### http-response *(Sink)* - -

HTTP response sink is correlated with the The HTTP request source, through a unique source.id, and it send a response to the HTTP request source having the same source.id. The response message can be formatted in text, XML or JSON and can be sent with appropriate headers.

- -Syntax -``` -@sink(type="http-response", source.id="", message.id="", headers="", @map(...))) -``` - -QUERY PARAMETERS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
source.idIdentifier of the source.STRINGNoNo
message.idIdentifier of the message.STRINGNoYes
headersThe headers that should be included as HTTP response headers. There can be any number of headers concatenated on following format. "'header1:value1','header2:value2'" User can include content-type header if he/she need to have any specific type for payload. If not system get the mapping type as the content-Type header (ie.@map(xml):application/xml, @map(json):application/json, @map(text):plain/text) and if user does not include any mapping type then system gets the plain/text as default Content-Type header. If user does not include Content-Length header then system calculate the bytes size of payload and include it as content-length header. STRINGYesNo
- -Examples -EXAMPLE 1 -``` -@sink(type='http-response', source.id='sampleSourceId', message.id='{{messageId}}', headers="'content-type:json','content-length:94'"@map(type='json', @payload('{{payloadBody}}'))) -define stream FooStream (payloadBody String, messageId string, headers string); - -``` -

If it is json mapping expected input should be in following format for FooStream:
{
{"events":
    {"event":
        "symbol":WSO2,
        "price":55.6,
        "volume":100,
    }
},
0cf708b1-7eae-440b-a93e-e72f801b486a,
Content-Length:24#Content-Location:USA
}

Above event will generate response for the matching source message as below.

~Output http event payload
{"events":
    {"event":
        "symbol":WSO2,
        "price":55.6,
        "volume":100,
    }
}

~Output http event headers
Content-Length:24,
Content-Location:'USA',
Content-Type:'application/json'

- -## Source - -### http *(Source)* - -

The HTTP source receives POST requests via HTTP or HTTPS in format such as text, XML and JSON. In WSO2 SP, if required, you can enable basic authentication to ensure that events are received only from users who are authorized to access the service.

- -Syntax -``` -@source(type="http", receiver.url="", basic.auth.enabled="", worker.count="", socket.idle.timeout="", ssl.verify.client="", ssl.protocol="", tls.store.type="", parameters="", ciphers="", ssl.enabled.protocols="", server.enable.session.creation="", server.supported.snimatchers="", server.suported.server.names="", request.size.validation.configuration="", request.size.validation="", request.size.validation.maximum.value="", request.size.validation.reject.status.code="", request.size.validation.reject.message="", request.size.validation.reject.message.content.type="", header.size.validation="", header.validation.maximum.request.line="", header.validation.maximum.size="", header.validation.maximum.chunk.size="", header.validation.reject.status.code="", header.validation.reject.message="", header.validation.reject.message.content.type="", server.bootstrap.configuration="", server.bootstrap.nodelay="", server.bootstrap.keepalive="", server.bootstrap.sendbuffersize="", server.bootstrap.recievebuffersize="", server.bootstrap.connect.timeout="", server.bootstrap.socket.reuse="", server.bootstrap.socket.timeout="", server.bootstrap.socket.backlog="", trace.log.enabled="", @map(...))) -``` - -QUERY PARAMETERS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
receiver.urlThe URL to which the events should be received. User can provide any valid url and if the url is not provided the system will use the following format http://0.0.0.0:9763/<appNAme>/<streamName>If the user want to use SSL the url should be given in following format https://localhost:8080/<streamName>http://0.0.0.0:9763//STRINGYesNo
basic.auth.enabledThis works only in WSO2 SP. If this is set to true, basic authentication is enabled for incoming events, and the credentials with which each event is sent are verified to ensure that the user is authorized to access the service. If basic authentication fails, the event is not authenticated and an authentication error is logged in the CLI.falseSTRINGYesNo
worker.countThe number of active worker threads to serve the incoming events. The value is 1 by default. This will ensure that the events are directed to the event stream in the same order in which they arrive. By increasing this value the performance might increase at the cost of loosing event ordering.1INTYesNo
socket.idle.timeoutIdle timeout for HTTP connection.120000INTYesNo
ssl.verify.clientThe type of client certificate verification.nullSTRINGYesNo
ssl.protocolssl/tls related optionsTLSSTRINGYesNo
tls.store.typeTLS store type.JKSSTRINGYesNo
parametersParameters other than basics such as ciphers,sslEnabledProtocols,client.enable.session.creation. Expected format of these parameters is as follows: "'ciphers:xxx','sslEnabledProtocols,client.enable:xxx'"nullSTRINGYesNo
ciphersList of ciphers to be used. This parameter should include under parameters Ex: 'ciphers:TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256'nullSTRINGYesNo
ssl.enabled.protocolsSSL/TLS protocols to be enabled. This parameter should be in camel case format(sslEnabledProtocols) under parameters. Ex 'sslEnabledProtocols:true'nullSTRINGYesNo
server.enable.session.creationEnable HTTP session creation.This parameter should include under parameters Ex: 'client.enable.session.creation:true'nullSTRINGYesNo
server.supported.snimatchersHttp SNIMatcher to be added. This parameter should include under parameters Ex: 'server.supported.snimatchers:SNIMatcher'nullSTRINGYesNo
server.suported.server.namesHttp supported servers. This parameter should include under parameters Ex: 'server.suported.server.names:server'nullSTRINGYesNo
request.size.validation.configurationParameters that responsible for validating the http request and request headers. Expected format of these parameters is as follows: "'request.size.validation:xxx','request.size.validation.maximum.value:xxx'"nullSTRINGYesNo
request.size.validationTo enable the request size validation.falseSTRINGYesNo
request.size.validation.maximum.valueIf request size is validated then maximum size.Integer.MAX_VALUESTRINGYesNo
request.size.validation.reject.status.codeIf request is exceed maximum size and request.size.validation is enabled then status code to be send as response.401STRINGYesNo
request.size.validation.reject.messageIf request is exceed maximum size and request.size.validation is enabled then status message to be send as response.Message is bigger than the valid sizeSTRINGYesNo
request.size.validation.reject.message.content.typeIf request is exceed maximum size and request.size.validation is enabled then content type to be send as response.plain/textSTRINGYesNo
header.size.validationTo enable the header size validation.falseSTRINGYesNo
header.validation.maximum.request.lineIf header header validation is enabled then the maximum request line.4096STRINGYesNo
header.validation.maximum.sizeIf header header validation is enabled then the maximum expected header size.8192STRINGYesNo
header.validation.maximum.chunk.sizeIf header header validation is enabled then the maximum expected chunk size.8192STRINGYesNo
header.validation.reject.status.code401If header is exceed maximum size and header.size.validation is enabled then status code to be send as response.STRINGYesNo
header.validation.reject.messageIf header is exceed maximum size and header.size.validation is enabled then message to be send as response.Message header is bigger than the valid sizeSTRINGYesNo
header.validation.reject.message.content.typeIf header is exceed maximum size and header.size.validation is enabled then content type to be send as response.plain/textSTRINGYesNo
server.bootstrap.configurationParameters that for bootstrap configurations of the server. Expected format of these parameters is as follows: "'ciphers:xxx','sslEnabledProtocols,client.enable:xxx'"nullOBJECTYesNo
server.bootstrap.nodelayHttp server no delay.trueBOOLYesNo
server.bootstrap.keepaliveHttp server keep alive.trueBOOLYesNo
server.bootstrap.sendbuffersizeHttp server send buffer size.1048576INTYesNo
server.bootstrap.recievebuffersizeHttp server receive buffer size.1048576INTYesNo
server.bootstrap.connect.timeoutHttp server connection timeout.15000INTYesNo
server.bootstrap.socket.reuseTo enable http socket reuse.falseBOOLYesNo
server.bootstrap.socket.timeoutHttp server socket timeout.15BOOLYesNo
server.bootstrap.socket.backlogTHttp server socket backlog.100BOOLYesNo
trace.log.enabledHttp traffic monitoring.falseBOOLYesNo
- -System Parameters - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Parameters
serverBootstrapBossGroupSizeproperty to configure number of boss threads, which accepts incoming connections until the ports are unbound. Once connection accepts successfully, boss thread passes the accepted channel to one of the worker threads.Number of available processorsAny integer
serverBootstrapWorkerGroupSizeproperty to configure number of worker threads, which performs non blocking read and write for one or more channels in non-blocking mode.(Number of available processors)*2Any integer
serverBootstrapClientGroupSizeproperty to configure number of client threads, which performs non blocking read and write for one or more channels in non-blocking mode.(Number of available processors)*2Any integer
defaultHostThe default host of the transport.0.0.0.0Any valid host
defaultHttpPortThe default port if the default scheme is 'http'.8280Any valid port
defaultHttpsPortThe default port if the default scheme is 'https'.8243Any valid port
defaultSchemeThe default protocol.httphttp
https
keyStoreLocationThe default keystore file path.${carbon.home}/resources/security/wso2carbon.jksPath to wso2carbon.jks file
keyStorePasswordThe default keystore password.wso2carbonString of keystore password
- -Examples -EXAMPLE 1 -``` -@source(type='http', receiver.url='http://localhost:9055/endpoints/RecPro', socketIdleTimeout='150000', parameters="'ciphers : TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256', 'sslEnabledProtocols:TLSv1.1,TLSv1.2'",request.size.validation.configuration="request.size.validation:true",server.bootstrap.configuration="server.bootstrap.socket.timeout:25" @map(type='xml')) -define stream FooStream (symbol string, price float, volume long); - -``` -

Above source listenerConfiguration performs a default XML input mapping. The expected input is as follows:
<events>
    <event>
        <symbol>WSO2</symbol>
        <price>55.6</price>
        <volume>100</volume>
    </event>
</events>
If basic authentication is enabled via the basic.auth.enabled='true setting, each input event is also expected to contain the Authorization:'Basic encodeBase64(username:Password)' header.

- -### http-request *(Source)* - -

The HTTP request is correlated with the HTTP response sink, through a unique source.id, and for each POST requests it receives via HTTP or HTTPS in format such as text, XML and JSON it sends the response via the HTTP response sink. The individual request and response messages are correlated at the sink using the message.id of the events. If required, you can enable basic authentication at the source to ensure that events are received only from users who are authorized to access the service.

- -Syntax -``` -@source(type="http-request", receiver.url="", source.id="", connection.timeout="", basic.auth.enabled="", worker.count="", socket.idle.timeout="", ssl.verify.client="", ssl.protocol="", tls.store.type="", parameters="", ciphers="", ssl.enabled.protocols="", server.enable.session.creation="", server.supported.snimatchers="", server.suported.server.names="", request.size.validation.configuration="", request.size.validation="", request.size.validation.maximum.value="", request.size.validation.reject.status.code="", request.size.validation.reject.message="", request.size.validation.reject.message.content.type="", header.size.validation="", header.validation.maximum.request.line="", header.validation.maximum.size="", header.validation.maximum.chunk.size="", header.validation.reject.status.code="", header.validation.reject.message="", header.validation.reject.message.content.type="", server.bootstrap.configuration="", server.bootstrap.nodelay="", server.bootstrap.keepalive="", server.bootstrap.sendbuffersize="", server.bootstrap.recievebuffersize="", server.bootstrap.connect.timeout="", server.bootstrap.socket.reuse="", server.bootstrap.socket.timeout="", server.bootstrap.socket.backlog="", trace.log.enabled="", @map(...))) -``` - -QUERY PARAMETERS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
receiver.urlThe URL to which the events should be received. User can provide any valid url and if the url is not provided the system will use the following format http://0.0.0.0:9763/<appNAme>/<streamName>If the user want to use SSL the url should be given in following format https://localhost:8080/<streamName>http://0.0.0.0:9763//STRINGYesNo
source.idIdentifier need to map the source to sink.STRINGNoNo
connection.timeoutConnection timeout in milliseconds. If the mapped http-response sink does not get a correlated message, after this timeout value, a timeout response is sent120000INTYesNo
basic.auth.enabledIf this is set to true, basic authentication is enabled for incoming events, and the credentials with which each event is sent are verified to ensure that the user is authorized to access the service. If basic authentication fails, the event is not authenticated and an authentication error is logged in the CLI. By default this values 'false' falseSTRINGYesNo
worker.countThe number of active worker threads to serve the incoming events. The value is 1 by default. This will ensure that the events are directed to the event stream in the same order in which they arrive. By increasing this value the performance might increase at the cost of loosing event ordering.1INTYesNo
socket.idle.timeoutIdle timeout for HTTP connection.120000INTYesNo
ssl.verify.clientThe type of client certificate verification.nullSTRINGYesNo
ssl.protocolssl/tls related optionsTLSSTRINGYesNo
tls.store.typeTLS store type.JKSSTRINGYesNo
parametersParameters other than basics such as ciphers,sslEnabledProtocols,client.enable.session.creation. Expected format of these parameters is as follows: "'ciphers:xxx','sslEnabledProtocols,client.enable:xxx'"nullSTRINGYesNo
ciphersList of ciphers to be used. This parameter should include under parameters Ex: 'ciphers:TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256'nullSTRINGYesNo
ssl.enabled.protocolsSSL/TLS protocols to be enabled. This parameter should be in camel case format(sslEnabledProtocols) under parameters. Ex 'sslEnabledProtocols:true'nullSTRINGYesNo
server.enable.session.creationEnable HTTP session creation.This parameter should include under parameters Ex: 'client.enable.session.creation:true'nullSTRINGYesNo
server.supported.snimatchersHttp SNIMatcher to be added. This parameter should include under parameters Ex: 'server.supported.snimatchers:SNIMatcher'nullSTRINGYesNo
server.suported.server.namesHttp supported servers. This parameter should include under parameters Ex: 'server.suported.server.names:server'nullSTRINGYesNo
request.size.validation.configurationParameters that responsible for validating the http request and request headers. Expected format of these parameters is as follows: "'request.size.validation:xxx','request.size.validation.maximum.value:xxx'"nullSTRINGYesNo
request.size.validationTo enable the request size validation.falseSTRINGYesNo
request.size.validation.maximum.valueIf request size is validated then maximum size.Integer.MAX_VALUESTRINGYesNo
request.size.validation.reject.status.codeIf request is exceed maximum size and request.size.validation is enabled then status code to be send as response.401STRINGYesNo
request.size.validation.reject.messageIf request is exceed maximum size and request.size.validation is enabled then status message to be send as response.Message is bigger than the valid sizeSTRINGYesNo
request.size.validation.reject.message.content.typeIf request is exceed maximum size and request.size.validation is enabled then content type to be send as response.plain/textSTRINGYesNo
header.size.validationTo enable the header size validation.falseSTRINGYesNo
header.validation.maximum.request.lineIf header header validation is enabled then the maximum request line.4096STRINGYesNo
header.validation.maximum.sizeIf header header validation is enabled then the maximum expected header size.8192STRINGYesNo
header.validation.maximum.chunk.sizeIf header header validation is enabled then the maximum expected chunk size.8192STRINGYesNo
header.validation.reject.status.code401If header is exceed maximum size and header.size.validation is enabled then status code to be send as response.STRINGYesNo
header.validation.reject.messageIf header is exceed maximum size and header.size.validation is enabled then message to be send as response.Message header is bigger than the valid sizeSTRINGYesNo
header.validation.reject.message.content.typeIf header is exceed maximum size and header.size.validation is enabled then content type to be send as response.plain/textSTRINGYesNo
server.bootstrap.configurationParameters that for bootstrap configurations of the server. Expected format of these parameters is as follows: "'ciphers:xxx','sslEnabledProtocols,client.enable:xxx'"nullOBJECTYesNo
server.bootstrap.nodelayHttp server no delay.trueBOOLYesNo
server.bootstrap.keepaliveHttp server keep alive.trueBOOLYesNo
server.bootstrap.sendbuffersizeHttp server send buffer size.1048576INTYesNo
server.bootstrap.recievebuffersizeHttp server receive buffer size.1048576INTYesNo
server.bootstrap.connect.timeoutHttp server connection timeout.15000INTYesNo
server.bootstrap.socket.reuseTo enable http socket reuse.falseBOOLYesNo
server.bootstrap.socket.timeoutHttp server socket timeout.15BOOLYesNo
server.bootstrap.socket.backlogTHttp server socket backlog.100BOOLYesNo
trace.log.enabledHttp traffic monitoring.falseBOOLYesNo
- -System Parameters - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Parameters
serverBootstrapBossGroupSizeproperty to configure number of boss threads, which accepts incoming connections until the ports are unbound. Once connection accepts successfully, boss thread passes the accepted channel to one of the worker threads.Number of available processorsAny integer
serverBootstrapWorkerGroupSizeproperty to configure number of worker threads, which performs non blocking read and write for one or more channels in non-blocking mode.(Number of available processors)*2Any integer
serverBootstrapClientGroupSizeproperty to configure number of client threads, which performs non blocking read and write for one or more channels in non-blocking mode.(Number of available processors)*2Any integer
defaultHostThe default host of the transport.0.0.0.0Any valid host
defaultHttpPortThe default port if the default scheme is 'http'.8280Any valid port
defaultHttpsPortThe default port if the default scheme is 'https'.8243Any valid port
defaultSchemeThe default protocol.httphttp
https
keyStoreLocationThe default keystore file path.${carbon.home}/resources/security/wso2carbon.jksPath to wso2carbon.jks file
keyStorePasswordThe default keystore password.wso2carbonString of keystore password
certPasswordThe default cert password.wso2carbonString of cert password
- -Examples -EXAMPLE 1 -``` -@source(type='http-request', source.id='sampleSourceId, receiver.url='http://localhost:9055/endpoints/RecPro', connection.timeout='150000', parameters="'ciphers : TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256', 'sslEnabledProtocols:TLSv1.1,TLSv1.2'", request.size.validation.configuration="request.size.validation:true", server.bootstrap.configuration="server.bootstrap.socket.timeout:25", @map(type='json, @attributes(messageId='trp:messageId', symbol='$.events.event.symbol', price='$.events.event.price', volume='$.events.event.volume'))) -define stream FooStream (messageId string, symbol string, price float, volume long); - -``` -

The expected input is as follows:
{"events":
    {"event":
        "symbol":WSO2,
        "price":55.6,
        "volume":100,
    }
}
If basic authentication is enabled via the basic.auth.enabled='true setting, each input event is also expected to contain the Authorization:'Basic encodeBase64(username:Password)' header.

- -### http-response *(Source)* - -

The http-response source co-relates with http-request sink with the parameter 'sink.id'.
This receives responses for the requests sent by the http-request sink which has the same sink id.
Response messages can be in formats such as TEXT, JSON and XML.
In order to handle the responses with different http status codes, user is allowed to defined the acceptable response source code using the parameter 'http.status.code'

- -Syntax -``` -@source(type="http-response", sink.id="", http.status.code="", allow.streaming.responses="", @map(...))) -``` - -QUERY PARAMETERS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
sink.idThis parameter is used to map the http-response source to a http-request sink. Then this source will accepts the response messages for the requests sent by corresponding http-request sink.STRINGNoNo
http.status.codeAcceptable http status code for the responses.
This can be a complete string or a regex.
Only the responses with matching status codes to the defined value, will be received by the http-response source.
Eg: 'http.status.code = '200', http.status.code = '2\\d+''
200STRINGYesNo
allow.streaming.responsesIf responses can be received multiple times for a single request, this option should be enabled. If this is not enabled, for every request, response will be extracted only once.falseBOOLYesNo
- -Examples -EXAMPLE 1 -``` -@sink(type='http-request', -downloading.enabled='true', -publisher.url='http://localhost:8005/registry/employee', -method='POST', headers='{{headers}}',sink.id='employee-info', -@map(type='json')) -define stream BarStream (name String, id int, headers String, downloadPath string); - -@source(type='http-response' , sink.id='employee-info', http.status.code='2\\d+', -@map(type='text', regex.A='((.|\n)*)', @attributes(message='A[1]'))) -define stream responseStream2xx(message string);@source(type='http-response' , sink.id='employee-info', http.status.code='4\\d+' , -@map(type='text', regex.A='((.|\n)*)', @attributes(message='A[1]'))) -define stream responseStream4xx(message string); -``` -

In above example, the defined http-request sink will send a POST requests to the endpoint defined by 'publisher.url'.
Then for those requests, the source with the response code '2\\d+' and sink.id 'employee-info' will receive the responses with 2xx status codes.
The http-response source which has 'employee-info' as the 'sink.id' and '4\\d+' as the http.response.code will receive all the responses with 4xx status codes.
. Then the body of the response message will be extracted using text mapper and converted into siddhi events.
.

- diff --git a/docs/index.md b/docs/index.md index d38067b2..1806b3e5 100644 --- a/docs/index.md +++ b/docs/index.md @@ -2,8 +2,8 @@ Siddhi IO HTTP ====================================== [![Jenkins Build Status](https://wso2.org/jenkins/job/siddhi/job/siddhi-io-http/badge/icon)](https://wso2.org/jenkins/job/siddhi/job/siddhi-io-http/) - [![GitHub (pre-)Release](https://img.shields.io/github/release/siddhi-io/siddhi-io-http/all.svg)](https://github.com/siddhi-io/siddhi-io-http/releases) - [![GitHub (Pre-)Release Date](https://img.shields.io/github/release-date-pre/siddhi-io/siddhi-io-http.svg)](https://github.com/siddhi-io/siddhi-io-http/releases) + [![GitHub Release](https://img.shields.io/github/release/siddhi-io/siddhi-io-http.svg)](https://github.com/siddhi-io/siddhi-io-http/releases) + [![GitHub Release Date](https://img.shields.io/github/release-date/siddhi-io/siddhi-io-http.svg)](https://github.com/siddhi-io/siddhi-io-http/releases) [![GitHub Open Issues](https://img.shields.io/github/issues-raw/siddhi-io/siddhi-io-http.svg)](https://github.com/siddhi-io/siddhi-io-http/issues) [![GitHub Last Commit](https://img.shields.io/github/last-commit/siddhi-io/siddhi-io-http.svg)](https://github.com/siddhi-io/siddhi-io-http/commits/master) [![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0) @@ -15,7 +15,7 @@ For information on Siddhi and i ## Download * Versions 2.x and above with group id `io.siddhi.extension.*` from here. -* Versions 1.x and lower with group id `org.wso2.extension.siddhi.*` from here. +* Versions 1.x and lower with group id `org.wso2.extension.siddhi.*` from here. ## Latest API Docs diff --git a/mkdocs.yml b/mkdocs.yml index bdf548bf..545e4ccf 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -37,54 +37,18 @@ pages: - 2.0.8: api/2.0.8.md - 2.0.7: api/2.0.7.md - 2.0.6: api/2.0.6.md - - 2.0.5: api/2.0.5.md - 2.0.4: api/2.0.4.md - - 2.0.3: api/2.0.3.md - - 2.0.2: api/2.0.2.md - - 2.0.1: api/2.0.1.md - 2.0.0: api/2.0.0.md - 1.2.2: api/1.2.2.md - 1.2.1: api/1.2.1.md - 1.2.0: api/1.2.0.md - 1.1.5: api/1.1.5.md - - 1.1.4: api/1.1.4.md - - 1.1.3: api/1.1.3.md - 1.1.2: api/1.1.2.md - - 1.1.1: api/1.1.1.md - 1.1.0: api/1.1.0.md - 1.0.45: api/1.0.45.md - - 1.0.44: api/1.0.44.md - - 1.0.43: api/1.0.43.md - - 1.0.42: api/1.0.42.md - - 1.0.41: api/1.0.41.md - - 1.0.40: api/1.0.40.md - 1.0.39: api/1.0.39.md - - 1.0.37: api/1.0.37.md - - 1.0.36: api/1.0.36.md - - 1.0.35: api/1.0.35.md - - 1.0.34: api/1.0.34.md - - 1.0.33: api/1.0.33.md - - 1.0.32: api/1.0.32.md - - 1.0.31: api/1.0.31.md - - 1.0.30: api/1.0.30.md - 1.0.29: api/1.0.29.md - - 1.0.28: api/1.0.28.md - - 1.0.27: api/1.0.27.md - - 1.0.26: api/1.0.26.md - - 1.0.25: api/1.0.25.md - - 1.0.24: api/1.0.24.md - - 1.0.22: api/1.0.22.md - - 1.0.21: api/1.0.21.md - - 1.0.20: api/1.0.20.md - - 1.0.19: api/1.0.19.md - 1.0.18: api/1.0.18.md - - 1.0.17: api/1.0.17.md - - 1.0.16: api/1.0.16.md - - 1.0.15: api/1.0.15.md - - 1.0.14: api/1.0.14.md - - 1.0.13: api/1.0.13.md - - 1.0.12: api/1.0.12.md - - 1.0.11: api/1.0.11.md - 1.0.10: api/1.0.10.md - 1.0.4: api/1.0.4.md - License: license.md diff --git a/pom.xml b/pom.xml index 1817773b..a898466a 100644 --- a/pom.xml +++ b/pom.xml @@ -36,7 +36,7 @@ io.siddhi.extension.io.http siddhi-io-http-parent - 2.0.9-SNAPSHOT + 2.1.0-SNAPSHOT Siddhi IO Extension - HTTP IO Aggregator http://wso2.org @@ -398,7 +398,7 @@ 5.0.2 2.0.1 5.0.2 - 5.0.2 + 5.1.2 [5.0.0,6.0.0) 1.0.0-m3 4.10.0 diff --git a/tests/distribution/pom.xml b/tests/distribution/pom.xml index 67b874bf..2dd4906b 100644 --- a/tests/distribution/pom.xml +++ b/tests/distribution/pom.xml @@ -18,14 +18,14 @@ siddhi-io-http-tests io.siddhi.extension.io.http - 2.0.9-SNAPSHOT + 2.1.0-SNAPSHOT ../pom.xml 4.0.0 org.wso2.extension.io.http.test.distribution pom - WSO2 HTTP IO - Test Distribution + HTTP IO - Test Distribution http://wso2.com diff --git a/tests/osgi-tests/pom.xml b/tests/osgi-tests/pom.xml index 01f04b43..07a16ab4 100644 --- a/tests/osgi-tests/pom.xml +++ b/tests/osgi-tests/pom.xml @@ -19,7 +19,7 @@ siddhi-io-http-tests io.siddhi.extension.io.http - 2.0.9-SNAPSHOT + 2.1.0-SNAPSHOT ../pom.xml diff --git a/tests/pom.xml b/tests/pom.xml index 02d4d2c0..cf2cb8ec 100644 --- a/tests/pom.xml +++ b/tests/pom.xml @@ -18,14 +18,14 @@ siddhi-io-http-parent io.siddhi.extension.io.http - 2.0.9-SNAPSHOT + 2.1.0-SNAPSHOT ../pom.xml 4.0.0 siddhi-io-http-tests pom - WSO2 HTTP IO - Tests + HTTP IO - Tests http://wso2.com