IBM Streams 4.2.1

Operator UDPSink

Primitive operator image not displayed. Problem loading file: ../../image/tk$spl/op$spl.adapter$UDPSink.svg

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 UDPSink operator throws an exception in the following cases:
  • 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.

Input Ports

Ports (0)

The UDPSink operator is configurable with a single input port, which ingests tuples to be written to UDP packets.

Properties

Parameters

This operator supports 12 parameters.

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

compression

Specifies the compression mode. For more information, see the compression parameter in the FileSink operator.

Properties

encoding

Specifies the character set encoding of the output. For more information, see the encoding parameter in the FileSink operator.

Properties

format

Specifies the format of the data. For more information, see the format parameter in the FileSink operator.

Properties

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

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

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

quoteStrings

Specifies whether to generate quoted strings for csv format. For more information, see the quoteStrings parameter in the FileSink operator.

Properties

sendBufferSize

Specifies the kernel send buffer size for the UDP socket.

Properties

separator

Specifies the separator character for the csv format. For more information, see the separator parameter in the FileSink operator.

Properties

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

writePunctuations

Specifies whether to write punctuations to the output. For more information, see the writePunctuations parameter in the FileSink operator.

Properties

Code Templates

UDPSink with Address
() as ${sinkPrefix}Sink = UDPSink(${inputStream}) {
            param
                address : "${hostOrIp}";
                port : "${sinkPort}";
        }
      

UDPSink with Name
() as ${sinkPrefix}Sink = UDPSink(${inputStream}) {
            param
                name : "${name}";
        }
      

Libraries

spl-std-tk-lib
Library Name: streams-stdtk-runtime, streams_boost_iostreams, streams_boost_system
Include Path: ../../../impl/include