Class ChangelogSocketExample
java.lang.Object
org.apache.flink.table.examples.java.connectors.ChangelogSocketExample
Example for implementing a custom
DynamicTableSource and a DecodingFormat.
The example implements a table source with a decoding format that supports changelog semantics.
The SocketDynamicTableFactory illustrates how connector components play together. It
can serve as a reference implementation for implementing own connectors and/or formats.
The SocketDynamicTableSource uses a simple single-threaded Source to open a
socket that listens for incoming bytes. The raw bytes are decoded into rows by a pluggable
format. The format expects a changelog flag as the first column.
In particular, the example shows how to
- create factories that parse and validate options,
- implement table connectors,
- implement and discover custom formats,
- and use provided utilities such as data structure converters and the
FactoryUtil.
Usage: ChangelogSocketExample --hostname <localhost> --port <9999>
Use the following command to ingest data in a terminal:
nc -lk 9999
INSERT|Alice|12
INSERT|Bob|5
DELETE|Alice|12
INSERT|Alice|18
The result is written to stdout.
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
ChangelogSocketExample
public ChangelogSocketExample()
-
-
Method Details
-
main
- Throws:
Exception
-