Kafka runs as a cluster comprised of one or more servers each of which is called a broker. Kafka brokers stream data in the form of messages. These messages are published to a topic.
Kafka topics are divided into partitions. Spark Structured Streaming can read the partitions of the topics in parallel. This gives better throughput and could be used to scale the number of messages processed. Message ordering is guaranteed only within partitions. For optimal performance you should have multiple partitions. You can create or import a Kafka data object.
When you configure the Kafka data object, specify the topic name that you read from or write to. You can specify the topic name or use a regular expression for the topic name pattern only when you read from Kafka. To subscribe to multiple topics that match a pattern, you can specify a regular expression. When you run the application on the cluster, the pattern matching is done against topics before the application runs. If you add a topic with a similar pattern when the application is already running, the application will not read from the topic.
After you create a Kafka data object, create a read operation. You can use the Kafka data object read operation as a source in streaming mappings. If you want to configure high availability for the mapping, ensure that the Kafka cluster is highly available. You can also read from a Kerberised Kafka cluster.
When you configure the data operation read properties, you can specify the time from which the Kafka source starts reading Kafka messages from a Kafka topic.
You can associate the data object with an intelligent structure model and directly parse input from text, CSV, XML, Avro, or JSON input files.
When you configure the data operation properties, specify the format in which the Kafka data object reads data. You can specify XML, JSON, Avro, or Flat as format. When you specify XML format, you must provide a XSD file. When you specify Avro format, provide a sample Avro schema in a .avsc file. When you specify JSON or Flat format, you must provide a sample file.
You can pass any payload format directly from source to target in Streaming mappings. You can project columns in binary format pass a payload from source to target in its original form or to pass a payload format that is not supported.
Streaming mappings can read, process, and write hierarchical data. You can use array, struct, and map complex data types to process the hierarchical data. You assign complex data types to ports in a mapping to flow hierarchical data. Ports that flow hierarchical data are called complex ports.
For more information about processing hierarchical data, see the
Data Engineering Integration User Guide
.
If you use a Kafka data object in a streaming mapping, you cannot use a MapR Streams data object in the same mapping.
Kafka Combinations Support Matrix
The following table shows the different authentication mechanisms that you can use against listener protocols in a streaming mapping with a Kafka source:
Protocols
| Authentication Mechanisms
|
SSL+TLS1.0,TLS1.1,TLS1.2
| Yes
| Yes
| Yes
|
SASL_SSL+TLS1.0
| Yes
| Yes
| NA
|
SASL_SSL+TLS1.1
| Yes
| Yes
| NA
|
SASL_SSL+TLS1.2
| Yes
| Yes
| NA
|
SASL_SSL+TLS1.0,TLS1.1,TLS1.2
| Yes
| Yes
| NA
|