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="Name | -Description | -Default Value | -Possible Data Types | -Optional | -Dynamic | -
---|---|---|---|---|---|
publisher.url | -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 |
- - | STRING | -No | -No | -
basic.auth.username | -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. | -- | STRING | -Yes | -No | -
basic.auth.password | -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. | -- | STRING | -Yes | -No | -
https.truststore.file | -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. | -${carbon.home}/resources/security/client-truststore.jks | -STRING | -Yes | -No | -
https.truststore.password | -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. | -wso2carbon | -STRING | -Yes | -No | -
headers | -The 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. | -- | STRING | -Yes | -No | -
method | -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. | -POST | -STRING | -Yes | -No | -
socket.idle.timeout | -Socket timeout value in millisecond | -6000 | -INT | -Yes | -No | -
chunk.disabled | -port: Port number of the remote service | -false | -BOOL | -Yes | -No | -
ssl.protocol | -The SSL protocol version | -TLS | -STRING | -Yes | -No | -
parameters | -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'" | -null | -STRING | -Yes | -No | -
ciphers | -List of ciphers to be used. This parameter should include under parameters Ex: 'ciphers:TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256' | -null | -STRING | -Yes | -No | -
ssl.enabled.protocols | -SSL/TLS protocols to be enabled. This parameter should be in camel case format(sslEnabledProtocols) under parameters. Ex 'sslEnabledProtocols:true' | -null | -STRING | -Yes | -No | -
client.enable.session.creation | -Enable HTTP session creation.This parameter should include under parameters Ex: 'client.enable.session.creation:true' | -null | -STRING | -Yes | -No | -
follow.redirect | -Redirect related enabled. | -true | -BOOL | -Yes | -No | -
max.redirect.count | -Maximum redirect count. | -5 | -INT | -Yes | -No | -
tls.store.type | -TLS store type to be used. | -JKS | -STRING | -Yes | -No | -
proxy.host | -Proxy server host | -null | -STRING | -Yes | -No | -
proxy.port | -Proxy server port | -null | -STRING | -Yes | -No | -
proxy.username | -Proxy server username | -null | -STRING | -Yes | -No | -
proxy.password | -Proxy server password | -null | -STRING | -Yes | -No | -
client.bootstrap.configuration | -Client bootsrap configurations. Expected format of these parameters is as follows: "'client.bootstrap.nodelay:xxx','client.bootstrap.keepalive:xxx'" | -TODO | -STRING | -Yes | -No | -
client.bootstrap.nodelay | -Http client no delay. | -true | -BOOL | -Yes | -No | -
client.bootstrap.keepalive | -Http client keep alive. | -true | -BOOL | -Yes | -No | -
client.bootstrap.sendbuffersize | -Http client send buffer size. | -1048576 | -INT | -Yes | -No | -
client.bootstrap.recievebuffersize | -Http client receive buffer size. | -1048576 | -INT | -Yes | -No | -
client.bootstrap.connect.timeout | -Http client connection timeout. | -15000 | -INT | -Yes | -No | -
client.bootstrap.socket.reuse | -To enable http socket reuse. | -false | -BOOL | -Yes | -No | -
client.bootstrap.socket.timeout | -Http client socket timeout. | -15 | -STRING | -Yes | -No | -
client.threadpool.configurations | -Thread pool configuration. Expected format of these parameters is as follows: "'client.connection.pool.count:xxx','client.max.active.connections.per.pool:xxx'" | -TODO | -STRING | -Yes | -No | -
client.connection.pool.count | -Connection pool count. | -0 | -INT | -Yes | -No | -
client.max.active.connections.per.pool | -Active connections per pool. | --1 | -INT | -Yes | -No | -
client.min.idle.connections.per.pool | -Minimum ideal connection per pool. | -0 | -INT | -Yes | -No | -
client.max.idle.connections.per.pool | -Maximum ideal connection per pool. | -100 | -INT | -Yes | -No | -
client.min.eviction.idle.time | -Minimum eviction idle time. | -5 * 60 * 1000 | -STRING | -Yes | -No | -
sender.thread.count | -Http sender thread count. | -20 | -STRING | -Yes | -No | -
event.group.executor.thread.size | -Event group executor thread size. | -15 | -STRING | -Yes | -No | -
max.wait.for.client.connection.pool | -Maximum wait for client connection pool. | -60000 | -STRING | -Yes | -No | -
Name | -Description | -Default Value | -Possible Parameters | -
---|---|---|---|
clientBootstrapBossGroupSize | -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. | -4 | -Any integer | -
clientBootstrapWorkerGroupSize | -property to configure number of worker threads, which performs non blocking read and write for one or more channels in non-blocking mode. | -8 | -Any integer | -
trustStoreLocation | -The default truststore file path. | -${carbon.home}/resources/security/client-truststore.jks | -Path to client-truststore.jks | -
trustStorePassword | -The default truststore password. | -wso2carbon | -Truststore password | -
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'
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.