Operator UDPSink
The UDPSink operator writes data to a UDP socket in the form of tuples (and punctuation). Each tuple must fit into a single UDP packet and a single UDP packet contains only a single tuple or punctuation.
Checkpointed data
When the UDPSink operator is checkpointed, logic state variables (if present) are saved in checkpoint.
Behavior in a consistent region
The UDPSink operator can be an operator within the reachability graph of a consistent region. It cannot be the start of a consistent region. When in a consistent region, replayed tuples are rewritten to the UDP socket. Logic state variables (if present) are also automatically checkpointed and resetted.
Checkpointing behavior in an autonomous region
When the UDPSink operator is in an autonomous region and configured with config checkpoint : periodic(T) clause, a background thread in SPL Runtime checkpoints the operator every T seconds, and such periodic checkpointing activity is asynchronous to tuple processing. Upon restart, the operator restores its state from the last checkpoint.
When the UDPSink operator is in an autonomous region and configured with config checkpoint : operatorDriven clause, no checkpoint is taken at runtime. Upon restart, the operator restores to its initial state.
Such checkpointing behavior is subject to change in the future.
Exceptions
- The host cannot be resolved.
- The name cannot be located.
Examples
This example uses the UDPSink operator.
composite Main {
graph
stream<rstring name, uint32 age, uint64 salary> Employees = Beacon() {}
// send messages to "some.node.some.host", using port for "ftp"
() as Beat = UDPSink(Employees)
{
param
address : "some.node.some.host";
port : "ftp";
}
// similar to above, but employ a certain send buffer size
() as Beat1 = UDPSink(Employees)
{
param
address : "some.node.some.host";
port : 80u;
sendBufferSize : 10240u;
}
// send messages to the source registered at the name server
() as Beat2 = UDPSink(Employees)
{
param
name : "my_server";
}
}
Summary
- Ports
- This operator has 1 input port and 0 output ports.
- Windowing
- This operator does not accept any windowing configurations.
- Parameters
- This operator supports 12 parameters.
Optional: address, compression, encoding, format, hasDelayField, name, port, quoteStrings, sendBufferSize, separator, timeToLive, writePunctuations
- Metrics
- This operator does not report any metrics.
Properties
- Implementation
- C++
- Threading
- Always - Operator always provides a single threaded execution context.
- Ports (0)
-
The UDPSink operator is configurable with a single input port, which ingests tuples to be written to UDP packets.
- Properties
-
- Optional: false
- ControlPort: false
- TupleMutationAllowed: false
- WindowingMode: NonWindowed
- WindowPunctuationInputMode: Oblivious
Optional: address, compression, encoding, format, hasDelayField, name, port, quoteStrings, sendBufferSize, separator, timeToLive, writePunctuations
- address
-
Specifies the address of the receiver where the UDP packets are sent. It must be specified when the name parameter is not specified and it cannot be specified otherwise. The parameter value can be a host name or an IP address.
- Properties
-
- Type: rstring
- Cardinality: 1
- Optional: true
- ExpressionMode: AttributeFree
- compression
-
Specifies the compression mode. For more information, see the compression parameter in the FileSink operator.
- Properties
-
- Type: CompressionAlg (zlib, gzip, bzip2)
- Cardinality: 1
- Optional: true
- ExpressionMode: CustomLiteral
- encoding
-
Specifies the character set encoding of the output. For more information, see the encoding parameter in the FileSink operator.
- Properties
-
- Type: rstring
- Cardinality: 1
- Optional: true
- ExpressionMode: AttributeFree
- format
-
Specifies the format of the data. For more information, see the format parameter in the FileSink operator.
- Properties
-
- Type: DataFormat (csv, txt, bin, block, line)
- Cardinality: 1
- Optional: true
- ExpressionMode: CustomLiteral
- hasDelayField
-
Specifies that the format contains inter-arrival delays as the first field. For more information, see the hasDelayField parameter in the FileSink operator.
- Properties
-
- Type: boolean
- Cardinality: 1
- Optional: true
- ExpressionMode: Constant
- name
-
Specifies the name that is used to look up the address and port pair for the UDPSource operator from the name service, so that this UDPSink operator can send its UDP packets to the registered address at the registered port.
These names are automatically prefixed with the application scope, thus applications with differing scopes cannot communicate through the same name. The application scope can be set by using config applicationScope on the main composite in the application. It is an error for a name with the same application scope to be defined multiple times with an instance. If multiple operators attempt to define the same name, the second and subsequent operators keep trying periodically to register the name with an error message for each failure.
- Properties
-
- Type: rstring
- Cardinality: 1
- Optional: true
- ExpressionMode: AttributeFree
- port
-
Specifies the port address to which the UDP packets are sent. It must be specified when the name parameter is not specified and it cannot be specified otherwise. For more information, see the port parameter in the UDPSource operator.
- Properties
-
- Cardinality: 1
- Optional: true
- ExpressionMode: AttributeFree
- quoteStrings
-
Specifies whether to generate quoted strings for csv format. For more information, see the quoteStrings parameter in the FileSink operator.
- Properties
-
- Type: boolean
- Cardinality: 1
- Optional: true
- ExpressionMode: Constant
- sendBufferSize
-
Specifies the kernel send buffer size for the UDP socket.
- Properties
-
- Type: uint32
- Cardinality: 1
- Optional: true
- ExpressionMode: AttributeFree
- separator
-
Specifies the separator character for the csv format. For more information, see the separator parameter in the FileSink operator.
- Properties
-
- Cardinality: 1
- Optional: true
- ExpressionMode: Constant
- timeToLive
-
Specifies the time-to-live (TTL) on generated packets. TTL controls the lifespan of generated packets on the network. If the operator is configured with a multicast address, this value is used as the multicast TTL IP header field. Otherwise, it is used as the TTL IP header field.
If you do not specify a value for this parameter, a system-specific default is used.
- Properties
-
- Type: uint8
- Cardinality: 1
- Optional: true
- ExpressionMode: Constant
- writePunctuations
-
Specifies whether to write punctuations to the output. For more information, see the writePunctuations parameter in the FileSink operator.
- Properties
-
- Type: boolean
- Cardinality: 1
- Optional: true
- ExpressionMode: Constant
- UDPSink with Address
-
() as ${sinkPrefix}Sink = UDPSink(${inputStream}) { param address : "${hostOrIp}"; port : "${sinkPort}"; }
- UDPSink with Name
-
() as ${sinkPrefix}Sink = UDPSink(${inputStream}) { param name : "${name}"; }
- spl-std-tk-lib