Skip to main content

tcp

A stream worker application can be configured to publish events via the TCP transport by adding the type='tcp' annotation at the top of an event stream definition.

Syntax

CREATE SINK <NAME> WITH (type="tcp", map.type="<STRING>", url="<STRING>", sync="<STRING>", tcp.no.delay="<BOOL>", keep.alive="<BOOL>", worker.threads="<INT|LONG>")

Query Parameters

NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
urlThe URL to which outgoing events should be published via TCP. The URL should adhere to tcp://<host>:<port>/<context> format.STRINGNoNo
syncThis parameter defines whether the events should be published in a synchronized manner or not. If sync = true, then the worker will wait for the ack after sending the message. Else it will not wait for an ack.falseSTRINGYesYes
tcp.no.delayThis is to specify whether to disable Nagle algorithm during message passing. If tcp.no.delay = true, the execution of Nagle algorithm will be disabled in the underlying TCP logic. Hence there will be no delay between two successive writes to the TCP connection. Else there can be a constant ack delay.trueBOOLYesNo
keep.aliveThis property defines whether the server should be kept alive when there are no connections available.trueBOOLYesNo
worker.threadsNumber of threads to publish events.10INT LONGYesNo

Example 1

CREATE SINK Foo WITH (type = 'tcp', url='tcp://localhost:8080/abc', sync='true' map.type='binary') (attribute1 string, attribute2 int);

A sink of type tcp has been defined. All events arriving at Foo stream via TCP transport will be sent to the URL tcp://localhost:8080/abc in a synchronous manner.