diff --git a/spring-cloud-stream-binder-kafka/3.0.0.RELEASE/reference/html/Guardfile b/spring-cloud-stream-binder-kafka/3.0.0.RELEASE/reference/html/Guardfile new file mode 100644 index 00000000..bdd4d729 --- /dev/null +++ b/spring-cloud-stream-binder-kafka/3.0.0.RELEASE/reference/html/Guardfile @@ -0,0 +1,20 @@ +require 'asciidoctor' +require 'erb' + +guard 'shell' do + watch(/.*\.adoc$/) {|m| + Asciidoctor.render_file('index.adoc', \ + :in_place => true, \ + :safe => Asciidoctor::SafeMode::UNSAFE, \ + :attributes=> { \ + 'source-highlighter' => 'prettify', \ + 'icons' => 'font', \ + 'linkcss'=> 'true', \ + 'copycss' => 'true', \ + 'doctype' => 'book'}) + } +end + +guard 'livereload' do + watch(%r{^.+\.(css|js|html)$}) +end diff --git a/spring-cloud-stream-binder-kafka/3.0.0.RELEASE/reference/html/README.html b/spring-cloud-stream-binder-kafka/3.0.0.RELEASE/reference/html/README.html new file mode 100644 index 00000000..844ced57 --- /dev/null +++ b/spring-cloud-stream-binder-kafka/3.0.0.RELEASE/reference/html/README.html @@ -0,0 +1,1356 @@ + + + + + + + +Apache Kafka Binder + + + + + + + + + + +
+
+
+
+
+CircleCI +
+
+
+
+codecov +
+
+
+
+Gitter +
+
+ +
+
+
+

Apache Kafka Binder

+
+
+

Usage

+
+

To use Apache Kafka binder, you need to add spring-cloud-stream-binder-kafka as a dependency to your Spring Cloud Stream application, as shown in the following example for Maven:

+
+
+
+
<dependency>
+  <groupId>org.springframework.cloud</groupId>
+  <artifactId>spring-cloud-stream-binder-kafka</artifactId>
+</dependency>
+
+
+
+

Alternatively, you can also use the Spring Cloud Stream Kafka Starter, as shown in the following example for Maven:

+
+
+
+
<dependency>
+  <groupId>org.springframework.cloud</groupId>
+  <artifactId>spring-cloud-starter-stream-kafka</artifactId>
+</dependency>
+
+
+
+
+

Overview

+
+

The following image shows a simplified diagram of how the Apache Kafka binder operates:

+
+
+
+kafka binder +
+
Figure 1. Kafka Binder
+
+
+

The Apache Kafka Binder implementation maps each destination to an Apache Kafka topic. +The consumer group maps directly to the same Apache Kafka concept. +Partitioning also maps directly to Apache Kafka partitions as well.

+
+
+

The binder currently uses the Apache Kafka kafka-clients version 2.3.1. +This client can communicate with older brokers (see the Kafka documentation), but certain features may not be available. +For example, with versions earlier than 0.11.x.x, native headers are not supported. +Also, 0.11.x.x does not support the autoAddPartitions property.

+
+
+
+

Configuration Options

+
+

This section contains the configuration options used by the Apache Kafka binder.

+
+
+

For common configuration options and properties pertaining to binder, see the core documentation.

+
+
+

Kafka Binder Properties

+
+
+
spring.cloud.stream.kafka.binder.brokers
+
+

A list of brokers to which the Kafka binder connects.

+
+

Default: localhost.

+
+
+
spring.cloud.stream.kafka.binder.defaultBrokerPort
+
+

brokers allows hosts specified with or without port information (for example, host1,host2:port2). +This sets the default port when no port is configured in the broker list.

+
+

Default: 9092.

+
+
+
spring.cloud.stream.kafka.binder.configuration
+
+

Key/Value map of client properties (both producers and consumer) passed to all clients created by the binder. +Due to the fact that these properties are used by both producers and consumers, usage should be restricted to common properties — for example, security settings. +Unknown Kafka producer or consumer properties provided through this configuration are filtered out and not allowed to propagate. +Properties here supersede any properties set in boot.

+
+

Default: Empty map.

+
+
+
spring.cloud.stream.kafka.binder.consumerProperties
+
+

Key/Value map of arbitrary Kafka client consumer properties. +In addition to support known Kafka consumer properties, unknown consumer properties are allowed here as well. +Properties here supersede any properties set in boot and in the configuration property above.

+
+

Default: Empty map.

+
+
+
spring.cloud.stream.kafka.binder.headers
+
+

The list of custom headers that are transported by the binder. +Only required when communicating with older applications (⇐ 1.3.x) with a kafka-clients version < 0.11.0.0. Newer versions support headers natively.

+
+

Default: empty.

+
+
+
spring.cloud.stream.kafka.binder.healthTimeout
+
+

The time to wait to get partition information, in seconds. +Health reports as down if this timer expires.

+
+

Default: 10.

+
+
+
spring.cloud.stream.kafka.binder.requiredAcks
+
+

The number of required acks on the broker. +See the Kafka documentation for the producer acks property.

+
+

Default: 1.

+
+
+
spring.cloud.stream.kafka.binder.minPartitionCount
+
+

Effective only if autoCreateTopics or autoAddPartitions is set. +The global minimum number of partitions that the binder configures on topics on which it produces or consumes data. +It can be superseded by the partitionCount setting of the producer or by the value of instanceCount * concurrency settings of the producer (if either is larger).

+
+

Default: 1.

+
+
+
spring.cloud.stream.kafka.binder.producerProperties
+
+

Key/Value map of arbitrary Kafka client producer properties. +In addition to support known Kafka producer properties, unknown producer properties are allowed here as well. +Properties here supersede any properties set in boot and in the configuration property above.

+
+

Default: Empty map.

+
+
+
spring.cloud.stream.kafka.binder.replicationFactor
+
+

The replication factor of auto-created topics if autoCreateTopics is active. +Can be overridden on each binding.

+
+

Default: 1.

+
+
+
spring.cloud.stream.kafka.binder.autoCreateTopics
+
+

If set to true, the binder creates new topics automatically. +If set to false, the binder relies on the topics being already configured. +In the latter case, if the topics do not exist, the binder fails to start.

+
+ + + + + +
+ + +This setting is independent of the auto.create.topics.enable setting of the broker and does not influence it. +If the server is set to auto-create topics, they may be created as part of the metadata retrieval request, with default broker settings. +
+
+
+

Default: true.

+
+
+
spring.cloud.stream.kafka.binder.autoAddPartitions
+
+

If set to true, the binder creates new partitions if required. +If set to false, the binder relies on the partition size of the topic being already configured. +If the partition count of the target topic is smaller than the expected value, the binder fails to start.

+
+

Default: false.

+
+
+
spring.cloud.stream.kafka.binder.transaction.transactionIdPrefix
+
+

Enables transactions in the binder. See transaction.id in the Kafka documentation and Transactions in the spring-kafka documentation. +When transactions are enabled, individual producer properties are ignored and all producers use the spring.cloud.stream.kafka.binder.transaction.producer.* properties.

+
+

Default null (no transactions)

+
+
+
spring.cloud.stream.kafka.binder.transaction.producer.*
+
+

Global producer properties for producers in a transactional binder. +See spring.cloud.stream.kafka.binder.transaction.transactionIdPrefix and Kafka Producer Properties and the general producer properties supported by all binders.

+
+

Default: See individual producer properties.

+
+
+
spring.cloud.stream.kafka.binder.headerMapperBeanName
+
+

The bean name of a KafkaHeaderMapper used for mapping spring-messaging headers to and from Kafka headers. +Use this, for example, if you wish to customize the trusted packages in a BinderHeaderMapper bean that uses JSON deserialization for the headers. +If this custom BinderHeaderMapper bean is not made available to the binder using this property, then the binder will look for a header mapper bean with the name kafkaBinderHeaderMapper that is of type BinderHeaderMapper before falling back to a default BinderHeaderMapper created by the binder.

+
+

Default: none.

+
+
+
+
+
+
+

Kafka Consumer Properties

+
+ + + + + +
+ + +To avoid repetition, Spring Cloud Stream supports setting values for all channels, in the format of spring.cloud.stream.kafka.default.consumer.<property>=<value>. +
+
+
+

The following properties are available for Kafka consumers only and +must be prefixed with spring.cloud.stream.kafka.bindings.<channelName>.consumer..

+
+
+
+
admin.configuration
+
+

Since version 2.1.1, this property is deprecated in favor of topic.properties, and support for it will be removed in a future version.

+
+
admin.replicas-assignment
+
+

Since version 2.1.1, this property is deprecated in favor of topic.replicas-assignment, and support for it will be removed in a future version.

+
+
admin.replication-factor
+
+

Since version 2.1.1, this property is deprecated in favor of topic.replication-factor, and support for it will be removed in a future version.

+
+
autoRebalanceEnabled
+
+

When true, topic partitions is automatically rebalanced between the members of a consumer group. +When false, each consumer is assigned a fixed set of partitions based on spring.cloud.stream.instanceCount and spring.cloud.stream.instanceIndex. +This requires both the spring.cloud.stream.instanceCount and spring.cloud.stream.instanceIndex properties to be set appropriately on each launched instance. +The value of the spring.cloud.stream.instanceCount property must typically be greater than 1 in this case.

+
+

Default: true.

+
+
+
ackEachRecord
+
+

When autoCommitOffset is true, this setting dictates whether to commit the offset after each record is processed. +By default, offsets are committed after all records in the batch of records returned by consumer.poll() have been processed. +The number of records returned by a poll can be controlled with the max.poll.records Kafka property, which is set through the consumer configuration property. +Setting this to true may cause a degradation in performance, but doing so reduces the likelihood of redelivered records when a failure occurs. +Also, see the binder requiredAcks property, which also affects the performance of committing offsets.

+
+

Default: false.

+
+
+
autoCommitOffset
+
+

Whether to autocommit offsets when a message has been processed. +If set to false, a header with the key kafka_acknowledgment of the type org.springframework.kafka.support.Acknowledgment header is present in the inbound message. +Applications may use this header for acknowledging messages. +See the examples section for details. +When this property is set to false, Kafka binder sets the ack mode to org.springframework.kafka.listener.AbstractMessageListenerContainer.AckMode.MANUAL and the application is responsible for acknowledging records. +Also see ackEachRecord.

+
+

Default: true.

+
+
+
autoCommitOnError
+
+

Effective only if autoCommitOffset is set to true. +If set to false, it suppresses auto-commits for messages that result in errors and commits only for successful messages. It allows a stream to automatically replay from the last successfully processed message, in case of persistent failures. +If set to true, it always auto-commits (if auto-commit is enabled). +If not set (the default), it effectively has the same value as enableDlq, auto-committing erroneous messages if they are sent to a DLQ and not committing them otherwise.

+
+

Default: not set.

+
+
+
resetOffsets
+
+

Whether to reset offsets on the consumer to the value provided by startOffset. +Must be false if a KafkaRebalanceListener is provided; see Using a KafkaRebalanceListener.

+
+

Default: false.

+
+
+
startOffset
+
+

The starting offset for new groups. +Allowed values: earliest and latest. +If the consumer group is set explicitly for the consumer 'binding' (through spring.cloud.stream.bindings.<channelName>.group), 'startOffset' is set to earliest. Otherwise, it is set to latest for the anonymous consumer group. +Also see resetOffsets (earlier in this list).

+
+

Default: null (equivalent to earliest).

+
+
+
enableDlq
+
+

When set to true, it enables DLQ behavior for the consumer. +By default, messages that result in errors are forwarded to a topic named error.<destination>.<group>. +The DLQ topic name can be configurable by setting the dlqName property. +This provides an alternative option to the more common Kafka replay scenario for the case when the number of errors is relatively small and replaying the entire original topic may be too cumbersome. +See [kafka-dlq-processing] processing for more information. +Starting with version 2.0, messages sent to the DLQ topic are enhanced with the following headers: x-original-topic, x-exception-message, and x-exception-stacktrace as byte[]. +By default, a failed record is sent to the same partition number in the DLQ topic as the original record. +See [dlq-partition-selection] for how to change that behavior. +Not allowed when destinationIsPattern is true.

+
+

Default: false.

+
+
+
dlqPartitions
+
+

When enableDlq is true, and this property is not set, a dead letter topic with the same number of partitions as the primary topic(s) is created. +Usually, dead-letter records are sent to the same partition in the dead-letter topic as the original record. +This behavior can be changed; see [dlq-partition-selection]. +If this property is set to 1 and there is no DqlPartitionFunction bean, all dead-letter records will be written to partition 0. +If this property is greater than 1, you MUST provide a DlqPartitionFunction bean. +Note that the actual partition count is affected by the binder’s minPartitionCount property.

+
+

Default: none

+
+
+
configuration
+
+

Map with a key/value pair containing generic Kafka consumer properties. +In addition to having Kafka consumer properties, other configuration properties can be passed here. +For example some properties needed by the application such as spring.cloud.stream.kafka.bindings.input.consumer.configuration.foo=bar.

+
+

Default: Empty map.

+
+
+
dlqName
+
+

The name of the DLQ topic to receive the error messages.

+
+

Default: null (If not specified, messages that result in errors are forwarded to a topic named error.<destination>.<group>).

+
+
+
dlqProducerProperties
+
+

Using this, DLQ-specific producer properties can be set. +All the properties available through kafka producer properties can be set through this property. +When native decoding is enabled on the consumer (i.e., useNativeDecoding: true) , the application must provide corresponding key/value serializers for DLQ. +This must be provided in the form of dlqProducerProperties.configuration.key.serializer and dlqProducerProperties.configuration.value.serializer.

+
+

Default: Default Kafka producer properties.

+
+
+
standardHeaders
+
+

Indicates which standard headers are populated by the inbound channel adapter. +Allowed values: none, id, timestamp, or both. +Useful if using native deserialization and the first component to receive a message needs an id (such as an aggregator that is configured to use a JDBC message store).

+
+

Default: none

+
+
+
converterBeanName
+
+

The name of a bean that implements RecordMessageConverter. Used in the inbound channel adapter to replace the default MessagingMessageConverter.

+
+

Default: null

+
+
+
idleEventInterval
+
+

The interval, in milliseconds, between events indicating that no messages have recently been received. +Use an ApplicationListener<ListenerContainerIdleEvent> to receive these events. +See Example: Pausing and Resuming the Consumer for a usage example.

+
+

Default: 30000

+
+
+
destinationIsPattern
+
+

When true, the destination is treated as a regular expression Pattern used to match topic names by the broker. +When true, topics are not provisioned, and enableDlq is not allowed, because the binder does not know the topic names during the provisioning phase. +Note, the time taken to detect new topics that match the pattern is controlled by the consumer property metadata.max.age.ms, which (at the time of writing) defaults to 300,000ms (5 minutes). +This can be configured using the configuration property above.

+
+

Default: false

+
+
+
topic.properties
+
+

A Map of Kafka topic properties used when provisioning new topics — for example, spring.cloud.stream.kafka.bindings.input.consumer.topic.properties.message.format.version=0.9.0.0

+
+

Default: none.

+
+
+
topic.replicas-assignment
+
+

A Map<Integer, List<Integer>> of replica assignments, with the key being the partition and the value being the assignments. +Used when provisioning new topics. +See the NewTopic Javadocs in the kafka-clients jar.

+
+

Default: none.

+
+
+
topic.replication-factor
+
+

The replication factor to use when provisioning topics. Overrides the binder-wide setting. +Ignored if replicas-assignments is present.

+
+

Default: none (the binder-wide default of 1 is used).

+
+
+
pollTimeout
+
+

Timeout used for polling in pollable consumers.

+
+

Default: 5 seconds.

+
+
+
+
+
+
+

Consuming Batches

+
+

Starting with version 3.0, when spring.cloud.stream.binding.<name>.consumer.batch-mode is set to true, all of the records received by polling the Kafka Consumer will be presented as a List<?> to the listener method. +Otherwise, the method will be called with one record at a time. +The size of the batch is controlled by Kafka consumer properties max.poll.records, min.fetch.bytes, fetch.max.wait.ms; refer to the Kafka documentation for more information.

+
+
+ + + + + +
+ + +Retry within the binder is not supported when using batch mode, so maxAttempts will be overridden to 1. +You can configure a SeekToCurrentBatchErrorHandler (using a ListenerContainerCustomizer) to achieve similar functionality to retry in the binder. +You can also use a manual AckMode and call Ackowledgment.nack(index, sleep) to commit the offsets for a partial batch and have the remaining records redelivered. +Refer to the Spring for Apache Kafka documentation for more information about these techniques. +
+
+
+
+

Kafka Producer Properties

+
+ + + + + +
+ + +To avoid repetition, Spring Cloud Stream supports setting values for all channels, in the format of spring.cloud.stream.kafka.default.producer.<property>=<value>. +
+
+
+

The following properties are available for Kafka producers only and +must be prefixed with spring.cloud.stream.kafka.bindings.<channelName>.producer..

+
+
+
+
admin.configuration
+
+

Since version 2.1.1, this property is deprecated in favor of topic.properties, and support for it will be removed in a future version.

+
+
admin.replicas-assignment
+
+

Since version 2.1.1, this property is deprecated in favor of topic.replicas-assignment, and support for it will be removed in a future version.

+
+
admin.replication-factor
+
+

Since version 2.1.1, this property is deprecated in favor of topic.replication-factor, and support for it will be removed in a future version.

+
+
bufferSize
+
+

Upper limit, in bytes, of how much data the Kafka producer attempts to batch before sending.

+
+

Default: 16384.

+
+
+
sync
+
+

Whether the producer is synchronous.

+
+

Default: false.

+
+
+
sendTimeoutExpression
+
+

A SpEL expression evaluated against the outgoing message used to evaluate the time to wait for ack when synchronous publish is enabled — for example, headers['mySendTimeout']. +The value of the timeout is in milliseconds. +With versions before 3.0, the payload could not be used unless native encoding was being used because, by the time this expression was evaluated, the payload was already in the form of a byte[]. +Now, the expression is evaluated before the payload is converted.

+
+

Default: none.

+
+
+
batchTimeout
+
+

How long the producer waits to allow more messages to accumulate in the same batch before sending the messages. +(Normally, the producer does not wait at all and simply sends all the messages that accumulated while the previous send was in progress.) A non-zero value may increase throughput at the expense of latency.

+
+

Default: 0.

+
+
+
messageKeyExpression
+
+

A SpEL expression evaluated against the outgoing message used to populate the key of the produced Kafka message — for example, headers['myKey']. +With versions before 3.0, the payload could not be used unless native encoding was being used because, by the time this expression was evaluated, the payload was already in the form of a byte[]. +Now, the expression is evaluated before the payload is converted.

+
+

Default: none.

+
+
+
headerPatterns
+
+

A comma-delimited list of simple patterns to match Spring messaging headers to be mapped to the Kafka Headers in the ProducerRecord. +Patterns can begin or end with the wildcard character (asterisk). +Patterns can be negated by prefixing with !. +Matching stops after the first match (positive or negative). +For example !ask,as* will pass ash but not ask. +id and timestamp are never mapped.

+
+

Default: * (all headers - except the id and timestamp)

+
+
+
configuration
+
+

Map with a key/value pair containing generic Kafka producer properties.

+
+

Default: Empty map.

+
+
+
topic.properties
+
+

A Map of Kafka topic properties used when provisioning new topics — for example, spring.cloud.stream.kafka.bindings.output.producer.topic.properties.message.format.version=0.9.0.0

+
+
topic.replicas-assignment
+
+

A Map<Integer, List<Integer>> of replica assignments, with the key being the partition and the value being the assignments. +Used when provisioning new topics. +See the NewTopic Javadocs in the kafka-clients jar.

+
+

Default: none.

+
+
+
topic.replication-factor
+
+

The replication factor to use when provisioning topics. Overrides the binder-wide setting. +Ignored if replicas-assignments is present.

+
+

Default: none (the binder-wide default of 1 is used).

+
+
+
useTopicHeader
+
+

Set to true to override the default binding destination (topic name) with the value of the KafkaHeaders.TOPIC message header in the outbound message. +If the header is not present, the default binding destination is used. +Default: false.

+
+
recordMetadataChannel
+
+

The bean name of a MessageChannel to which successful send results should be sent; the bean must exist in the application context. +The message sent to the channel is the sent message (after conversion, if any) with an additional header KafkaHeaders.RECORD_METADATA. +The header contains a RecordMetadata object provided by the Kafka client; it includes the partition and offset where the record was written in the topic.

+
+
+
+
+

ResultMetadata meta = sendResultMsg.getHeaders().get(KafkaHeaders.RECORD_METADATA, RecordMetadata.class)

+
+
+

Failed sends go the producer error channel (if configured); see Error Channels. +Default: null

+
+
+

+

+
+
+ + + + + +
+ + +The Kafka binder uses the partitionCount setting of the producer as a hint to create a topic with the given partition count (in conjunction with the minPartitionCount, the maximum of the two being the value being used). +Exercise caution when configuring both minPartitionCount for a binder and partitionCount for an application, as the larger value is used. +If a topic already exists with a smaller partition count and autoAddPartitions is disabled (the default), the binder fails to start. +If a topic already exists with a smaller partition count and autoAddPartitions is enabled, new partitions are added. +If a topic already exists with a larger number of partitions than the maximum of (minPartitionCount or partitionCount), the existing partition count is used. +
+
+
+
+
compression
+
+

Set the compression.type producer property. +Supported values are none, gzip, snappy and lz4. +If you override the kafka-clients jar to 2.1.0 (or later), as discussed in the Spring for Apache Kafka documentation, and wish to use zstd compression, use spring.cloud.stream.kafka.bindings.<binding-name>.producer.configuration.compression.type=zstd.

+
+

Default: none.

+
+
+
+
+
+
+

Usage examples

+
+

In this section, we show the use of the preceding properties for specific scenarios.

+
+
+
Example: Setting autoCommitOffset to false and Relying on Manual Acking
+
+

This example illustrates how one may manually acknowledge offsets in a consumer application.

+
+
+

This example requires that spring.cloud.stream.kafka.bindings.input.consumer.autoCommitOffset be set to false. +Use the corresponding input channel name for your example.

+
+
+
+
@SpringBootApplication
+@EnableBinding(Sink.class)
+public class ManuallyAcknowdledgingConsumer {
+
+ public static void main(String[] args) {
+     SpringApplication.run(ManuallyAcknowdledgingConsumer.class, args);
+ }
+
+ @StreamListener(Sink.INPUT)
+ public void process(Message<?> message) {
+     Acknowledgment acknowledgment = message.getHeaders().get(KafkaHeaders.ACKNOWLEDGMENT, Acknowledgment.class);
+     if (acknowledgment != null) {
+         System.out.println("Acknowledgment provided");
+         acknowledgment.acknowledge();
+     }
+ }
+}
+
+
+
+
+
Example: Security Configuration
+
+

Apache Kafka 0.9 supports secure connections between client and brokers. +To take advantage of this feature, follow the guidelines in the Apache Kafka Documentation as well as the Kafka 0.9 security guidelines from the Confluent documentation. +Use the spring.cloud.stream.kafka.binder.configuration option to set security properties for all clients created by the binder.

+
+
+

For example, to set security.protocol to SASL_SSL, set the following property:

+
+
+
+
spring.cloud.stream.kafka.binder.configuration.security.protocol=SASL_SSL
+
+
+
+

All the other security properties can be set in a similar manner.

+
+
+

When using Kerberos, follow the instructions in the reference documentation for creating and referencing the JAAS configuration.

+
+
+

Spring Cloud Stream supports passing JAAS configuration information to the application by using a JAAS configuration file and using Spring Boot properties.

+
+
+
Using JAAS Configuration Files
+
+

The JAAS and (optionally) krb5 file locations can be set for Spring Cloud Stream applications by using system properties. +The following example shows how to launch a Spring Cloud Stream application with SASL and Kerberos by using a JAAS configuration file:

+
+
+
+
 java -Djava.security.auth.login.config=/path.to/kafka_client_jaas.conf -jar log.jar \
+   --spring.cloud.stream.kafka.binder.brokers=secure.server:9092 \
+   --spring.cloud.stream.bindings.input.destination=stream.ticktock \
+   --spring.cloud.stream.kafka.binder.configuration.security.protocol=SASL_PLAINTEXT
+
+
+
+
+
Using Spring Boot Properties
+
+

As an alternative to having a JAAS configuration file, Spring Cloud Stream provides a mechanism for setting up the JAAS configuration for Spring Cloud Stream applications by using Spring Boot properties.

+
+
+

The following properties can be used to configure the login context of the Kafka client:

+
+
+
+
spring.cloud.stream.kafka.binder.jaas.loginModule
+
+

The login module name. Not necessary to be set in normal cases.

+
+

Default: com.sun.security.auth.module.Krb5LoginModule.

+
+
+
spring.cloud.stream.kafka.binder.jaas.controlFlag
+
+

The control flag of the login module.

+
+

Default: required.

+
+
+
spring.cloud.stream.kafka.binder.jaas.options
+
+

Map with a key/value pair containing the login module options.

+
+

Default: Empty map.

+
+
+
+
+
+

The following example shows how to launch a Spring Cloud Stream application with SASL and Kerberos by using Spring Boot configuration properties:

+
+
+
+
 java --spring.cloud.stream.kafka.binder.brokers=secure.server:9092 \
+   --spring.cloud.stream.bindings.input.destination=stream.ticktock \
+   --spring.cloud.stream.kafka.binder.autoCreateTopics=false \
+   --spring.cloud.stream.kafka.binder.configuration.security.protocol=SASL_PLAINTEXT \
+   --spring.cloud.stream.kafka.binder.jaas.options.useKeyTab=true \
+   --spring.cloud.stream.kafka.binder.jaas.options.storeKey=true \
+   --spring.cloud.stream.kafka.binder.jaas.options.keyTab=/etc/security/keytabs/kafka_client.keytab \
+   --spring.cloud.stream.kafka.binder.jaas.options.principal=kafka-client-1@EXAMPLE.COM
+
+
+
+

The preceding example represents the equivalent of the following JAAS file:

+
+
+
+
KafkaClient {
+    com.sun.security.auth.module.Krb5LoginModule required
+    useKeyTab=true
+    storeKey=true
+    keyTab="/etc/security/keytabs/kafka_client.keytab"
+    principal="kafka-client-1@EXAMPLE.COM";
+};
+
+
+
+

If the topics required already exist on the broker or will be created by an administrator, autocreation can be turned off and only client JAAS properties need to be sent.

+
+
+ + + + + +
+ + +Do not mix JAAS configuration files and Spring Boot properties in the same application. +If the -Djava.security.auth.login.config system property is already present, Spring Cloud Stream ignores the Spring Boot properties. +
+
+
+ + + + + +
+ + +Be careful when using the autoCreateTopics and autoAddPartitions with Kerberos. +Usually, applications may use principals that do not have administrative rights in Kafka and Zookeeper. +Consequently, relying on Spring Cloud Stream to create/modify topics may fail. +In secure environments, we strongly recommend creating topics and managing ACLs administratively by using Kafka tooling. +
+
+
+
+
+
Example: Pausing and Resuming the Consumer
+
+

If you wish to suspend consumption but not cause a partition rebalance, you can pause and resume the consumer. +This is facilitated by adding the Consumer as a parameter to your @StreamListener. +To resume, you need an ApplicationListener for ListenerContainerIdleEvent instances. +The frequency at which events are published is controlled by the idleEventInterval property. +Since the consumer is not thread-safe, you must call these methods on the calling thread.

+
+
+

The following simple application shows how to pause and resume:

+
+
+
+
@SpringBootApplication
+@EnableBinding(Sink.class)
+public class Application {
+
+	public static void main(String[] args) {
+		SpringApplication.run(Application.class, args);
+	}
+
+	@StreamListener(Sink.INPUT)
+	public void in(String in, @Header(KafkaHeaders.CONSUMER) Consumer<?, ?> consumer) {
+		System.out.println(in);
+		consumer.pause(Collections.singleton(new TopicPartition("myTopic", 0)));
+	}
+
+	@Bean
+	public ApplicationListener<ListenerContainerIdleEvent> idleListener() {
+		return event -> {
+			System.out.println(event);
+			if (event.getConsumer().paused().size() > 0) {
+				event.getConsumer().resume(event.getConsumer().paused());
+			}
+		};
+	}
+
+}
+
+
+
+
+
+
+

Transactional Binder

+
+

Enable transactions by setting spring.cloud.stream.kafka.binder.transaction.transactionIdPrefix to a non-empty value, e.g. tx-. +When used in a processor application, the consumer starts the transaction; any records sent on the consumer thread participate in the same transaction. +When the listener exits normally, the listener container will send the offset to the transaction and commit it. +A common producer factory is used for all producer bindings configured using spring.cloud.stream.kafka.binder.transaction.producer.* properties; individual binding Kafka producer properties are ignored.

+
+
+ + + + + +
+ + +Normal binder retries (and dead lettering) are not supported with transactions because the retries will run in the original transaction, which may be rolled back and any published records will be rolled back too. +When retries are enabled (the common property maxAttempts is greater than zero) the retry properties are used to configure a DefaultAfterRollbackProcessor to enable retries at the container level. +Similarly, instead of publishing dead-letter records within the transaction, this functionality is moved to the listener container, again via the DefaultAfterRollbackProcessor which runs after the main transaction has rolled back. +
+
+
+

If you wish to use transactions in a source application, or from some arbitrary thread for producer-only transaction (e.g. @Scheduled method), you must get a reference to the transactional producer factory and define a KafkaTransactionManager bean using it.

+
+
+
+
+
+
@Bean
+public PlatformTransactionManager transactionManager(BinderFactory binders) {
+    ProducerFactory<byte[], byte[]> pf = ((KafkaMessageChannelBinder) binders.getBinder(null,
+            MessageChannel.class)).getTransactionalProducerFactory();
+    return new KafkaTransactionManager<>(pf);
+}
+
+
+
+
+
+

Notice that we get a reference to the binder using the BinderFactory; use null in the first argument when there is only one binder configured. +If more than one binder is configured, use the binder name to get the reference. +Once we have a reference to the binder, we can obtain a reference to the ProducerFactory and create a transaction manager.

+
+
+

Then you would use normal Spring transaction support, e.g. TransactionTemplate or @Transactional, for example:

+
+
+
+
+
+
public static class Sender {
+
+    @Transactional
+    public void doInTransaction(MessageChannel output, List<String> stuffToSend) {
+        stuffToSend.forEach(stuff -> output.send(new GenericMessage<>(stuff)));
+    }
+
+}
+
+
+
+
+
+

If you wish to synchronize producer-only transactions with those from some other transaction manager, use a ChainedTransactionManager.

+
+
+
+

Error Channels

+
+

Starting with version 1.3, the binder unconditionally sends exceptions to an error channel for each consumer destination and can also be configured to send async producer send failures to an error channel. +See [spring-cloud-stream-overview-error-handling] for more information.

+
+
+

The payload of the ErrorMessage for a send failure is a KafkaSendFailureException with properties:

+
+
+
    +
  • +

    failedMessage: The Spring Messaging Message<?> that failed to be sent.

    +
  • +
  • +

    record: The raw ProducerRecord that was created from the failedMessage

    +
  • +
+
+
+

There is no automatic handling of producer exceptions (such as sending to a Dead-Letter queue). +You can consume these exceptions with your own Spring Integration flow.

+
+
+
+

Kafka Metrics

+
+

Kafka binder module exposes the following metrics:

+
+
+

spring.cloud.stream.binder.kafka.offset: This metric indicates how many messages have not been yet consumed from a given binder’s topic by a given consumer group. +The metrics provided are based on the Mircometer metrics library. The metric contains the consumer group information, topic and the actual lag in committed offset from the latest offset on the topic. +This metric is particularly useful for providing auto-scaling feedback to a PaaS platform.

+
+
+
+

Tombstone Records (null record values)

+
+

When using compacted topics, a record with a null value (also called a tombstone record) represents the deletion of a key. +To receive such messages in a @StreamListener method, the parameter must be marked as not required to receive a null value argument.

+
+
+
+
+
+
@StreamListener(Sink.INPUT)
+public void in(@Header(KafkaHeaders.RECEIVED_MESSAGE_KEY) byte[] key,
+               @Payload(required = false) Customer customer) {
+    // customer is null if a tombstone record
+    ...
+}
+
+
+
+
+
+
+

Using a KafkaRebalanceListener

+
+

Applications may wish to seek topics/partitions to arbitrary offsets when the partitions are initially assigned, or perform other operations on the consumer. +Starting with version 2.1, if you provide a single KafkaRebalanceListener bean in the application context, it will be wired into all Kafka consumer bindings.

+
+
+
+
+
+
public interface KafkaBindingRebalanceListener {
+
+	/**
+	 * Invoked by the container before any pending offsets are committed.
+	 * @param bindingName the name of the binding.
+	 * @param consumer the consumer.
+	 * @param partitions the partitions.
+	 */
+	default void onPartitionsRevokedBeforeCommit(String bindingName, Consumer<?, ?> consumer,
+			Collection<TopicPartition> partitions) {
+
+	}
+
+	/**
+	 * Invoked by the container after any pending offsets are committed.
+	 * @param bindingName the name of the binding.
+	 * @param consumer the consumer.
+	 * @param partitions the partitions.
+	 */
+	default void onPartitionsRevokedAfterCommit(String bindingName, Consumer<?, ?> consumer, Collection<TopicPartition> partitions) {
+
+	}
+
+	/**
+	 * Invoked when partitions are initially assigned or after a rebalance.
+	 * Applications might only want to perform seek operations on an initial assignment.
+	 * @param bindingName the name of the binding.
+	 * @param consumer the consumer.
+	 * @param partitions the partitions.
+	 * @param initial true if this is the initial assignment.
+	 */
+	default void onPartitionsAssigned(String bindingName, Consumer<?, ?> consumer, Collection<TopicPartition> partitions,
+			boolean initial) {
+
+	}
+
+}
+
+
+
+
+
+

You cannot set the resetOffsets consumer property to true when you provide a rebalance listener.

+
+
+
+
+

Appendices

+
+

Appendix A: Building

+
+
+

Basic Compile and Test

+
+

To build the source you will need to install JDK 1.7.

+
+
+

The build uses the Maven wrapper so you don’t have to install a specific +version of Maven. To enable the tests, you should have Kafka server 0.9 or above running +before building. See below for more information on running the servers.

+
+
+

The main build command is

+
+
+
+
$ ./mvnw clean install
+
+
+
+

You can also add '-DskipTests' if you like, to avoid running the tests.

+
+
+ + + + + +
+ + +You can also install Maven (>=3.3.3) yourself and run the mvn command +in place of ./mvnw in the examples below. If you do that you also +might need to add -P spring if your local Maven settings do not +contain repository declarations for spring pre-release artifacts. +
+
+
+ + + + + +
+ + +Be aware that you might need to increase the amount of memory +available to Maven by setting a MAVEN_OPTS environment variable with +a value like -Xmx512m -XX:MaxPermSize=128m. We try to cover this in +the .mvn configuration, so if you find you have to do it to make a +build succeed, please raise a ticket to get the settings added to +source control. +
+
+
+

The projects that require middleware generally include a +docker-compose.yml, so consider using +Docker Compose to run the middeware servers +in Docker containers.

+
+
+
+

Documentation

+
+

There is a "full" profile that will generate documentation.

+
+
+
+

Working with the code

+
+

If you don’t have an IDE preference we would recommend that you use +Spring Tools Suite or +Eclipse when working with the code. We use the +m2eclipe eclipse plugin for maven support. Other IDEs and tools +should also work without issue.

+
+
+

Importing into eclipse with m2eclipse

+
+

We recommend the m2eclipe eclipse plugin when working with +eclipse. If you don’t already have m2eclipse installed it is available from the "eclipse +marketplace".

+
+
+

Unfortunately m2e does not yet support Maven 3.3, so once the projects +are imported into Eclipse you will also need to tell m2eclipse to use +the .settings.xml file for the projects. If you do not do this you +may see many different errors related to the POMs in the +projects. Open your Eclipse preferences, expand the Maven +preferences, and select User Settings. In the User Settings field +click Browse and navigate to the Spring Cloud project you imported +selecting the .settings.xml file in that project. Click Apply and +then OK to save the preference changes.

+
+
+ + + + + +
+ + +Alternatively you can copy the repository settings from .settings.xml into your own ~/.m2/settings.xml. +
+
+
+
+

Importing into eclipse without m2eclipse

+
+

If you prefer not to use m2eclipse you can generate eclipse project metadata using the +following command:

+
+
+
+
$ ./mvnw eclipse:eclipse
+
+
+
+

The generated eclipse projects can be imported by selecting import existing projects +from the file menu. +[[contributing] +== Contributing

+
+
+

Spring Cloud is released under the non-restrictive Apache 2.0 license, +and follows a very standard Github development process, using Github +tracker for issues and merging pull requests into master. If you want +to contribute even something trivial please do not hesitate, but +follow the guidelines below.

+
+
+
+
+

Sign the Contributor License Agreement

+
+

Before we accept a non-trivial patch or pull request we will need you to sign the +contributor’s agreement. +Signing the contributor’s agreement does not grant anyone commit rights to the main +repository, but it does mean that we can accept your contributions, and you will get an +author credit if we do. Active contributors might be asked to join the core team, and +given the ability to merge pull requests.

+
+
+
+

Code Conventions and Housekeeping

+
+

None of these is essential for a pull request, but they will all help. They can also be +added after the original pull request but before a merge.

+
+
+
    +
  • +

    Use the Spring Framework code format conventions. If you use Eclipse +you can import formatter settings using the +eclipse-code-formatter.xml file from the +Spring +Cloud Build project. If using IntelliJ, you can use the +Eclipse Code Formatter +Plugin to import the same file.

    +
  • +
  • +

    Make sure all new .java files to have a simple Javadoc class comment with at least an +@author tag identifying you, and preferably at least a paragraph on what the class is +for.

    +
  • +
  • +

    Add the ASF license header comment to all new .java files (copy from existing files +in the project)

    +
  • +
  • +

    Add yourself as an @author to the .java files that you modify substantially (more +than cosmetic changes).

    +
  • +
  • +

    Add some Javadocs and, if you change the namespace, some XSD doc elements.

    +
  • +
  • +

    A few unit tests would help a lot as well — someone has to do it.

    +
  • +
  • +

    If no-one else is using your branch, please rebase it against the current master (or +other target branch in the main project).

    +
  • +
  • +

    When writing a commit message please follow these conventions, +if you are fixing an existing issue please add Fixes gh-XXXX at the end of the commit +message (where XXXX is the issue number).

    +
  • +
+
+
+
+
+
+ + + + + + + \ No newline at end of file diff --git a/spring-cloud-stream-binder-kafka/3.0.0.RELEASE/reference/html/appendix.html b/spring-cloud-stream-binder-kafka/3.0.0.RELEASE/reference/html/appendix.html new file mode 100644 index 00000000..451bd702 --- /dev/null +++ b/spring-cloud-stream-binder-kafka/3.0.0.RELEASE/reference/html/appendix.html @@ -0,0 +1,106 @@ + + + + + + + +Appendices + + + + + + + + + + +
+ +
+ + + + + + + \ No newline at end of file diff --git a/spring-cloud-stream-binder-kafka/3.0.0.RELEASE/reference/html/building.html b/spring-cloud-stream-binder-kafka/3.0.0.RELEASE/reference/html/building.html new file mode 100644 index 00000000..62996f5a --- /dev/null +++ b/spring-cloud-stream-binder-kafka/3.0.0.RELEASE/reference/html/building.html @@ -0,0 +1,244 @@ + + + + + + + +Building + + + + + + + + + + +
+
+

Building

+
+
+

Basic Compile and Test

+
+

To build the source you will need to install JDK 1.7.

+
+
+

The build uses the Maven wrapper so you don’t have to install a specific +version of Maven. To enable the tests, you should have Kafka server 0.9 or above running +before building. See below for more information on running the servers.

+
+
+

The main build command is

+
+
+
+
$ ./mvnw clean install
+
+
+
+

You can also add '-DskipTests' if you like, to avoid running the tests.

+
+
+ + + + + +
+ + +You can also install Maven (>=3.3.3) yourself and run the mvn command +in place of ./mvnw in the examples below. If you do that you also +might need to add -P spring if your local Maven settings do not +contain repository declarations for spring pre-release artifacts. +
+
+
+ + + + + +
+ + +Be aware that you might need to increase the amount of memory +available to Maven by setting a MAVEN_OPTS environment variable with +a value like -Xmx512m -XX:MaxPermSize=128m. We try to cover this in +the .mvn configuration, so if you find you have to do it to make a +build succeed, please raise a ticket to get the settings added to +source control. +
+
+
+

The projects that require middleware generally include a +docker-compose.yml, so consider using +Docker Compose to run the middeware servers +in Docker containers.

+
+
+
+

Documentation

+
+

There is a "full" profile that will generate documentation.

+
+
+
+

Working with the code

+
+

If you don’t have an IDE preference we would recommend that you use +Spring Tools Suite or +Eclipse when working with the code. We use the +m2eclipe eclipse plugin for maven support. Other IDEs and tools +should also work without issue.

+
+
+

Importing into eclipse with m2eclipse

+
+

We recommend the m2eclipe eclipse plugin when working with +eclipse. If you don’t already have m2eclipse installed it is available from the "eclipse +marketplace".

+
+
+

Unfortunately m2e does not yet support Maven 3.3, so once the projects +are imported into Eclipse you will also need to tell m2eclipse to use +the .settings.xml file for the projects. If you do not do this you +may see many different errors related to the POMs in the +projects. Open your Eclipse preferences, expand the Maven +preferences, and select User Settings. In the User Settings field +click Browse and navigate to the Spring Cloud project you imported +selecting the .settings.xml file in that project. Click Apply and +then OK to save the preference changes.

+
+
+ + + + + +
+ + +Alternatively you can copy the repository settings from .settings.xml into your own ~/.m2/settings.xml. +
+
+
+
+

Importing into eclipse without m2eclipse

+
+

If you prefer not to use m2eclipse you can generate eclipse project metadata using the +following command:

+
+
+
+
$ ./mvnw eclipse:eclipse
+
+
+
+

The generated eclipse projects can be imported by selecting import existing projects +from the file menu.

+
+
+
+
+
+
+ + + + + + + \ No newline at end of file diff --git a/spring-cloud-stream-binder-kafka/3.0.0.RELEASE/reference/html/contributing.html b/spring-cloud-stream-binder-kafka/3.0.0.RELEASE/reference/html/contributing.html new file mode 100644 index 00000000..a00bf7da --- /dev/null +++ b/spring-cloud-stream-binder-kafka/3.0.0.RELEASE/reference/html/contributing.html @@ -0,0 +1,185 @@ + + + + + + + +Sign the Contributor License Agreement + + + + + + + + + + +
+
+
+
+

[[contributing] +== Contributing

+
+
+

Spring Cloud is released under the non-restrictive Apache 2.0 license, +and follows a very standard Github development process, using Github +tracker for issues and merging pull requests into master. If you want +to contribute even something trivial please do not hesitate, but +follow the guidelines below.

+
+
+
+
+

Sign the Contributor License Agreement

+
+

Before we accept a non-trivial patch or pull request we will need you to sign the +contributor’s agreement. +Signing the contributor’s agreement does not grant anyone commit rights to the main +repository, but it does mean that we can accept your contributions, and you will get an +author credit if we do. Active contributors might be asked to join the core team, and +given the ability to merge pull requests.

+
+
+
+

Code Conventions and Housekeeping

+
+

None of these is essential for a pull request, but they will all help. They can also be +added after the original pull request but before a merge.

+
+
+
    +
  • +

    Use the Spring Framework code format conventions. If you use Eclipse +you can import formatter settings using the +eclipse-code-formatter.xml file from the +Spring +Cloud Build project. If using IntelliJ, you can use the +Eclipse Code Formatter +Plugin to import the same file.

    +
  • +
  • +

    Make sure all new .java files to have a simple Javadoc class comment with at least an +@author tag identifying you, and preferably at least a paragraph on what the class is +for.

    +
  • +
  • +

    Add the ASF license header comment to all new .java files (copy from existing files +in the project)

    +
  • +
  • +

    Add yourself as an @author to the .java files that you modify substantially (more +than cosmetic changes).

    +
  • +
  • +

    Add some Javadocs and, if you change the namespace, some XSD doc elements.

    +
  • +
  • +

    A few unit tests would help a lot as well — someone has to do it.

    +
  • +
  • +

    If no-one else is using your branch, please rebase it against the current master (or +other target branch in the main project).

    +
  • +
  • +

    When writing a commit message please follow these conventions, +if you are fixing an existing issue please add Fixes gh-XXXX at the end of the commit +message (where XXXX is the issue number).

    +
  • +
+
+
+
+ + + + + + + \ No newline at end of file diff --git a/spring-cloud-stream-binder-kafka/3.0.0.RELEASE/reference/html/css/spring.css b/spring-cloud-stream-binder-kafka/3.0.0.RELEASE/reference/html/css/spring.css new file mode 100644 index 00000000..40821db3 --- /dev/null +++ b/spring-cloud-stream-binder-kafka/3.0.0.RELEASE/reference/html/css/spring.css @@ -0,0 +1 @@ +@import url("https://fonts.googleapis.com/css?family=Karla:400,700|Montserrat:400,700");/*! normalize.css v2.1.2 | MIT License | git.io/normalize */article,aside,details,figcaption,figure,footer,header,hgroup,main,nav,section,summary{display:block}audio,canvas,video{display:inline-block}audio:not([controls]){display:none;height:0}[hidden],template{display:none}script{display:none !important}html,body{font-size:100%}html{font-family:Karla, sans-serif;-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%}*,*:before,*:after{-moz-box-sizing:border-box;-webkit-box-sizing:border-box;box-sizing:border-box}body{background:white;color:#000;padding:0;margin:0;font-size:16px;font-family:Karla, sans-serif;font-weight:normal;font-style:normal;line-height:1.6em;position:relative;cursor:auto}a:hover{cursor:pointer}img,object,embed{max-width:100%;height:auto}object,embed{height:100%}img{-ms-interpolation-mode:bicubic}#map_canvas img,#map_canvas embed,#map_canvas object,.map_canvas img,.map_canvas embed,.map_canvas object{max-width:none !important}.left{float:left !important}.right{float:right !important}.text-left{text-align:left !important}.text-right{text-align:right !important}.text-center{text-align:center !important}.text-justify{text-align:justify !important}.hide{display:none}.antialiased{-webkit-font-smoothing:antialiased}img{display:inline-block;vertical-align:middle}textarea{height:auto;min-height:50px}select{width:100%}object,svg{display:inline-block;vertical-align:middle}.center{margin-left:auto;margin-right:auto}.spread{width:100%}p.lead,.paragraph.lead>p,#preamble>.sectionbody>.paragraph:first-of-type p{line-height:1.6}.subheader,.admonitionblock td.content>.title,.audioblock>.title,.exampleblock>.title,.imageblock>.title,.listingblock>.title,.literalblock>.title,.stemblock>.title,.openblock>.title,.paragraph>.title,.quoteblock>.title,table.tableblock>.title,.verseblock>.title,.videoblock>.title,.dlist>.title,.olist>.title,.ulist>.title,.qlist>.title,.hdlist>.title{line-height:1.45;color:#0b0a0a;font-weight:bold;margin-top:0;margin-bottom:0.8em}div,dl,dt,dd,ul,ol,li,h1,h2,h3,#toctitle,.sidebarblock>.content>.title,h4,h5,h6,pre,form,p,blockquote,th,td{margin:0;padding:0;direction:ltr}a{color:#097dff;line-height:inherit;text-decoration:none}a:hover,a:focus{color:#016be2;text-decoration:underline}a img{border:none}p{font-family:inherit;font-weight:normal;font-size:1em;line-height:1.6;margin-bottom:1.25em;text-rendering:optimizeLegibility}p aside{font-size:0.875em;line-height:1.35;font-style:italic}h1,h2,h3,#toctitle,.sidebarblock>.content>.title,h4,h5,h6{font-family:Montserrat, sans-serif;font-weight:400;font-style:normal;color:#000;text-rendering:optimizeLegibility;margin-top:1em;margin-bottom:0.5em;line-height:1.0125em}h1 small,h2 small,h3 small,#toctitle small,.sidebarblock>.content>.title small,h4 small,h5 small,h6 small{font-size:60%;color:#867c74;line-height:0}h1{font-size:2.125em}h2{font-size:1.6875em}h3,#toctitle,.sidebarblock>.content>.title{font-size:1.375em}h4{font-size:1.125em}h5{font-size:1.125em}h6{font-size:1em}hr{border:solid #ddddd8;border-width:1px 0 0;clear:both;margin:1.25em 0 1.1875em;height:0}em,i{font-style:italic;line-height:inherit}strong,b{font-weight:bold;line-height:inherit}small{font-size:60%;line-height:inherit}code{font-family:Monaco, Menlo, Consolas, "Courier New", monospace;font-weight:normal;color:#3d3d3c;word-break:break-word}ul,ol,dl{font-size:1em;line-height:1.6;margin-bottom:1.25em;list-style-position:outside;font-family:inherit}ul,ol{margin-left:1.5em}ul.no-bullet,ol.no-bullet{margin-left:1.5em}ul li ul,ul li ol{margin-left:1.25em;margin-bottom:0;font-size:1em}ul.square li ul,ul.circle li ul,ul.disc li ul{list-style:inherit}ul.square{list-style-type:square}ul.circle{list-style-type:circle}ul.disc{list-style-type:disc}ul.no-bullet{list-style:none}ol li ul,ol li ol{margin-left:1.25em;margin-bottom:0}dl dt{margin-bottom:0.3125em;font-weight:bold}dl dd{margin-bottom:1.25em}abbr,acronym{text-transform:uppercase;font-size:90%;color:#000;border-bottom:1px dotted #dddddd;cursor:help}abbr{text-transform:none}blockquote{margin:0 0 1.25em;padding:0.5625em 1.25em 0 1.1875em;border-left:1px solid #dddddd}blockquote cite{display:block;font-size:0.9375em;color:rgba(0,0,0,0.6)}blockquote cite:before{content:"\2014 \0020"}blockquote cite a,blockquote cite a:visited{color:rgba(0,0,0,0.6)}blockquote,blockquote p{line-height:1.6;color:rgba(0,0,0,0.85)}.vcard{display:inline-block;margin:0 0 1.25em 0;border:1px solid #dddddd;padding:0.625em 0.75em}.vcard li{margin:0;display:block}.vcard .fn{font-weight:bold;font-size:0.9375em}.vevent .summary{font-weight:bold}.vevent abbr{cursor:auto;text-decoration:none;font-weight:bold;border:none;padding:0 0.0625em}#tocbot{padding:0 0 1rem 0;line-height:1.5rem;padding-left:25px}.mobile-toc{padding:0 0 1rem 0;line-height:1.5rem}.mobile-toc li a{display:block;padding:.3rem 0}#tocbot ol li{list-style:none;padding:0;margin:0}#tocbot ol{margin:0;padding:0;padding-left:0.6rem}#tocbot .toc-link{display:block;padding-top:4px;padding-bottom:4px;outline:none}table{background:white;margin-bottom:1.25em;border:solid 1px #cacaca;border-spacing:0}table thead,table tfoot{background:#f7f8f7;font-weight:bold}table thead tr th,table thead tr td,table tfoot tr th,table tfoot tr td{padding:0.5em 0.625em 0.625em;font-size:inherit;color:#000;text-align:left}table tr th,table tr td{padding:0.5625em 0.625em;font-size:inherit;color:#000}table thead tr th,table tfoot tr th,table tbody tr td,table tr td,table tfoot tr td{display:table-cell;line-height:1.6}body{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;tab-size:4}h1,h2,h3,#toctitle,.sidebarblock>.content>.title,h4,h5,h6{line-height:1.2;word-spacing:-0.05em}.clearfix:before,.clearfix:after,.float-group:before,.float-group:after{content:" ";display:table}.clearfix:after,.float-group:after{clear:both}*:not(pre)>code{font-size:0.8525em;font-style:normal !important;letter-spacing:0;padding:0.1em 0.3em 0.2em;background-color:rgba(0,0,0,0.05);border-radius:4px;text-rendering:optimizeSpeed}pre,pre>code{line-height:1.85;color:rgba(0,0,0,0.9);font-family:Monaco, Menlo, Consolas, "Courier New", monospace;font-weight:normal;text-rendering:optimizeSpeed;word-break:normal}pre{overflow:auto}em em{font-style:normal}strong strong{font-weight:normal}.keyseq{color:#6b625c}kbd{font-family:Monaco, Menlo, Consolas, "Courier New", monospace;display:inline-block;color:#000;font-size:0.65em;line-height:1.45;background-color:#f7f7f7;border:1px solid #ccc;-webkit-border-radius:3px;border-radius:3px;-webkit-box-shadow:0 1px 0 rgba(0,0,0,0.2),0 0 0 0.1em white inset;box-shadow:0 1px 0 rgba(0,0,0,0.2),0 0 0 0.1em white inset;margin:0 0.15em;padding:0.2em 0.5em;vertical-align:middle;position:relative;top:-0.1em;white-space:nowrap}.keyseq kbd:first-child{margin-left:0}.keyseq kbd:last-child{margin-right:0}.menuseq,.menu{color:#191715}b.button:before,b.button:after{position:relative;top:-1px;font-weight:normal}b.button:before{content:"[";padding:0 3px 0 2px}b.button:after{content:"]";padding:0 2px 0 3px}p a>code:hover{color:rgba(0,0,0,0.9)}#toc{border-bottom:1px solid #ddddd8;padding-bottom:0.5em}#toc>ul{margin-left:0.125em}#toc ul.sectlevel0>li>a{font-style:italic}#toc ul.sectlevel0 ul.sectlevel1{margin:0.5em 0}#toc ul{list-style-type:none}#toc li{line-height:1.3334}#toc a{text-decoration:none}#toc a:active{text-decoration:underline}#toctitle{color:#0b0a0a;font-size:1.2em;display:none}body.toc2{padding-top:90px;text-rendering:optimizeLegibility}#content #toc{border-style:solid;border-width:1px;border-color:#d7d7d7;margin-bottom:1.25em;padding:1.25em;background:#f1f1f1;-webkit-border-radius:4px;border-radius:4px}#content #toc>:first-child{margin-top:0}#content #toc>:last-child{margin-bottom:0}#footer{padding-bottom:2rem}#footer #footer-text{padding:2rem 0;border-top:1px solid #efefed}#footer-text{color:rgba(0,0,0,0.6);line-height:1.44}.sect1{padding-bottom:0.625em}.sect1+.sect1{border-top:1px solid #efefed}#content h1>a.anchor,h2>a.anchor,h3>a.anchor,#toctitle>a.anchor,.sidebarblock>.content>.title>a.anchor,h4>a.anchor,h5>a.anchor,h6>a.anchor{position:absolute;z-index:1001;width:1.5ex;margin-left:-1.5ex;margin-top:0.1rem;display:block;visibility:hidden;text-align:center;font-weight:normal;color:rgba(0,0,0,0.2)}#content h1>a.anchor:hover,h2>a.anchor:hover,h3>a.anchor:hover,#toctitle>a.anchor:hover,.sidebarblock>.content>.title>a.anchor:hover,h4>a.anchor:hover,h5>a.anchor:hover,h6>a.anchor:hover{color:#097dff;text-decoration:none}#content h1>a.anchor:before,h2>a.anchor:before,h3>a.anchor:before,#toctitle>a.anchor:before,.sidebarblock>.content>.title>a.anchor:before,h4>a.anchor:before,h5>a.anchor:before,h6>a.anchor:before{content:"\0023";font-size:0.85em;display:block;padding-top:0.1em}#content h1:hover>a.anchor,#content h1>a.anchor:hover,h2:hover>a.anchor,h2>a.anchor:hover,h3:hover>a.anchor,#toctitle:hover>a.anchor,.sidebarblock>.content>.title:hover>a.anchor,h3>a.anchor:hover,#toctitle>a.anchor:hover,.sidebarblock>.content>.title>a.anchor:hover,h4:hover>a.anchor,h4>a.anchor:hover,h5:hover>a.anchor,h5>a.anchor:hover,h6:hover>a.anchor,h6>a.anchor:hover{visibility:visible}#content h1>a.link,h2>a.link,h3>a.link,#toctitle>a.link,.sidebarblock>.content>.title>a.link,h4>a.link,h5>a.link,h6>a.link{color:#000;text-decoration:none}#content h1>a.link:hover,h2>a.link:hover,h3>a.link:hover,#toctitle>a.link:hover,.sidebarblock>.content>.title>a.link:hover,h4>a.link:hover,h5>a.link:hover,h6>a.link:hover{color:#262321}.audioblock,.imageblock,.literalblock,.listingblock,.stemblock,.videoblock{margin-bottom:1.25em}.admonitionblock td.content>.title,.audioblock>.title,.exampleblock>.title,.imageblock>.title,.listingblock>.title,.literalblock>.title,.stemblock>.title,.openblock>.title,.paragraph>.title,.quoteblock>.title,table.tableblock>.title,.verseblock>.title,.videoblock>.title,.dlist>.title,.olist>.title,.ulist>.title,.qlist>.title,.hdlist>.title{text-rendering:optimizeLegibility;text-align:left;font-family:Karla, sans-serif;font-size:1rem}table.tableblock>caption.title{white-space:nowrap;overflow:visible;max-width:0;padding:0.6rem 0}table.tableblock #preamble>.sectionbody>.paragraph:first-of-type p{font-size:inherit}.admonitionblock>table{border-collapse:separate;border:0;background:none;width:100%}.admonitionblock>table td.icon{text-align:center;vertical-align:top;padding-top:0.8em;width:80px}.admonitionblock>table td.icon img{max-width:initial}.admonitionblock>table td.icon .title{font-weight:bold;font-family:Montserrat, sans-serif;text-transform:uppercase}.admonitionblock>table td.content{padding-left:0em;padding-right:1.25em;border-left:1px solid #ddddd8}.admonitionblock>table td.content>:last-child>:last-child{margin-bottom:0}.exampleblock>.content{border-style:solid;border-width:0;border-color:#e6e6e6;margin-bottom:1.25em;padding:1.25em;background:#f1f1f1;border-radius:4px}.exampleblock>.content>:first-child{margin-top:0}.exampleblock>.content>:last-child{margin-bottom:0}.sidebarblock{border-style:solid;border-width:0;border-color:#d7d7d7;margin-bottom:1.25em;padding:1.25em;background:#f1f1f1;border-radius:4px;overflow:scroll}.sidebarblock>:first-child{margin-top:0}.sidebarblock>:last-child{margin-bottom:0}.sidebarblock>.content>.title{color:#0b0a0a;margin-top:0;text-align:center}.exampleblock>.content>:last-child>:last-child,.exampleblock>.content .olist>ol>li:last-child>:last-child,.exampleblock>.content .ulist>ul>li:last-child>:last-child,.exampleblock>.content .qlist>ol>li:last-child>:last-child,.sidebarblock>.content>:last-child>:last-child,.sidebarblock>.content .olist>ol>li:last-child>:last-child,.sidebarblock>.content .ulist>ul>li:last-child>:last-child,.sidebarblock>.content .qlist>ol>li:last-child>:last-child{margin-bottom:0}.literalblock pre,.listingblock pre:not(.highlight),.listingblock pre[class="highlight"],.listingblock pre[class^="highlight "],.listingblock pre.CodeRay,.listingblock pre.prettyprint{background:#282c33;color:#e6e1dc;border-radius:4px}.sidebarblock .literalblock pre,.sidebarblock .listingblock pre:not(.highlight),.sidebarblock .listingblock pre[class="highlight"],.sidebarblock .listingblock pre[class^="highlight "],.sidebarblock .listingblock pre.CodeRay,.sidebarblock .listingblock pre.prettyprint{background:#282c33;color:#e6e1dc}.literalblock pre,.literalblock pre[class],.listingblock pre,.listingblock pre[class],.listingblock pre:not(.highlight){padding:1em 1.5rem;font-size:0.8125em}.literalblock pre.nowrap,.literalblock pre[class].nowrap,.listingblock pre.nowrap,.listingblock pre[class].nowrap{overflow-x:auto}.literalblock.output pre{color:whitesmoke;background-color:rgba(0,0,0,0.9)}.listingblock{white-space:nowrap}.listingblock pre.highlightjs{padding:0.2rem 0}.listingblock pre.highlightjs>code{padding:1em 1.5rem;border-radius:4px}.listingblock>.content{position:relative}.listingblock code[data-lang]:before{display:none;content:attr(data-lang);position:absolute;font-size:0.8em;font-weight:bold;top:0.425rem;right:0.5rem;line-height:1;text-transform:uppercase;color:#999}.listingblock code[data-lang]:before{display:block}.listingblock.terminal pre .command:before{content:attr(data-prompt);padding-right:0.5em;color:#999}.listingblock.terminal pre .command:not([data-prompt]):before{content:"$"}table.pyhltable{border-collapse:separate;border:0;margin-bottom:0;background:none}table.pyhltable td{vertical-align:top;padding-top:0;padding-bottom:0;line-height:1.45}table.pyhltable td.code{padding-left:.75em;padding-right:0}pre.pygments .lineno,table.pyhltable td:not(.code){color:#999;padding-left:0;padding-right:.5em;border-right:1px solid #ddddd8}pre.pygments .lineno{display:block;margin-right:.25em}table.pyhltable .linenodiv{background:none !important;padding-right:0 !important}.quoteblock{margin:0 1em 1.25em 1.5em;display:block;text-align:left;padding-left:20px}.quoteblock blockquote,.quoteblock blockquote p{color:rgba(0,0,0,0.85);line-height:1.75;letter-spacing:0}.quoteblock blockquote{margin:0;padding:0;border:0;position:relative}.quoteblock blockquote:before{content:"\201c";font-size:2.75em;font-weight:bold;line-height:0.6em;margin-left:0em;margin-right:1rem;margin-top:0.8rem;color:rgba(0,0,0,0.1);position:absolute;top:0;left:-30px}.quoteblock blockquote>.paragraph:last-child p{margin-bottom:0}.quoteblock .attribution{margin-right:0.5ex}.quoteblock .quoteblock{margin-left:0;margin-right:0;padding:0.5em 0;border-left:3px solid rgba(0,0,0,0.6)}.quoteblock .quoteblock blockquote{padding:0 0 0 0.75em}.quoteblock .quoteblock blockquote:before{display:none}.verseblock{margin:0 1em 1.25em 0;background-color:#f1f1f1;padding:1rem 1.4rem;border-radius:4px}.verseblock pre{font-family:Monaco, Menlo, Consolas, "Courier New", monospace;font-size:0.9rem;color:rgba(0,0,0,0.85);font-weight:300;text-rendering:optimizeLegibility}.verseblock pre strong{font-weight:400}.verseblock .attribution{margin-top:1.25rem;margin-left:0.5ex}.quoteblock .attribution,.verseblock .attribution{font-size:0.9375em;line-height:1.45;font-style:italic}.quoteblock .attribution br,.verseblock .attribution br{display:none}.quoteblock .attribution cite,.verseblock .attribution cite{display:block;letter-spacing:-0.025em;color:rgba(0,0,0,0.6)}.quoteblock.abstract{margin:0 0 1.25em 0;display:block}.quoteblock.abstract blockquote,.quoteblock.abstract blockquote p{text-align:left;word-spacing:0}.quoteblock.abstract blockquote:before,.quoteblock.abstract blockquote p:first-of-type:before{display:none}table.tableblock{max-width:100%;border-collapse:separate;overflow-x:scroll}table.tableblock td>.paragraph:last-child p>p:last-child,table.tableblock th>p:last-child,table.tableblock td>p:last-child{margin-bottom:0}table.tableblock,th.tableblock,td.tableblock{border:0 solid #cacaca;background:white}table.grid-all th.tableblock,table.grid-all td.tableblock{border-width:0 1px 1px 0}table.grid-all tfoot>tr>th.tableblock,table.grid-all tfoot>tr>td.tableblock{border-width:1px 1px 0 0}table.grid-cols th.tableblock,table.grid-cols td.tableblock{border-width:0 1px 0 0}table.grid-all *>tr>.tableblock:last-child,table.grid-cols *>tr>.tableblock:last-child{border-right-width:0}table.grid-rows th.tableblock,table.grid-rows td.tableblock{border-width:0 0 1px 0}table.grid-all tbody>tr:last-child>th.tableblock,table.grid-all tbody>tr:last-child>td.tableblock,table.grid-all thead:last-child>tr>th.tableblock,table.grid-rows tbody>tr:last-child>th.tableblock,table.grid-rows tbody>tr:last-child>td.tableblock,table.grid-rows thead:last-child>tr>th.tableblock{border-bottom-width:0}table.grid-rows tfoot>tr>th.tableblock,table.grid-rows tfoot>tr>td.tableblock{border-width:1px 0 0 0}table.frame-all{border-width:1px}table.frame-sides{border-width:0 1px}table.frame-topbot{border-width:1px 0}th.halign-left,td.halign-left{text-align:left}th.halign-right,td.halign-right{text-align:right}th.halign-center,td.halign-center{text-align:center}th.valign-top,td.valign-top{vertical-align:top}th.valign-bottom,td.valign-bottom{vertical-align:bottom}th.valign-middle,td.valign-middle{vertical-align:middle}table thead th,table tfoot th{font-weight:bold}tbody tr th{display:table-cell;line-height:1.6;background:#f7f8f7}tbody tr th,tbody tr th p,tfoot tr th,tfoot tr th p{color:#34302d;font-weight:bold}p.tableblock>code:only-child{background:none;padding:0}p.tableblock{font-size:1em}td>div.verse{white-space:pre}ol{margin-left:1.75em}ul li ol{margin-left:1.5em}dl dd{margin-left:1.125em}dl dd:last-child,dl dd:last-child>:last-child{margin-bottom:0}ol>li p,ul>li p,ul dd,ol dd,.olist .olist,.ulist .ulist,.ulist .olist,.olist .ulist{margin-bottom:0.625em}ul.unstyled,ol.unnumbered,ul.checklist,ul.none{list-style-type:none}ul.unstyled,ol.unnumbered,ul.checklist{margin-left:0.625em}ul.checklist li>p:first-child>.fa-square-o:first-child,ul.checklist li>p:first-child>.fa-check-square-o:first-child{width:1em;font-size:0.85em}ul.checklist li>p:first-child>input[type="checkbox"]:first-child{width:1em;position:relative;top:1px}ul.inline{margin:0 auto 0.625em auto;margin-left:-1.375em;margin-right:0;padding:0;list-style:none;overflow:hidden}ul.inline>li{list-style:none;float:left;margin-left:1.375em;display:block}ul.inline>li>*{display:block}.unstyled dl dt{font-weight:normal;font-style:normal}ol.arabic{list-style-type:decimal}ol.decimal{list-style-type:decimal-leading-zero}ol.loweralpha{list-style-type:lower-alpha}ol.upperalpha{list-style-type:upper-alpha}ol.lowerroman{list-style-type:lower-roman}ol.upperroman{list-style-type:upper-roman}ol.lowergreek{list-style-type:lower-greek}.hdlist>table,.colist>table{border:0;background:none}.hdlist>table>tbody>tr,.colist>table>tbody>tr{background:none}td.hdlist1,td.hdlist2{vertical-align:top;padding:0 0.625em}td.hdlist1{font-weight:bold;padding-bottom:1.25em}.literalblock+.colist,.listingblock+.colist{margin-top:-0.5em}.colist>table tr>td:first-of-type{padding:0 0.75em;line-height:1}.colist>table tr>td:first-of-type img{max-width:initial}.colist>table tr>td:last-of-type{padding:0.25em 0}.thumb,.th{line-height:0;display:inline-block;border:solid 4px white;-webkit-box-shadow:0 0 0 1px #dddddd;box-shadow:0 0 0 1px #dddddd}.imageblock.left,.imageblock[style*="float: left"]{margin:0.25em 0.625em 1.25em 0}.imageblock.right,.imageblock[style*="float: right"]{margin:0.25em 0 1.25em 0.625em}.imageblock>.title{margin-bottom:0}.imageblock.thumb,.imageblock.th{border-width:6px}.imageblock.thumb>.title,.imageblock.th>.title{padding:0 0.125em}.image.left,.image.right{margin-top:0.25em;margin-bottom:0.25em;display:inline-block;line-height:0}.image.left{margin-right:0.625em}.image.right{margin-left:0.625em}a.image{text-decoration:none;display:inline-block}a.image object{pointer-events:none}sup.footnote,sup.footnoteref{font-size:0.875em;position:static;vertical-align:super}sup.footnote a,sup.footnoteref a{text-decoration:none}sup.footnote a:active,sup.footnoteref a:active{text-decoration:underline}#footnotes{padding-top:0.75em;padding-bottom:0.75em;margin-bottom:0.625em}#footnotes hr{width:20%;min-width:6.25em;margin:-0.25em 0 0.75em 0;border-width:1px 0 0 0}#footnotes .footnote{padding:0 0.375em 0 0.225em;line-height:1.3334;font-size:0.875em;margin-left:1.2em;text-indent:-1.05em;margin-bottom:0.2em}#footnotes .footnote a:first-of-type{font-weight:bold;text-decoration:none}#footnotes .footnote:last-of-type{margin-bottom:0}#content #footnotes{margin-top:-0.625em;margin-bottom:0;padding:0.75em 0}.gist .file-data>table{border:0;background:#fff;width:100%;margin-bottom:0}.gist .file-data>table td.line-data{width:99%}div.unbreakable{page-break-inside:avoid}.big{font-size:larger}.small{font-size:smaller}.underline{text-decoration:underline}.overline{text-decoration:overline}.line-through{text-decoration:line-through}.aqua{color:#00bfbf}.aqua-background{background-color:#00fafa}.black{color:black}.black-background{background-color:black}.blue{color:#0000bf}.blue-background{background-color:#0000fa}.fuchsia{color:#bf00bf}.fuchsia-background{background-color:#fa00fa}.gray{color:#606060}.gray-background{background-color:#7d7d7d}.green{color:#006000}.green-background{background-color:#007d00}.lime{color:#00bf00}.lime-background{background-color:#00fa00}.maroon{color:#600000}.maroon-background{background-color:#7d0000}.navy{color:#000060}.navy-background{background-color:#00007d}.olive{color:#606000}.olive-background{background-color:#7d7d00}.purple{color:#600060}.purple-background{background-color:#7d007d}.red{color:#bf0000}.red-background{background-color:#fa0000}.silver{color:#909090}.silver-background{background-color:#bcbcbc}.teal{color:#006060}.teal-background{background-color:#007d7d}.white{color:#bfbfbf}.white-background{background-color:#fafafa}.yellow{color:#bfbf00}.yellow-background{background-color:#fafa00}span.icon>.fa{cursor:default}.admonitionblock td.icon [class^="fa icon-"]{font-size:2.5em;cursor:default}.admonitionblock td.icon .icon-note:before{content:"\f05a";color:#3f6a22}.admonitionblock td.icon .icon-tip:before{content:"\f0eb";color:#0077b9}.admonitionblock td.icon .icon-warning:before{content:"\f071";color:#d88400}.admonitionblock td.icon .icon-caution:before{content:"\f06d";color:#bf3400}.admonitionblock td.icon .icon-important:before{content:"\f06a";color:#bf0000}.conum[data-value]{display:inline-block;color:#000 !important;background-color:#ffe157;-webkit-border-radius:100px;border-radius:100px;text-align:center;font-size:0.75em;width:1.67em;height:1.67em;line-height:1.67em;font-family:"Open Sans", "DejaVu Sans", sans-serif;font-style:normal;font-weight:bold}.conum[data-value] *{color:#fff !important}.conum[data-value]+b{display:none}.conum[data-value]:after{content:attr(data-value)}pre .conum[data-value]{position:relative;top:0;color:#000 !important;background-color:#ffe157;font-size:12px}b.conum *{color:inherit !important}.conum:not([data-value]):empty{display:none}.admonitionblock{background-color:#ecf1e8;padding:0.8em 0;margin:30px 0;width:auto;border-radius:4px;overflow-x:scroll}.admonitionblock.important{border-left:0px solid #e20000;background-color:#f9ebeb}.admonitionblock.warning{border-left:0px solid #d88400;background-color:#fff9e4}.admonitionblock.tip{border-left:0px solid #0077b9;background-color:#e9f1f6}.admonitionblock.caution{border-left:0px solid #e20000;background-color:#f9ebeb}.admonitionblock .exampleblock>.content{border:0 none;background-color:#fff}#toc a:hover{text-decoration:underline}.admonitionblock>table{margin-bottom:0}.admonitionblock>table td.content{border-left:none}@media print{#tocbot a.toc-link.node-name--H4{display:none}}.is-collapsible{max-height:1000px;overflow:hidden;transition:all 200ms ease-in-out}.is-collapsed{max-height:0}div.back-action,#toc.toc2 div.back-action{padding:0.8rem 0 0 0}div.back-action a,#toc.toc2 div.back-action a{position:relative;display:inline-block;padding:0.6rem 1.2rem;padding-left:35px}div.back-action a span,#toc.toc2 div.back-action a span{position:absolute;left:5px;top:5px;display:block;color:#333;height:26px;width:26px;border-radius:13px}div.back-action a i,#toc.toc2 div.back-action a i{position:absolute;top:5px;left:5px}div.back-action a:hover span,#toc.toc2 div.back-action a:hover span{color:#000}#tocbot.desktop-toc{padding-top:0.8rem}#header-spring{position:absolute;text-rendering:optimizeLegibility;top:0;left:0;right:0;height:90px;margin:0 1rem;padding:0 1rem;border-bottom:1px solid #ddddd8;border-top:3px solid #6BB344}#header-spring h1{margin:0;padding:0;font-size:22px;text-align:left;line-height:86px;padding-left:0.6rem}#header-spring h1 svg{width:200px}#header-spring h1 svg .st0{fill:#6BB344}#header-spring h1 svg .st2{fill:#444}body.book #header-spring{position:relative;top:auto;left:auto;right:auto;margin:0}body.book #header>h1:only-child{border:0 none;padding-bottom:1.2rem;font-size:1.8rem}body.book #header,body.book #content,body.book #footnotes,body.book #footer{margin:0 auto}body.toc2 #header-spring{position:absolute;left:0;right:0;top:0}body.toc2 #header>h1:only-child{font-size:2.2rem}body.toc2 #header,body.toc2 #content,body.toc2 #footnotes,body.toc2 #footer{margin:0 auto}body.toc2 #content{padding-top:2rem}#header,#content,#footnotes,#footer{width:100%;margin-right:auto;margin-top:0;margin-bottom:0;max-width:62.5em;*zoom:1;position:relative;padding-left:0.9375em;padding-right:0.9375em}#header:before,#header:after,#content:before,#content:after,#footnotes:before,#footnotes:after,#footer:before,#footer:after{content:" ";display:table}#header:after,#content:after,#footnotes:after,#footer:after{clear:both}#content{margin-top:1.25em}#content:before{content:none}#header>h1:first-child{margin-top:2.55rem;margin-bottom:0.5em;margin-bottom:0.5em}#header>h1:first-child+#toc{margin-top:8px;border-top:0 none}#header>h1:only-child,body.toc2 #header>h1:nth-last-child(2){border-bottom:1px solid #ddddd8;padding-bottom:8px}#header .details{border-bottom:1px solid #ddddd8;line-height:1.45;padding-top:0;padding-bottom:2.25em;padding-left:0.25em;color:rgba(0,0,0,0.6);display:-ms-flexbox;display:-webkit-flex;display:flex;-ms-flex-flow:row wrap;-webkit-flex-flow:row wrap;flex-flow:row wrap}#header .details span:first-child{margin-left:-0.125em}#header .details span.email a{color:rgba(0,0,0,0.85)}#header .details br{display:none}#header .details br+span:before{content:"\00a0\2013\00a0"}#header .details br+span.author:before{content:"\00a0\22c5\00a0";color:rgba(0,0,0,0.85)}#header .details br+span#revremark:before{content:"\00a0|\00a0"}#header #revnumber{text-transform:capitalize}#header #revnumber:after{content:"\00a0"}#content>h1:first-child:not([class]){color:rgba(0,0,0,0.85);border-bottom:1px solid #ddddd8;padding-bottom:8px;margin-top:0;padding-top:1.5rem;margin-bottom:1.25rem}h1{font-size:2.2rem;letter-spacing:-1px}h1,h2,h3,h4,h5,h6{font-weight:normal;font-family:Montserrat, Arial, Helvetica, sans-serif}h1:focus,h2:focus,h3:focus,h4:focus,h5:focus,h6:focus{box-shadow:none;outline:none}h2,h3,h4,h5,h6{padding:.8rem 0 .4rem}h1{font-size:1.75em}h2{font-size:1.6rem;letter-spacing:-1px}h3{font-size:1.5rem}h4{font-size:1.4rem}h5{font-size:1.3rem}h6{font-size:1.2rem}pre.highlight{background:#232323;color:#e6e1dc;border-radius:4px}pre.highlight code{color:#e6e1dc}pre.highlight a,#toc.toc2 a{color:#000;font-size:1rem}pre.highlight ul.sectlevel1,#toc.toc2 ul.sectlevel1{padding-left:0.2rem}pre.highlight ul.sectlevel1 li,#toc.toc2 ul.sectlevel1 li{line-height:1.4rem}::selection{background-color:#d1ff79}.literalblock pre::selection,.listingblock pre[class="highlight"]::selection,.highlight::selection,pre::selection,.highlight code::selection,.highlight code span::selection{background:rgba(255,255,255,0.2) !important}body.book #header{margin-bottom:2rem}body.toc2 #header{margin-bottom:0}.desktop-toc{display:none}.admonitionblock td.icon{display:none}.admonitionblock>table td.content{padding-left:1.25em}@media only screen and (min-width: 768px){#toctitle{font-size:1.375em}.sect1{padding-bottom:1.25em}.mobile-toc{display:none}.desktop-toc{display:block}.literalblock pre,.literalblock pre[class],.listingblock pre,.listingblock pre[class]{font-size:0.90625em}.admonitionblock td.icon{display:table-cell}.admonitionblock>table td.content{padding-left:0}body.toc2{padding-right:0}body.toc2 #toc.toc2{position:absolute;margin-top:0 !important;width:15em;top:0;border-top-width:0 !important;border-bottom-width:0 !important;margin-left:-15.9375em;z-index:1000;padding:0 1em 1.25em 0em;overflow:auto}body.toc2 #toc.toc2 #toctitle{margin-top:0;margin-bottom:0.8rem;font-size:1.2em}body.toc2 #toc.toc2>ul{font-size:0.9em;margin-bottom:0}body.toc2 #toc.toc2 ul ul{margin-left:0;padding-left:1em}body.toc2 #toc.toc2 ul.sectlevel0 ul.sectlevel1{padding-left:0;margin-top:0.5em;margin-bottom:0.5em}body.toc2 #header,body.toc2 #content,body.toc2 #footnotes,body.toc2 #footer{padding-left:15.9375em;max-width:none}body.book #header-spring h1{max-width:1400px;margin:0 auto}body.book #header,body.book #content,body.book #footnotes,body.book #footer{max-width:1400px}body.is-position-fixed #toc.toc2{position:fixed;height:100%}h1,h2,h3,#toctitle,.sidebarblock>.content>.title,h4,h5,h6{line-height:1.2}h1{font-size:1.75em}h2{font-size:1.6em}h3,#toctitle,.sidebarblock>.content>.title{font-size:1.5em}h4{font-size:1.4em}h5{font-size:1.2em}h6{font-size:1.2em}#tocbot a.toc-link.node-name--H1{font-style:italic}#tocbot ol{margin:0;padding:0;padding-left:0.6rem}#tocbot ol li{list-style:none;padding:0 0;margin:0;display:block}#tocbot{z-index:999}#tocbot .toc-link{position:relative;display:block;z-index:999;padding-right:5px;padding-top:4px;padding-bottom:4px}#tocbot .is-active-link{padding-right:3px;border-right:3px solid #6BB344}}@media only screen and (min-width: 768px){#tocbot>ul.toc-list{margin-bottom:0.5em;margin-left:0.125em}#tocbot ul.sectlevel0,#tocbot a.toc-link.node-name--H1+ul{padding-left:0}#tocbot a.toc-link{height:100%}.is-collapsible{max-height:3000px;overflow:hidden}.is-collapsed{max-height:0}.is-active-link{font-weight:700}}@media only screen and (min-width: 768px){body.toc2 #header,body.toc2 #content,body.toc2 #footer{background-repeat:repeat-y;background-position:14em 0;background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAMAAAAoyzS7AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyhpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNi1jMTQwIDc5LjE2MDQ1MSwgMjAxNy8wNS8wNi0wMTowODoyMSAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENDIDIwMTggKE1hY2ludG9zaCkiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6RDE0NUNENzNGMTVGMTFFODk5RjI5ODk3QURGRjcxMkEiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6RDE0NUNENzRGMTVGMTFFODk5RjI5ODk3QURGRjcxMkEiPiA8eG1wTU06RGVyaXZlZEZyb20gc3RSZWY6aW5zdGFuY2VJRD0ieG1wLmlpZDpEMTQ1Q0Q3MUYxNUYxMUU4OTlGMjk4OTdBREZGNzEyQSIgc3RSZWY6ZG9jdW1lbnRJRD0ieG1wLmRpZDpEMTQ1Q0Q3MkYxNUYxMUU4OTlGMjk4OTdBREZGNzEyQSIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/PjmGxxYAAAAGUExURd3d2AAAAJlCnKAAAAAMSURBVHjaYmAACDAAAAIAAU9tWeEAAAAASUVORK5CYII=)}}@media only screen and (min-width: 1280px){body.toc2{padding-right:0}body.toc2 #toc.toc2{width:25em;left:auto;margin-left:-26.9375em}body.toc2 #toc.toc2 #toctitle{font-size:1.375em}body.toc2 #toc.toc2>ul{font-size:0.95em}body.toc2 #toc.toc2 ul ul{padding-left:1.25em}body.toc2 body.toc2.toc-right{padding-left:0;padding-right:20em}body.toc2 #header,body.toc2 #content,body.toc2 #footnotes,body.toc2 #footer{padding-left:26.9375em;max-width:1400px}body.toc2 #header-spring h1{margin:0 auto;max-width:1400px}.literalblock pre,.literalblock pre[class],.listingblock pre,.listingblock pre[class]{font-size:0.8125em}body.toc2 #header,body.toc2 #content,body.toc2 #footer{background-repeat:repeat-y;background-position:24em 0;background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAMAAAAoyzS7AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyhpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNi1jMTQwIDc5LjE2MDQ1MSwgMjAxNy8wNS8wNi0wMTowODoyMSAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENDIDIwMTggKE1hY2ludG9zaCkiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6RDE0NUNENzNGMTVGMTFFODk5RjI5ODk3QURGRjcxMkEiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6RDE0NUNENzRGMTVGMTFFODk5RjI5ODk3QURGRjcxMkEiPiA8eG1wTU06RGVyaXZlZEZyb20gc3RSZWY6aW5zdGFuY2VJRD0ieG1wLmlpZDpEMTQ1Q0Q3MUYxNUYxMUU4OTlGMjk4OTdBREZGNzEyQSIgc3RSZWY6ZG9jdW1lbnRJRD0ieG1wLmRpZDpEMTQ1Q0Q3MkYxNUYxMUU4OTlGMjk4OTdBREZGNzEyQSIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/PjmGxxYAAAAGUExURd3d2AAAAJlCnKAAAAAMSURBVHjaYmAACDAAAAIAAU9tWeEAAAAASUVORK5CYII=)}} diff --git a/spring-cloud-stream-binder-kafka/3.0.0.RELEASE/reference/html/dlq.html b/spring-cloud-stream-binder-kafka/3.0.0.RELEASE/reference/html/dlq.html new file mode 100644 index 00000000..6d825ae2 --- /dev/null +++ b/spring-cloud-stream-binder-kafka/3.0.0.RELEASE/reference/html/dlq.html @@ -0,0 +1,268 @@ + + + + + + + +Dead-Letter Topic Processing + + + + + + + + + + +
+
+

Dead-Letter Topic Processing

+
+

Dead-Letter Topic Partition Selection

+
+

By default, records are published to the Dead-Letter topic using the same partition as the original record. +This means the Dead-Letter topic must have at least as many partitions as the original record.

+
+
+

To change this behavior, add a DlqPartitionFunction implementation as a @Bean to the application context. +Only one such bean can be present. +The function is provided with the consumer group, the failed ConsumerRecord and the exception. +For example, if you always want to route to partition 0, you might use:

+
+
+
+
+
+
@Bean
+public DlqPartitionFunction partitionFunction() {
+    return (group, record, ex) -> 0;
+}
+
+
+
+
+
+ + + + + +
+ + +If you set a consumer binding’s dlqPartitions property to 1 (and the binder’s minPartitionCount is equal to 1), there is no need to supply a DlqPartitionFunction; the framework will always use partition 0. +If you set a consumer binding’s dlqPartitions property to a value greater than 1 (or the binder’s minPartitionCount is greater than 1), you must provide a DlqPartitionFunction bean, even if the partition count is the same as the original topic’s. +
+
+
+
+

Handling Records in a Dead-Letter Topic

+
+

Because the framework cannot anticipate how users would want to dispose of dead-lettered messages, it does not provide any standard mechanism to handle them. +If the reason for the dead-lettering is transient, you may wish to route the messages back to the original topic. +However, if the problem is a permanent issue, that could cause an infinite loop. +The sample Spring Boot application within this topic is an example of how to route those messages back to the original topic, but it moves them to a “parking lot” topic after three attempts. +The application is another spring-cloud-stream application that reads from the dead-letter topic. +It terminates when no messages are received for 5 seconds.

+
+
+

The examples assume the original destination is so8400out and the consumer group is so8400.

+
+
+

There are a couple of strategies to consider:

+
+
+
    +
  • +

    Consider running the rerouting only when the main application is not running. +Otherwise, the retries for transient errors are used up very quickly.

    +
  • +
  • +

    Alternatively, use a two-stage approach: Use this application to route to a third topic and another to route from there back to the main topic.

    +
  • +
+
+
+

The following code listings show the sample application:

+
+
+
application.properties
+
+
spring.cloud.stream.bindings.input.group=so8400replay
+spring.cloud.stream.bindings.input.destination=error.so8400out.so8400
+
+spring.cloud.stream.bindings.output.destination=so8400out
+
+spring.cloud.stream.bindings.parkingLot.destination=so8400in.parkingLot
+
+spring.cloud.stream.kafka.binder.configuration.auto.offset.reset=earliest
+
+spring.cloud.stream.kafka.binder.headers=x-retries
+
+
+
+
Application
+
+
@SpringBootApplication
+@EnableBinding(TwoOutputProcessor.class)
+public class ReRouteDlqKApplication implements CommandLineRunner {
+
+    private static final String X_RETRIES_HEADER = "x-retries";
+
+    public static void main(String[] args) {
+        SpringApplication.run(ReRouteDlqKApplication.class, args).close();
+    }
+
+    private final AtomicInteger processed = new AtomicInteger();
+
+    @Autowired
+    private MessageChannel parkingLot;
+
+    @StreamListener(Processor.INPUT)
+    @SendTo(Processor.OUTPUT)
+    public Message<?> reRoute(Message<?> failed) {
+        processed.incrementAndGet();
+        Integer retries = failed.getHeaders().get(X_RETRIES_HEADER, Integer.class);
+        if (retries == null) {
+            System.out.println("First retry for " + failed);
+            return MessageBuilder.fromMessage(failed)
+                    .setHeader(X_RETRIES_HEADER, new Integer(1))
+                    .setHeader(BinderHeaders.PARTITION_OVERRIDE,
+                            failed.getHeaders().get(KafkaHeaders.RECEIVED_PARTITION_ID))
+                    .build();
+        }
+        else if (retries.intValue() < 3) {
+            System.out.println("Another retry for " + failed);
+            return MessageBuilder.fromMessage(failed)
+                    .setHeader(X_RETRIES_HEADER, new Integer(retries.intValue() + 1))
+                    .setHeader(BinderHeaders.PARTITION_OVERRIDE,
+                            failed.getHeaders().get(KafkaHeaders.RECEIVED_PARTITION_ID))
+                    .build();
+        }
+        else {
+            System.out.println("Retries exhausted for " + failed);
+            parkingLot.send(MessageBuilder.fromMessage(failed)
+                    .setHeader(BinderHeaders.PARTITION_OVERRIDE,
+                            failed.getHeaders().get(KafkaHeaders.RECEIVED_PARTITION_ID))
+                    .build());
+        }
+        return null;
+    }
+
+    @Override
+    public void run(String... args) throws Exception {
+        while (true) {
+            int count = this.processed.get();
+            Thread.sleep(5000);
+            if (count == this.processed.get()) {
+                System.out.println("Idle, terminating");
+                return;
+            }
+        }
+    }
+
+    public interface TwoOutputProcessor extends Processor {
+
+        @Output("parkingLot")
+        MessageChannel parkingLot();
+
+    }
+
+}
+
+
+
+
+
+ + + + + + + \ No newline at end of file diff --git a/spring-cloud-stream-binder-kafka/3.0.0.RELEASE/reference/html/favicon.ico b/spring-cloud-stream-binder-kafka/3.0.0.RELEASE/reference/html/favicon.ico new file mode 100644 index 00000000..1a4956e6 Binary files /dev/null and b/spring-cloud-stream-binder-kafka/3.0.0.RELEASE/reference/html/favicon.ico differ diff --git a/spring-cloud-stream-binder-kafka/3.0.0.RELEASE/reference/html/images/kafka-binder.png b/spring-cloud-stream-binder-kafka/3.0.0.RELEASE/reference/html/images/kafka-binder.png new file mode 100644 index 00000000..7c6c4c02 Binary files /dev/null and b/spring-cloud-stream-binder-kafka/3.0.0.RELEASE/reference/html/images/kafka-binder.png differ diff --git a/spring-cloud-stream-binder-kafka/3.0.0.RELEASE/reference/html/images/kafka-streams-initializr.png b/spring-cloud-stream-binder-kafka/3.0.0.RELEASE/reference/html/images/kafka-streams-initializr.png new file mode 100644 index 00000000..3f101489 Binary files /dev/null and b/spring-cloud-stream-binder-kafka/3.0.0.RELEASE/reference/html/images/kafka-streams-initializr.png differ diff --git a/spring-cloud-stream-binder-kafka/3.0.0.RELEASE/reference/html/images/spring-initializr-kafka-streams.png b/spring-cloud-stream-binder-kafka/3.0.0.RELEASE/reference/html/images/spring-initializr-kafka-streams.png new file mode 100644 index 00000000..f629e9df Binary files /dev/null and b/spring-cloud-stream-binder-kafka/3.0.0.RELEASE/reference/html/images/spring-initializr-kafka-streams.png differ diff --git a/spring-cloud-stream-binder-kafka/3.0.0.RELEASE/reference/html/js/highlight/highlight.min.js b/spring-cloud-stream-binder-kafka/3.0.0.RELEASE/reference/html/js/highlight/highlight.min.js new file mode 100644 index 00000000..dcbbb4c7 --- /dev/null +++ b/spring-cloud-stream-binder-kafka/3.0.0.RELEASE/reference/html/js/highlight/highlight.min.js @@ -0,0 +1,2 @@ +/*! highlight.js v9.13.1 | BSD3 License | git.io/hljslicense */ +!function(e){var n="object"==typeof window&&window||"object"==typeof self&&self;"undefined"!=typeof exports?e(exports):n&&(n.hljs=e({}),"function"==typeof define&&define.amd&&define([],function(){return n.hljs}))}(function(e){function n(e){return e.replace(/&/g,"&").replace(//g,">")}function t(e){return e.nodeName.toLowerCase()}function r(e,n){var t=e&&e.exec(n);return t&&0===t.index}function a(e){return k.test(e)}function i(e){var n,t,r,i,o=e.className+" ";if(o+=e.parentNode?e.parentNode.className:"",t=M.exec(o))return w(t[1])?t[1]:"no-highlight";for(o=o.split(/\s+/),n=0,r=o.length;r>n;n++)if(i=o[n],a(i)||w(i))return i}function o(e){var n,t={},r=Array.prototype.slice.call(arguments,1);for(n in e)t[n]=e[n];return r.forEach(function(e){for(n in e)t[n]=e[n]}),t}function c(e){var n=[];return function r(e,a){for(var i=e.firstChild;i;i=i.nextSibling)3===i.nodeType?a+=i.nodeValue.length:1===i.nodeType&&(n.push({event:"start",offset:a,node:i}),a=r(i,a),t(i).match(/br|hr|img|input/)||n.push({event:"stop",offset:a,node:i}));return a}(e,0),n}function u(e,r,a){function i(){return e.length&&r.length?e[0].offset!==r[0].offset?e[0].offset"}function c(e){l+=""}function u(e){("start"===e.event?o:c)(e.node)}for(var s=0,l="",f=[];e.length||r.length;){var g=i();if(l+=n(a.substring(s,g[0].offset)),s=g[0].offset,g===e){f.reverse().forEach(c);do u(g.splice(0,1)[0]),g=i();while(g===e&&g.length&&g[0].offset===s);f.reverse().forEach(o)}else"start"===g[0].event?f.push(g[0].node):f.pop(),u(g.splice(0,1)[0])}return l+n(a.substr(s))}function s(e){return e.v&&!e.cached_variants&&(e.cached_variants=e.v.map(function(n){return o(e,{v:null},n)})),e.cached_variants||e.eW&&[o(e)]||[e]}function l(e){function n(e){return e&&e.source||e}function t(t,r){return new RegExp(n(t),"m"+(e.cI?"i":"")+(r?"g":""))}function r(a,i){if(!a.compiled){if(a.compiled=!0,a.k=a.k||a.bK,a.k){var o={},c=function(n,t){e.cI&&(t=t.toLowerCase()),t.split(" ").forEach(function(e){var t=e.split("|");o[t[0]]=[n,t[1]?Number(t[1]):1]})};"string"==typeof a.k?c("keyword",a.k):B(a.k).forEach(function(e){c(e,a.k[e])}),a.k=o}a.lR=t(a.l||/\w+/,!0),i&&(a.bK&&(a.b="\\b("+a.bK.split(" ").join("|")+")\\b"),a.b||(a.b=/\B|\b/),a.bR=t(a.b),a.endSameAsBegin&&(a.e=a.b),a.e||a.eW||(a.e=/\B|\b/),a.e&&(a.eR=t(a.e)),a.tE=n(a.e)||"",a.eW&&i.tE&&(a.tE+=(a.e?"|":"")+i.tE)),a.i&&(a.iR=t(a.i)),null==a.r&&(a.r=1),a.c||(a.c=[]),a.c=Array.prototype.concat.apply([],a.c.map(function(e){return s("self"===e?a:e)})),a.c.forEach(function(e){r(e,a)}),a.starts&&r(a.starts,i);var u=a.c.map(function(e){return e.bK?"\\.?("+e.b+")\\.?":e.b}).concat([a.tE,a.i]).map(n).filter(Boolean);a.t=u.length?t(u.join("|"),!0):{exec:function(){return null}}}}r(e)}function f(e,t,a,i){function o(e){return new RegExp(e.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"),"m")}function c(e,n){var t,a;for(t=0,a=n.c.length;a>t;t++)if(r(n.c[t].bR,e))return n.c[t].endSameAsBegin&&(n.c[t].eR=o(n.c[t].bR.exec(e)[0])),n.c[t]}function u(e,n){if(r(e.eR,n)){for(;e.endsParent&&e.parent;)e=e.parent;return e}return e.eW?u(e.parent,n):void 0}function s(e,n){return!a&&r(n.iR,e)}function p(e,n){var t=R.cI?n[0].toLowerCase():n[0];return e.k.hasOwnProperty(t)&&e.k[t]}function d(e,n,t,r){var a=r?"":j.classPrefix,i='',i+n+o}function h(){var e,t,r,a;if(!E.k)return n(k);for(a="",t=0,E.lR.lastIndex=0,r=E.lR.exec(k);r;)a+=n(k.substring(t,r.index)),e=p(E,r),e?(M+=e[1],a+=d(e[0],n(r[0]))):a+=n(r[0]),t=E.lR.lastIndex,r=E.lR.exec(k);return a+n(k.substr(t))}function b(){var e="string"==typeof E.sL;if(e&&!L[E.sL])return n(k);var t=e?f(E.sL,k,!0,B[E.sL]):g(k,E.sL.length?E.sL:void 0);return E.r>0&&(M+=t.r),e&&(B[E.sL]=t.top),d(t.language,t.value,!1,!0)}function v(){y+=null!=E.sL?b():h(),k=""}function m(e){y+=e.cN?d(e.cN,"",!0):"",E=Object.create(e,{parent:{value:E}})}function N(e,n){if(k+=e,null==n)return v(),0;var t=c(n,E);if(t)return t.skip?k+=n:(t.eB&&(k+=n),v(),t.rB||t.eB||(k=n)),m(t,n),t.rB?0:n.length;var r=u(E,n);if(r){var a=E;a.skip?k+=n:(a.rE||a.eE||(k+=n),v(),a.eE&&(k=n));do E.cN&&(y+=I),E.skip||E.sL||(M+=E.r),E=E.parent;while(E!==r.parent);return r.starts&&(r.endSameAsBegin&&(r.starts.eR=r.eR),m(r.starts,"")),a.rE?0:n.length}if(s(n,E))throw new Error('Illegal lexeme "'+n+'" for mode "'+(E.cN||"")+'"');return k+=n,n.length||1}var R=w(e);if(!R)throw new Error('Unknown language: "'+e+'"');l(R);var x,E=i||R,B={},y="";for(x=E;x!==R;x=x.parent)x.cN&&(y=d(x.cN,"",!0)+y);var k="",M=0;try{for(var C,A,S=0;;){if(E.t.lastIndex=S,C=E.t.exec(t),!C)break;A=N(t.substring(S,C.index),C[0]),S=C.index+A}for(N(t.substr(S)),x=E;x.parent;x=x.parent)x.cN&&(y+=I);return{r:M,value:y,language:e,top:E}}catch(O){if(O.message&&-1!==O.message.indexOf("Illegal"))return{r:0,value:n(t)};throw O}}function g(e,t){t=t||j.languages||B(L);var r={r:0,value:n(e)},a=r;return t.filter(w).filter(x).forEach(function(n){var t=f(n,e,!1);t.language=n,t.r>a.r&&(a=t),t.r>r.r&&(a=r,r=t)}),a.language&&(r.second_best=a),r}function p(e){return j.tabReplace||j.useBR?e.replace(C,function(e,n){return j.useBR&&"\n"===e?"
":j.tabReplace?n.replace(/\t/g,j.tabReplace):""}):e}function d(e,n,t){var r=n?y[n]:t,a=[e.trim()];return e.match(/\bhljs\b/)||a.push("hljs"),-1===e.indexOf(r)&&a.push(r),a.join(" ").trim()}function h(e){var n,t,r,o,s,l=i(e);a(l)||(j.useBR?(n=document.createElementNS("http://www.w3.org/1999/xhtml","div"),n.innerHTML=e.innerHTML.replace(/\n/g,"").replace(//g,"\n")):n=e,s=n.textContent,r=l?f(l,s,!0):g(s),t=c(n),t.length&&(o=document.createElementNS("http://www.w3.org/1999/xhtml","div"),o.innerHTML=r.value,r.value=u(t,c(o),s)),r.value=p(r.value),e.innerHTML=r.value,e.className=d(e.className,l,r.language),e.result={language:r.language,re:r.r},r.second_best&&(e.second_best={language:r.second_best.language,re:r.second_best.r}))}function b(e){j=o(j,e)}function v(){if(!v.called){v.called=!0;var e=document.querySelectorAll("pre code");E.forEach.call(e,h)}}function m(){addEventListener("DOMContentLoaded",v,!1),addEventListener("load",v,!1)}function N(n,t){var r=L[n]=t(e);r.aliases&&r.aliases.forEach(function(e){y[e]=n})}function R(){return B(L)}function w(e){return e=(e||"").toLowerCase(),L[e]||L[y[e]]}function x(e){var n=w(e);return n&&!n.disableAutodetect}var E=[],B=Object.keys,L={},y={},k=/^(no-?highlight|plain|text)$/i,M=/\blang(?:uage)?-([\w-]+)\b/i,C=/((^(<[^>]+>|\t|)+|(?:\n)))/gm,I="
",j={classPrefix:"hljs-",tabReplace:null,useBR:!1,languages:void 0};return e.highlight=f,e.highlightAuto=g,e.fixMarkup=p,e.highlightBlock=h,e.configure=b,e.initHighlighting=v,e.initHighlightingOnLoad=m,e.registerLanguage=N,e.listLanguages=R,e.getLanguage=w,e.autoDetection=x,e.inherit=o,e.IR="[a-zA-Z]\\w*",e.UIR="[a-zA-Z_]\\w*",e.NR="\\b\\d+(\\.\\d+)?",e.CNR="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",e.BNR="\\b(0b[01]+)",e.RSR="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",e.BE={b:"\\\\[\\s\\S]",r:0},e.ASM={cN:"string",b:"'",e:"'",i:"\\n",c:[e.BE]},e.QSM={cN:"string",b:'"',e:'"',i:"\\n",c:[e.BE]},e.PWM={b:/\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|they|like|more)\b/},e.C=function(n,t,r){var a=e.inherit({cN:"comment",b:n,e:t,c:[]},r||{});return a.c.push(e.PWM),a.c.push({cN:"doctag",b:"(?:TODO|FIXME|NOTE|BUG|XXX):",r:0}),a},e.CLCM=e.C("//","$"),e.CBCM=e.C("/\\*","\\*/"),e.HCM=e.C("#","$"),e.NM={cN:"number",b:e.NR,r:0},e.CNM={cN:"number",b:e.CNR,r:0},e.BNM={cN:"number",b:e.BNR,r:0},e.CSSNM={cN:"number",b:e.NR+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",r:0},e.RM={cN:"regexp",b:/\//,e:/\/[gimuy]*/,i:/\n/,c:[e.BE,{b:/\[/,e:/\]/,r:0,c:[e.BE]}]},e.TM={cN:"title",b:e.IR,r:0},e.UTM={cN:"title",b:e.UIR,r:0},e.METHOD_GUARD={b:"\\.\\s*"+e.UIR,r:0},e});hljs.registerLanguage("bash",function(e){var t={cN:"variable",v:[{b:/\$[\w\d#@][\w\d_]*/},{b:/\$\{(.*?)}/}]},s={cN:"string",b:/"/,e:/"/,c:[e.BE,t,{cN:"variable",b:/\$\(/,e:/\)/,c:[e.BE]}]},a={cN:"string",b:/'/,e:/'/};return{aliases:["sh","zsh"],l:/\b-?[a-z\._]+\b/,k:{keyword:"if then else elif fi for while in do done case esac function",literal:"true false",built_in:"break cd continue eval exec exit export getopts hash pwd readonly return shift test times trap umask unset alias bind builtin caller command declare echo enable help let local logout mapfile printf read readarray source type typeset ulimit unalias set shopt autoload bg bindkey bye cap chdir clone comparguments compcall compctl compdescribe compfiles compgroups compquote comptags comptry compvalues dirs disable disown echotc echoti emulate fc fg float functions getcap getln history integer jobs kill limit log noglob popd print pushd pushln rehash sched setcap setopt stat suspend ttyctl unfunction unhash unlimit unsetopt vared wait whence where which zcompile zformat zftp zle zmodload zparseopts zprof zpty zregexparse zsocket zstyle ztcp",_:"-ne -eq -lt -gt -f -d -e -s -l -a"},c:[{cN:"meta",b:/^#![^\n]+sh\s*$/,r:10},{cN:"function",b:/\w[\w\d_]*\s*\(\s*\)\s*\{/,rB:!0,c:[e.inherit(e.TM,{b:/\w[\w\d_]*/})],r:0},e.HCM,s,a,t]}});hljs.registerLanguage("dockerfile",function(e){return{aliases:["docker"],cI:!0,k:"from maintainer expose env arg user onbuild stopsignal",c:[e.HCM,e.ASM,e.QSM,e.NM,{bK:"run cmd entrypoint volume add copy workdir label healthcheck shell",starts:{e:/[^\\]\n/,sL:"bash"}}],i:")?[^\s\(]+(\s+[^\s\(]+)\s*=/,r:5,c:[{b:e.UIR+"\\s*\\(",rB:!0,r:0,c:[e.UTM]},{cN:"type",b://,k:"reified",r:0},{cN:"params",b:/\(/,e:/\)/,endsParent:!0,k:t,r:0,c:[{b:/:/,e:/[=,\/]/,eW:!0,c:[{cN:"type",b:e.UIR},e.CLCM,e.CBCM],r:0},e.CLCM,e.CBCM,s,l,c,e.CNM]},e.CBCM]},{cN:"class",bK:"class interface trait",e:/[:\{(]|$/,eE:!0,i:"extends implements",c:[{bK:"public protected internal private constructor"},e.UTM,{cN:"type",b://,eB:!0,eE:!0,r:0},{cN:"type",b:/[,:]\s*/,e:/[<\(,]|$/,eB:!0,rE:!0},s,l]},c,{cN:"meta",b:"^#!/usr/bin/env",e:"$",i:"\n"},o]}});hljs.registerLanguage("java",function(e){var a="[À-ʸa-zA-Z_$][À-ʸa-zA-Z_$0-9]*",t=a+"(<"+a+"(\\s*,\\s*"+a+")*>)?",r="false synchronized int abstract float private char boolean var static null if const for true while long strictfp finally protected import native final void enum else break transient catch instanceof byte super volatile case assert short package default double public try this switch continue throws protected public private module requires exports do",s="\\b(0[bB]([01]+[01_]+[01]+|[01]+)|0[xX]([a-fA-F0-9]+[a-fA-F0-9_]+[a-fA-F0-9]+|[a-fA-F0-9]+)|(([\\d]+[\\d_]+[\\d]+|[\\d]+)(\\.([\\d]+[\\d_]+[\\d]+|[\\d]+))?|\\.([\\d]+[\\d_]+[\\d]+|[\\d]+))([eE][-+]?\\d+)?)[lLfF]?",c={cN:"number",b:s,r:0};return{aliases:["jsp"],k:r,i:/<\/|#/,c:[e.C("/\\*\\*","\\*/",{r:0,c:[{b:/\w+@/,r:0},{cN:"doctag",b:"@[A-Za-z]+"}]}),e.CLCM,e.CBCM,e.ASM,e.QSM,{cN:"class",bK:"class interface",e:/[{;=]/,eE:!0,k:"class interface",i:/[:"\[\]]/,c:[{bK:"extends implements"},e.UTM]},{bK:"new throw return else",r:0},{cN:"function",b:"("+t+"\\s+)+"+e.UIR+"\\s*\\(",rB:!0,e:/[{;=]/,eE:!0,k:r,c:[{b:e.UIR+"\\s*\\(",rB:!0,r:0,c:[e.UTM]},{cN:"params",b:/\(/,e:/\)/,k:r,r:0,c:[e.ASM,e.QSM,e.CNM,e.CBCM]},e.CLCM,e.CBCM]},c,{cN:"meta",b:"@[A-Za-z]+"}]}});hljs.registerLanguage("xml",function(s){var e="[A-Za-z0-9\\._:-]+",t={eW:!0,i:/`]+/}]}]}]};return{aliases:["html","xhtml","rss","atom","xjb","xsd","xsl","plist"],cI:!0,c:[{cN:"meta",b:"",r:10,c:[{b:"\\[",e:"\\]"}]},s.C("",{r:10}),{b:"<\\!\\[CDATA\\[",e:"\\]\\]>",r:10},{cN:"meta",b:/<\?xml/,e:/\?>/,r:10},{b:/<\?(php)?/,e:/\?>/,sL:"php",c:[{b:"/\\*",e:"\\*/",skip:!0},{b:'b"',e:'"',skip:!0},{b:"b'",e:"'",skip:!0},s.inherit(s.ASM,{i:null,cN:null,c:null,skip:!0}),s.inherit(s.QSM,{i:null,cN:null,c:null,skip:!0})]},{cN:"tag",b:"|$)",e:">",k:{name:"style"},c:[t],starts:{e:"",rE:!0,sL:["css","xml"]}},{cN:"tag",b:"|$)",e:">",k:{name:"script"},c:[t],starts:{e:"",rE:!0,sL:["actionscript","javascript","handlebars","xml"]}},{cN:"tag",b:"",c:[{cN:"name",b:/[^\/><\s]+/,r:0},t]}]}});hljs.registerLanguage("properties",function(r){var t="[ \\t\\f]*",e="[ \\t\\f]+",s="("+t+"[:=]"+t+"|"+e+")",n="([^\\\\\\W:= \\t\\f\\n]|\\\\.)+",a="([^\\\\:= \\t\\f\\n]|\\\\.)+",c={e:s,r:0,starts:{cN:"string",e:/$/,r:0,c:[{b:"\\\\\\n"}]}};return{cI:!0,i:/\S/,c:[r.C("^\\s*[!#]","$"),{b:n+s,rB:!0,c:[{cN:"attr",b:n,endsParent:!0,r:0}],starts:c},{b:a+s,rB:!0,r:0,c:[{cN:"meta",b:a,endsParent:!0,r:0}],starts:c},{cN:"attr",r:0,b:a+t+"$"}]}});hljs.registerLanguage("diff",function(e){return{aliases:["patch"],c:[{cN:"meta",r:10,v:[{b:/^@@ +\-\d+,\d+ +\+\d+,\d+ +@@$/},{b:/^\*\*\* +\d+,\d+ +\*\*\*\*$/},{b:/^\-\-\- +\d+,\d+ +\-\-\-\-$/}]},{cN:"comment",v:[{b:/Index: /,e:/$/},{b:/={3,}/,e:/$/},{b:/^\-{3}/,e:/$/},{b:/^\*{3} /,e:/$/},{b:/^\+{3}/,e:/$/},{b:/\*{5}/,e:/\*{5}$/}]},{cN:"addition",b:"^\\+",e:"$"},{cN:"deletion",b:"^\\-",e:"$"},{cN:"addition",b:"^\\!",e:"$"}]}});hljs.registerLanguage("shell",function(s){return{aliases:["console"],c:[{cN:"meta",b:"^\\s{0,3}[\\w\\d\\[\\]()@-]*[>%$#]",starts:{e:"$",sL:"bash"}}]}});hljs.registerLanguage("asciidoc",function(e){return{aliases:["adoc"],c:[e.C("^/{4,}\\n","\\n/{4,}$",{r:10}),e.C("^//","$",{r:0}),{cN:"title",b:"^\\.\\w.*$"},{b:"^[=\\*]{4,}\\n",e:"\\n^[=\\*]{4,}$",r:10},{cN:"section",r:10,v:[{b:"^(={1,5}) .+?( \\1)?$"},{b:"^[^\\[\\]\\n]+?\\n[=\\-~\\^\\+]{2,}$"}]},{cN:"meta",b:"^:.+?:",e:"\\s",eE:!0,r:10},{cN:"meta",b:"^\\[.+?\\]$",r:0},{cN:"quote",b:"^_{4,}\\n",e:"\\n_{4,}$",r:10},{cN:"code",b:"^[\\-\\.]{4,}\\n",e:"\\n[\\-\\.]{4,}$",r:10},{b:"^\\+{4,}\\n",e:"\\n\\+{4,}$",c:[{b:"<",e:">",sL:"xml",r:0}],r:10},{cN:"bullet",b:"^(\\*+|\\-+|\\.+|[^\\n]+?::)\\s+"},{cN:"symbol",b:"^(NOTE|TIP|IMPORTANT|WARNING|CAUTION):\\s+",r:10},{cN:"strong",b:"\\B\\*(?![\\*\\s])",e:"(\\n{2}|\\*)",c:[{b:"\\\\*\\w",r:0}]},{cN:"emphasis",b:"\\B'(?!['\\s])",e:"(\\n{2}|')",c:[{b:"\\\\'\\w",r:0}],r:0},{cN:"emphasis",b:"_(?![_\\s])",e:"(\\n{2}|_)",r:0},{cN:"string",v:[{b:"``.+?''"},{b:"`.+?'"}]},{cN:"code",b:"(`.+?`|\\+.+?\\+)",r:0},{cN:"code",b:"^[ \\t]",e:"$",r:0},{b:"^'{3,}[ \\t]*$",r:10},{b:"(link:)?(http|https|ftp|file|irc|image:?):\\S+\\[.*?\\]",rB:!0,c:[{b:"(link|image:?):",r:0},{cN:"link",b:"\\w",e:"[^\\[]+",r:0},{cN:"string",b:"\\[",e:"\\]",eB:!0,eE:!0,r:0}],r:10}]}});hljs.registerLanguage("aspectj",function(e){var t="false synchronized int abstract float private char boolean static null if const for true while long throw strictfp finally protected import native final return void enum else extends implements break transient new catch instanceof byte super volatile case assert short package default double public try this switch continue throws privileged aspectOf adviceexecution proceed cflowbelow cflow initialization preinitialization staticinitialization withincode target within execution getWithinTypeName handler thisJoinPoint thisJoinPointStaticPart thisEnclosingJoinPointStaticPart declare parents warning error soft precedence thisAspectInstance",i="get set args call";return{k:t,i:/<\/|#/,c:[e.C("/\\*\\*","\\*/",{r:0,c:[{b:/\w+@/,r:0},{cN:"doctag",b:"@[A-Za-z]+"}]}),e.CLCM,e.CBCM,e.ASM,e.QSM,{cN:"class",bK:"aspect",e:/[{;=]/,eE:!0,i:/[:;"\[\]]/,c:[{bK:"extends implements pertypewithin perthis pertarget percflowbelow percflow issingleton"},e.UTM,{b:/\([^\)]*/,e:/[)]+/,k:t+" "+i,eE:!1}]},{cN:"class",bK:"class interface",e:/[{;=]/,eE:!0,r:0,k:"class interface",i:/[:"\[\]]/,c:[{bK:"extends implements"},e.UTM]},{bK:"pointcut after before around throwing returning",e:/[)]/,eE:!1,i:/["\[\]]/,c:[{b:e.UIR+"\\s*\\(",rB:!0,c:[e.UTM]}]},{b:/[:]/,rB:!0,e:/[{;]/,r:0,eE:!1,k:t,i:/["\[\]]/,c:[{b:e.UIR+"\\s*\\(",k:t+" "+i,r:0},e.QSM]},{bK:"new throw",r:0},{cN:"function",b:/\w+ +\w+(\.)?\w+\s*\([^\)]*\)\s*((throws)[\w\s,]+)?[\{;]/,rB:!0,e:/[{;=]/,k:t,eE:!0,c:[{b:e.UIR+"\\s*\\(",rB:!0,r:0,c:[e.UTM]},{cN:"params",b:/\(/,e:/\)/,r:0,k:t,c:[e.ASM,e.QSM,e.CNM,e.CBCM]},e.CLCM,e.CBCM]},e.CNM,{cN:"meta",b:"@[A-Za-z]+"}]}});hljs.registerLanguage("gradle",function(e){return{cI:!0,k:{keyword:"task project allprojects subprojects artifacts buildscript configurations dependencies repositories sourceSets description delete from into include exclude source classpath destinationDir includes options sourceCompatibility targetCompatibility group flatDir doLast doFirst flatten todir fromdir ant def abstract break case catch continue default do else extends final finally for if implements instanceof native new private protected public return static switch synchronized throw throws transient try volatile while strictfp package import false null super this true antlrtask checkstyle codenarc copy boolean byte char class double float int interface long short void compile runTime file fileTree abs any append asList asWritable call collect compareTo count div dump each eachByte eachFile eachLine every find findAll flatten getAt getErr getIn getOut getText grep immutable inject inspect intersect invokeMethods isCase join leftShift minus multiply newInputStream newOutputStream newPrintWriter newReader newWriter next plus pop power previous print println push putAt read readBytes readLines reverse reverseEach round size sort splitEachLine step subMap times toInteger toList tokenize upto waitForOrKill withPrintWriter withReader withStream withWriter withWriterAppend write writeLine"},c:[e.CLCM,e.CBCM,e.ASM,e.QSM,e.NM,e.RM]}});hljs.registerLanguage("json",function(e){var i={literal:"true false null"},n=[e.QSM,e.CNM],r={e:",",eW:!0,eE:!0,c:n,k:i},t={b:"{",e:"}",c:[{cN:"attr",b:/"/,e:/"/,c:[e.BE],i:"\\n"},e.inherit(r,{b:/:/})],i:"\\S"},c={b:"\\[",e:"\\]",c:[e.inherit(r)],i:"\\S"};return n.splice(n.length,0,t,c),{c:n,k:i,i:"\\S"}});hljs.registerLanguage("sql",function(e){var t=e.C("--","$");return{cI:!0,i:/[<>{}*]/,c:[{bK:"begin end start commit rollback savepoint lock alter create drop rename call delete do handler insert load replace select truncate update set show pragma grant merge describe use explain help declare prepare execute deallocate release unlock purge reset change stop analyze cache flush optimize repair kill install uninstall checksum restore check backup revoke comment with",e:/;/,eW:!0,l:/[\w\.]+/,k:{keyword:"as abort abs absolute acc acce accep accept access accessed accessible account acos action activate add addtime admin administer advanced advise aes_decrypt aes_encrypt after agent aggregate ali alia alias allocate allow alter always analyze ancillary and any anydata anydataset anyschema anytype apply archive archived archivelog are as asc ascii asin assembly assertion associate asynchronous at atan atn2 attr attri attrib attribu attribut attribute attributes audit authenticated authentication authid authors auto autoallocate autodblink autoextend automatic availability avg backup badfile basicfile before begin beginning benchmark between bfile bfile_base big bigfile bin binary_double binary_float binlog bit_and bit_count bit_length bit_or bit_xor bitmap blob_base block blocksize body both bound buffer_cache buffer_pool build bulk by byte byteordermark bytes cache caching call calling cancel capacity cascade cascaded case cast catalog category ceil ceiling chain change changed char_base char_length character_length characters characterset charindex charset charsetform charsetid check checksum checksum_agg child choose chr chunk class cleanup clear client clob clob_base clone close cluster_id cluster_probability cluster_set clustering coalesce coercibility col collate collation collect colu colum column column_value columns columns_updated comment commit compact compatibility compiled complete composite_limit compound compress compute concat concat_ws concurrent confirm conn connec connect connect_by_iscycle connect_by_isleaf connect_by_root connect_time connection consider consistent constant constraint constraints constructor container content contents context contributors controlfile conv convert convert_tz corr corr_k corr_s corresponding corruption cos cost count count_big counted covar_pop covar_samp cpu_per_call cpu_per_session crc32 create creation critical cross cube cume_dist curdate current current_date current_time current_timestamp current_user cursor curtime customdatum cycle data database databases datafile datafiles datalength date_add date_cache date_format date_sub dateadd datediff datefromparts datename datepart datetime2fromparts day day_to_second dayname dayofmonth dayofweek dayofyear days db_role_change dbtimezone ddl deallocate declare decode decompose decrement decrypt deduplicate def defa defau defaul default defaults deferred defi defin define degrees delayed delegate delete delete_all delimited demand dense_rank depth dequeue des_decrypt des_encrypt des_key_file desc descr descri describ describe descriptor deterministic diagnostics difference dimension direct_load directory disable disable_all disallow disassociate discardfile disconnect diskgroup distinct distinctrow distribute distributed div do document domain dotnet double downgrade drop dumpfile duplicate duration each edition editionable editions element ellipsis else elsif elt empty enable enable_all enclosed encode encoding encrypt end end-exec endian enforced engine engines enqueue enterprise entityescaping eomonth error errors escaped evalname evaluate event eventdata events except exception exceptions exchange exclude excluding execu execut execute exempt exists exit exp expire explain export export_set extended extent external external_1 external_2 externally extract failed failed_login_attempts failover failure far fast feature_set feature_value fetch field fields file file_name_convert filesystem_like_logging final finish first first_value fixed flash_cache flashback floor flush following follows for forall force foreign form forma format found found_rows freelist freelists freepools fresh from from_base64 from_days ftp full function general generated get get_format get_lock getdate getutcdate global global_name globally go goto grant grants greatest group group_concat group_id grouping grouping_id groups gtid_subtract guarantee guard handler hash hashkeys having hea head headi headin heading heap help hex hierarchy high high_priority hosts hour http id ident_current ident_incr ident_seed identified identity idle_time if ifnull ignore iif ilike ilm immediate import in include including increment index indexes indexing indextype indicator indices inet6_aton inet6_ntoa inet_aton inet_ntoa infile initial initialized initially initrans inmemory inner innodb input insert install instance instantiable instr interface interleaved intersect into invalidate invisible is is_free_lock is_ipv4 is_ipv4_compat is_not is_not_null is_used_lock isdate isnull isolation iterate java join json json_exists keep keep_duplicates key keys kill language large last last_day last_insert_id last_value lax lcase lead leading least leaves left len lenght length less level levels library like like2 like4 likec limit lines link list listagg little ln load load_file lob lobs local localtime localtimestamp locate locator lock locked log log10 log2 logfile logfiles logging logical logical_reads_per_call logoff logon logs long loop low low_priority lower lpad lrtrim ltrim main make_set makedate maketime managed management manual map mapping mask master master_pos_wait match matched materialized max maxextents maximize maxinstances maxlen maxlogfiles maxloghistory maxlogmembers maxsize maxtrans md5 measures median medium member memcompress memory merge microsecond mid migration min minextents minimum mining minus minute minvalue missing mod mode model modification modify module monitoring month months mount move movement multiset mutex name name_const names nan national native natural nav nchar nclob nested never new newline next nextval no no_write_to_binlog noarchivelog noaudit nobadfile nocheck nocompress nocopy nocycle nodelay nodiscardfile noentityescaping noguarantee nokeep nologfile nomapping nomaxvalue nominimize nominvalue nomonitoring none noneditionable nonschema noorder nopr nopro noprom nopromp noprompt norely noresetlogs noreverse normal norowdependencies noschemacheck noswitch not nothing notice notnull notrim novalidate now nowait nth_value nullif nulls num numb numbe nvarchar nvarchar2 object ocicoll ocidate ocidatetime ociduration ociinterval ociloblocator ocinumber ociref ocirefcursor ocirowid ocistring ocitype oct octet_length of off offline offset oid oidindex old on online only opaque open operations operator optimal optimize option optionally or oracle oracle_date oradata ord ordaudio orddicom orddoc order ordimage ordinality ordvideo organization orlany orlvary out outer outfile outline output over overflow overriding package pad parallel parallel_enable parameters parent parse partial partition partitions pascal passing password password_grace_time password_lock_time password_reuse_max password_reuse_time password_verify_function patch path patindex pctincrease pctthreshold pctused pctversion percent percent_rank percentile_cont percentile_disc performance period period_add period_diff permanent physical pi pipe pipelined pivot pluggable plugin policy position post_transaction pow power pragma prebuilt precedes preceding precision prediction prediction_cost prediction_details prediction_probability prediction_set prepare present preserve prior priority private private_sga privileges procedural procedure procedure_analyze processlist profiles project prompt protection public publishingservername purge quarter query quick quiesce quota quotename radians raise rand range rank raw read reads readsize rebuild record records recover recovery recursive recycle redo reduced ref reference referenced references referencing refresh regexp_like register regr_avgx regr_avgy regr_count regr_intercept regr_r2 regr_slope regr_sxx regr_sxy reject rekey relational relative relaylog release release_lock relies_on relocate rely rem remainder rename repair repeat replace replicate replication required reset resetlogs resize resource respect restore restricted result result_cache resumable resume retention return returning returns reuse reverse revoke right rlike role roles rollback rolling rollup round row row_count rowdependencies rowid rownum rows rtrim rules safe salt sample save savepoint sb1 sb2 sb4 scan schema schemacheck scn scope scroll sdo_georaster sdo_topo_geometry search sec_to_time second section securefile security seed segment select self sequence sequential serializable server servererror session session_user sessions_per_user set sets settings sha sha1 sha2 share shared shared_pool short show shrink shutdown si_averagecolor si_colorhistogram si_featurelist si_positionalcolor si_stillimage si_texture siblings sid sign sin size size_t sizes skip slave sleep smalldatetimefromparts smallfile snapshot some soname sort soundex source space sparse spfile split sql sql_big_result sql_buffer_result sql_cache sql_calc_found_rows sql_small_result sql_variant_property sqlcode sqldata sqlerror sqlname sqlstate sqrt square standalone standby start starting startup statement static statistics stats_binomial_test stats_crosstab stats_ks_test stats_mode stats_mw_test stats_one_way_anova stats_t_test_ stats_t_test_indep stats_t_test_one stats_t_test_paired stats_wsr_test status std stddev stddev_pop stddev_samp stdev stop storage store stored str str_to_date straight_join strcmp strict string struct stuff style subdate subpartition subpartitions substitutable substr substring subtime subtring_index subtype success sum suspend switch switchoffset switchover sync synchronous synonym sys sys_xmlagg sysasm sysaux sysdate sysdatetimeoffset sysdba sysoper system system_user sysutcdatetime table tables tablespace tan tdo template temporary terminated tertiary_weights test than then thread through tier ties time time_format time_zone timediff timefromparts timeout timestamp timestampadd timestampdiff timezone_abbr timezone_minute timezone_region to to_base64 to_date to_days to_seconds todatetimeoffset trace tracking transaction transactional translate translation treat trigger trigger_nestlevel triggers trim truncate try_cast try_convert try_parse type ub1 ub2 ub4 ucase unarchived unbounded uncompress under undo unhex unicode uniform uninstall union unique unix_timestamp unknown unlimited unlock unnest unpivot unrecoverable unsafe unsigned until untrusted unusable unused update updated upgrade upped upper upsert url urowid usable usage use use_stored_outlines user user_data user_resources users using utc_date utc_timestamp uuid uuid_short validate validate_password_strength validation valist value values var var_samp varcharc vari varia variab variabl variable variables variance varp varraw varrawc varray verify version versions view virtual visible void wait wallet warning warnings week weekday weekofyear wellformed when whene whenev wheneve whenever where while whitespace with within without work wrapped xdb xml xmlagg xmlattributes xmlcast xmlcolattval xmlelement xmlexists xmlforest xmlindex xmlnamespaces xmlpi xmlquery xmlroot xmlschema xmlserialize xmltable xmltype xor year year_to_month years yearweek",literal:"true false null unknown",built_in:"array bigint binary bit blob bool boolean char character date dec decimal float int int8 integer interval number numeric real record serial serial8 smallint text time timestamp varchar varying void"},c:[{cN:"string",b:"'",e:"'",c:[e.BE,{b:"''"}]},{cN:"string",b:'"',e:'"',c:[e.BE,{b:'""'}]},{cN:"string",b:"`",e:"`",c:[e.BE]},e.CNM,e.CBCM,t,e.HCM]},e.CBCM,t,e.HCM]}});hljs.registerLanguage("go",function(e){var t={keyword:"break default func interface select case map struct chan else goto package switch const fallthrough if range type continue for import return var go defer bool byte complex64 complex128 float32 float64 int8 int16 int32 int64 string uint8 uint16 uint32 uint64 int uint uintptr rune",literal:"true false iota nil",built_in:"append cap close complex copy imag len make new panic print println real recover delete"};return{aliases:["golang"],k:t,i:"",rB:!0,e:"\\s*=>",c:[{cN:"params",v:[{b:r},{b:/\(\s*\)/},{b:/\(/,e:/\)/,eB:!0,eE:!0,k:t,c:s}]}]},{b://,sL:"xml",c:[{b:/<\w+\s*\/>/,skip:!0},{b:/<\w+/,e:/(\/\w+|\w+\/)>/,skip:!0,c:[{b:/<\w+\s*\/>/,skip:!0},"self"]}]}],r:0},{cN:"function",bK:"function",e:/\{/,eE:!0,c:[e.inherit(e.TM,{b:r}),{cN:"params",b:/\(/,e:/\)/,eB:!0,eE:!0,c:s}],i:/\[|%/},{b:/\$[(.]/},e.METHOD_GUARD,{cN:"class",bK:"class",e:/[{;=]/,eE:!0,i:/[:"\[\]]/,c:[{bK:"extends"},e.UTM]},{bK:"constructor",e:/\{/,eE:!0}],i:/#(?!!)/}}); \ No newline at end of file diff --git a/spring-cloud-stream-binder-kafka/3.0.0.RELEASE/reference/html/js/highlight/styles/a11y-dark.min.css b/spring-cloud-stream-binder-kafka/3.0.0.RELEASE/reference/html/js/highlight/styles/a11y-dark.min.css new file mode 100644 index 00000000..b93b742a --- /dev/null +++ b/spring-cloud-stream-binder-kafka/3.0.0.RELEASE/reference/html/js/highlight/styles/a11y-dark.min.css @@ -0,0 +1,99 @@ +/* a11y-dark theme */ +/* Based on the Tomorrow Night Eighties theme: https://github.com/isagalaev/highlight.js/blob/master/src/styles/tomorrow-night-eighties.css */ +/* @author: ericwbailey */ + +/* Comment */ +.hljs-comment, +.hljs-quote { + color: #d4d0ab; +} + +/* Red */ +.hljs-variable, +.hljs-template-variable, +.hljs-tag, +.hljs-name, +.hljs-selector-id, +.hljs-selector-class, +.hljs-regexp, +.hljs-deletion { + color: #ffa07a; +} + +/* Orange */ +.hljs-number, +.hljs-built_in, +.hljs-builtin-name, +.hljs-literal, +.hljs-type, +.hljs-params, +.hljs-meta, +.hljs-link { + color: #f5ab35; +} + +/* Yellow */ +.hljs-attribute { + color: #ffd700; +} + +/* Green */ +.hljs-string, +.hljs-symbol, +.hljs-bullet, +.hljs-addition { + color: #abe338; +} + +/* Blue */ +.hljs-title, +.hljs-section { + color: #00e0e0; +} + +/* Purple */ +.hljs-keyword, +.hljs-selector-tag { + color: #dcc6e0; +} + +.hljs { + display: block; + overflow-x: auto; + background: #2b2b2b; + color: #f8f8f2; + padding: 0.5em; +} + +.hljs-emphasis { + font-style: italic; +} + +.hljs-strong { + font-weight: bold; +} + +@media screen and (-ms-high-contrast: active) { + .hljs-addition, + .hljs-attribute, + .hljs-built_in, + .hljs-builtin-name, + .hljs-bullet, + .hljs-comment, + .hljs-link, + .hljs-literal, + .hljs-meta, + .hljs-number, + .hljs-params, + .hljs-string, + .hljs-symbol, + .hljs-type, + .hljs-quote { + color: highlight; + } + + .hljs-keyword, + .hljs-selector-tag { + font-weight: bold; + } +} diff --git a/spring-cloud-stream-binder-kafka/3.0.0.RELEASE/reference/html/js/highlight/styles/an-old-hope.min.css b/spring-cloud-stream-binder-kafka/3.0.0.RELEASE/reference/html/js/highlight/styles/an-old-hope.min.css new file mode 100644 index 00000000..a6d56f4b --- /dev/null +++ b/spring-cloud-stream-binder-kafka/3.0.0.RELEASE/reference/html/js/highlight/styles/an-old-hope.min.css @@ -0,0 +1,89 @@ +/* + +An Old Hope – Star Wars Syntax (c) Gustavo Costa +Original theme - Ocean Dark Theme – by https://github.com/gavsiu +Based on Jesse Leite's Atom syntax theme 'An Old Hope' – https://github.com/JesseLeite/an-old-hope-syntax-atom + +*/ + +/* Death Star Comment */ +.hljs-comment, +.hljs-quote +{ + color: #B6B18B; +} + +/* Darth Vader */ +.hljs-variable, +.hljs-template-variable, +.hljs-tag, +.hljs-name, +.hljs-selector-id, +.hljs-selector-class, +.hljs-regexp, +.hljs-deletion +{ + color: #EB3C54; +} + +/* Threepio */ +.hljs-number, +.hljs-built_in, +.hljs-builtin-name, +.hljs-literal, +.hljs-type, +.hljs-params, +.hljs-meta, +.hljs-link +{ + color: #E7CE56; +} + +/* Luke Skywalker */ +.hljs-attribute +{ + color: #EE7C2B; +} + +/* Obi Wan Kenobi */ +.hljs-string, +.hljs-symbol, +.hljs-bullet, +.hljs-addition +{ + color: #4FB4D7; +} + +/* Yoda */ +.hljs-title, +.hljs-section +{ + color: #78BB65; +} + +/* Mace Windu */ +.hljs-keyword, +.hljs-selector-tag +{ + color: #B45EA4; +} + +/* Millenium Falcon */ +.hljs +{ + display: block; + overflow-x: auto; + background: #1C1D21; + color: #c0c5ce; + padding: 0.5em; +} + +.hljs-emphasis +{ + font-style: italic; +} + +.hljs-strong +{ + font-weight: bold; +} diff --git a/spring-cloud-stream-binder-kafka/3.0.0.RELEASE/reference/html/js/highlight/styles/atom-one-dark-reasonable.min.css b/spring-cloud-stream-binder-kafka/3.0.0.RELEASE/reference/html/js/highlight/styles/atom-one-dark-reasonable.min.css new file mode 100644 index 00000000..fd41c996 --- /dev/null +++ b/spring-cloud-stream-binder-kafka/3.0.0.RELEASE/reference/html/js/highlight/styles/atom-one-dark-reasonable.min.css @@ -0,0 +1,77 @@ +/* + +Atom One Dark With support for ReasonML by Gidi Morris, based off work by Daniel Gamage + +Original One Dark Syntax theme from https://github.com/atom/one-dark-syntax + +*/ +.hljs { + display: block; + overflow-x: auto; + padding: 0.5em; + line-height: 1.3em; + color: #abb2bf; + background: #282c34; + border-radius: 5px; +} +.hljs-keyword, .hljs-operator { + color: #F92672; +} +.hljs-pattern-match { + color: #F92672; +} +.hljs-pattern-match .hljs-constructor { + color: #61aeee; +} +.hljs-function { + color: #61aeee; +} +.hljs-function .hljs-params { + color: #A6E22E; +} +.hljs-function .hljs-params .hljs-typing { + color: #FD971F; +} +.hljs-module-access .hljs-module { + color: #7e57c2; +} +.hljs-constructor { + color: #e2b93d; +} +.hljs-constructor .hljs-string { + color: #9CCC65; +} +.hljs-comment, .hljs-quote { + color: #b18eb1; + font-style: italic; +} +.hljs-doctag, .hljs-formula { + color: #c678dd; +} +.hljs-section, .hljs-name, .hljs-selector-tag, .hljs-deletion, .hljs-subst { + color: #e06c75; +} +.hljs-literal { + color: #56b6c2; +} +.hljs-string, .hljs-regexp, .hljs-addition, .hljs-attribute, .hljs-meta-string { + color: #98c379; +} +.hljs-built_in, .hljs-class .hljs-title { + color: #e6c07b; +} +.hljs-attr, .hljs-variable, .hljs-template-variable, .hljs-type, .hljs-selector-class, .hljs-selector-attr, .hljs-selector-pseudo, .hljs-number { + color: #d19a66; +} +.hljs-symbol, .hljs-bullet, .hljs-link, .hljs-meta, .hljs-selector-id, .hljs-title { + color: #61aeee; +} +.hljs-emphasis { + font-style: italic; +} +.hljs-strong { + font-weight: bold; +} +.hljs-link { + text-decoration: underline; +} diff --git a/spring-cloud-stream-binder-kafka/3.0.0.RELEASE/reference/html/js/highlight/styles/atom-one-dark.min.css b/spring-cloud-stream-binder-kafka/3.0.0.RELEASE/reference/html/js/highlight/styles/atom-one-dark.min.css new file mode 100644 index 00000000..1616aafe --- /dev/null +++ b/spring-cloud-stream-binder-kafka/3.0.0.RELEASE/reference/html/js/highlight/styles/atom-one-dark.min.css @@ -0,0 +1,96 @@ +/* + +Atom One Dark by Daniel Gamage +Original One Dark Syntax theme from https://github.com/atom/one-dark-syntax + +base: #282c34 +mono-1: #abb2bf +mono-2: #818896 +mono-3: #5c6370 +hue-1: #56b6c2 +hue-2: #61aeee +hue-3: #c678dd +hue-4: #98c379 +hue-5: #e06c75 +hue-5-2: #be5046 +hue-6: #d19a66 +hue-6-2: #e6c07b + +*/ + +.hljs { + display: block; + overflow-x: auto; + padding: 0.5em; + color: #abb2bf; + background: #282c34; +} + +.hljs-comment, +.hljs-quote { + color: #5c6370; + font-style: italic; +} + +.hljs-doctag, +.hljs-keyword, +.hljs-formula { + color: #c678dd; +} + +.hljs-section, +.hljs-name, +.hljs-selector-tag, +.hljs-deletion, +.hljs-subst { + color: #e06c75; +} + +.hljs-literal { + color: #56b6c2; +} + +.hljs-string, +.hljs-regexp, +.hljs-addition, +.hljs-attribute, +.hljs-meta-string { + color: #98c379; +} + +.hljs-built_in, +.hljs-class .hljs-title { + color: #e6c07b; +} + +.hljs-attr, +.hljs-variable, +.hljs-template-variable, +.hljs-type, +.hljs-selector-class, +.hljs-selector-attr, +.hljs-selector-pseudo, +.hljs-number { + color: #d19a66; +} + +.hljs-symbol, +.hljs-bullet, +.hljs-link, +.hljs-meta, +.hljs-selector-id, +.hljs-title { + color: #61aeee; +} + +.hljs-emphasis { + font-style: italic; +} + +.hljs-strong { + font-weight: bold; +} + +.hljs-link { + text-decoration: underline; +} diff --git a/spring-cloud-stream-binder-kafka/3.0.0.RELEASE/reference/html/js/highlight/styles/atom-one-light.min.css b/spring-cloud-stream-binder-kafka/3.0.0.RELEASE/reference/html/js/highlight/styles/atom-one-light.min.css new file mode 100644 index 00000000..d5bd1d2a --- /dev/null +++ b/spring-cloud-stream-binder-kafka/3.0.0.RELEASE/reference/html/js/highlight/styles/atom-one-light.min.css @@ -0,0 +1,96 @@ +/* + +Atom One Light by Daniel Gamage +Original One Light Syntax theme from https://github.com/atom/one-light-syntax + +base: #fafafa +mono-1: #383a42 +mono-2: #686b77 +mono-3: #a0a1a7 +hue-1: #0184bb +hue-2: #4078f2 +hue-3: #a626a4 +hue-4: #50a14f +hue-5: #e45649 +hue-5-2: #c91243 +hue-6: #986801 +hue-6-2: #c18401 + +*/ + +.hljs { + display: block; + overflow-x: auto; + padding: 0.5em; + color: #383a42; + background: #fafafa; +} + +.hljs-comment, +.hljs-quote { + color: #a0a1a7; + font-style: italic; +} + +.hljs-doctag, +.hljs-keyword, +.hljs-formula { + color: #a626a4; +} + +.hljs-section, +.hljs-name, +.hljs-selector-tag, +.hljs-deletion, +.hljs-subst { + color: #e45649; +} + +.hljs-literal { + color: #0184bb; +} + +.hljs-string, +.hljs-regexp, +.hljs-addition, +.hljs-attribute, +.hljs-meta-string { + color: #50a14f; +} + +.hljs-built_in, +.hljs-class .hljs-title { + color: #c18401; +} + +.hljs-attr, +.hljs-variable, +.hljs-template-variable, +.hljs-type, +.hljs-selector-class, +.hljs-selector-attr, +.hljs-selector-pseudo, +.hljs-number { + color: #986801; +} + +.hljs-symbol, +.hljs-bullet, +.hljs-link, +.hljs-meta, +.hljs-selector-id, +.hljs-title { + color: #4078f2; +} + +.hljs-emphasis { + font-style: italic; +} + +.hljs-strong { + font-weight: bold; +} + +.hljs-link { + text-decoration: underline; +} diff --git a/spring-cloud-stream-binder-kafka/3.0.0.RELEASE/reference/html/js/highlight/styles/dracula.min.css b/spring-cloud-stream-binder-kafka/3.0.0.RELEASE/reference/html/js/highlight/styles/dracula.min.css new file mode 100644 index 00000000..d591db68 --- /dev/null +++ b/spring-cloud-stream-binder-kafka/3.0.0.RELEASE/reference/html/js/highlight/styles/dracula.min.css @@ -0,0 +1,76 @@ +/* + +Dracula Theme v1.2.0 + +https://github.com/zenorocha/dracula-theme + +Copyright 2015, All rights reserved + +Code licensed under the MIT license +http://zenorocha.mit-license.org + +@author Éverton Ribeiro +@author Zeno Rocha + +*/ + +.hljs { + display: block; + overflow-x: auto; + padding: 0.5em; + background: #282a36; +} + +.hljs-keyword, +.hljs-selector-tag, +.hljs-literal, +.hljs-section, +.hljs-link { + color: #8be9fd; +} + +.hljs-function .hljs-keyword { + color: #ff79c6; +} + +.hljs, +.hljs-subst { + color: #f8f8f2; +} + +.hljs-string, +.hljs-title, +.hljs-name, +.hljs-type, +.hljs-attribute, +.hljs-symbol, +.hljs-bullet, +.hljs-addition, +.hljs-variable, +.hljs-template-tag, +.hljs-template-variable { + color: #f1fa8c; +} + +.hljs-comment, +.hljs-quote, +.hljs-deletion, +.hljs-meta { + color: #6272a4; +} + +.hljs-keyword, +.hljs-selector-tag, +.hljs-literal, +.hljs-title, +.hljs-section, +.hljs-doctag, +.hljs-type, +.hljs-name, +.hljs-strong { + font-weight: bold; +} + +.hljs-emphasis { + font-style: italic; +} diff --git a/spring-cloud-stream-binder-kafka/3.0.0.RELEASE/reference/html/js/highlight/styles/github.min.css b/spring-cloud-stream-binder-kafka/3.0.0.RELEASE/reference/html/js/highlight/styles/github.min.css new file mode 100644 index 00000000..791932b8 --- /dev/null +++ b/spring-cloud-stream-binder-kafka/3.0.0.RELEASE/reference/html/js/highlight/styles/github.min.css @@ -0,0 +1,99 @@ +/* + +github.com style (c) Vasily Polovnyov + +*/ + +.hljs { + display: block; + overflow-x: auto; + padding: 0.5em; + color: #333; + background: #f8f8f8; +} + +.hljs-comment, +.hljs-quote { + color: #998; + font-style: italic; +} + +.hljs-keyword, +.hljs-selector-tag, +.hljs-subst { + color: #333; + font-weight: bold; +} + +.hljs-number, +.hljs-literal, +.hljs-variable, +.hljs-template-variable, +.hljs-tag .hljs-attr { + color: #008080; +} + +.hljs-string, +.hljs-doctag { + color: #d14; +} + +.hljs-title, +.hljs-section, +.hljs-selector-id { + color: #900; + font-weight: bold; +} + +.hljs-subst { + font-weight: normal; +} + +.hljs-type, +.hljs-class .hljs-title { + color: #458; + font-weight: bold; +} + +.hljs-tag, +.hljs-name, +.hljs-attribute { + color: #000080; + font-weight: normal; +} + +.hljs-regexp, +.hljs-link { + color: #009926; +} + +.hljs-symbol, +.hljs-bullet { + color: #990073; +} + +.hljs-built_in, +.hljs-builtin-name { + color: #0086b3; +} + +.hljs-meta { + color: #999; + font-weight: bold; +} + +.hljs-deletion { + background: #fdd; +} + +.hljs-addition { + background: #dfd; +} + +.hljs-emphasis { + font-style: italic; +} + +.hljs-strong { + font-weight: bold; +} diff --git a/spring-cloud-stream-binder-kafka/3.0.0.RELEASE/reference/html/js/highlight/styles/monokai-sublime.min.css b/spring-cloud-stream-binder-kafka/3.0.0.RELEASE/reference/html/js/highlight/styles/monokai-sublime.min.css new file mode 100644 index 00000000..2864170d --- /dev/null +++ b/spring-cloud-stream-binder-kafka/3.0.0.RELEASE/reference/html/js/highlight/styles/monokai-sublime.min.css @@ -0,0 +1,83 @@ +/* + +Monokai Sublime style. Derived from Monokai by noformnocontent http://nn.mit-license.org/ + +*/ + +.hljs { + display: block; + overflow-x: auto; + padding: 0.5em; + background: #23241f; +} + +.hljs, +.hljs-tag, +.hljs-subst { + color: #f8f8f2; +} + +.hljs-strong, +.hljs-emphasis { + color: #a8a8a2; +} + +.hljs-bullet, +.hljs-quote, +.hljs-number, +.hljs-regexp, +.hljs-literal, +.hljs-link { + color: #ae81ff; +} + +.hljs-code, +.hljs-title, +.hljs-section, +.hljs-selector-class { + color: #a6e22e; +} + +.hljs-strong { + font-weight: bold; +} + +.hljs-emphasis { + font-style: italic; +} + +.hljs-keyword, +.hljs-selector-tag, +.hljs-name, +.hljs-attr { + color: #f92672; +} + +.hljs-symbol, +.hljs-attribute { + color: #66d9ef; +} + +.hljs-params, +.hljs-class .hljs-title { + color: #f8f8f2; +} + +.hljs-string, +.hljs-type, +.hljs-built_in, +.hljs-builtin-name, +.hljs-selector-id, +.hljs-selector-attr, +.hljs-selector-pseudo, +.hljs-addition, +.hljs-variable, +.hljs-template-variable { + color: #e6db74; +} + +.hljs-comment, +.hljs-deletion, +.hljs-meta { + color: #75715e; +} diff --git a/spring-cloud-stream-binder-kafka/3.0.0.RELEASE/reference/html/js/highlight/styles/monokai.min.css b/spring-cloud-stream-binder-kafka/3.0.0.RELEASE/reference/html/js/highlight/styles/monokai.min.css new file mode 100644 index 00000000..775d53f9 --- /dev/null +++ b/spring-cloud-stream-binder-kafka/3.0.0.RELEASE/reference/html/js/highlight/styles/monokai.min.css @@ -0,0 +1,70 @@ +/* +Monokai style - ported by Luigi Maselli - http://grigio.org +*/ + +.hljs { + display: block; + overflow-x: auto; + padding: 0.5em; + background: #272822; color: #ddd; +} + +.hljs-tag, +.hljs-keyword, +.hljs-selector-tag, +.hljs-literal, +.hljs-strong, +.hljs-name { + color: #f92672; +} + +.hljs-code { + color: #66d9ef; +} + +.hljs-class .hljs-title { + color: white; +} + +.hljs-attribute, +.hljs-symbol, +.hljs-regexp, +.hljs-link { + color: #bf79db; +} + +.hljs-string, +.hljs-bullet, +.hljs-subst, +.hljs-title, +.hljs-section, +.hljs-emphasis, +.hljs-type, +.hljs-built_in, +.hljs-builtin-name, +.hljs-selector-attr, +.hljs-selector-pseudo, +.hljs-addition, +.hljs-variable, +.hljs-template-tag, +.hljs-template-variable { + color: #a6e22e; +} + +.hljs-comment, +.hljs-quote, +.hljs-deletion, +.hljs-meta { + color: #75715e; +} + +.hljs-keyword, +.hljs-selector-tag, +.hljs-literal, +.hljs-doctag, +.hljs-title, +.hljs-section, +.hljs-type, +.hljs-selector-id { + font-weight: bold; +} diff --git a/spring-cloud-stream-binder-kafka/3.0.0.RELEASE/reference/html/js/highlight/styles/solarized-light.min.css b/spring-cloud-stream-binder-kafka/3.0.0.RELEASE/reference/html/js/highlight/styles/solarized-light.min.css new file mode 100644 index 00000000..fdcfcc72 --- /dev/null +++ b/spring-cloud-stream-binder-kafka/3.0.0.RELEASE/reference/html/js/highlight/styles/solarized-light.min.css @@ -0,0 +1,84 @@ +/* + +Orginal Style from ethanschoonover.com/solarized (c) Jeremy Hull + +*/ + +.hljs { + display: block; + overflow-x: auto; + padding: 0.5em; + background: #fdf6e3; + color: #657b83; +} + +.hljs-comment, +.hljs-quote { + color: #93a1a1; +} + +/* Solarized Green */ +.hljs-keyword, +.hljs-selector-tag, +.hljs-addition { + color: #859900; +} + +/* Solarized Cyan */ +.hljs-number, +.hljs-string, +.hljs-meta .hljs-meta-string, +.hljs-literal, +.hljs-doctag, +.hljs-regexp { + color: #2aa198; +} + +/* Solarized Blue */ +.hljs-title, +.hljs-section, +.hljs-name, +.hljs-selector-id, +.hljs-selector-class { + color: #268bd2; +} + +/* Solarized Yellow */ +.hljs-attribute, +.hljs-attr, +.hljs-variable, +.hljs-template-variable, +.hljs-class .hljs-title, +.hljs-type { + color: #b58900; +} + +/* Solarized Orange */ +.hljs-symbol, +.hljs-bullet, +.hljs-subst, +.hljs-meta, +.hljs-meta .hljs-keyword, +.hljs-selector-attr, +.hljs-selector-pseudo, +.hljs-link { + color: #cb4b16; +} + +/* Solarized Red */ +.hljs-built_in, +.hljs-deletion { + color: #dc322f; +} + +.hljs-formula { + background: #eee8d5; +} + +.hljs-emphasis { + font-style: italic; +} + +.hljs-strong { + font-weight: bold; +} diff --git a/spring-cloud-stream-binder-kafka/3.0.0.RELEASE/reference/html/js/highlight/styles/zenburn.min.css b/spring-cloud-stream-binder-kafka/3.0.0.RELEASE/reference/html/js/highlight/styles/zenburn.min.css new file mode 100644 index 00000000..07be5020 --- /dev/null +++ b/spring-cloud-stream-binder-kafka/3.0.0.RELEASE/reference/html/js/highlight/styles/zenburn.min.css @@ -0,0 +1,80 @@ +/* + +Zenburn style from voldmar.ru (c) Vladimir Epifanov +based on dark.css by Ivan Sagalaev + +*/ + +.hljs { + display: block; + overflow-x: auto; + padding: 0.5em; + background: #3f3f3f; + color: #dcdcdc; +} + +.hljs-keyword, +.hljs-selector-tag, +.hljs-tag { + color: #e3ceab; +} + +.hljs-template-tag { + color: #dcdcdc; +} + +.hljs-number { + color: #8cd0d3; +} + +.hljs-variable, +.hljs-template-variable, +.hljs-attribute { + color: #efdcbc; +} + +.hljs-literal { + color: #efefaf; +} + +.hljs-subst { + color: #8f8f8f; +} + +.hljs-title, +.hljs-name, +.hljs-selector-id, +.hljs-selector-class, +.hljs-section, +.hljs-type { + color: #efef8f; +} + +.hljs-symbol, +.hljs-bullet, +.hljs-link { + color: #dca3a3; +} + +.hljs-deletion, +.hljs-string, +.hljs-built_in, +.hljs-builtin-name { + color: #cc9393; +} + +.hljs-addition, +.hljs-comment, +.hljs-quote, +.hljs-meta { + color: #7f9f7f; +} + + +.hljs-emphasis { + font-style: italic; +} + +.hljs-strong { + font-weight: bold; +} diff --git a/spring-cloud-stream-binder-kafka/3.0.0.RELEASE/reference/html/js/toc.js b/spring-cloud-stream-binder-kafka/3.0.0.RELEASE/reference/html/js/toc.js new file mode 100644 index 00000000..a6e933bf --- /dev/null +++ b/spring-cloud-stream-binder-kafka/3.0.0.RELEASE/reference/html/js/toc.js @@ -0,0 +1,107 @@ +var toctitle = document.getElementById('toctitle'); +var path = window.location.pathname; +if (toctitle != null) { + var oldtoc = toctitle.nextElementSibling; + var newtoc = document.createElement('div'); + newtoc.setAttribute('id', 'tocbot'); + newtoc.setAttribute('class', 'js-toc desktop-toc'); + oldtoc.setAttribute('class', 'mobile-toc'); + oldtoc.parentNode.appendChild(newtoc); + tocbot.init({ + contentSelector: '#content', + headingSelector: 'h1, h2, h3, h4, h5', + positionFixedSelector: 'body', + fixedSidebarOffset: 90, + smoothScroll: false + }); + if (!path.endsWith("index.html") && !path.endsWith("/")) { + var link = document.createElement("a"); + link.setAttribute("href", "index.html"); + link.innerHTML = " Back to index"; + var block = document.createElement("div"); + block.setAttribute('class', 'back-action'); + block.appendChild(link); + var toc = document.getElementById('toc'); + var next = document.getElementById('toctitle').nextElementSibling; + toc.insertBefore(block, next); + } +} + +var headerHtml = '
\n' + + '

\n' + + '\n' + + '\n' + + '\n' + + '\n' + + '\n' + + '\n' + + '\n' + + '\n' + + '\n' + + '\n' + + '\n' + + '\n' + + '\n' + + '\n' + + '\n' + + '\n' + + '\n' + + '\n' + + '\n' + + '\n' + + '\n' + + '\n' + + '\n' + + '\n' + + '\n' + + '\n' + + '\n' + + '\n' + + '\n' + + '\n' + + '\n' + + '\n' + + '\n' + + '\n' + + '\n' + + '\n' + + '\n' + + '\n' + + '\n' + + '\n' + + '

\n' + + '
'; + +var header = document.createElement("div"); +header.innerHTML = headerHtml; +document.body.insertBefore(header, document.body.firstChild); \ No newline at end of file diff --git a/spring-cloud-stream-binder-kafka/3.0.0.RELEASE/reference/html/js/tocbot/tocbot.css b/spring-cloud-stream-binder-kafka/3.0.0.RELEASE/reference/html/js/tocbot/tocbot.css new file mode 100644 index 00000000..0632de23 --- /dev/null +++ b/spring-cloud-stream-binder-kafka/3.0.0.RELEASE/reference/html/js/tocbot/tocbot.css @@ -0,0 +1 @@ +.toc{overflow-y:auto}.toc>.toc-list{overflow:hidden;position:relative}.toc>.toc-list li{list-style:none}.toc-list{margin:0;padding-left:10px}a.toc-link{color:currentColor;height:100%}.is-collapsible{max-height:1000px;overflow:hidden;transition:all 300ms ease-in-out}.is-collapsed{max-height:0}.is-position-fixed{position:fixed !important;top:0}.is-active-link{font-weight:700}.toc-link::before{background-color:#EEE;content:' ';display:inline-block;height:inherit;left:0;margin-top:-1px;position:absolute;width:2px}.is-active-link::before{background-color:#54BC4B} diff --git a/spring-cloud-stream-binder-kafka/3.0.0.RELEASE/reference/html/js/tocbot/tocbot.min.js b/spring-cloud-stream-binder-kafka/3.0.0.RELEASE/reference/html/js/tocbot/tocbot.min.js new file mode 100644 index 00000000..943d8fdb --- /dev/null +++ b/spring-cloud-stream-binder-kafka/3.0.0.RELEASE/reference/html/js/tocbot/tocbot.min.js @@ -0,0 +1 @@ +!function(e){function t(o){if(n[o])return n[o].exports;var l=n[o]={i:o,l:!1,exports:{}};return e[o].call(l.exports,l,l.exports,t),l.l=!0,l.exports}var n={};t.m=e,t.c=n,t.d=function(e,n,o){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:o})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=0)}([function(e,t,n){(function(o){var l,i,s;!function(n,o){i=[],l=o(n),void 0!==(s="function"==typeof l?l.apply(t,i):l)&&(e.exports=s)}(void 0!==o?o:this.window||this.global,function(e){"use strict";function t(){for(var e={},t=0;te.fixedSidebarOffset?-1===n.className.indexOf(e.positionFixedClass)&&(n.className+=h+e.positionFixedClass):n.className=n.className.split(h+e.positionFixedClass).join("")}function s(t){var n=document.documentElement.scrollTop||f.scrollTop;e.positionFixedSelector&&i();var o,l=t;if(m&&null!==document.querySelector(e.tocSelector)&&l.length>0){d.call(l,function(t,i){if(t.offsetTop>n+e.headingsOffset+10){return o=l[0===i?i:i-1],!0}if(i===l.length-1)return o=l[l.length-1],!0});var s=document.querySelector(e.tocSelector).querySelectorAll("."+e.linkClass);u.call(s,function(t){t.className=t.className.split(h+e.activeLinkClass).join("")});var c=document.querySelector(e.tocSelector).querySelectorAll("."+e.listItemClass);u.call(c,function(t){t.className=t.className.split(h+e.activeListItemClass).join("")});var a=document.querySelector(e.tocSelector).querySelector("."+e.linkClass+".node-name--"+o.nodeName+'[href="#'+o.id+'"]');-1===a.className.indexOf(e.activeLinkClass)&&(a.className+=h+e.activeLinkClass);var p=a.parentNode;p&&-1===p.className.indexOf(e.activeListItemClass)&&(p.className+=h+e.activeListItemClass);var C=document.querySelector(e.tocSelector).querySelectorAll("."+e.listClass+"."+e.collapsibleClass);u.call(C,function(t){-1===t.className.indexOf(e.isCollapsedClass)&&(t.className+=h+e.isCollapsedClass)}),a.nextSibling&&-1!==a.nextSibling.className.indexOf(e.isCollapsedClass)&&(a.nextSibling.className=a.nextSibling.className.split(h+e.isCollapsedClass).join("")),r(a.parentNode.parentNode)}}function r(t){return-1!==t.className.indexOf(e.collapsibleClass)&&-1!==t.className.indexOf(e.isCollapsedClass)?(t.className=t.className.split(h+e.isCollapsedClass).join(""),r(t.parentNode.parentNode)):t}function c(t){var n=t.target||t.srcElement;"string"==typeof n.className&&-1!==n.className.indexOf(e.linkClass)&&(m=!1)}function a(){m=!0}var u=[].forEach,d=[].some,f=document.body,m=!0,h=" ";return{enableTocAnimation:a,disableTocAnimation:c,render:n,updateToc:s}}},function(e,t){e.exports=function(e){function t(e){return e[e.length-1]}function n(e){return+e.nodeName.split("H").join("")}function o(t){var o={id:t.id,children:[],nodeName:t.nodeName,headingLevel:n(t),textContent:t.textContent.trim()};return e.includeHtml&&(o.childNodes=t.childNodes),o}function l(l,i){for(var s=o(l),r=n(l),c=i,a=t(c),u=a?a.headingLevel:0,d=r-u;d>0;)a=t(c),a&&void 0!==a.children&&(c=a.children),d--;return r>=e.collapseDepth&&(s.isCollapsed=!0),c.push(s),c}function i(t,n){var o=n;e.ignoreSelector&&(o=n.split(",").map(function(t){return t.trim()+":not("+e.ignoreSelector+")"}));try{return document.querySelector(t).querySelectorAll(o)}catch(e){return console.warn("Element not found: "+t),null}}function s(e){return r.call(e,function(e,t){return l(o(t),e.nest),e},{nest:[]})}var r=[].reduce;return{nestHeadingsArray:s,selectHeadings:i}}},function(e,t){function n(e){function t(e){return"a"===e.tagName.toLowerCase()&&(e.hash.length>0||"#"===e.href.charAt(e.href.length-1))&&(n(e.href)===s||n(e.href)+"#"===s)}function n(e){return e.slice(0,e.lastIndexOf("#"))}function l(e){var t=document.getElementById(e.substring(1));t&&(/^(?:a|select|input|button|textarea)$/i.test(t.tagName)||(t.tabIndex=-1),t.focus())}!function(){document.documentElement.style}();var i=e.duration,s=location.hash?n(location.href):location.href;!function(){function n(n){!t(n.target)||n.target.className.indexOf("no-smooth-scroll")>-1||"#"===n.target.href.charAt(n.target.href.length-2)&&"!"===n.target.href.charAt(n.target.href.length-1)||-1===n.target.className.indexOf(e.linkClass)||o(n.target.hash,{duration:i,callback:function(){l(n.target.hash)}})}document.body.addEventListener("click",n,!1)}()}function o(e,t){function n(e){s=e-i,window.scrollTo(0,c.easing(s,r,u,d)),s + + + + + + +Kafka Streams Binder + + + + + + + + + + +
+
+

Kafka Streams Binder

+
+
+

Usage

+
+

For using the Kafka Streams binder, you just need to add it to your Spring Cloud Stream application, using the following maven coordinates:

+
+
+
+
<dependency>
+  <groupId>org.springframework.cloud</groupId>
+  <artifactId>spring-cloud-stream-binder-kafka-streams</artifactId>
+</dependency>
+
+
+
+

A quick way to bootstrap a new project for Kafka Streams binder is to use Spring Initializr and then select "Cloud Streams" and "Spring for Kafka Streams" as shown below

+
+
+
+spring initializr kafka streams +
+
+
+
+

Overview

+
+

Spring Cloud Stream includes a binder implementation designed explicitly for Apache Kafka Streams binding. +With this native integration, a Spring Cloud Stream "processor" application can directly use the +Apache Kafka Streams APIs in the core business logic.

+
+
+

Kafka Streams binder implementation builds on the foundations provided by the Spring for Apache Kafka project.

+
+
+

Kafka Streams binder provides binding capabilities for the three major types in Kafka Streams - KStream, KTable and GlobalKTable.

+
+
+

Kafka Streams applications typically follow a model in which the records are read from an inbound topic, apply business logic, and then write the transformed records to an outbound topic. +Alternatively, a Processor application with no outbound destination can be defined as well.

+
+
+

In the following sections, we are going to look at the details of Spring Cloud Stream’s integration with Kafka Streams.

+
+
+
+

Programming Model

+
+

When using the programming model provided by Kafka Streams binder, both the high-level Streams DSL and a mix of both the higher level and the lower level Processor-API can be used as options. +When mixing both higher and lower level API’s, this is usually achieved by invoking transform or process API methods on KStream.

+
+
+

Functional Style

+
+

Starting with Spring Cloud Stream 3.0.0, Kafka Streams binder allows the applications to be designed and developed using the functional programming style that is available in Java 8. +This means that the applications can be concisely represented as a lambda expression of types java.util.function.Function or java.util.function.Consumer.

+
+
+

Let’s take a very basic example.

+
+
+
+
@SpringBootApplication
+public class SimpleConsumerApplication {
+
+    @Bean
+    public java.util.function.Consumer<KStream<Object, String>> process() {
+
+        return input ->
+                input.foreach((key, value) -> {
+                    System.out.println("Key: " + key + " Value: " + value);
+                });
+    }
+}
+
+
+
+

Albeit simple, this is a complete standalone Spring Boot application that is leveraging Kafka Streams for stream processing. +This is a consumer application with no outbound binding and only a single inbound binding. +The application consumes data and it simply logs the information from the KStream key and value on the standard output. +The application contains the SpringBootApplication annotation and a method that is marked as Bean. +The bean method is of type java.util.function.Consumer which is parameterized with KStream. +Then in the implementation, we are returning a Consumer object that is essentially a lambda expression. +Inside the lambda expression, the code for processing the data is provided.

+
+
+

In this application, there is a single input binding that is of type KStream. +The binder creates this binding for the application with a name process-in-0, i.e. the name of the function bean name followed by a dash character (-) and the literal in followed by another dash and then the ordinal position of the parameter. +You use this binding name to set other properties such as destination. +For example, spring.cloud.stream.bindings.process-in-0.destination=my-topic.

+
+
+ + + + + +
+ + +If the destination property is not set on the binding, a topic is created with the same name as the binding (if there are sufficient privileges for the application) or that topic is expected to be already available. +
+
+
+

Once built as a uber-jar (e.g., kstream-consumer-app.jar), you can run the above example like the following.

+
+
+
+
java -jar kstream-consumer-app.jar --spring.cloud.stream.bindings.process-in-0.destination=my-topic
+
+
+
+

Here is another example, where it is a full processor with both input and output bindings. +This is the classic word-count example in which the application receives data from a topic, the number of occurrences for each word is then computed in a tumbling time-window.

+
+
+
+
@SpringBootApplication
+public class WordCountProcessorApplication {
+
+  @Bean
+  public Function<KStream<Object, String>, KStream<?, WordCount>> process() {
+
+    return input -> input
+                .flatMapValues(value -> Arrays.asList(value.toLowerCase().split("\\W+")))
+                .map((key, value) -> new KeyValue<>(value, value))
+                .groupByKey(Serialized.with(Serdes.String(), Serdes.String()))
+                .windowedBy(TimeWindows.of(5000))
+                .count(Materialized.as("word-counts-state-store"))
+                .toStream()
+                .map((key, value) -> new KeyValue<>(key.key(), new WordCount(key.key(), value,
+                        new Date(key.window().start()), new Date(key.window().end()))));
+  }
+
+	public static void main(String[] args) {
+		SpringApplication.run(WordCountProcessorApplication.class, args);
+	}
+}
+
+
+
+

Here again, this is a complete Spring Boot application. The difference here from the first application is that the bean method is of type java.util.function.Function. +The first parameterized type for the Function is for the input KStream and the second one is for the output. +In the method body, a lambda expression is provided that is of type Function and as implementation, the actual business logic is given. +Similar to the previously discussed Consumer based application, the input binding here is named as process-in-0 by default. For the output, the binding name is automatically also set to process-out-0.

+
+
+

Once built as an uber-jar (e.g., wordcount-processor.jar), you can run the above example like the following.

+
+
+
+
java -jar wordcount-processor.jar --spring.cloud.stream.bindings.process-in-0.destination=words --spring.cloud.stream.bindings.process-out-0.destination=counts
+
+
+
+

This application will consume messages from the Kafka topic words and the computed results are published to an output +topic counts.

+
+
+

Spring Cloud Stream will ensure that the messages from both the incoming and outgoing topics are automatically bound as +KStream objects. As a developer, you can exclusively focus on the business aspects of the code, i.e. writing the logic +required in the processor. Setting up Kafka Streams specific configuration required by the Kafka Streams infrastructure +is automatically handled by the framework.

+
+
+

The two examples we saw above have a single KStream input binding. In both cases, the bindings received the records from a single topic. +If you want to multiplex multiple topics into a single KStream binding, you can provide comma separated Kafka topics as destinations below.

+
+
+

spring.cloud.stream.bindings.process-in-0.destination=topic-1,topic-2,topic-3

+
+
+
Multiple Input Bindings
+
+

Many non-trivial Kafka Streams applications often consume data from more than one topic through multiple bindings. +For instance, one topic is consumed as Kstream and another as KTable or GlobalKTable. +There are many reasons why an application might want to receive data as a table type. +Think of a use-case where the underlying topic is populated through a change data capture (CDC) mechanism from a database or perhaps the application only cares about the latest updates for downstream processing. +If the application specifies that the data needs to be bound as KTable or GlobalKTable, then Kafka Streams binder will properly bind the destination to a KTable or GlobalKTable and make them available for the application to operate upon. +We will look at a few different scenarios how multiple input bindings are handled in the Kafka Streams binder.

+
+
+
BiFunction in Kafka Streams Binder
+
+

Here is an example where we have two inputs and an output. In this case, the application can leverage on java.util.function.BiFunction.

+
+
+
+
@Bean
+public BiFunction<KStream<String, Long>, KTable<String, String>, KStream<String, Long>> process() {
+    return (userClicksStream, userRegionsTable) -> (userClicksStream
+            .leftJoin(userRegionsTable, (clicks, region) -> new RegionWithClicks(region == null ?
+                            "UNKNOWN" : region, clicks),
+                    Joined.with(Serdes.String(), Serdes.Long(), null))
+            .map((user, regionWithClicks) -> new KeyValue<>(regionWithClicks.getRegion(),
+                    regionWithClicks.getClicks()))
+            .groupByKey(Grouped.with(Serdes.String(), Serdes.Long()))
+            .reduce(Long::sum)
+            .toStream());
+}
+
+
+
+

Here again, the basic theme is the same as in the previous examples, but here we have two inputs. +Java’s BiFunction support is used to bind the inputs to the desired destinations. +The default binding names generated by the binder for the inputs are process-in-0 and process-in-1 respectively. The default output binding is process-out-0. +In this example, the first parameter of BiFunction is bound as a KStream for the first input and the second parameter is bound as a KTable for the second input.

+
+
+
+
BiConsumer in Kafka Streams Binder
+
+

If there are two inputs, but no outputs, in that case we can use java.util.function.BiConsumer as shown below.

+
+
+
+
@Bean
+public BiConsumer<KStream<String, Long>, KTable<String, String>> process() {
+    return (userClicksStream, userRegionsTable) -> {}
+}
+
+
+
+
+
Beyond two inputs
+
+

What if you have more than two inputs? +There are situations in which you need more than two inputs. In that case, the binder allows you to chain partial functions. +In functional programming jargon, this technique is generally known as currying. +With the functional programming support added as part of Java 8, Java now enables you to write curried functions. +Spring Cloud Stream Kafka Streams binder can make use of this feature to enable multiple input bindings.

+
+
+

Let’s see an example.

+
+
+
+
@Bean
+public Function<KStream<Long, Order>,
+        Function<GlobalKTable<Long, Customer>,
+                Function<GlobalKTable<Long, Product>, KStream<Long, EnrichedOrder>>>> enrichOrder() {
+
+    return orders -> (
+              customers -> (
+                    products -> (
+                        orders.join(customers,
+                            (orderId, order) -> order.getCustomerId(),
+                                (order, customer) -> new CustomerOrder(customer, order))
+                                .join(products,
+                                        (orderId, customerOrder) -> customerOrder
+                                                .productId(),
+                                        (customerOrder, product) -> {
+                                            EnrichedOrder enrichedOrder = new EnrichedOrder();
+                                            enrichedOrder.setProduct(product);
+                                            enrichedOrder.setCustomer(customerOrder.customer);
+                                            enrichedOrder.setOrder(customerOrder.order);
+                                            return enrichedOrder;
+                                        })
+                        )
+                )
+    );
+}
+
+
+
+

Let’s look at the details of the binding model presented above. +In this model, we have 3 partially applied functions on the inbound. Let’s call them as f(x), f(y) and f(z). +If we expand these functions in the sense of true mathematical functions, it will look like these: f(x) → (fy) → f(z) → KStream<Long, EnrichedOrder>. +The x variable stands for KStream<Long, Order>, the y variable stands for GlobalKTable<Long, Customer> and the z variable stands for GlobalKTable<Long, Product>. +The first function f(x) has the first input binding of the application (KStream<Long, Order>) and its output is the function, f(y). +The function f(y) has the second input binding for the application (GlobalKTable<Long, Customer>) and its output is yet another function, f(z). +The input for the function f(z) is the third input for the application (GlobalKTable<Long, Product>) and its output is KStream<Long, EnrichedOrder> which is the final output binding for the application. +The input from the three partial functions which are KStream, GlobalKTable, GlobalKTable respectively are available for you in the method body for implementing the business logic as part of the lambda expression.

+
+
+

Input bindings are named as enrichOrder-in-0, enrichOrder-in-1 and enrichOrder-in-2 respectively. Output binding is named as enrichOrder-out-0.

+
+
+

With curried functions, you can virtually have any number of inputs. However, keep in mind that, anything more than a smaller number of inputs and partially applied functions for them as above in Java might lead to unreadable code. +Therefore if your Kafka Streams application requires more than a reasonably smaller number of input bindings and you want to use this functional model, then you may want to rethink your design and decompose the application appropriately.

+
+
+
+
+
Multiple Output Bindings
+
+

Kafka Streams allows to write outbound data into multiple topics. This feature is known as branching in Kafka Streams. +When using multiple output bindings, you need to provide an array of KStream (KStream[]) as the outbound return type.

+
+
+

Here is an example:

+
+
+
+
@Bean
+public Function<KStream<Object, String>, KStream<?, WordCount>[]> process() {
+
+    Predicate<Object, WordCount> isEnglish = (k, v) -> v.word.equals("english");
+    Predicate<Object, WordCount> isFrench = (k, v) -> v.word.equals("french");
+    Predicate<Object, WordCount> isSpanish = (k, v) -> v.word.equals("spanish");
+
+    return input -> input
+            .flatMapValues(value -> Arrays.asList(value.toLowerCase().split("\\W+")))
+            .groupBy((key, value) -> value)
+            .windowedBy(TimeWindows.of(5000))
+            .count(Materialized.as("WordCounts-branch"))
+            .toStream()
+            .map((key, value) -> new KeyValue<>(null, new WordCount(key.key(), value,
+                    new Date(key.window().start()), new Date(key.window().end()))))
+            .branch(isEnglish, isFrench, isSpanish);
+}
+
+
+
+

The programming model remains the same, however the outbound parameterized type is KStream[]. +The default output binding names are process-out-0, process-out-1, process-out-2 respectively. +The reason why the binder generates three output bindings is because it detects the length of the returned KStream array.

+
+
+
+
Summary of Function based Programming Styles for Kafka Streams
+
+

In summary, the following table shows the various options that can be used in the functional paradigm.

+
+ +++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Number of InputsNumber of OutputsComponent to use

1

0

java.util.function.Consumer

2

0

java.util.function.BiConsumer

1

1..n

java.util.function.Function

2

1..n

java.util.function.BiFunction

>= 3

0..n

Use curried functions

+
+
    +
  • +

    In the case of more than one output in this table, the type simply becomes KStream[].

    +
  • +
+
+
+
+
+

Imperative programming model.

+
+

Although the functional programming model outlined above is the preferred approach, you can still use the classic StreamListener based approach if you prefer.

+
+
+

Here are some examples.

+
+
+

Following is the equivalent of the Word count example using StreamListener.

+
+
+
+
@SpringBootApplication
+@EnableBinding(KafkaStreamsProcessor.class)
+public class WordCountProcessorApplication {
+
+    @StreamListener("input")
+    @SendTo("output")
+    public KStream<?, WordCount> process(KStream<?, String> input) {
+        return input
+                .flatMapValues(value -> Arrays.asList(value.toLowerCase().split("\\W+")))
+                .groupBy((key, value) -> value)
+                .windowedBy(TimeWindows.of(5000))
+                .count(Materialized.as("WordCounts-multi"))
+                .toStream()
+                .map((key, value) -> new KeyValue<>(null, new WordCount(key.key(), value, new Date(key.window().start()), new Date(key.window().end()))));
+    }
+
+    public static void main(String[] args) {
+        SpringApplication.run(WordCountProcessorApplication.class, args);
+    }
+
+
+
+

As you can see, this is a bit more verbose since you need to provide EnableBinding and the other extra annotations like StreamListener and SendTo to make it a complete application. +EnableBinding is where you specify your binding interface that contains your bindings. +In this case, we are using the stock KafkaStreamsProcessor binding interface that has the following contracts.

+
+
+
+
public interface KafkaStreamsProcessor {
+
+	@Input("input")
+	KStream<?, ?> input();
+
+	@Output("output")
+	KStream<?, ?> output();
+
+}
+
+
+
+

Binder will create bindings for the input KStream and output KStream since you are using a binding interface that contains those declarations.

+
+
+

In addition to the obvious differences in the programming model offered in the functional style, one particular thing that needs to be mentioned here is that the binding names are what you specify in the binding interface. +For example, in the above application, since we are using KafkaStreamsProcessor, the binding names are input and output. +Binding properties need to use those names. For instance spring.cloud.stream.bindings.input.destination, spring.cloud.stream.bindings.output.destination etc. +Keep in mind that this is fundamentally different from the functional style since there the binder generates binding names for the application. +This is because the application does not provide any binding interfaces in the functional model using EnableBinding.

+
+
+

Here is another example of a sink where we have two inputs.

+
+
+
+
@EnableBinding(KStreamKTableBinding.class)
+.....
+.....
+@StreamListener
+public void process(@Input("inputStream") KStream<String, PlayEvent> playEvents,
+                    @Input("inputTable") KTable<Long, Song> songTable) {
+                    ....
+                    ....
+}
+
+interface KStreamKTableBinding {
+
+    @Input("inputStream")
+    KStream<?, ?> inputStream();
+
+    @Input("inputTable")
+    KTable<?, ?> inputTable();
+}
+
+
+
+

Following is the StreamListener equivalent of the same BiFunction based processor that we saw above.

+
+
+
+
@EnableBinding(KStreamKTableBinding.class)
+....
+....
+
+@StreamListener
+@SendTo("output")
+public KStream<String, Long> process(@Input("input") KStream<String, Long> userClicksStream,
+                                     @Input("inputTable") KTable<String, String> userRegionsTable) {
+....
+....
+}
+
+interface KStreamKTableBinding extends KafkaStreamsProcessor {
+
+    @Input("inputX")
+    KTable<?, ?> inputTable();
+}
+
+
+
+

Finally, here is the StreamListener equivalent of the application with three inputs and curried functions.

+
+
+
+
@EnableBinding(CustomGlobalKTableProcessor.class)
+...
+...
+    @StreamListener
+    @SendTo("output")
+    public KStream<Long, EnrichedOrder> process(
+            @Input("input-1") KStream<Long, Order> ordersStream,
+            @Input("input-"2) GlobalKTable<Long, Customer> customers,
+            @Input("input-3") GlobalKTable<Long, Product> products) {
+
+        KStream<Long, CustomerOrder> customerOrdersStream = ordersStream.join(
+                customers, (orderId, order) -> order.getCustomerId(),
+                (order, customer) -> new CustomerOrder(customer, order));
+
+        return customerOrdersStream.join(products,
+                (orderId, customerOrder) -> customerOrder.productId(),
+                (customerOrder, product) -> {
+                    EnrichedOrder enrichedOrder = new EnrichedOrder();
+                    enrichedOrder.setProduct(product);
+                    enrichedOrder.setCustomer(customerOrder.customer);
+                    enrichedOrder.setOrder(customerOrder.order);
+                    return enrichedOrder;
+                });
+        }
+
+    interface CustomGlobalKTableProcessor {
+
+            @Input("input-1")
+            KStream<?, ?> input1();
+
+            @Input("input-2")
+            GlobalKTable<?, ?> input2();
+
+            @Input("input-3")
+            GlobalKTable<?, ?> input3();
+
+            @Output("output")
+            KStream<?, ?> output();
+    }
+
+
+
+

You might notice that the above two examples are even more verbose since in addition to provide EnableBinding, you also need to write your own custom binding interface as well. +Using the functional model, you can avoid all those ceremonial details.

+
+
+

Before we move on from looking at the general programming model offered by Kafka Streams binder, here is the StreamListener version of multiple output bindings.

+
+
+
+
EnableBinding(KStreamProcessorWithBranches.class)
+public static class WordCountProcessorApplication {
+
+    @Autowired
+    private TimeWindows timeWindows;
+
+    @StreamListener("input")
+    @SendTo({"output1","output2","output3})
+    public KStream<?, WordCount>[] process(KStream<Object, String> input) {
+
+			Predicate<Object, WordCount> isEnglish = (k, v) -> v.word.equals("english");
+			Predicate<Object, WordCount> isFrench =  (k, v) -> v.word.equals("french");
+			Predicate<Object, WordCount> isSpanish = (k, v) -> v.word.equals("spanish");
+
+			return input
+					.flatMapValues(value -> Arrays.asList(value.toLowerCase().split("\\W+")))
+					.groupBy((key, value) -> value)
+					.windowedBy(timeWindows)
+					.count(Materialized.as("WordCounts-1"))
+					.toStream()
+					.map((key, value) -> new KeyValue<>(null, new WordCount(key.key(), value, new Date(key.window().start()), new Date(key.window().end()))))
+					.branch(isEnglish, isFrench, isSpanish);
+    }
+
+    interface KStreamProcessorWithBranches {
+
+    		@Input("input")
+    		KStream<?, ?> input();
+
+    		@Output("output1")
+    		KStream<?, ?> output1();
+
+    		@Output("output2")
+    		KStream<?, ?> output2();
+
+    		@Output("output3")
+    		KStream<?, ?> output3();
+    	}
+}
+
+
+
+

To recap, we have reviewed the various programming model choices when using the Kafka Streams binder.

+
+
+

The binder provides binding capabilities for KStream, KTable and GlobalKTable on the input. +KTable and GlobalKTable bindings are only available on the input. +Binder supports both input and output bindings for KStream.

+
+
+

The upshot of the programming model of Kafka Streams binder is that the binder provides you the flexibility of going with a fully functional programming model or using the StreamListener based imperative approach.

+
+
+
+
+

Ancillaries to the programming model

+
+

Multiple Kafka Streams processors within a single application

+
+

Binder allows to have multiple Kafka Streams processors within a single Spring Cloud Stream application. +You can have an application as below.

+
+
+
+
@Bean
+public java.util.function.Function<KStream<Object, String>, KStream<Object, String>> process() {
+   ...
+}
+
+@Bean
+public java.util.function.Consumer<KStream<Object, String>> anotherProcess() {
+  ...
+}
+
+@Bean
+public java.util.function.BiFunction<KStream<Object, String>, KTable<Integer, String>, KStream<Object, String>> yetAnotherProcess() {
+   ...
+}
+
+
+
+

In this case, the binder will create 3 separate Kafka Streams objects with different application ID’s (more on this below). +However, if you have more than one processor in the application, you have to tell Spring Cloud Stream, which functions need to be activated. +Here is how you activate the functions.

+
+
+

spring.cloud.stream.function.definition: process;anotherProcess;yetAnotherProcess

+
+
+

If you want certain functions to be not activated right away, you can remove that from this list.

+
+
+

This is also true when you have a single Kafka Streams processor and other types of Function beans in the same application that is handled through a different binder (for e.g., a function bean that is based on the regular Kafka Message Channel binder)

+
+
+
+

Kafka Streams Application ID

+
+

Application id is a mandatory property that you need to provide for a Kafka Streams application. +Spring Cloud Stream Kafka Streams binder allows you to configure this application id in multiple ways.

+
+
+

If you only have one single processor or StreamListener in the application, then you can set this at the binder level using the following property:

+
+
+

spring.cloud.stream.kafka.streams.binder.applicationId.

+
+
+

As a convenience, if you only have a single processor, you can also use spring.application.name as the property to delegate the application id.

+
+
+

If you have multiple Kafka Streams processors in the application, then you need to set the application id per processor. +In the case of the functional model, you can attach it to each function as a property.

+
+
+

For e.g. imagine that you have the following functions.

+
+
+
+
@Bean
+public java.util.function.Consumer<KStream<Object, String>> process() {
+   ...
+}
+
+
+
+

and

+
+
+
+
@Bean
+public java.util.function.Consumer<KStream<Object, String>> anotherProcess() {
+  ...
+}
+
+
+
+

Then you can set the application id for each, using the following binder level properties.

+
+
+

spring.cloud.stream.kafka.streams.binder.functions.process.applicationId

+
+
+

and

+
+
+

spring.cloud.stream.kafka.streams.binder.functions.anotherProcess.applicationId

+
+
+

In the case of StreamListener, you need to set this on the first input binding on the processor.

+
+
+

For e.g. imagine that you have the following two StreamListener based processors.

+
+
+
+
@StreamListener
+@SendTo("output")
+public KStream<String, String> process(@Input("input") <KStream<Object, String>> input) {
+   ...
+}
+
+@StreamListener
+@SendTo("anotherOutput")
+public KStream<String, String> anotherProcess(@Input("anotherInput") <KStream<Object, String>> input) {
+   ...
+}
+
+
+
+

Then you must set the application id for this using the following binding property.

+
+
+

spring.cloud.stream.kafka.streams.bindings.input.applicationId

+
+
+

and

+
+
+

spring.cloud.stream.kafka.streams.bindings.anotherInput.applicationId

+
+
+

For function based model also, this approach of setting application id at the binding level will work. +However, setting per function at the binder level as we have seen above is much easier if you are using the functional model.

+
+
+

For production deployments, it is highly recommended to explicitly specify the application ID through configuration. +This is especially going to be very critical if you are auto scaling your application in which case you need to make sure that you are deploying each instance with the same application ID.

+
+
+

If the application does not provide an application ID, then in that case the binder will auto generate a static application ID for you. +This is convenient in development scenarios as it avoids the need for explicitly providing the application ID. +The generated application ID in this manner will be static over application restarts. +In the case of functional model, the generated application ID will be the function bean name followed by the literal applicationID, for e.g process-applicationID if process if the function bean name. +In the case of StreamListener, instead of using the function bean name, the generated application ID will be use the containing class name followed by the method name followed by the literal applicationId.

+
+
+
Summary of setting Application ID
+
+
    +
  • +

    By default, binder will auto generate the application ID per function or StreamListener methods.

    +
  • +
  • +

    If you have a single processor, then you can use spring.kafka.streams.applicationId, spring.application.name or spring.cloud.stream.kafka.streams.binder.applicationId.

    +
  • +
  • +

    If you have multiple processors, then application ID can be set per function using the property - spring.cloud.stream.kafka.streams.binder.functions.<function-name>.applicationId. +In the case of StreamListener, this can be done using spring.cloud.stream.kafka.streams.bindings.input.applicationId, assuming that the input binding name is input.

    +
  • +
+
+
+
+
+

Overriding the default binding names generated by the binder with the functional style

+
+

By default, the binder uses the strategy discussed above to generate the binding name when using the functional style, i.e. <function-bean-name>-<in>|<out>-[0..n], for e.g. process-in-0, process-out-0 etc. +If you want to override those binding names, you can do that by specifying the following properties.

+
+
+

spring.cloud.stream.function.bindings.<default binding name>. Default binding name is the original binding name generated by the binder.

+
+
+

For e.g. lets say, you have this function.

+
+
+
+
@Bean
+public BiFunction<KStream<String, Long>, KTable<String, String>, KStream<String, Long>> process() {
+...
+}
+
+
+
+

Binder will generate bindings with names, process-in-0, process-in-1 and process-out-0. +Now, if you want to change them to something else completely, maybe more domain specific binding names, then you can do so as below.

+
+
+

springc.cloud.stream.function.bindings.process-in-0=users

+
+
+

springc.cloud.stream.function.bindings.process-in-0=regions

+
+
+

and

+
+
+

spring.cloud.stream.function.bindings.process-out-0=clicks

+
+
+

After that, you must set all the binding level properties on these new binding names.

+
+
+

Please keep in mind that with the functional programming model described above, adhering to the default binding names make sense in most situations. +The only reason you may still want to do this overriding is when you have larger number of configuration properties and you want to map the bindings to something more domain friendly.

+
+
+
+

Setting up bootstrap server configuration

+
+

When running Kafka Streams applications, you must provide the Kafka broker server information. +If you don’t provide this information, the binder expects that you are running the broker at the default localhost:9092. +If that is not the case, then you need to override that. There are a couple of ways to do that.

+
+
+
    +
  • +

    Using the boot property - spring.kafka.bootstrapServers

    +
  • +
  • +

    Binder level property - spring.cloud.stream.kafka.streams.binder.brokers

    +
  • +
+
+
+

When it comes to the binder level property, it doesn’t matter if you use the broker property provided through the regular Kafka binder - spring.cloud.stream.kafka.binder.brokers. +Kafka Streams binder will first check if Kafka Streams binder specific broker property is set (spring.cloud.stream.kafka.streams.binder.brokers) and if not found, it looks for spring.cloud.stream.kafka.binder.brokers.

+
+
+
+
+

Record serialization and deserialization

+
+

Kafka Streams binder allows you to serialize and deserialize records in two ways. +One is the native serialization and deserialization facilities provided by Kafka and the other one is the message conversion capabilities of Spring Cloud Stream framework. +Lets look at some details.

+
+
+

Inbound deserialization

+
+

Keys are always deserialized using native Serdes.

+
+
+

For values, by default, deserialization on the inbound is natively performed by Kafka. +Please note that this is a major change on default behavior from previous versions of Kafka Streams binder where the deserialization was done by the framework.

+
+
+

Kafka Streams binder will try to infer matching Serde types by looking at the type signature of java.util.function.Function|Consumer or StreamListener. +Here is the order that it matches the Serdes.

+
+
+
    +
  • +

    If the application provides a bean of type Serde and if the return type is parameterized with the actual type of the incoming key or value type, then it will use that Serde for inbound deserialization. +For e.g. if you have the following in the application, the binder detects that the incoming value type for the KStream matches with a type that is parameterized on a Serde bean. +It will use that for inbound deserialization.

    +
  • +
+
+
+
+
@Bean
+public Serde<Foo() customSerde{
+ ...
+}
+
+@Bean
+public Function<KStream<String, Foo>, KStream<String, Foo>> process() {
+}
+
+
+
+
    +
  • +

    Next, it looks at the types and see if they are one of the types exposed by Kafka Streams. If so, use them. +Here are the Serde types that the binder will try to match from Kafka Streams.

    +
    +
    +
    Integer, Long, Short, Double, Float, byte[], UUID and String.
    +
    +
    +
  • +
  • +

    If none of the Serdes provided by Kafka Streams don’t match the types, then it will use JsonSerde provided by Spring Kafka. In this case, the binder assumes that the types are JSON friendly. +This is useful if you have multiple value objects as inputs since the binder will internally infer them to correct Java types. +Before falling back to the JsonSerde though, the binder checks at the default Serde`s set in the Kafka Streams configuration to see if it is a `Serde that it can match with the incoming KStream’s types.

    +
  • +
+
+
+

If none of the above strategies worked, then the applications must provide the `Serde`s through configuration. +This can be configured in two ways - binding or default.

+
+
+

First the binder will look if a Serde is provided at the binding level. +For e.g. if you have the following processor,

+
+
+
+
@Bean
+public BiFunction<KStream<CustomKey, AvroIn1>, KTable<CustomKey, AvroIn2>, KStream<CustomKey, AvroOutput>> process() {...}
+
+
+
+

then, you can provide a binding level Serde using the following:

+
+
+
+
spring.cloud.stream.kafka.streams.bindings.process-in-0.consumer.keySerde=CustomKeySerde
+spring.cloud.stream.kafka.streams.bindings.process-in-0.consumer.valueSerde=io.confluent.kafka.streams.serdes.avro.SpecificAvroSerde
+
+spring.cloud.stream.kafka.streams.bindings.process-in-1.consumer.keySerde=CustomKeySerde
+spring.cloud.stream.kafka.streams.bindings.process-in-1.consumer.valueSerde=io.confluent.kafka.streams.serdes.avro.SpecificAvroSerde
+
+
+
+ + + + + +
+ + +If you provide Serde as abover per input binding, then that will takes higher precedence and the binder will stay away from any Serde inference. +
+
+
+

If you want the default key/value Serdes to be used for inbound deserialization, you can do so at the binder level.

+
+
+
+
spring.cloud.stream.kafka.streams.binder.configuration.default.key.serde
+spring.cloud.stream.kafka.streams.binder.configuration.default.value.serde
+
+
+
+

If you don’t want the native decoding provided by Kafka, you can rely on the message conversion features that Spring Cloud Stream provides. +Since native decoding is the default, in order to let Spring Cloud Stream deserialize the inbound value object, you need to explicitly disable native decoding.

+
+
+

For e.g. if you have the same BiFunction processor as above, then spring.cloud.stream.bindings.process-in-0.consumer.nativeDecoding: false +You need to disable native decoding for all the inputs individually. Otherwise, native decoding will still be applied for those you do not disable.

+
+
+

By default, Spring Cloud Stream will use application/json as the content type and use an appropriate json message converter. +You can use custom message converters by using the following property and an appropriate MessageConverter bean.

+
+
+
+
spring.cloud.stream.bindings.process-in-0.contentType
+
+
+
+
+

Outbound serialization

+
+

Outbound serialization pretty much follows the same rules as above for inbound deserialization. +As with the inbound deserialization, one major change from the previous versions of Spring Cloud Stream is that the serialization on the outbound is handled by Kafka natively. +Before 3.0 versions of the binder, this was done by the framework itself.

+
+
+

Keys on the outbound are always serialized by Kafka using a matching Serde that is inferred by the binder. +If it can’t infer the type of the key, then that needs to be specified using configuration.

+
+
+

Value serdes are inferred using the same rules used for inbound deserialization. +First it matches to see if the outbound type is from a provided bean in the application. +If not, it checks to see if it matches with a Serde exposed by Kafka such as - Integer, Long, Short, Double, Float, byte[], UUID and String. +If that doesnt’t work, then it falls back to JsonSerde provided by the Spring Kafka project, but first look at the default Serde configuration to see if there is a match. +Keep in mind that all these happen transparently to the application. +If none of these work, then the user has to provide the Serde to use by configuration.

+
+
+

Lets say you are using the same BiFunction processor as above. Then you can configure outbound key/value Serdes as following.

+
+
+
+
spring.cloud.stream.kafka.streams.bindings.process-out-0.producer.keySerde=CustomKeySerde
+spring.cloud.stream.kafka.streams.bindings.process-out-0.producer.valueSerde=io.confluent.kafka.streams.serdes.avro.SpecificAvroSerde
+
+
+
+

If Serde inference fails, and no binding level Serdes are provided, then the binder falls back to the JsonSerde, but look at the default Serdes for a match.

+
+
+

Default serdes are configured in the same way as above where it is described under deserialization.

+
+
+

spring.cloud.stream.kafka.streams.binder.configuration.default.key.serde +spring.cloud.stream.kafka.streams.binder.configuration.default.value.serde

+
+
+

If your application uses the branching feature and has multiple output bindings, then these have to be configured per binding. +Once again, if the binder is capable of inferring the Serde types, you don’t need to do this configuration.

+
+
+

If you don’t want the native encoding provided by Kafka, but want to use the framework provided message conversion, then you need to explicitly disable native encoding since since native encoding is the default. +For e.g. if you have the same BiFunction processor as above, then spring.cloud.stream.bindings.process-out-0.producer.nativeEncoding: false +You need to disable native encoding for all the output individually in the case of branching. Otherwise, native encoding will still be applied for those you don’t disable.

+
+
+

When conversion is done by Spring Cloud Stream, by default, it will use application/json as the content type and use an appropriate json message converter. +You can use custom message converters by using the following property and a corresponding MessageConverter bean.

+
+
+
+
spring.cloud.stream.bindings.process-out-0.contentType
+
+
+
+

When native encoding/decoding is disabled, binder will not do any inference as in the case of native Serdes. +Applications need to explicitly provide all the configuration options. +For that reason, it is generally advised to stay with the default options for de/serialization and stick with native de/serialization provided by Kafka Streams when you write Spring Cloud Stream Kafka Streams applications. +The one scenario in which you must use message conversion capabilities provided by the framework is when your upstream producer is using a specific serialization strategy. +In that case, you want to use a matching deserialization strategy as native mechanisms may fail. +When relying on the default Serde mechanism, the applications must ensure that the binder has a way forward with correctly map the inbound and outbound with a proper Serde, as otherwise things might fail.

+
+
+

It is worth to mention that the data de/serialization approaches outlined above are only applicable on the edges of your processors, i.e. - inbound and outbound. +Your business logic might still need to call Kafka Streams API’s that explicitly need Serde objects. +Those are still the responsibility of the application and must be handled accordingly by the developer.

+
+
+
+
+

Error Handling

+
+

Apache Kafka Streams provides the capability for natively handling exceptions from deserialization errors. +For details on this support, please see this. +Out of the box, Apache Kafka Streams provides two kinds of deserialization exception handlers - LogAndContinueExceptionHandler and LogAndFailExceptionHandler. +As the name indicates, the former will log the error and continue processing the next records and the latter will log the error and fail. LogAndFailExceptionHandler is the default deserialization exception handler.

+
+
+

Handling Deserialization Exceptions in the Binder

+
+

Kafka Streams binder allows to specify the deserialization exception handlers above using the following property.

+
+
+
+
spring.cloud.stream.kafka.streams.binder.deserializationExceptionHandler: logAndContinue
+
+
+
+

or

+
+
+
+
spring.cloud.stream.kafka.streams.binder.deserializationExceptionHandler: logAndFail
+
+
+
+

In addition to the above two deserialization exception handlers, the binder also provides a third one for sending the erroneous records (poison pills) to a DLQ (dead letter queue) topic. +Here is how you enable this DLQ exception handler.

+
+
+
+
spring.cloud.stream.kafka.streams.binder.deserializationExceptionHandler: sendToDlq
+
+
+
+

When the above property is set, all the records in deserialization error are automatically sent to the DLQ topic.

+
+
+

You can set the topic name where the DLQ messages are published as below.

+
+
+
+
spring.cloud.stream.kafka.streams.bindings.process-in-0.consumer.dlqName: custom-dlq (Change the binding name accordingly)
+
+
+
+

If this is set, then the error records are sent to the topic custom-dlq. +If this is not set, then it will create a DLQ topic with the name error.<input-topic-name>.<application-id>. +For instance, if your binding’s destination topic is inputTopic and the application ID is process-applicationId, then the default DLQ topic is error.inputTopic.process-applicationId. +It is always recommended to explicitly create a DLQ topic for each input binding if it is your intention to enable DLQ.

+
+
+
+

DLQ per input consumer binding

+
+

The property spring.cloud.stream.kafka.streams.binder.deserializationExceptionHandler is applicable for the entire application. +This implies that if there are multiple functions or StreamListener methods in the same application, this property is applied to all of them. +However, if you have multiple processors or multiple input bindings within a single processor, then you can use the finer-grained DLQ control that the binder provides per input consumer binding.

+
+
+

If you have the following processor,

+
+
+
+
@Bean
+public BiFunction<KStream<String, Long>, KTable<String, String>, KStream<String, Long>> process() {
+...
+}
+
+
+
+

and you only want to enable DLQ on the first input binding and logAndSkip on the second binding, then you can do so on the consumer as below.

+
+
+

spring.cloud.stream.kafka.streams.bindings.process-in-0.consumer.deserializationExceptionHandler: sendToDlq +spring.cloud.stream.kafka.streams.bindings.process-in-1.consumer.deserializationExceptionHandler: logAndSkip

+
+
+

Setting deserialization exception handlers this way has a higher precedence than setting at the binder level.

+
+
+
+

DLQ partitioning

+
+

By default, records are published to the Dead-Letter topic using the same partition as the original record. +This means the Dead-Letter topic must have at least as many partitions as the original record.

+
+
+

To change this behavior, add a DlqPartitionFunction implementation as a @Bean to the application context. +Only one such bean can be present. +The function is provided with the consumer group (which is the same as the application ID in most situations), the failed ConsumerRecord and the exception. +For example, if you always want to route to partition 0, you might use:

+
+
+
+
@Bean
+public DlqPartitionFunction partitionFunction() {
+    return (group, record, ex) -> 0;
+}
+
+
+
+ + + + + +
+ + +If you set a consumer binding’s dlqPartitions property to 1 (and the binder’s minPartitionCount is equal to 1), there is no need to supply a DlqPartitionFunction; the framework will always use partition 0. +If you set a consumer binding’s dlqPartitions property to a value greater than 1 (or the binder’s minPartitionCount is greater than 1), you must provide a DlqPartitionFunction bean, even if the partition count is the same as the original topic’s. +
+
+
+

A couple of things to keep in mind when using the exception handling feature in Kafka Streams binder.

+
+
+
    +
  • +

    The property spring.cloud.stream.kafka.streams.binder.deserializationExceptionHandler is applicable for the entire application. +This implies that if there are multiple functions or StreamListener methods in the same application, this property is applied to all of them.

    +
  • +
  • +

    The exception handling for deserialization works consistently with native deserialization and framework provided message conversion.

    +
  • +
+
+
+
+

Handling Production Exceptions in the Binder

+
+

Unlike the support for deserialization exception handlers as described above, the binder does not provide such first class mechanisms for handling production exceptions. +However, you still can configure production exception handlers using the StreamsBuilderFactoryBean customizer which you can find more details about, in a subsequent section below.

+
+
+
+
+

State Store

+
+

State stores are created automatically by Kafka Streams when the high level DSL is used and appropriate calls are made those trigger a state store.

+
+
+

If you want to materialize an incoming KTable binding as a named state store, then you can do so by using the following strategy.

+
+
+

Lets say you have the following function.

+
+
+
+
@Bean
+public BiFunction<KStream<String, Long>, KTable<String, String>, KStream<String, Long>> process() {
+   ...
+}
+
+
+
+

Then by setting the following property, the incoming KTable data will be materialized in to the named state store.

+
+
+
+
spring.cloud.stream.kafka.streams.bindings.process-in-1.consumer.materializedAs: incoming-store
+
+
+
+

You can define custom state stores as beans in your application and those will be detected and added to the Kafka Streams builder by the binder. +Especially when the processor API is used, you need to register a state store manually. +In order to do so, you can create the StateStore as a bean in the application. +Here are examples of defining such beans.

+
+
+
+
@Bean
+public StoreBuilder myStore() {
+    return Stores.keyValueStoreBuilder(
+            Stores.persistentKeyValueStore("my-store"), Serdes.Long(),
+            Serdes.Long());
+}
+
+@Bean
+public StoreBuilder otherStore() {
+    return Stores.windowStoreBuilder(
+            Stores.persistentWindowStore("other-store",
+                    1L, 3, 3L, false), Serdes.Long(),
+            Serdes.Long());
+}
+
+
+
+

These state stores can be then accessed by the applications directly.

+
+
+

During the bootstrap, the above beans will be processed by the binder and passed on to the Streams builder object.

+
+
+

Accessing the state store:

+
+
+
+
Processor<Object, Product>() {
+
+    WindowStore<Object, String> state;
+
+    @Override
+    public void init(ProcessorContext processorContext) {
+        state = (WindowStore)processorContext.getStateStore("mystate");
+    }
+    ...
+}
+
+
+
+

This will not work when it comes to registering global state stores. +In order to register a global state store, please see the section below on customizing StreamsBuilderFactoryBean.

+
+
+
+

Interactive Queries

+
+

Kafka Streams binder API exposes a class called InteractiveQueryService to interactively query the state stores. +You can access this as a Spring bean in your application. An easy way to get access to this bean from your application is to autowire the bean.

+
+
+
+
@Autowired
+private InteractiveQueryService interactiveQueryService;
+
+
+
+

Once you gain access to this bean, then you can query for the particular state-store that you are interested. See below.

+
+
+
+
ReadOnlyKeyValueStore<Object, Object> keyValueStore =
+						interactiveQueryService.getQueryableStoreType("my-store", QueryableStoreTypes.keyValueStore());
+
+
+
+

During the startup, the above method call to retrieve the store might fail. +For e.g it might still be in the middle of initializing the state store. +In such cases, it will be useful to retry this operation. +Kafka Streams binder provides a simple retry mechanism to accommodate this.

+
+
+

Following are the two properties that you can use to control this retrying.

+
+
+
    +
  • +

    spring.cloud.stream.kafka.streams.binder.stateStoreRetry.maxAttempts - Default is 1 .

    +
  • +
  • +

    spring.cloud.stream.kafka.streams.binder.stateStoreRetry.backOffInterval - Default is 1000 milliseconds.

    +
  • +
+
+
+

If there are multiple instances of the kafka streams application running, then before you can query them interactively, you need to identify which application instance hosts the particular key that you are querying. +InteractiveQueryService API provides methods for identifying the host information.

+
+
+

In order for this to work, you must configure the property application.server as below:

+
+
+
+
spring.cloud.stream.kafka.streams.binder.configuration.application.server: <server>:<port>
+
+
+
+

Here are some code snippets:

+
+
+
+
org.apache.kafka.streams.state.HostInfo hostInfo = interactiveQueryService.getHostInfo("store-name",
+						key, keySerializer);
+
+if (interactiveQueryService.getCurrentHostInfo().equals(hostInfo)) {
+
+    //query from the store that is locally available
+}
+else {
+    //query from the remote host
+}
+
+
+
+
+

Health Indicator

+
+

The health indicator requires the dependency spring-boot-starter-actuator. For maven use:

+
+
+
+
<dependency>
+  <groupId>org.springframework.boot</groupId>
+  <artifactId>spring-boot-starter-actuator</artifactId>
+</dependency>
+
+
+
+

Spring Cloud Stream Kafka Streams Binder provides a health indicator to check the state of the underlying streams threads. +Spring Cloud Stream defines a property management.health.binders.enabled to enable the health indicator. See the +Spring Cloud Stream documentation.

+
+
+

The health indicator provides the following details for each stream thread’s metadata:

+
+
+
    +
  • +

    Thread name

    +
  • +
  • +

    Thread state: CREATED, RUNNING, PARTITIONS_REVOKED, PARTITIONS_ASSIGNED, PENDING_SHUTDOWN or DEAD

    +
  • +
  • +

    Active tasks: task ID and partitions

    +
  • +
  • +

    Standby tasks: task ID and partitions

    +
  • +
+
+
+

By default, only the global status is visible (UP or DOWN). To show the details, the property management.endpoint.health.show-details must be set to ALWAYS or WHEN_AUTHORIZED. +For more details about the health information, see the +Spring Boot Actuator documentation.

+
+
+ + + + + +
+ + +The status of the health indicator is UP if all the Kafka threads registered are in the RUNNING state. +
+
+
+

Since there are three individual binders in Kafka Streams binder (KStream, KTable and GlobalKTable), all of them will report the health status. +When enabling show-details, some of the information reported may be redundant.

+
+
+

When there are multiple Kafka Streams processors present in the same application, then the health checks will be reported for all of them and will be categorized by the application ID of Kafka Streams.

+
+
+
+

Accessing Kafka Streams Metrics

+
+

Spring Cloud Stream Kafka Streams binder provides a basic mechanism for accessing Kafka Streams metrics exported through a Micrometer MeterRegistry. +Kafka Streams metrics that are available through KafkaStreams#metrics() are exported to this meter registry by the binder. +The metrics exported are from the consumers, producers, admin-client and the stream itself.

+
+
+

The metrics exported by the binder are exported with the format of metrics group name followed by a dot and then the actual metric name. +All dashes in the original metric information is replaced with dots.

+
+
+

For e.g. the metric name network-io-total from the metric group consumer-metrics is available in the micrometer registry as consumer.metrics.network.io.total. +Similarly, the metric commit-total from stream-metrics is available as stream.metrics.commit.total.

+
+
+

If you have multiple Kafka Streams processors in the same application, then the metric name will be prepended with the corresponding application ID of the Kafka Streams. +The application ID in this case will be preserved as is, i.e. no dashes will be converted to dots etc. +For example, if the application ID of the first processor is processor-1, then the metric name network-io-total from the metric group consumer-metrics is available in the micrometer registry as processor-1.consumer.metrics.network.io.total.

+
+
+

You can either programmatically access the Micrometer MeterRegistry in the application and then iterate through the available gauges or use Spring Boot actuator to access the metrics through a REST endpoint. +When accessing through the Boot actuator endpoint, make sure to add metrics to the property management.endpoints.web.exposure.include. +Then you can access /acutator/metrics to get a list of all the available metrics which then can be individually accessed through the same URI (/actuator/metrics/<metric-name>).

+
+
+

Anything beyond the info level metrics available through KafkaStreams#metrics(), (for e.g. the debugging level metrics) are still only available through JMX after you set the metrics.recording.level to DEBUG. +Kafka Streams, by default, set this level to INFO. +Please see this section from Kafka Streams documentation for more details. +In a future release, binder may support exporting these DEBUG level metrics through Micrometer.

+
+
+
+

Mixing high level DSL and low level Processor API

+
+

Kafka Streams provides two variants of APIs. +It has a higher level DSL like API where you can chain various operations that maybe familiar to a lot of functional programmers. +Kafka Streams also gives access to a low level Processor API. +The processor API, although very powerful and gives the ability to control things in a much lower level, is imperative in nature. +Kafka Streams binder for Spring Cloud Stream, allows you to use either the high level DSL or mixing both the DSL and the processor API. +Mixing both of these variants give you a lot of options to control various use cases in an application. +Applications can use the transform or process method API calls to get access to the processor API.

+
+
+

Here is a look at how one may combine both the DSL and the processor API in a Spring Cloud Stream application using the process API.

+
+
+
+
@Bean
+public Consumer<KStream<Object, String>> process() {
+    return input ->
+        input.process(() -> new Processor<Object, String>() {
+            @Override
+            @SuppressWarnings("unchecked")
+            public void init(ProcessorContext context) {
+               this.context = context;
+            }
+
+            @Override
+            public void process(Object key, String value) {
+                //business logic
+            }
+
+            @Override
+            public void close() {
+
+        });
+}
+
+
+
+

Here is an example using the transform API.

+
+
+
+
@Bean
+public Consumer<KStream<Object, String>> process() {
+    return (input, a) ->
+        input.transform(() -> new Transformer<Object, String, KeyValue<Object, String>>() {
+            @Override
+            public void init(ProcessorContext context) {
+
+            }
+
+            @Override
+            public void close() {
+
+            }
+
+            @Override
+            public KeyValue<Object, String> transform(Object key, String value) {
+                // business logic - return transformed KStream;
+            }
+        });
+}
+
+
+
+

The process API method call is a terminal operation while the transform API is non terminal and gives you a potentially transformed KStream using which you can continue further processing using either the DSL or the processor API.

+
+
+
+

Partition support on the outbound

+
+

A Kafka Streams processor usually sends the processed output into an outbound Kafka topic. +If the outbound topic is partitioned and the processor needs to send the outgoing data into particular partitions, the applications needs to provide a bean of type StreamPartitioner. +See StreamPartitioner for more details. +Let’s see some examples.

+
+
+

This is the same processor we already saw multiple times,

+
+
+
+
@Bean
+public Function<KStream<Object, String>, KStream<?, WordCount>> process() {
+
+    ...
+}
+
+
+
+

Here is the output binding destination:

+
+
+
+
spring.cloud.stream.bindings.process-out-0.destination: outputTopic
+
+
+
+

If the topic outputTopic has 4 partitions, if you don’t provide a partitioning strategy, Kafka Streams will use default partitioning strategy which may not be the outcome you want depending on the particular use case. +Let’s say, you want to send any key that matches to spring to partition 0, cloud to partition 1, stream to partition 2, and everything else to partition 3. +This is what you need to do in the application.

+
+
+
+
@Bean
+public StreamPartitioner<String, WordCount> streamPartitioner() {
+    return (t, k, v, n) -> {
+        if (k.equals("spring")) {
+            return 0;
+        }
+        else if (k.equals("cloud")) {
+            return 1;
+        }
+        else if (k.equals("stream")) {
+            return 2;
+        }
+        else {
+            return 3;
+        }
+    };
+}
+
+
+
+

This is a rudimentary implementation, however, you have access to the key/value of the record, the topic name and the total number of partitions. +Therefore, you can implement complex partitioning strategies if need be.

+
+
+

You also need to provide this bean name along with the application configuration.

+
+
+
+
spring.cloud.stream.kafka.streams.bindings.process-out-0.producer.streamPartitionerBeanName: streamPartitioner
+
+
+
+

Each output topic in the application needs to be configured separately like this.

+
+
+
+

StreamsBuilderFactoryBean customizer

+
+

It is often required to customize the StreamsBuilderFactoryBean that creates the KafkaStreams objects. +Based on the underlying support provided by Spring Kafka, the binder allows you to customize the StreamsBuilderFactoryBean. +You can use the StreamsBuilderFactoryBeanCustomizer to customize the StreamsBuilderFactoryBean itself. +Then, once you get access to the StreamsBuilderFactoryBean through this customizer, you can customize the corresponding KafkaStreams using KafkaStreamsCustomzier. +Both of these customizers are part of the Spring for Apache Kafka project.

+
+
+

Here is an example of using the StreamsBuilderFactoryBeanCustomizer.

+
+
+
+
@Bean
+public StreamsBuilderFactoryBeanCustomizer streamsBuilderFactoryBeanCustomizer() {
+    return sfb -> sfb.setStateListener((newState, oldState) -> {
+         //Do some action here!
+    });
+}
+
+
+
+

The above is shown as an illustration of the things you can do to customize the StreamsBuilderFactoryBean. +You can essentially call any available mutation operations from StreamsBuilderFactoryBean to customize it. +This customizer will be invoked by the binder right before the factory bean is started.

+
+
+

Once you get access to the StreamsBuilderFactoryBean, you can also customize the underlying KafkaStreams object. +Here is a blueprint for doing so.

+
+
+
+
@Bean
+public StreamsBuilderFactoryBeanCustomizer streamsBuilderFactoryBeanCustomizer() {
+    return factoryBean -> {
+        factoryBean.setKafkaStreamsCustomizer(new KafkaStreamsCustomizer() {
+            @Override
+            public void customize(KafkaStreams kafkaStreams) {
+                kafkaStreams.setUncaughtExceptionHandler((t, e) -> {
+
+                });
+            }
+        });
+    };
+}
+
+
+
+

KafkaStreamsCustomizer will be called by the StreamsBuilderFactoryBeabn right before the underlying KafkaStreams gets started.

+
+
+

There can only be one StreamsBuilderFactoryBeanCustomizer in the entire application. +Then how do we account for multiple Kafka Streams processors as each of them are backed up by individual StreamsBuilderFactoryBean objects? +In that case, if the customization needs to be different for those processors, then the application needs to apply some filter based on the application ID.

+
+
+

For e.g,

+
+
+
+
@Bean
+public StreamsBuilderFactoryBeanCustomizer streamsBuilderFactoryBeanCustomizer() {
+
+    return factoryBean -> {
+        if (factoryBean.getStreamsConfiguration().getProperty(StreamsConfig.APPLICATION_ID_CONFIG)
+                .equals("processor1-application-id")) {
+            factoryBean.setKafkaStreamsCustomizer(new KafkaStreamsCustomizer() {
+                @Override
+                public void customize(KafkaStreams kafkaStreams) {
+                    kafkaStreams.setUncaughtExceptionHandler((t, e) -> {
+
+                    });
+                }
+            });
+        }
+    };
+
+
+
+

Using Customizer to register a global state store

+
+

As mentioned above, the binder does not provide a first class way to register global state stores as a feature. +For that, you need to use the customizer. +Here is how that can be done.

+
+
+
+
@Bean
+public StreamsBuilderFactoryBeanCustomizer customizer() {
+    return fb -> {
+        try {
+            final StreamsBuilder streamsBuilder = fb.getObject();
+            streamsBuilder.addGlobalStore(...);
+        }
+        catch (Exception e) {
+
+        }
+    };
+}
+
+
+
+

Again, if you have multiple processors, you want to attach the global state store to the right StreamsBuilder by filtering out the other StreamsBuilderFactoryBean objects using the application id as outlined above.

+
+
+
+

Using customizer to register a production exception handler

+
+

In the error handling section, we indicated that the binder does not provide a first class way to deal with production exceptions. +Though that is the case, you can still use the StreamsBuilderFacotryBean customizer to register production exception handlers. See below.

+
+
+
+
@Bean
+public StreamsBuilderFactoryBeanCustomizer customizer() {
+    return fb -> {
+        fb.getStreamsConfiguration().put(StreamsConfig.DEFAULT_PRODUCTION_EXCEPTION_HANDLER_CLASS_CONFIG,
+                            CustomProductionExceptionHandler.class);
+    };
+}
+
+
+
+

Once again, if you have multiple processors, you may want to set it appropriately against the correct StreamsBuilderFactoryBean. +You may also add such production exception handlers using the configuration property (See below for more on that), but this is an option if you choose to go with a programmatic approach.

+
+
+
+
+

Timestamp extractor

+
+

Kafka Streams allows you to control the processing of the consumer records based on various notions of timestamp. +By default, Kafka Streams extracts the timestamp metadata embedded in the consumer record. +You can change this default behavior by providing a different TimestampExtractor implementation per input binding. +Here are some details on how that can be done.

+
+
+
+
@Bean
+public Function<KStream<Long, Order>,
+        Function<KTable<Long, Customer>,
+                Function<GlobalKTable<Long, Product>, KStream<Long, Order>>>> process() {
+    return orderStream ->
+            customers ->
+                products -> orderStream;
+}
+
+@Bean
+public TimestampExtractor timestampExtractor() {
+    return new WallclockTimestampExtractor();
+}
+
+
+
+

Then you set the above TimestampExtractor bean name per consumer binding.

+
+
+
+
spring.cloud.stream.kafka.streams.bindings.process-in-0.consumer.timestampExtractorBeanName=timestampExtractor
+spring.cloud.stream.kafka.streams.bindings.process-in-1.consumer.timestampExtractorBeanName=timestampExtractor
+spring.cloud.stream.kafka.streams.bindings.process-in-2.consumer.timestampExtractorBeanName=timestampExtractor"
+
+
+
+

If you skip an input consumer binding for setting a custom timestamp extractor, that consumer will use the default settings.

+
+
+
+

Multi binders with Kafka Streams based binders and regular Kafka Binder

+
+

You can have an application where you have both a function/consumer/supplier that is based on the regular Kafka binder and a Kafka Streams based processor. +However, you cannot mix both of them within a single function or consumer.

+
+
+

Here is an example, where you have both binder based components within the same application.

+
+
+
+
@Bean
+public Function<String, String> process() {
+    return s -> s;
+}
+
+@Bean
+public Function<KStream<Object, String>, KStream<?, WordCount>> kstreamProcess() {
+
+    return input -> input;
+}
+
+
+
+

This is the relevant parts from the configuration:

+
+
+
+
spring.cloud.stream.function.definition=process;kstreamProcess
+spring.cloud.stream.bindings.process-in-0.destination=foo
+spring.cloud.stream.bindings.process-out-0.destination=bar
+spring.cloud.stream.bindings.kstreamProcess-in-0.destination=bar
+spring.cloud.stream.bindings.kstreamProcess-out-0.destination=foobar
+
+
+
+

Things become a bit more complex if you have the same application as above, but is dealing with two different Kafka clusters, for e.g. the regular process is acting upon both Kafka cluster 1 and cluster 2 (receiving data from cluster-1 and sending to cluster-2) and the Kafka Streams processor is acting upon Kafka cluster 2. +Then you have to use the multi binder facilities provided by Spring Cloud Stream.

+
+
+

Here is how your configuration may change in that scenario.

+
+
+
+
# multi binder configuration
+spring.cloud.stream.binders.kafka1.type: kafka
+spring.cloud.stream.binders.kafka1.environment.spring.cloud.stream.kafka.streams.binder.brokers=${kafkaCluster-1} #Replace kafkaCluster-1 with the approprate IP of the cluster
+spring.cloud.stream.binders.kafka2.type: kafka
+spring.cloud.stream.binders.kafka2.environment.spring.cloud.stream.kafka.streams.binder.brokers=${kafkaCluster-2} #Replace kafkaCluster-2 with the approprate IP of the cluster
+spring.cloud.stream.binders.kafka3.type: kstream
+spring.cloud.stream.binders.kafka3.environment.spring.cloud.stream.kafka.streams.binder.brokers=${kafkaCluster-2} #Replace kafkaCluster-2 with the approprate IP of the cluster
+
+spring.cloud.stream.function.definition=process;kstreamProcess
+
+# From cluster 1 to cluster 2 with regular process function
+spring.cloud.stream.bindings.process-in-0.destination=foo
+spring.cloud.stream.bindings.process-in-0.binder=kafka1 # source from cluster 1
+spring.cloud.stream.bindings.process-out-0.destination=bar
+spring.cloud.stream.bindings.process-out-0.binder=kafka2 # send to cluster 2
+
+# Kafka Streams processor on cluster 2
+spring.cloud.stream.bindings.kstreamProcess-in-0.destination=bar
+spring.cloud.stream.bindings.kstreamProcess-in-0.binder=kafka3
+spring.cloud.stream.bindings.kstreamProcess-out-0.destination=foobar
+spring.cloud.stream.bindings.kstreamProcess-out-0.binder=kafka3
+
+
+
+

Pay attention to the above configuration. +We have two kinds of binders, but 3 binders all in all, first one is the regular Kafka binder based on cluster 1 (kafka1), then another Kafka binder based on cluster 2 (kafka2) and finally the kstream one (kafka3). +The first processor in the application receives data from kafka1 and publishes to kafka2 where both binders are based on regular Kafka binder but differnt clusters. +The second processor, which is a Kafka Streams processor consumes data from kafka3 which is the same cluster as kafka2, but a different binder type.

+
+
+

Since there are three different binder types available in the Kafka Streams family of binders - kstream, ktable and globalktable - if your application has multiple bindings based on any of these binders, that needs to be explicitly provided as the binder type.

+
+
+

For e.g if you have a processor as below,

+
+
+
+
@Bean
+public Function<KStream<Long, Order>,
+        Function<KTable<Long, Customer>,
+                Function<GlobalKTable<Long, Product>, KStream<Long, EnrichedOrder>>>> enrichOrder() {
+
+    ...
+}
+
+
+
+

then, this has to be configured in a multi binder scenario as the following. +Please note that this is only needed if you have a true multi-binder scenario where there are multiple processors dealing with multiple clusters within a single application. +In that case, the binders need to be explicitly provided with the bindings to distinguish from other processor’s binder types and clusters.

+
+
+
+
spring.cloud.stream.binders.kafka1.type: kstream
+spring.cloud.stream.binders.kafka1.environment.spring.cloud.stream.kafka.streams.binder.brokers=${kafkaCluster-2}
+spring.cloud.stream.binders.kafka2.type: ktable
+spring.cloud.stream.binders.kafka2.environment.spring.cloud.stream.kafka.streams.binder.brokers=${kafkaCluster-2}
+spring.cloud.stream.binders.kafka3.type: globalktable
+spring.cloud.stream.binders.kafka3.environment.spring.cloud.stream.kafka.streams.binder.brokers=${kafkaCluster-2}
+
+spring.cloud.stream.bindings.enrichOrder-in-0.binder=kafka1  #kstream
+spring.cloud.stream.bindings.enrichOrder-in-1.binder=kafka2  #ktablr
+spring.cloud.stream.bindings.enrichOrder-in-2.binder=kafka3  #globalktable
+spring.cloud.stream.bindings.enrichOrder-out-0.binder=kafka1 #kstream
+
+# rest of the configuration is omitted.
+
+
+
+
+

State Cleanup

+
+

By default, the Kafkastreams.cleanup() method is called when the binding is stopped. +See the Spring Kafka documentation. +To modify this behavior simply add a single CleanupConfig @Bean (configured to clean up on start, stop, or neither) to the application context; the bean will be detected and wired into the factory bean.

+
+
+
+

Configuration Options

+
+

This section contains the configuration options used by the Kafka Streams binder.

+
+
+

For common configuration options and properties pertaining to binder, refer to the core documentation.

+
+
+

Kafka Streams Binder Properties

+
+

The following properties are available at the binder level and must be prefixed with spring.cloud.stream.kafka.streams.binder.

+
+
+
+
configuration
+
+

Map with a key/value pair containing properties pertaining to Apache Kafka Streams API. + This property must be prefixed with spring.cloud.stream.kafka.streams.binder.. +Following are some examples of using this property.

+
+
+
+
+
+
spring.cloud.stream.kafka.streams.binder.configuration.default.key.serde=org.apache.kafka.common.serialization.Serdes$StringSerde
+spring.cloud.stream.kafka.streams.binder.configuration.default.value.serde=org.apache.kafka.common.serialization.Serdes$StringSerde
+spring.cloud.stream.kafka.streams.binder.configuration.commit.interval.ms=1000
+
+
+
+

For more information about all the properties that may go into streams configuration, see StreamsConfig JavaDocs in Apache Kafka Streams docs. +All configuration that you can set from StreamsConfig can be set through this. +When using this property, it is applicable against the entire application since this is a binder level property. +If you have more than processors in the application, all of them will acquire these properties. +In the case of properties like application.id, this will become problematic and therefore you have to carefully examine how the properties from StreamsConfig are mapped using this binder level configuration property.

+
+
+
+
functions.<function-bean-name>.applicationId
+
+

Applicable only for functional style processors. +This can be used for setting application ID per function in the application. +In the case of multiple functions, this is a handy way to set the application ID.

+
+
functions.<function-bean-name>.configuration
+
+

Applicable only for functional style processors. +Map with a key/value pair containing properties pertaining to Apache Kafka Streams API. +This is similar to the binder level configuration property describe above, but this level of configuration property is restricted only against the named function. +When you have multiple processors and you want to restrict access to the configuration based on particular functions, you might want to use this. +All StreamsConfig properties can be used here.

+
+
brokers
+
+

Broker URL

+
+

Default: localhost

+
+
+
zkNodes
+
+

Zookeeper URL

+
+

Default: localhost

+
+
+
deserializationExceptionHandler
+
+

Deserialization error handler type. +This handler is applied at the binder level and thus applied against all input binding in the application. +There is a way to control it in a more fine-grained way at the consumer binding level. +Possible values are - logAndContinue, logAndFail or sendToDlq

+
+

Default: logAndFail

+
+
+
applicationId
+
+

Convenient way to set the application.id for the Kafka Streams application globally at the binder level. +If the application contains multiple functions or StreamListener methods, then the application id should be set differently. +See above where setting the application id is discussed in detail.

+
+

Default: application will generate a static application ID. See the application ID section for more details.

+
+
+
stateStoreRetry.maxAttempts
+
+

Max attempts for trying to connect to a state store.

+
+

Default: 1

+
+
+
stateStoreRetry.backoffPeriod
+
+

Backoff period when trying to connect to a state store on a retry.

+
+

Default: 1000 ms

+
+
+
+
+
+
+

Kafka Streams Producer Properties

+
+

The following properties are only available for Kafka Streams producers and must be prefixed with spring.cloud.stream.kafka.streams.bindings.<binding name>.producer. +For convenience, if there are multiple output bindings and they all require a common value, that can be configured by using the prefix spring.cloud.stream.kafka.streams.default.producer..

+
+
+
+
keySerde
+
+

key serde to use

+
+

Default: See the above discussion on message de/serialization

+
+
+
valueSerde
+
+

value serde to use

+
+

Default: See the above discussion on message de/serialization

+
+
+
useNativeEncoding
+
+

flag to enable/disable native encoding

+
+

Default: true.

+
+
+
+
+
+

streamPartitionerBeanName: + Custom outbound partitioner bean name to be used at the consumer. + Applications can provide custom StreamPartitioner as a Spring bean and the name of this bean can be provided to the producer to use instead of the default one.

+
+
+

+ +Default: See the discussion above on outbound partition support.

+
+
+
+

Kafka Streams Consumer Properties

+
+

The following properties are available for Kafka Streams consumers and must be prefixed with spring.cloud.stream.kafka.streams.bindings.<binding-name>.consumer. +For convenience, if there are multiple input bindings and they all require a common value, that can be configured by using the prefix spring.cloud.stream.kafka.streams.default.consumer..

+
+
+
+
applicationId
+
+

Setting application.id per input binding. This is only preferred for StreamListener based processors, for function based processors see other approaches outlined above.

+
+

Default: See above.

+
+
+
keySerde
+
+

key serde to use

+
+

Default: See the above discussion on message de/serialization

+
+
+
valueSerde
+
+

value serde to use

+
+

Default: See the above discussion on message de/serialization

+
+
+
materializedAs
+
+

state store to materialize when using incoming KTable types

+
+

Default: none.

+
+
+
useNativeDecoding
+
+

flag to enable/disable native decoding

+
+

Default: true.

+
+
+
dlqName
+
+

DLQ topic name.

+
+

Default: See above on the discussion of error handling and DLQ.

+
+
+
startOffset
+
+

Offset to start from if there is no committed offset to consume from. +This is mostly used when the consumer is consuming from a topic for the first time. +Kafka Streams uses earliest as the default strategy and the binder uses the same default. +This can be overridden to latest using this property.

+
+

Default: earliest.

+
+
+
+
+
+

Note: Using resetOffsets on the consumer does not have any effect on Kafka Streams binder. +Unlike the message channel based binder, Kafka Streams binder does not seek to beginning or end on demand.

+
+
+
+
deserializationExceptionHandler
+
+

Deserialization error handler type. +This handler is applied per consumer binding as opposed to the binder level property described before. +Possible values are - logAndContinue, logAndFail or sendToDlq

+
+

Default: logAndFail

+
+
+
timestampExtractorBeanName
+
+

Specific time stamp extractor bean name to be used at the consumer. +Applications can provide TimestampExtractor as a Spring bean and the name of this bean can be provided to the consumer to use instead of the default one.

+
+

Default: See the discussion above on timestamp extractors.

+
+
+
+
+
+
+

Special note on concurrency

+
+

In Kafka Streams, you can control of the number of threads a processor can create using the num.stream.threads property. +This, you can do using the various configuration options described above under binder, functions, producer or consumer level. +You can also use the concurrency property that core Spring Cloud Stream provides for this purpose. +When using this, you need to use it on the consumer. +When you have more than one input bindings either in a function or StreamListener, set this on the first input binding. +For e.g. when setting spring.cloud.stream.bindings.process-in-0.consumer.concurrency, it will be translated as num.stream.threads by the binder.

+
+
+
+
+
+
+ + + + + + + \ No newline at end of file diff --git a/spring-cloud-stream-binder-kafka/3.0.0.RELEASE/reference/html/overview.html b/spring-cloud-stream-binder-kafka/3.0.0.RELEASE/reference/html/overview.html new file mode 100644 index 00000000..2943ce63 --- /dev/null +++ b/spring-cloud-stream-binder-kafka/3.0.0.RELEASE/reference/html/overview.html @@ -0,0 +1,1131 @@ + + + + + + + +Apache Kafka Binder + + + + + + + + + + +
+
+
+ +
+
+
+

Apache Kafka Binder

+
+
+

Usage

+
+

To use Apache Kafka binder, you need to add spring-cloud-stream-binder-kafka as a dependency to your Spring Cloud Stream application, as shown in the following example for Maven:

+
+
+
+
<dependency>
+  <groupId>org.springframework.cloud</groupId>
+  <artifactId>spring-cloud-stream-binder-kafka</artifactId>
+</dependency>
+
+
+
+

Alternatively, you can also use the Spring Cloud Stream Kafka Starter, as shown in the following example for Maven:

+
+
+
+
<dependency>
+  <groupId>org.springframework.cloud</groupId>
+  <artifactId>spring-cloud-starter-stream-kafka</artifactId>
+</dependency>
+
+
+
+
+

Overview

+
+

The following image shows a simplified diagram of how the Apache Kafka binder operates:

+
+
+
+kafka binder +
+
Figure 1. Kafka Binder
+
+
+

The Apache Kafka Binder implementation maps each destination to an Apache Kafka topic. +The consumer group maps directly to the same Apache Kafka concept. +Partitioning also maps directly to Apache Kafka partitions as well.

+
+
+

The binder currently uses the Apache Kafka kafka-clients version 2.3.1. +This client can communicate with older brokers (see the Kafka documentation), but certain features may not be available. +For example, with versions earlier than 0.11.x.x, native headers are not supported. +Also, 0.11.x.x does not support the autoAddPartitions property.

+
+
+
+

Configuration Options

+
+

This section contains the configuration options used by the Apache Kafka binder.

+
+
+

For common configuration options and properties pertaining to binder, see the core documentation.

+
+
+

Kafka Binder Properties

+
+
+
spring.cloud.stream.kafka.binder.brokers
+
+

A list of brokers to which the Kafka binder connects.

+
+

Default: localhost.

+
+
+
spring.cloud.stream.kafka.binder.defaultBrokerPort
+
+

brokers allows hosts specified with or without port information (for example, host1,host2:port2). +This sets the default port when no port is configured in the broker list.

+
+

Default: 9092.

+
+
+
spring.cloud.stream.kafka.binder.configuration
+
+

Key/Value map of client properties (both producers and consumer) passed to all clients created by the binder. +Due to the fact that these properties are used by both producers and consumers, usage should be restricted to common properties — for example, security settings. +Unknown Kafka producer or consumer properties provided through this configuration are filtered out and not allowed to propagate. +Properties here supersede any properties set in boot.

+
+

Default: Empty map.

+
+
+
spring.cloud.stream.kafka.binder.consumerProperties
+
+

Key/Value map of arbitrary Kafka client consumer properties. +In addition to support known Kafka consumer properties, unknown consumer properties are allowed here as well. +Properties here supersede any properties set in boot and in the configuration property above.

+
+

Default: Empty map.

+
+
+
spring.cloud.stream.kafka.binder.headers
+
+

The list of custom headers that are transported by the binder. +Only required when communicating with older applications (⇐ 1.3.x) with a kafka-clients version < 0.11.0.0. Newer versions support headers natively.

+
+

Default: empty.

+
+
+
spring.cloud.stream.kafka.binder.healthTimeout
+
+

The time to wait to get partition information, in seconds. +Health reports as down if this timer expires.

+
+

Default: 10.

+
+
+
spring.cloud.stream.kafka.binder.requiredAcks
+
+

The number of required acks on the broker. +See the Kafka documentation for the producer acks property.

+
+

Default: 1.

+
+
+
spring.cloud.stream.kafka.binder.minPartitionCount
+
+

Effective only if autoCreateTopics or autoAddPartitions is set. +The global minimum number of partitions that the binder configures on topics on which it produces or consumes data. +It can be superseded by the partitionCount setting of the producer or by the value of instanceCount * concurrency settings of the producer (if either is larger).

+
+

Default: 1.

+
+
+
spring.cloud.stream.kafka.binder.producerProperties
+
+

Key/Value map of arbitrary Kafka client producer properties. +In addition to support known Kafka producer properties, unknown producer properties are allowed here as well. +Properties here supersede any properties set in boot and in the configuration property above.

+
+

Default: Empty map.

+
+
+
spring.cloud.stream.kafka.binder.replicationFactor
+
+

The replication factor of auto-created topics if autoCreateTopics is active. +Can be overridden on each binding.

+
+

Default: 1.

+
+
+
spring.cloud.stream.kafka.binder.autoCreateTopics
+
+

If set to true, the binder creates new topics automatically. +If set to false, the binder relies on the topics being already configured. +In the latter case, if the topics do not exist, the binder fails to start.

+
+ + + + + +
+ + +This setting is independent of the auto.create.topics.enable setting of the broker and does not influence it. +If the server is set to auto-create topics, they may be created as part of the metadata retrieval request, with default broker settings. +
+
+
+

Default: true.

+
+
+
spring.cloud.stream.kafka.binder.autoAddPartitions
+
+

If set to true, the binder creates new partitions if required. +If set to false, the binder relies on the partition size of the topic being already configured. +If the partition count of the target topic is smaller than the expected value, the binder fails to start.

+
+

Default: false.

+
+
+
spring.cloud.stream.kafka.binder.transaction.transactionIdPrefix
+
+

Enables transactions in the binder. See transaction.id in the Kafka documentation and Transactions in the spring-kafka documentation. +When transactions are enabled, individual producer properties are ignored and all producers use the spring.cloud.stream.kafka.binder.transaction.producer.* properties.

+
+

Default null (no transactions)

+
+
+
spring.cloud.stream.kafka.binder.transaction.producer.*
+
+

Global producer properties for producers in a transactional binder. +See spring.cloud.stream.kafka.binder.transaction.transactionIdPrefix and Kafka Producer Properties and the general producer properties supported by all binders.

+
+

Default: See individual producer properties.

+
+
+
spring.cloud.stream.kafka.binder.headerMapperBeanName
+
+

The bean name of a KafkaHeaderMapper used for mapping spring-messaging headers to and from Kafka headers. +Use this, for example, if you wish to customize the trusted packages in a BinderHeaderMapper bean that uses JSON deserialization for the headers. +If this custom BinderHeaderMapper bean is not made available to the binder using this property, then the binder will look for a header mapper bean with the name kafkaBinderHeaderMapper that is of type BinderHeaderMapper before falling back to a default BinderHeaderMapper created by the binder.

+
+

Default: none.

+
+
+
+
+
+
+

Kafka Consumer Properties

+
+ + + + + +
+ + +To avoid repetition, Spring Cloud Stream supports setting values for all channels, in the format of spring.cloud.stream.kafka.default.consumer.<property>=<value>. +
+
+
+

The following properties are available for Kafka consumers only and +must be prefixed with spring.cloud.stream.kafka.bindings.<channelName>.consumer..

+
+
+
+
admin.configuration
+
+

Since version 2.1.1, this property is deprecated in favor of topic.properties, and support for it will be removed in a future version.

+
+
admin.replicas-assignment
+
+

Since version 2.1.1, this property is deprecated in favor of topic.replicas-assignment, and support for it will be removed in a future version.

+
+
admin.replication-factor
+
+

Since version 2.1.1, this property is deprecated in favor of topic.replication-factor, and support for it will be removed in a future version.

+
+
autoRebalanceEnabled
+
+

When true, topic partitions is automatically rebalanced between the members of a consumer group. +When false, each consumer is assigned a fixed set of partitions based on spring.cloud.stream.instanceCount and spring.cloud.stream.instanceIndex. +This requires both the spring.cloud.stream.instanceCount and spring.cloud.stream.instanceIndex properties to be set appropriately on each launched instance. +The value of the spring.cloud.stream.instanceCount property must typically be greater than 1 in this case.

+
+

Default: true.

+
+
+
ackEachRecord
+
+

When autoCommitOffset is true, this setting dictates whether to commit the offset after each record is processed. +By default, offsets are committed after all records in the batch of records returned by consumer.poll() have been processed. +The number of records returned by a poll can be controlled with the max.poll.records Kafka property, which is set through the consumer configuration property. +Setting this to true may cause a degradation in performance, but doing so reduces the likelihood of redelivered records when a failure occurs. +Also, see the binder requiredAcks property, which also affects the performance of committing offsets.

+
+

Default: false.

+
+
+
autoCommitOffset
+
+

Whether to autocommit offsets when a message has been processed. +If set to false, a header with the key kafka_acknowledgment of the type org.springframework.kafka.support.Acknowledgment header is present in the inbound message. +Applications may use this header for acknowledging messages. +See the examples section for details. +When this property is set to false, Kafka binder sets the ack mode to org.springframework.kafka.listener.AbstractMessageListenerContainer.AckMode.MANUAL and the application is responsible for acknowledging records. +Also see ackEachRecord.

+
+

Default: true.

+
+
+
autoCommitOnError
+
+

Effective only if autoCommitOffset is set to true. +If set to false, it suppresses auto-commits for messages that result in errors and commits only for successful messages. It allows a stream to automatically replay from the last successfully processed message, in case of persistent failures. +If set to true, it always auto-commits (if auto-commit is enabled). +If not set (the default), it effectively has the same value as enableDlq, auto-committing erroneous messages if they are sent to a DLQ and not committing them otherwise.

+
+

Default: not set.

+
+
+
resetOffsets
+
+

Whether to reset offsets on the consumer to the value provided by startOffset. +Must be false if a KafkaRebalanceListener is provided; see Using a KafkaRebalanceListener.

+
+

Default: false.

+
+
+
startOffset
+
+

The starting offset for new groups. +Allowed values: earliest and latest. +If the consumer group is set explicitly for the consumer 'binding' (through spring.cloud.stream.bindings.<channelName>.group), 'startOffset' is set to earliest. Otherwise, it is set to latest for the anonymous consumer group. +Also see resetOffsets (earlier in this list).

+
+

Default: null (equivalent to earliest).

+
+
+
enableDlq
+
+

When set to true, it enables DLQ behavior for the consumer. +By default, messages that result in errors are forwarded to a topic named error.<destination>.<group>. +The DLQ topic name can be configurable by setting the dlqName property. +This provides an alternative option to the more common Kafka replay scenario for the case when the number of errors is relatively small and replaying the entire original topic may be too cumbersome. +See [kafka-dlq-processing] processing for more information. +Starting with version 2.0, messages sent to the DLQ topic are enhanced with the following headers: x-original-topic, x-exception-message, and x-exception-stacktrace as byte[]. +By default, a failed record is sent to the same partition number in the DLQ topic as the original record. +See [dlq-partition-selection] for how to change that behavior. +Not allowed when destinationIsPattern is true.

+
+

Default: false.

+
+
+
dlqPartitions
+
+

When enableDlq is true, and this property is not set, a dead letter topic with the same number of partitions as the primary topic(s) is created. +Usually, dead-letter records are sent to the same partition in the dead-letter topic as the original record. +This behavior can be changed; see [dlq-partition-selection]. +If this property is set to 1 and there is no DqlPartitionFunction bean, all dead-letter records will be written to partition 0. +If this property is greater than 1, you MUST provide a DlqPartitionFunction bean. +Note that the actual partition count is affected by the binder’s minPartitionCount property.

+
+

Default: none

+
+
+
configuration
+
+

Map with a key/value pair containing generic Kafka consumer properties. +In addition to having Kafka consumer properties, other configuration properties can be passed here. +For example some properties needed by the application such as spring.cloud.stream.kafka.bindings.input.consumer.configuration.foo=bar.

+
+

Default: Empty map.

+
+
+
dlqName
+
+

The name of the DLQ topic to receive the error messages.

+
+

Default: null (If not specified, messages that result in errors are forwarded to a topic named error.<destination>.<group>).

+
+
+
dlqProducerProperties
+
+

Using this, DLQ-specific producer properties can be set. +All the properties available through kafka producer properties can be set through this property. +When native decoding is enabled on the consumer (i.e., useNativeDecoding: true) , the application must provide corresponding key/value serializers for DLQ. +This must be provided in the form of dlqProducerProperties.configuration.key.serializer and dlqProducerProperties.configuration.value.serializer.

+
+

Default: Default Kafka producer properties.

+
+
+
standardHeaders
+
+

Indicates which standard headers are populated by the inbound channel adapter. +Allowed values: none, id, timestamp, or both. +Useful if using native deserialization and the first component to receive a message needs an id (such as an aggregator that is configured to use a JDBC message store).

+
+

Default: none

+
+
+
converterBeanName
+
+

The name of a bean that implements RecordMessageConverter. Used in the inbound channel adapter to replace the default MessagingMessageConverter.

+
+

Default: null

+
+
+
idleEventInterval
+
+

The interval, in milliseconds, between events indicating that no messages have recently been received. +Use an ApplicationListener<ListenerContainerIdleEvent> to receive these events. +See Example: Pausing and Resuming the Consumer for a usage example.

+
+

Default: 30000

+
+
+
destinationIsPattern
+
+

When true, the destination is treated as a regular expression Pattern used to match topic names by the broker. +When true, topics are not provisioned, and enableDlq is not allowed, because the binder does not know the topic names during the provisioning phase. +Note, the time taken to detect new topics that match the pattern is controlled by the consumer property metadata.max.age.ms, which (at the time of writing) defaults to 300,000ms (5 minutes). +This can be configured using the configuration property above.

+
+

Default: false

+
+
+
topic.properties
+
+

A Map of Kafka topic properties used when provisioning new topics — for example, spring.cloud.stream.kafka.bindings.input.consumer.topic.properties.message.format.version=0.9.0.0

+
+

Default: none.

+
+
+
topic.replicas-assignment
+
+

A Map<Integer, List<Integer>> of replica assignments, with the key being the partition and the value being the assignments. +Used when provisioning new topics. +See the NewTopic Javadocs in the kafka-clients jar.

+
+

Default: none.

+
+
+
topic.replication-factor
+
+

The replication factor to use when provisioning topics. Overrides the binder-wide setting. +Ignored if replicas-assignments is present.

+
+

Default: none (the binder-wide default of 1 is used).

+
+
+
pollTimeout
+
+

Timeout used for polling in pollable consumers.

+
+

Default: 5 seconds.

+
+
+
+
+
+
+

Consuming Batches

+
+

Starting with version 3.0, when spring.cloud.stream.binding.<name>.consumer.batch-mode is set to true, all of the records received by polling the Kafka Consumer will be presented as a List<?> to the listener method. +Otherwise, the method will be called with one record at a time. +The size of the batch is controlled by Kafka consumer properties max.poll.records, min.fetch.bytes, fetch.max.wait.ms; refer to the Kafka documentation for more information.

+
+
+ + + + + +
+ + +Retry within the binder is not supported when using batch mode, so maxAttempts will be overridden to 1. +You can configure a SeekToCurrentBatchErrorHandler (using a ListenerContainerCustomizer) to achieve similar functionality to retry in the binder. +You can also use a manual AckMode and call Ackowledgment.nack(index, sleep) to commit the offsets for a partial batch and have the remaining records redelivered. +Refer to the Spring for Apache Kafka documentation for more information about these techniques. +
+
+
+
+

Kafka Producer Properties

+
+ + + + + +
+ + +To avoid repetition, Spring Cloud Stream supports setting values for all channels, in the format of spring.cloud.stream.kafka.default.producer.<property>=<value>. +
+
+
+

The following properties are available for Kafka producers only and +must be prefixed with spring.cloud.stream.kafka.bindings.<channelName>.producer..

+
+
+
+
admin.configuration
+
+

Since version 2.1.1, this property is deprecated in favor of topic.properties, and support for it will be removed in a future version.

+
+
admin.replicas-assignment
+
+

Since version 2.1.1, this property is deprecated in favor of topic.replicas-assignment, and support for it will be removed in a future version.

+
+
admin.replication-factor
+
+

Since version 2.1.1, this property is deprecated in favor of topic.replication-factor, and support for it will be removed in a future version.

+
+
bufferSize
+
+

Upper limit, in bytes, of how much data the Kafka producer attempts to batch before sending.

+
+

Default: 16384.

+
+
+
sync
+
+

Whether the producer is synchronous.

+
+

Default: false.

+
+
+
sendTimeoutExpression
+
+

A SpEL expression evaluated against the outgoing message used to evaluate the time to wait for ack when synchronous publish is enabled — for example, headers['mySendTimeout']. +The value of the timeout is in milliseconds. +With versions before 3.0, the payload could not be used unless native encoding was being used because, by the time this expression was evaluated, the payload was already in the form of a byte[]. +Now, the expression is evaluated before the payload is converted.

+
+

Default: none.

+
+
+
batchTimeout
+
+

How long the producer waits to allow more messages to accumulate in the same batch before sending the messages. +(Normally, the producer does not wait at all and simply sends all the messages that accumulated while the previous send was in progress.) A non-zero value may increase throughput at the expense of latency.

+
+

Default: 0.

+
+
+
messageKeyExpression
+
+

A SpEL expression evaluated against the outgoing message used to populate the key of the produced Kafka message — for example, headers['myKey']. +With versions before 3.0, the payload could not be used unless native encoding was being used because, by the time this expression was evaluated, the payload was already in the form of a byte[]. +Now, the expression is evaluated before the payload is converted.

+
+

Default: none.

+
+
+
headerPatterns
+
+

A comma-delimited list of simple patterns to match Spring messaging headers to be mapped to the Kafka Headers in the ProducerRecord. +Patterns can begin or end with the wildcard character (asterisk). +Patterns can be negated by prefixing with !. +Matching stops after the first match (positive or negative). +For example !ask,as* will pass ash but not ask. +id and timestamp are never mapped.

+
+

Default: * (all headers - except the id and timestamp)

+
+
+
configuration
+
+

Map with a key/value pair containing generic Kafka producer properties.

+
+

Default: Empty map.

+
+
+
topic.properties
+
+

A Map of Kafka topic properties used when provisioning new topics — for example, spring.cloud.stream.kafka.bindings.output.producer.topic.properties.message.format.version=0.9.0.0

+
+
topic.replicas-assignment
+
+

A Map<Integer, List<Integer>> of replica assignments, with the key being the partition and the value being the assignments. +Used when provisioning new topics. +See the NewTopic Javadocs in the kafka-clients jar.

+
+

Default: none.

+
+
+
topic.replication-factor
+
+

The replication factor to use when provisioning topics. Overrides the binder-wide setting. +Ignored if replicas-assignments is present.

+
+

Default: none (the binder-wide default of 1 is used).

+
+
+
useTopicHeader
+
+

Set to true to override the default binding destination (topic name) with the value of the KafkaHeaders.TOPIC message header in the outbound message. +If the header is not present, the default binding destination is used. +Default: false.

+
+
recordMetadataChannel
+
+

The bean name of a MessageChannel to which successful send results should be sent; the bean must exist in the application context. +The message sent to the channel is the sent message (after conversion, if any) with an additional header KafkaHeaders.RECORD_METADATA. +The header contains a RecordMetadata object provided by the Kafka client; it includes the partition and offset where the record was written in the topic.

+
+
+
+
+

ResultMetadata meta = sendResultMsg.getHeaders().get(KafkaHeaders.RECORD_METADATA, RecordMetadata.class)

+
+
+

Failed sends go the producer error channel (if configured); see Error Channels. +Default: null

+
+
+

+

+
+
+ + + + + +
+ + +The Kafka binder uses the partitionCount setting of the producer as a hint to create a topic with the given partition count (in conjunction with the minPartitionCount, the maximum of the two being the value being used). +Exercise caution when configuring both minPartitionCount for a binder and partitionCount for an application, as the larger value is used. +If a topic already exists with a smaller partition count and autoAddPartitions is disabled (the default), the binder fails to start. +If a topic already exists with a smaller partition count and autoAddPartitions is enabled, new partitions are added. +If a topic already exists with a larger number of partitions than the maximum of (minPartitionCount or partitionCount), the existing partition count is used. +
+
+
+
+
compression
+
+

Set the compression.type producer property. +Supported values are none, gzip, snappy and lz4. +If you override the kafka-clients jar to 2.1.0 (or later), as discussed in the Spring for Apache Kafka documentation, and wish to use zstd compression, use spring.cloud.stream.kafka.bindings.<binding-name>.producer.configuration.compression.type=zstd.

+
+

Default: none.

+
+
+
+
+
+
+

Usage examples

+
+

In this section, we show the use of the preceding properties for specific scenarios.

+
+
+
Example: Setting autoCommitOffset to false and Relying on Manual Acking
+
+

This example illustrates how one may manually acknowledge offsets in a consumer application.

+
+
+

This example requires that spring.cloud.stream.kafka.bindings.input.consumer.autoCommitOffset be set to false. +Use the corresponding input channel name for your example.

+
+
+
+
@SpringBootApplication
+@EnableBinding(Sink.class)
+public class ManuallyAcknowdledgingConsumer {
+
+ public static void main(String[] args) {
+     SpringApplication.run(ManuallyAcknowdledgingConsumer.class, args);
+ }
+
+ @StreamListener(Sink.INPUT)
+ public void process(Message<?> message) {
+     Acknowledgment acknowledgment = message.getHeaders().get(KafkaHeaders.ACKNOWLEDGMENT, Acknowledgment.class);
+     if (acknowledgment != null) {
+         System.out.println("Acknowledgment provided");
+         acknowledgment.acknowledge();
+     }
+ }
+}
+
+
+
+
+
Example: Security Configuration
+
+

Apache Kafka 0.9 supports secure connections between client and brokers. +To take advantage of this feature, follow the guidelines in the Apache Kafka Documentation as well as the Kafka 0.9 security guidelines from the Confluent documentation. +Use the spring.cloud.stream.kafka.binder.configuration option to set security properties for all clients created by the binder.

+
+
+

For example, to set security.protocol to SASL_SSL, set the following property:

+
+
+
+
spring.cloud.stream.kafka.binder.configuration.security.protocol=SASL_SSL
+
+
+
+

All the other security properties can be set in a similar manner.

+
+
+

When using Kerberos, follow the instructions in the reference documentation for creating and referencing the JAAS configuration.

+
+
+

Spring Cloud Stream supports passing JAAS configuration information to the application by using a JAAS configuration file and using Spring Boot properties.

+
+
+
Using JAAS Configuration Files
+
+

The JAAS and (optionally) krb5 file locations can be set for Spring Cloud Stream applications by using system properties. +The following example shows how to launch a Spring Cloud Stream application with SASL and Kerberos by using a JAAS configuration file:

+
+
+
+
 java -Djava.security.auth.login.config=/path.to/kafka_client_jaas.conf -jar log.jar \
+   --spring.cloud.stream.kafka.binder.brokers=secure.server:9092 \
+   --spring.cloud.stream.bindings.input.destination=stream.ticktock \
+   --spring.cloud.stream.kafka.binder.configuration.security.protocol=SASL_PLAINTEXT
+
+
+
+
+
Using Spring Boot Properties
+
+

As an alternative to having a JAAS configuration file, Spring Cloud Stream provides a mechanism for setting up the JAAS configuration for Spring Cloud Stream applications by using Spring Boot properties.

+
+
+

The following properties can be used to configure the login context of the Kafka client:

+
+
+
+
spring.cloud.stream.kafka.binder.jaas.loginModule
+
+

The login module name. Not necessary to be set in normal cases.

+
+

Default: com.sun.security.auth.module.Krb5LoginModule.

+
+
+
spring.cloud.stream.kafka.binder.jaas.controlFlag
+
+

The control flag of the login module.

+
+

Default: required.

+
+
+
spring.cloud.stream.kafka.binder.jaas.options
+
+

Map with a key/value pair containing the login module options.

+
+

Default: Empty map.

+
+
+
+
+
+

The following example shows how to launch a Spring Cloud Stream application with SASL and Kerberos by using Spring Boot configuration properties:

+
+
+
+
 java --spring.cloud.stream.kafka.binder.brokers=secure.server:9092 \
+   --spring.cloud.stream.bindings.input.destination=stream.ticktock \
+   --spring.cloud.stream.kafka.binder.autoCreateTopics=false \
+   --spring.cloud.stream.kafka.binder.configuration.security.protocol=SASL_PLAINTEXT \
+   --spring.cloud.stream.kafka.binder.jaas.options.useKeyTab=true \
+   --spring.cloud.stream.kafka.binder.jaas.options.storeKey=true \
+   --spring.cloud.stream.kafka.binder.jaas.options.keyTab=/etc/security/keytabs/kafka_client.keytab \
+   --spring.cloud.stream.kafka.binder.jaas.options.principal=kafka-client-1@EXAMPLE.COM
+
+
+
+

The preceding example represents the equivalent of the following JAAS file:

+
+
+
+
KafkaClient {
+    com.sun.security.auth.module.Krb5LoginModule required
+    useKeyTab=true
+    storeKey=true
+    keyTab="/etc/security/keytabs/kafka_client.keytab"
+    principal="kafka-client-1@EXAMPLE.COM";
+};
+
+
+
+

If the topics required already exist on the broker or will be created by an administrator, autocreation can be turned off and only client JAAS properties need to be sent.

+
+
+ + + + + +
+ + +Do not mix JAAS configuration files and Spring Boot properties in the same application. +If the -Djava.security.auth.login.config system property is already present, Spring Cloud Stream ignores the Spring Boot properties. +
+
+
+ + + + + +
+ + +Be careful when using the autoCreateTopics and autoAddPartitions with Kerberos. +Usually, applications may use principals that do not have administrative rights in Kafka and Zookeeper. +Consequently, relying on Spring Cloud Stream to create/modify topics may fail. +In secure environments, we strongly recommend creating topics and managing ACLs administratively by using Kafka tooling. +
+
+
+
+
+
Example: Pausing and Resuming the Consumer
+
+

If you wish to suspend consumption but not cause a partition rebalance, you can pause and resume the consumer. +This is facilitated by adding the Consumer as a parameter to your @StreamListener. +To resume, you need an ApplicationListener for ListenerContainerIdleEvent instances. +The frequency at which events are published is controlled by the idleEventInterval property. +Since the consumer is not thread-safe, you must call these methods on the calling thread.

+
+
+

The following simple application shows how to pause and resume:

+
+
+
+
@SpringBootApplication
+@EnableBinding(Sink.class)
+public class Application {
+
+	public static void main(String[] args) {
+		SpringApplication.run(Application.class, args);
+	}
+
+	@StreamListener(Sink.INPUT)
+	public void in(String in, @Header(KafkaHeaders.CONSUMER) Consumer<?, ?> consumer) {
+		System.out.println(in);
+		consumer.pause(Collections.singleton(new TopicPartition("myTopic", 0)));
+	}
+
+	@Bean
+	public ApplicationListener<ListenerContainerIdleEvent> idleListener() {
+		return event -> {
+			System.out.println(event);
+			if (event.getConsumer().paused().size() > 0) {
+				event.getConsumer().resume(event.getConsumer().paused());
+			}
+		};
+	}
+
+}
+
+
+
+
+
+
+

Transactional Binder

+
+

Enable transactions by setting spring.cloud.stream.kafka.binder.transaction.transactionIdPrefix to a non-empty value, e.g. tx-. +When used in a processor application, the consumer starts the transaction; any records sent on the consumer thread participate in the same transaction. +When the listener exits normally, the listener container will send the offset to the transaction and commit it. +A common producer factory is used for all producer bindings configured using spring.cloud.stream.kafka.binder.transaction.producer.* properties; individual binding Kafka producer properties are ignored.

+
+
+ + + + + +
+ + +Normal binder retries (and dead lettering) are not supported with transactions because the retries will run in the original transaction, which may be rolled back and any published records will be rolled back too. +When retries are enabled (the common property maxAttempts is greater than zero) the retry properties are used to configure a DefaultAfterRollbackProcessor to enable retries at the container level. +Similarly, instead of publishing dead-letter records within the transaction, this functionality is moved to the listener container, again via the DefaultAfterRollbackProcessor which runs after the main transaction has rolled back. +
+
+
+

If you wish to use transactions in a source application, or from some arbitrary thread for producer-only transaction (e.g. @Scheduled method), you must get a reference to the transactional producer factory and define a KafkaTransactionManager bean using it.

+
+
+
+
+
+
@Bean
+public PlatformTransactionManager transactionManager(BinderFactory binders) {
+    ProducerFactory<byte[], byte[]> pf = ((KafkaMessageChannelBinder) binders.getBinder(null,
+            MessageChannel.class)).getTransactionalProducerFactory();
+    return new KafkaTransactionManager<>(pf);
+}
+
+
+
+
+
+

Notice that we get a reference to the binder using the BinderFactory; use null in the first argument when there is only one binder configured. +If more than one binder is configured, use the binder name to get the reference. +Once we have a reference to the binder, we can obtain a reference to the ProducerFactory and create a transaction manager.

+
+
+

Then you would use normal Spring transaction support, e.g. TransactionTemplate or @Transactional, for example:

+
+
+
+
+
+
public static class Sender {
+
+    @Transactional
+    public void doInTransaction(MessageChannel output, List<String> stuffToSend) {
+        stuffToSend.forEach(stuff -> output.send(new GenericMessage<>(stuff)));
+    }
+
+}
+
+
+
+
+
+

If you wish to synchronize producer-only transactions with those from some other transaction manager, use a ChainedTransactionManager.

+
+
+
+

Error Channels

+
+

Starting with version 1.3, the binder unconditionally sends exceptions to an error channel for each consumer destination and can also be configured to send async producer send failures to an error channel. +See [spring-cloud-stream-overview-error-handling] for more information.

+
+
+

The payload of the ErrorMessage for a send failure is a KafkaSendFailureException with properties:

+
+
+
    +
  • +

    failedMessage: The Spring Messaging Message<?> that failed to be sent.

    +
  • +
  • +

    record: The raw ProducerRecord that was created from the failedMessage

    +
  • +
+
+
+

There is no automatic handling of producer exceptions (such as sending to a Dead-Letter queue). +You can consume these exceptions with your own Spring Integration flow.

+
+
+
+

Kafka Metrics

+
+

Kafka binder module exposes the following metrics:

+
+
+

spring.cloud.stream.binder.kafka.offset: This metric indicates how many messages have not been yet consumed from a given binder’s topic by a given consumer group. +The metrics provided are based on the Mircometer metrics library. The metric contains the consumer group information, topic and the actual lag in committed offset from the latest offset on the topic. +This metric is particularly useful for providing auto-scaling feedback to a PaaS platform.

+
+
+
+

Tombstone Records (null record values)

+
+

When using compacted topics, a record with a null value (also called a tombstone record) represents the deletion of a key. +To receive such messages in a @StreamListener method, the parameter must be marked as not required to receive a null value argument.

+
+
+
+
+
+
@StreamListener(Sink.INPUT)
+public void in(@Header(KafkaHeaders.RECEIVED_MESSAGE_KEY) byte[] key,
+               @Payload(required = false) Customer customer) {
+    // customer is null if a tombstone record
+    ...
+}
+
+
+
+
+
+
+

Using a KafkaRebalanceListener

+
+

Applications may wish to seek topics/partitions to arbitrary offsets when the partitions are initially assigned, or perform other operations on the consumer. +Starting with version 2.1, if you provide a single KafkaRebalanceListener bean in the application context, it will be wired into all Kafka consumer bindings.

+
+
+
+
+
+
public interface KafkaBindingRebalanceListener {
+
+	/**
+	 * Invoked by the container before any pending offsets are committed.
+	 * @param bindingName the name of the binding.
+	 * @param consumer the consumer.
+	 * @param partitions the partitions.
+	 */
+	default void onPartitionsRevokedBeforeCommit(String bindingName, Consumer<?, ?> consumer,
+			Collection<TopicPartition> partitions) {
+
+	}
+
+	/**
+	 * Invoked by the container after any pending offsets are committed.
+	 * @param bindingName the name of the binding.
+	 * @param consumer the consumer.
+	 * @param partitions the partitions.
+	 */
+	default void onPartitionsRevokedAfterCommit(String bindingName, Consumer<?, ?> consumer, Collection<TopicPartition> partitions) {
+
+	}
+
+	/**
+	 * Invoked when partitions are initially assigned or after a rebalance.
+	 * Applications might only want to perform seek operations on an initial assignment.
+	 * @param bindingName the name of the binding.
+	 * @param consumer the consumer.
+	 * @param partitions the partitions.
+	 * @param initial true if this is the initial assignment.
+	 */
+	default void onPartitionsAssigned(String bindingName, Consumer<?, ?> consumer, Collection<TopicPartition> partitions,
+			boolean initial) {
+
+	}
+
+}
+
+
+
+
+
+

You cannot set the resetOffsets consumer property to true when you provide a rebalance listener.

+
+
+
+
+
+ + + + + + + \ No newline at end of file diff --git a/spring-cloud-stream-binder-kafka/3.0.0.RELEASE/reference/html/partitions.html b/spring-cloud-stream-binder-kafka/3.0.0.RELEASE/reference/html/partitions.html new file mode 100644 index 00000000..adc49245 --- /dev/null +++ b/spring-cloud-stream-binder-kafka/3.0.0.RELEASE/reference/html/partitions.html @@ -0,0 +1,241 @@ + + + + + + + +Partitioning with the Kafka Binder + + + + + + + + + + +
+
+

Partitioning with the Kafka Binder

+
+

Apache Kafka supports topic partitioning natively.

+
+
+

Sometimes it is advantageous to send data to specific partitions — for example, when you want to strictly order message processing (all messages for a particular customer should go to the same partition).

+
+
+

The following example shows how to configure the producer and consumer side:

+
+
+
+
@SpringBootApplication
+@EnableBinding(Source.class)
+public class KafkaPartitionProducerApplication {
+
+    private static final Random RANDOM = new Random(System.currentTimeMillis());
+
+    private static final String[] data = new String[] {
+            "foo1", "bar1", "qux1",
+            "foo2", "bar2", "qux2",
+            "foo3", "bar3", "qux3",
+            "foo4", "bar4", "qux4",
+            };
+
+    public static void main(String[] args) {
+        new SpringApplicationBuilder(KafkaPartitionProducerApplication.class)
+            .web(false)
+            .run(args);
+    }
+
+    @InboundChannelAdapter(channel = Source.OUTPUT, poller = @Poller(fixedRate = "5000"))
+    public Message<?> generate() {
+        String value = data[RANDOM.nextInt(data.length)];
+        System.out.println("Sending: " + value);
+        return MessageBuilder.withPayload(value)
+                .setHeader("partitionKey", value)
+                .build();
+    }
+
+}
+
+
+
+
application.yml
+
+
spring:
+  cloud:
+    stream:
+      bindings:
+        output:
+          destination: partitioned.topic
+          producer:
+            partition-key-expression: headers['partitionKey']
+            partition-count: 12
+
+
+
+ + + + + +
+ + +The topic must be provisioned to have enough partitions to achieve the desired concurrency for all consumer groups. +The above configuration supports up to 12 consumer instances (6 if their concurrency is 2, 4 if their concurrency is 3, and so on). +It is generally best to “over-provision” the partitions to allow for future increases in consumers or concurrency. +
+
+
+ + + + + +
+ + +The preceding configuration uses the default partitioning (key.hashCode() % partitionCount). +This may or may not provide a suitably balanced algorithm, depending on the key values. +You can override this default by using the partitionSelectorExpression or partitionSelectorClass properties. +
+
+
+

Since partitions are natively handled by Kafka, no special configuration is needed on the consumer side. +Kafka allocates partitions across the instances.

+
+
+

The following Spring Boot application listens to a Kafka stream and prints (to the console) the partition ID to which each message goes:

+
+
+
+
@SpringBootApplication
+@EnableBinding(Sink.class)
+public class KafkaPartitionConsumerApplication {
+
+    public static void main(String[] args) {
+        new SpringApplicationBuilder(KafkaPartitionConsumerApplication.class)
+            .web(false)
+            .run(args);
+    }
+
+    @StreamListener(Sink.INPUT)
+    public void listen(@Payload String in, @Header(KafkaHeaders.RECEIVED_PARTITION_ID) int partition) {
+        System.out.println(in + " received from partition " + partition);
+    }
+
+}
+
+
+
+
application.yml
+
+
spring:
+  cloud:
+    stream:
+      bindings:
+        input:
+          destination: partitioned.topic
+          group: myGroup
+
+
+
+

You can add instances as needed. +Kafka rebalances the partition allocations. +If the instance count (or instance count * concurrency) exceeds the number of partitions, some consumers are idle.

+
+
+
+ + + + + + + \ No newline at end of file diff --git a/spring-cloud-stream-binder-kafka/3.0.0.RELEASE/reference/html/spring-cloud-stream-binder-kafka-aggregate.html b/spring-cloud-stream-binder-kafka/3.0.0.RELEASE/reference/html/spring-cloud-stream-binder-kafka-aggregate.html new file mode 100644 index 00000000..4c9335eb --- /dev/null +++ b/spring-cloud-stream-binder-kafka/3.0.0.RELEASE/reference/html/spring-cloud-stream-binder-kafka-aggregate.html @@ -0,0 +1,1407 @@ + + + + + + + +Apache Kafka Binder + + + + + + + + + + +
+
+
+ +
+
+
+

Apache Kafka Binder

+
+

Usage

+
+

To use Apache Kafka binder, you need to add spring-cloud-stream-binder-kafka as a dependency to your Spring Cloud Stream application, as shown in the following example for Maven:

+
+
+
+
<dependency>
+  <groupId>org.springframework.cloud</groupId>
+  <artifactId>spring-cloud-stream-binder-kafka</artifactId>
+</dependency>
+
+
+
+

Alternatively, you can also use the Spring Cloud Stream Kafka Starter, as shown in the following example for Maven:

+
+
+
+
<dependency>
+  <groupId>org.springframework.cloud</groupId>
+  <artifactId>spring-cloud-starter-stream-kafka</artifactId>
+</dependency>
+
+
+
+
+

Overview

+
+

The following image shows a simplified diagram of how the Apache Kafka binder operates:

+
+
+
+kafka binder +
+
Figure 1. Kafka Binder
+
+
+

The Apache Kafka Binder implementation maps each destination to an Apache Kafka topic. +The consumer group maps directly to the same Apache Kafka concept. +Partitioning also maps directly to Apache Kafka partitions as well.

+
+
+

The binder currently uses the Apache Kafka kafka-clients version 2.3.1. +This client can communicate with older brokers (see the Kafka documentation), but certain features may not be available. +For example, with versions earlier than 0.11.x.x, native headers are not supported. +Also, 0.11.x.x does not support the autoAddPartitions property.

+
+
+
+

Configuration Options

+
+

This section contains the configuration options used by the Apache Kafka binder.

+
+
+

For common configuration options and properties pertaining to binder, see the core documentation.

+
+
+
Kafka Binder Properties
+
+
+
spring.cloud.stream.kafka.binder.brokers
+
+

A list of brokers to which the Kafka binder connects.

+
+

Default: localhost.

+
+
+
spring.cloud.stream.kafka.binder.defaultBrokerPort
+
+

brokers allows hosts specified with or without port information (for example, host1,host2:port2). +This sets the default port when no port is configured in the broker list.

+
+

Default: 9092.

+
+
+
spring.cloud.stream.kafka.binder.configuration
+
+

Key/Value map of client properties (both producers and consumer) passed to all clients created by the binder. +Due to the fact that these properties are used by both producers and consumers, usage should be restricted to common properties — for example, security settings. +Unknown Kafka producer or consumer properties provided through this configuration are filtered out and not allowed to propagate. +Properties here supersede any properties set in boot.

+
+

Default: Empty map.

+
+
+
spring.cloud.stream.kafka.binder.consumerProperties
+
+

Key/Value map of arbitrary Kafka client consumer properties. +In addition to support known Kafka consumer properties, unknown consumer properties are allowed here as well. +Properties here supersede any properties set in boot and in the configuration property above.

+
+

Default: Empty map.

+
+
+
spring.cloud.stream.kafka.binder.headers
+
+

The list of custom headers that are transported by the binder. +Only required when communicating with older applications (⇐ 1.3.x) with a kafka-clients version < 0.11.0.0. Newer versions support headers natively.

+
+

Default: empty.

+
+
+
spring.cloud.stream.kafka.binder.healthTimeout
+
+

The time to wait to get partition information, in seconds. +Health reports as down if this timer expires.

+
+

Default: 10.

+
+
+
spring.cloud.stream.kafka.binder.requiredAcks
+
+

The number of required acks on the broker. +See the Kafka documentation for the producer acks property.

+
+

Default: 1.

+
+
+
spring.cloud.stream.kafka.binder.minPartitionCount
+
+

Effective only if autoCreateTopics or autoAddPartitions is set. +The global minimum number of partitions that the binder configures on topics on which it produces or consumes data. +It can be superseded by the partitionCount setting of the producer or by the value of instanceCount * concurrency settings of the producer (if either is larger).

+
+

Default: 1.

+
+
+
spring.cloud.stream.kafka.binder.producerProperties
+
+

Key/Value map of arbitrary Kafka client producer properties. +In addition to support known Kafka producer properties, unknown producer properties are allowed here as well. +Properties here supersede any properties set in boot and in the configuration property above.

+
+

Default: Empty map.

+
+
+
spring.cloud.stream.kafka.binder.replicationFactor
+
+

The replication factor of auto-created topics if autoCreateTopics is active. +Can be overridden on each binding.

+
+

Default: 1.

+
+
+
spring.cloud.stream.kafka.binder.autoCreateTopics
+
+

If set to true, the binder creates new topics automatically. +If set to false, the binder relies on the topics being already configured. +In the latter case, if the topics do not exist, the binder fails to start.

+
+ + + + + +
+ + +This setting is independent of the auto.create.topics.enable setting of the broker and does not influence it. +If the server is set to auto-create topics, they may be created as part of the metadata retrieval request, with default broker settings. +
+
+
+

Default: true.

+
+
+
spring.cloud.stream.kafka.binder.autoAddPartitions
+
+

If set to true, the binder creates new partitions if required. +If set to false, the binder relies on the partition size of the topic being already configured. +If the partition count of the target topic is smaller than the expected value, the binder fails to start.

+
+

Default: false.

+
+
+
spring.cloud.stream.kafka.binder.transaction.transactionIdPrefix
+
+

Enables transactions in the binder. See transaction.id in the Kafka documentation and Transactions in the spring-kafka documentation. +When transactions are enabled, individual producer properties are ignored and all producers use the spring.cloud.stream.kafka.binder.transaction.producer.* properties.

+
+

Default null (no transactions)

+
+
+
spring.cloud.stream.kafka.binder.transaction.producer.*
+
+

Global producer properties for producers in a transactional binder. +See spring.cloud.stream.kafka.binder.transaction.transactionIdPrefix and Kafka Producer Properties and the general producer properties supported by all binders.

+
+

Default: See individual producer properties.

+
+
+
spring.cloud.stream.kafka.binder.headerMapperBeanName
+
+

The bean name of a KafkaHeaderMapper used for mapping spring-messaging headers to and from Kafka headers. +Use this, for example, if you wish to customize the trusted packages in a BinderHeaderMapper bean that uses JSON deserialization for the headers. +If this custom BinderHeaderMapper bean is not made available to the binder using this property, then the binder will look for a header mapper bean with the name kafkaBinderHeaderMapper that is of type BinderHeaderMapper before falling back to a default BinderHeaderMapper created by the binder.

+
+

Default: none.

+
+
+
+
+
+
+
Kafka Consumer Properties
+
+ + + + + +
+ + +To avoid repetition, Spring Cloud Stream supports setting values for all channels, in the format of spring.cloud.stream.kafka.default.consumer.<property>=<value>. +
+
+
+

The following properties are available for Kafka consumers only and +must be prefixed with spring.cloud.stream.kafka.bindings.<channelName>.consumer..

+
+
+
+
admin.configuration
+
+

Since version 2.1.1, this property is deprecated in favor of topic.properties, and support for it will be removed in a future version.

+
+
admin.replicas-assignment
+
+

Since version 2.1.1, this property is deprecated in favor of topic.replicas-assignment, and support for it will be removed in a future version.

+
+
admin.replication-factor
+
+

Since version 2.1.1, this property is deprecated in favor of topic.replication-factor, and support for it will be removed in a future version.

+
+
autoRebalanceEnabled
+
+

When true, topic partitions is automatically rebalanced between the members of a consumer group. +When false, each consumer is assigned a fixed set of partitions based on spring.cloud.stream.instanceCount and spring.cloud.stream.instanceIndex. +This requires both the spring.cloud.stream.instanceCount and spring.cloud.stream.instanceIndex properties to be set appropriately on each launched instance. +The value of the spring.cloud.stream.instanceCount property must typically be greater than 1 in this case.

+
+

Default: true.

+
+
+
ackEachRecord
+
+

When autoCommitOffset is true, this setting dictates whether to commit the offset after each record is processed. +By default, offsets are committed after all records in the batch of records returned by consumer.poll() have been processed. +The number of records returned by a poll can be controlled with the max.poll.records Kafka property, which is set through the consumer configuration property. +Setting this to true may cause a degradation in performance, but doing so reduces the likelihood of redelivered records when a failure occurs. +Also, see the binder requiredAcks property, which also affects the performance of committing offsets.

+
+

Default: false.

+
+
+
autoCommitOffset
+
+

Whether to autocommit offsets when a message has been processed. +If set to false, a header with the key kafka_acknowledgment of the type org.springframework.kafka.support.Acknowledgment header is present in the inbound message. +Applications may use this header for acknowledging messages. +See the examples section for details. +When this property is set to false, Kafka binder sets the ack mode to org.springframework.kafka.listener.AbstractMessageListenerContainer.AckMode.MANUAL and the application is responsible for acknowledging records. +Also see ackEachRecord.

+
+

Default: true.

+
+
+
autoCommitOnError
+
+

Effective only if autoCommitOffset is set to true. +If set to false, it suppresses auto-commits for messages that result in errors and commits only for successful messages. It allows a stream to automatically replay from the last successfully processed message, in case of persistent failures. +If set to true, it always auto-commits (if auto-commit is enabled). +If not set (the default), it effectively has the same value as enableDlq, auto-committing erroneous messages if they are sent to a DLQ and not committing them otherwise.

+
+

Default: not set.

+
+
+
resetOffsets
+
+

Whether to reset offsets on the consumer to the value provided by startOffset. +Must be false if a KafkaRebalanceListener is provided; see Using a KafkaRebalanceListener.

+
+

Default: false.

+
+
+
startOffset
+
+

The starting offset for new groups. +Allowed values: earliest and latest. +If the consumer group is set explicitly for the consumer 'binding' (through spring.cloud.stream.bindings.<channelName>.group), 'startOffset' is set to earliest. Otherwise, it is set to latest for the anonymous consumer group. +Also see resetOffsets (earlier in this list).

+
+

Default: null (equivalent to earliest).

+
+
+
enableDlq
+
+

When set to true, it enables DLQ behavior for the consumer. +By default, messages that result in errors are forwarded to a topic named error.<destination>.<group>. +The DLQ topic name can be configurable by setting the dlqName property. +This provides an alternative option to the more common Kafka replay scenario for the case when the number of errors is relatively small and replaying the entire original topic may be too cumbersome. +See Dead-Letter Topic Processing processing for more information. +Starting with version 2.0, messages sent to the DLQ topic are enhanced with the following headers: x-original-topic, x-exception-message, and x-exception-stacktrace as byte[]. +By default, a failed record is sent to the same partition number in the DLQ topic as the original record. +See Dead-Letter Topic Partition Selection for how to change that behavior. +Not allowed when destinationIsPattern is true.

+
+

Default: false.

+
+
+
dlqPartitions
+
+

When enableDlq is true, and this property is not set, a dead letter topic with the same number of partitions as the primary topic(s) is created. +Usually, dead-letter records are sent to the same partition in the dead-letter topic as the original record. +This behavior can be changed; see Dead-Letter Topic Partition Selection. +If this property is set to 1 and there is no DqlPartitionFunction bean, all dead-letter records will be written to partition 0. +If this property is greater than 1, you MUST provide a DlqPartitionFunction bean. +Note that the actual partition count is affected by the binder’s minPartitionCount property.

+
+

Default: none

+
+
+
configuration
+
+

Map with a key/value pair containing generic Kafka consumer properties. +In addition to having Kafka consumer properties, other configuration properties can be passed here. +For example some properties needed by the application such as spring.cloud.stream.kafka.bindings.input.consumer.configuration.foo=bar.

+
+

Default: Empty map.

+
+
+
dlqName
+
+

The name of the DLQ topic to receive the error messages.

+
+

Default: null (If not specified, messages that result in errors are forwarded to a topic named error.<destination>.<group>).

+
+
+
dlqProducerProperties
+
+

Using this, DLQ-specific producer properties can be set. +All the properties available through kafka producer properties can be set through this property. +When native decoding is enabled on the consumer (i.e., useNativeDecoding: true) , the application must provide corresponding key/value serializers for DLQ. +This must be provided in the form of dlqProducerProperties.configuration.key.serializer and dlqProducerProperties.configuration.value.serializer.

+
+

Default: Default Kafka producer properties.

+
+
+
standardHeaders
+
+

Indicates which standard headers are populated by the inbound channel adapter. +Allowed values: none, id, timestamp, or both. +Useful if using native deserialization and the first component to receive a message needs an id (such as an aggregator that is configured to use a JDBC message store).

+
+

Default: none

+
+
+
converterBeanName
+
+

The name of a bean that implements RecordMessageConverter. Used in the inbound channel adapter to replace the default MessagingMessageConverter.

+
+

Default: null

+
+
+
idleEventInterval
+
+

The interval, in milliseconds, between events indicating that no messages have recently been received. +Use an ApplicationListener<ListenerContainerIdleEvent> to receive these events. +See Example: Pausing and Resuming the Consumer for a usage example.

+
+

Default: 30000

+
+
+
destinationIsPattern
+
+

When true, the destination is treated as a regular expression Pattern used to match topic names by the broker. +When true, topics are not provisioned, and enableDlq is not allowed, because the binder does not know the topic names during the provisioning phase. +Note, the time taken to detect new topics that match the pattern is controlled by the consumer property metadata.max.age.ms, which (at the time of writing) defaults to 300,000ms (5 minutes). +This can be configured using the configuration property above.

+
+

Default: false

+
+
+
topic.properties
+
+

A Map of Kafka topic properties used when provisioning new topics — for example, spring.cloud.stream.kafka.bindings.input.consumer.topic.properties.message.format.version=0.9.0.0

+
+

Default: none.

+
+
+
topic.replicas-assignment
+
+

A Map<Integer, List<Integer>> of replica assignments, with the key being the partition and the value being the assignments. +Used when provisioning new topics. +See the NewTopic Javadocs in the kafka-clients jar.

+
+

Default: none.

+
+
+
topic.replication-factor
+
+

The replication factor to use when provisioning topics. Overrides the binder-wide setting. +Ignored if replicas-assignments is present.

+
+

Default: none (the binder-wide default of 1 is used).

+
+
+
pollTimeout
+
+

Timeout used for polling in pollable consumers.

+
+

Default: 5 seconds.

+
+
+
+
+
+
+
Consuming Batches
+
+

Starting with version 3.0, when spring.cloud.stream.binding.<name>.consumer.batch-mode is set to true, all of the records received by polling the Kafka Consumer will be presented as a List<?> to the listener method. +Otherwise, the method will be called with one record at a time. +The size of the batch is controlled by Kafka consumer properties max.poll.records, min.fetch.bytes, fetch.max.wait.ms; refer to the Kafka documentation for more information.

+
+
+ + + + + +
+ + +Retry within the binder is not supported when using batch mode, so maxAttempts will be overridden to 1. +You can configure a SeekToCurrentBatchErrorHandler (using a ListenerContainerCustomizer) to achieve similar functionality to retry in the binder. +You can also use a manual AckMode and call Ackowledgment.nack(index, sleep) to commit the offsets for a partial batch and have the remaining records redelivered. +Refer to the Spring for Apache Kafka documentation for more information about these techniques. +
+
+
+
+
Kafka Producer Properties
+
+ + + + + +
+ + +To avoid repetition, Spring Cloud Stream supports setting values for all channels, in the format of spring.cloud.stream.kafka.default.producer.<property>=<value>. +
+
+
+

The following properties are available for Kafka producers only and +must be prefixed with spring.cloud.stream.kafka.bindings.<channelName>.producer..

+
+
+
+
admin.configuration
+
+

Since version 2.1.1, this property is deprecated in favor of topic.properties, and support for it will be removed in a future version.

+
+
admin.replicas-assignment
+
+

Since version 2.1.1, this property is deprecated in favor of topic.replicas-assignment, and support for it will be removed in a future version.

+
+
admin.replication-factor
+
+

Since version 2.1.1, this property is deprecated in favor of topic.replication-factor, and support for it will be removed in a future version.

+
+
bufferSize
+
+

Upper limit, in bytes, of how much data the Kafka producer attempts to batch before sending.

+
+

Default: 16384.

+
+
+
sync
+
+

Whether the producer is synchronous.

+
+

Default: false.

+
+
+
sendTimeoutExpression
+
+

A SpEL expression evaluated against the outgoing message used to evaluate the time to wait for ack when synchronous publish is enabled — for example, headers['mySendTimeout']. +The value of the timeout is in milliseconds. +With versions before 3.0, the payload could not be used unless native encoding was being used because, by the time this expression was evaluated, the payload was already in the form of a byte[]. +Now, the expression is evaluated before the payload is converted.

+
+

Default: none.

+
+
+
batchTimeout
+
+

How long the producer waits to allow more messages to accumulate in the same batch before sending the messages. +(Normally, the producer does not wait at all and simply sends all the messages that accumulated while the previous send was in progress.) A non-zero value may increase throughput at the expense of latency.

+
+

Default: 0.

+
+
+
messageKeyExpression
+
+

A SpEL expression evaluated against the outgoing message used to populate the key of the produced Kafka message — for example, headers['myKey']. +With versions before 3.0, the payload could not be used unless native encoding was being used because, by the time this expression was evaluated, the payload was already in the form of a byte[]. +Now, the expression is evaluated before the payload is converted.

+
+

Default: none.

+
+
+
headerPatterns
+
+

A comma-delimited list of simple patterns to match Spring messaging headers to be mapped to the Kafka Headers in the ProducerRecord. +Patterns can begin or end with the wildcard character (asterisk). +Patterns can be negated by prefixing with !. +Matching stops after the first match (positive or negative). +For example !ask,as* will pass ash but not ask. +id and timestamp are never mapped.

+
+

Default: * (all headers - except the id and timestamp)

+
+
+
configuration
+
+

Map with a key/value pair containing generic Kafka producer properties.

+
+

Default: Empty map.

+
+
+
topic.properties
+
+

A Map of Kafka topic properties used when provisioning new topics — for example, spring.cloud.stream.kafka.bindings.output.producer.topic.properties.message.format.version=0.9.0.0

+
+
topic.replicas-assignment
+
+

A Map<Integer, List<Integer>> of replica assignments, with the key being the partition and the value being the assignments. +Used when provisioning new topics. +See the NewTopic Javadocs in the kafka-clients jar.

+
+

Default: none.

+
+
+
topic.replication-factor
+
+

The replication factor to use when provisioning topics. Overrides the binder-wide setting. +Ignored if replicas-assignments is present.

+
+

Default: none (the binder-wide default of 1 is used).

+
+
+
useTopicHeader
+
+

Set to true to override the default binding destination (topic name) with the value of the KafkaHeaders.TOPIC message header in the outbound message. +If the header is not present, the default binding destination is used. +Default: false.

+
+
recordMetadataChannel
+
+

The bean name of a MessageChannel to which successful send results should be sent; the bean must exist in the application context. +The message sent to the channel is the sent message (after conversion, if any) with an additional header KafkaHeaders.RECORD_METADATA. +The header contains a RecordMetadata object provided by the Kafka client; it includes the partition and offset where the record was written in the topic.

+
+
+
+
+

ResultMetadata meta = sendResultMsg.getHeaders().get(KafkaHeaders.RECORD_METADATA, RecordMetadata.class)

+
+
+

Failed sends go the producer error channel (if configured); see Error Channels. +Default: null

+
+
+

+

+
+
+ + + + + +
+ + +The Kafka binder uses the partitionCount setting of the producer as a hint to create a topic with the given partition count (in conjunction with the minPartitionCount, the maximum of the two being the value being used). +Exercise caution when configuring both minPartitionCount for a binder and partitionCount for an application, as the larger value is used. +If a topic already exists with a smaller partition count and autoAddPartitions is disabled (the default), the binder fails to start. +If a topic already exists with a smaller partition count and autoAddPartitions is enabled, new partitions are added. +If a topic already exists with a larger number of partitions than the maximum of (minPartitionCount or partitionCount), the existing partition count is used. +
+
+
+
+
compression
+
+

Set the compression.type producer property. +Supported values are none, gzip, snappy and lz4. +If you override the kafka-clients jar to 2.1.0 (or later), as discussed in the Spring for Apache Kafka documentation, and wish to use zstd compression, use spring.cloud.stream.kafka.bindings.<binding-name>.producer.configuration.compression.type=zstd.

+
+

Default: none.

+
+
+
+
+
+
+
Usage examples
+
+

In this section, we show the use of the preceding properties for specific scenarios.

+
+
+
Example: Setting autoCommitOffset to false and Relying on Manual Acking
+
+

This example illustrates how one may manually acknowledge offsets in a consumer application.

+
+
+

This example requires that spring.cloud.stream.kafka.bindings.input.consumer.autoCommitOffset be set to false. +Use the corresponding input channel name for your example.

+
+
+
+
@SpringBootApplication
+@EnableBinding(Sink.class)
+public class ManuallyAcknowdledgingConsumer {
+
+ public static void main(String[] args) {
+     SpringApplication.run(ManuallyAcknowdledgingConsumer.class, args);
+ }
+
+ @StreamListener(Sink.INPUT)
+ public void process(Message<?> message) {
+     Acknowledgment acknowledgment = message.getHeaders().get(KafkaHeaders.ACKNOWLEDGMENT, Acknowledgment.class);
+     if (acknowledgment != null) {
+         System.out.println("Acknowledgment provided");
+         acknowledgment.acknowledge();
+     }
+ }
+}
+
+
+
+
+
Example: Security Configuration
+
+

Apache Kafka 0.9 supports secure connections between client and brokers. +To take advantage of this feature, follow the guidelines in the Apache Kafka Documentation as well as the Kafka 0.9 security guidelines from the Confluent documentation. +Use the spring.cloud.stream.kafka.binder.configuration option to set security properties for all clients created by the binder.

+
+
+

For example, to set security.protocol to SASL_SSL, set the following property:

+
+
+
+
spring.cloud.stream.kafka.binder.configuration.security.protocol=SASL_SSL
+
+
+
+

All the other security properties can be set in a similar manner.

+
+
+

When using Kerberos, follow the instructions in the reference documentation for creating and referencing the JAAS configuration.

+
+
+

Spring Cloud Stream supports passing JAAS configuration information to the application by using a JAAS configuration file and using Spring Boot properties.

+
+
+Using JAAS Configuration Files +
+

The JAAS and (optionally) krb5 file locations can be set for Spring Cloud Stream applications by using system properties. +The following example shows how to launch a Spring Cloud Stream application with SASL and Kerberos by using a JAAS configuration file:

+
+
+
+
 java -Djava.security.auth.login.config=/path.to/kafka_client_jaas.conf -jar log.jar \
+   --spring.cloud.stream.kafka.binder.brokers=secure.server:9092 \
+   --spring.cloud.stream.bindings.input.destination=stream.ticktock \
+   --spring.cloud.stream.kafka.binder.configuration.security.protocol=SASL_PLAINTEXT
+
+
+
+
+Using Spring Boot Properties +
+

As an alternative to having a JAAS configuration file, Spring Cloud Stream provides a mechanism for setting up the JAAS configuration for Spring Cloud Stream applications by using Spring Boot properties.

+
+
+

The following properties can be used to configure the login context of the Kafka client:

+
+
+
+
spring.cloud.stream.kafka.binder.jaas.loginModule
+
+

The login module name. Not necessary to be set in normal cases.

+
+

Default: com.sun.security.auth.module.Krb5LoginModule.

+
+
+
spring.cloud.stream.kafka.binder.jaas.controlFlag
+
+

The control flag of the login module.

+
+

Default: required.

+
+
+
spring.cloud.stream.kafka.binder.jaas.options
+
+

Map with a key/value pair containing the login module options.

+
+

Default: Empty map.

+
+
+
+
+
+

The following example shows how to launch a Spring Cloud Stream application with SASL and Kerberos by using Spring Boot configuration properties:

+
+
+
+
 java --spring.cloud.stream.kafka.binder.brokers=secure.server:9092 \
+   --spring.cloud.stream.bindings.input.destination=stream.ticktock \
+   --spring.cloud.stream.kafka.binder.autoCreateTopics=false \
+   --spring.cloud.stream.kafka.binder.configuration.security.protocol=SASL_PLAINTEXT \
+   --spring.cloud.stream.kafka.binder.jaas.options.useKeyTab=true \
+   --spring.cloud.stream.kafka.binder.jaas.options.storeKey=true \
+   --spring.cloud.stream.kafka.binder.jaas.options.keyTab=/etc/security/keytabs/kafka_client.keytab \
+   --spring.cloud.stream.kafka.binder.jaas.options.principal=kafka-client-1@EXAMPLE.COM
+
+
+
+

The preceding example represents the equivalent of the following JAAS file:

+
+
+
+
KafkaClient {
+    com.sun.security.auth.module.Krb5LoginModule required
+    useKeyTab=true
+    storeKey=true
+    keyTab="/etc/security/keytabs/kafka_client.keytab"
+    principal="kafka-client-1@EXAMPLE.COM";
+};
+
+
+
+

If the topics required already exist on the broker or will be created by an administrator, autocreation can be turned off and only client JAAS properties need to be sent.

+
+
+ + + + + +
+ + +Do not mix JAAS configuration files and Spring Boot properties in the same application. +If the -Djava.security.auth.login.config system property is already present, Spring Cloud Stream ignores the Spring Boot properties. +
+
+
+ + + + + +
+ + +Be careful when using the autoCreateTopics and autoAddPartitions with Kerberos. +Usually, applications may use principals that do not have administrative rights in Kafka and Zookeeper. +Consequently, relying on Spring Cloud Stream to create/modify topics may fail. +In secure environments, we strongly recommend creating topics and managing ACLs administratively by using Kafka tooling. +
+
+
+
+
+
Example: Pausing and Resuming the Consumer
+
+

If you wish to suspend consumption but not cause a partition rebalance, you can pause and resume the consumer. +This is facilitated by adding the Consumer as a parameter to your @StreamListener. +To resume, you need an ApplicationListener for ListenerContainerIdleEvent instances. +The frequency at which events are published is controlled by the idleEventInterval property. +Since the consumer is not thread-safe, you must call these methods on the calling thread.

+
+
+

The following simple application shows how to pause and resume:

+
+
+
+
@SpringBootApplication
+@EnableBinding(Sink.class)
+public class Application {
+
+	public static void main(String[] args) {
+		SpringApplication.run(Application.class, args);
+	}
+
+	@StreamListener(Sink.INPUT)
+	public void in(String in, @Header(KafkaHeaders.CONSUMER) Consumer<?, ?> consumer) {
+		System.out.println(in);
+		consumer.pause(Collections.singleton(new TopicPartition("myTopic", 0)));
+	}
+
+	@Bean
+	public ApplicationListener<ListenerContainerIdleEvent> idleListener() {
+		return event -> {
+			System.out.println(event);
+			if (event.getConsumer().paused().size() > 0) {
+				event.getConsumer().resume(event.getConsumer().paused());
+			}
+		};
+	}
+
+}
+
+
+
+
+
+
+

Transactional Binder

+
+

Enable transactions by setting spring.cloud.stream.kafka.binder.transaction.transactionIdPrefix to a non-empty value, e.g. tx-. +When used in a processor application, the consumer starts the transaction; any records sent on the consumer thread participate in the same transaction. +When the listener exits normally, the listener container will send the offset to the transaction and commit it. +A common producer factory is used for all producer bindings configured using spring.cloud.stream.kafka.binder.transaction.producer.* properties; individual binding Kafka producer properties are ignored.

+
+
+ + + + + +
+ + +Normal binder retries (and dead lettering) are not supported with transactions because the retries will run in the original transaction, which may be rolled back and any published records will be rolled back too. +When retries are enabled (the common property maxAttempts is greater than zero) the retry properties are used to configure a DefaultAfterRollbackProcessor to enable retries at the container level. +Similarly, instead of publishing dead-letter records within the transaction, this functionality is moved to the listener container, again via the DefaultAfterRollbackProcessor which runs after the main transaction has rolled back. +
+
+
+

If you wish to use transactions in a source application, or from some arbitrary thread for producer-only transaction (e.g. @Scheduled method), you must get a reference to the transactional producer factory and define a KafkaTransactionManager bean using it.

+
+
+
+
+
+
@Bean
+public PlatformTransactionManager transactionManager(BinderFactory binders) {
+    ProducerFactory<byte[], byte[]> pf = ((KafkaMessageChannelBinder) binders.getBinder(null,
+            MessageChannel.class)).getTransactionalProducerFactory();
+    return new KafkaTransactionManager<>(pf);
+}
+
+
+
+
+
+

Notice that we get a reference to the binder using the BinderFactory; use null in the first argument when there is only one binder configured. +If more than one binder is configured, use the binder name to get the reference. +Once we have a reference to the binder, we can obtain a reference to the ProducerFactory and create a transaction manager.

+
+
+

Then you would use normal Spring transaction support, e.g. TransactionTemplate or @Transactional, for example:

+
+
+
+
+
+
public static class Sender {
+
+    @Transactional
+    public void doInTransaction(MessageChannel output, List<String> stuffToSend) {
+        stuffToSend.forEach(stuff -> output.send(new GenericMessage<>(stuff)));
+    }
+
+}
+
+
+
+
+
+

If you wish to synchronize producer-only transactions with those from some other transaction manager, use a ChainedTransactionManager.

+
+
+
+

Error Channels

+
+

Starting with version 1.3, the binder unconditionally sends exceptions to an error channel for each consumer destination and can also be configured to send async producer send failures to an error channel. +See [spring-cloud-stream-overview-error-handling] for more information.

+
+
+

The payload of the ErrorMessage for a send failure is a KafkaSendFailureException with properties:

+
+
+
    +
  • +

    failedMessage: The Spring Messaging Message<?> that failed to be sent.

    +
  • +
  • +

    record: The raw ProducerRecord that was created from the failedMessage

    +
  • +
+
+
+

There is no automatic handling of producer exceptions (such as sending to a Dead-Letter queue). +You can consume these exceptions with your own Spring Integration flow.

+
+
+
+

Kafka Metrics

+
+

Kafka binder module exposes the following metrics:

+
+
+

spring.cloud.stream.binder.kafka.offset: This metric indicates how many messages have not been yet consumed from a given binder’s topic by a given consumer group. +The metrics provided are based on the Mircometer metrics library. The metric contains the consumer group information, topic and the actual lag in committed offset from the latest offset on the topic. +This metric is particularly useful for providing auto-scaling feedback to a PaaS platform.

+
+
+
+

Tombstone Records (null record values)

+
+

When using compacted topics, a record with a null value (also called a tombstone record) represents the deletion of a key. +To receive such messages in a @StreamListener method, the parameter must be marked as not required to receive a null value argument.

+
+
+
+
+
+
@StreamListener(Sink.INPUT)
+public void in(@Header(KafkaHeaders.RECEIVED_MESSAGE_KEY) byte[] key,
+               @Payload(required = false) Customer customer) {
+    // customer is null if a tombstone record
+    ...
+}
+
+
+
+
+
+
+

Using a KafkaRebalanceListener

+
+

Applications may wish to seek topics/partitions to arbitrary offsets when the partitions are initially assigned, or perform other operations on the consumer. +Starting with version 2.1, if you provide a single KafkaRebalanceListener bean in the application context, it will be wired into all Kafka consumer bindings.

+
+
+
+
+
+
public interface KafkaBindingRebalanceListener {
+
+	/**
+	 * Invoked by the container before any pending offsets are committed.
+	 * @param bindingName the name of the binding.
+	 * @param consumer the consumer.
+	 * @param partitions the partitions.
+	 */
+	default void onPartitionsRevokedBeforeCommit(String bindingName, Consumer<?, ?> consumer,
+			Collection<TopicPartition> partitions) {
+
+	}
+
+	/**
+	 * Invoked by the container after any pending offsets are committed.
+	 * @param bindingName the name of the binding.
+	 * @param consumer the consumer.
+	 * @param partitions the partitions.
+	 */
+	default void onPartitionsRevokedAfterCommit(String bindingName, Consumer<?, ?> consumer, Collection<TopicPartition> partitions) {
+
+	}
+
+	/**
+	 * Invoked when partitions are initially assigned or after a rebalance.
+	 * Applications might only want to perform seek operations on an initial assignment.
+	 * @param bindingName the name of the binding.
+	 * @param consumer the consumer.
+	 * @param partitions the partitions.
+	 * @param initial true if this is the initial assignment.
+	 */
+	default void onPartitionsAssigned(String bindingName, Consumer<?, ?> consumer, Collection<TopicPartition> partitions,
+			boolean initial) {
+
+	}
+
+}
+
+
+
+
+
+

You cannot set the resetOffsets consumer property to true when you provide a rebalance listener.

+
+
+
+

Dead-Letter Topic Processing

+
+
Dead-Letter Topic Partition Selection
+
+

By default, records are published to the Dead-Letter topic using the same partition as the original record. +This means the Dead-Letter topic must have at least as many partitions as the original record.

+
+
+

To change this behavior, add a DlqPartitionFunction implementation as a @Bean to the application context. +Only one such bean can be present. +The function is provided with the consumer group, the failed ConsumerRecord and the exception. +For example, if you always want to route to partition 0, you might use:

+
+
+
+
+
+
@Bean
+public DlqPartitionFunction partitionFunction() {
+    return (group, record, ex) -> 0;
+}
+
+
+
+
+
+ + + + + +
+ + +If you set a consumer binding’s dlqPartitions property to 1 (and the binder’s minPartitionCount is equal to 1), there is no need to supply a DlqPartitionFunction; the framework will always use partition 0. +If you set a consumer binding’s dlqPartitions property to a value greater than 1 (or the binder’s minPartitionCount is greater than 1), you must provide a DlqPartitionFunction bean, even if the partition count is the same as the original topic’s. +
+
+
+
+
Handling Records in a Dead-Letter Topic
+
+

Because the framework cannot anticipate how users would want to dispose of dead-lettered messages, it does not provide any standard mechanism to handle them. +If the reason for the dead-lettering is transient, you may wish to route the messages back to the original topic. +However, if the problem is a permanent issue, that could cause an infinite loop. +The sample Spring Boot application within this topic is an example of how to route those messages back to the original topic, but it moves them to a “parking lot” topic after three attempts. +The application is another spring-cloud-stream application that reads from the dead-letter topic. +It terminates when no messages are received for 5 seconds.

+
+
+

The examples assume the original destination is so8400out and the consumer group is so8400.

+
+
+

There are a couple of strategies to consider:

+
+
+
    +
  • +

    Consider running the rerouting only when the main application is not running. +Otherwise, the retries for transient errors are used up very quickly.

    +
  • +
  • +

    Alternatively, use a two-stage approach: Use this application to route to a third topic and another to route from there back to the main topic.

    +
  • +
+
+
+

The following code listings show the sample application:

+
+
+
application.properties
+
+
spring.cloud.stream.bindings.input.group=so8400replay
+spring.cloud.stream.bindings.input.destination=error.so8400out.so8400
+
+spring.cloud.stream.bindings.output.destination=so8400out
+
+spring.cloud.stream.bindings.parkingLot.destination=so8400in.parkingLot
+
+spring.cloud.stream.kafka.binder.configuration.auto.offset.reset=earliest
+
+spring.cloud.stream.kafka.binder.headers=x-retries
+
+
+
+
Application
+
+
@SpringBootApplication
+@EnableBinding(TwoOutputProcessor.class)
+public class ReRouteDlqKApplication implements CommandLineRunner {
+
+    private static final String X_RETRIES_HEADER = "x-retries";
+
+    public static void main(String[] args) {
+        SpringApplication.run(ReRouteDlqKApplication.class, args).close();
+    }
+
+    private final AtomicInteger processed = new AtomicInteger();
+
+    @Autowired
+    private MessageChannel parkingLot;
+
+    @StreamListener(Processor.INPUT)
+    @SendTo(Processor.OUTPUT)
+    public Message<?> reRoute(Message<?> failed) {
+        processed.incrementAndGet();
+        Integer retries = failed.getHeaders().get(X_RETRIES_HEADER, Integer.class);
+        if (retries == null) {
+            System.out.println("First retry for " + failed);
+            return MessageBuilder.fromMessage(failed)
+                    .setHeader(X_RETRIES_HEADER, new Integer(1))
+                    .setHeader(BinderHeaders.PARTITION_OVERRIDE,
+                            failed.getHeaders().get(KafkaHeaders.RECEIVED_PARTITION_ID))
+                    .build();
+        }
+        else if (retries.intValue() < 3) {
+            System.out.println("Another retry for " + failed);
+            return MessageBuilder.fromMessage(failed)
+                    .setHeader(X_RETRIES_HEADER, new Integer(retries.intValue() + 1))
+                    .setHeader(BinderHeaders.PARTITION_OVERRIDE,
+                            failed.getHeaders().get(KafkaHeaders.RECEIVED_PARTITION_ID))
+                    .build();
+        }
+        else {
+            System.out.println("Retries exhausted for " + failed);
+            parkingLot.send(MessageBuilder.fromMessage(failed)
+                    .setHeader(BinderHeaders.PARTITION_OVERRIDE,
+                            failed.getHeaders().get(KafkaHeaders.RECEIVED_PARTITION_ID))
+                    .build());
+        }
+        return null;
+    }
+
+    @Override
+    public void run(String... args) throws Exception {
+        while (true) {
+            int count = this.processed.get();
+            Thread.sleep(5000);
+            if (count == this.processed.get()) {
+                System.out.println("Idle, terminating");
+                return;
+            }
+        }
+    }
+
+    public interface TwoOutputProcessor extends Processor {
+
+        @Output("parkingLot")
+        MessageChannel parkingLot();
+
+    }
+
+}
+
+
+
+
+
+

Partitioning with the Kafka Binder

+
+

Apache Kafka supports topic partitioning natively.

+
+
+

Sometimes it is advantageous to send data to specific partitions — for example, when you want to strictly order message processing (all messages for a particular customer should go to the same partition).

+
+
+

The following example shows how to configure the producer and consumer side:

+
+
+
+
@SpringBootApplication
+@EnableBinding(Source.class)
+public class KafkaPartitionProducerApplication {
+
+    private static final Random RANDOM = new Random(System.currentTimeMillis());
+
+    private static final String[] data = new String[] {
+            "foo1", "bar1", "qux1",
+            "foo2", "bar2", "qux2",
+            "foo3", "bar3", "qux3",
+            "foo4", "bar4", "qux4",
+            };
+
+    public static void main(String[] args) {
+        new SpringApplicationBuilder(KafkaPartitionProducerApplication.class)
+            .web(false)
+            .run(args);
+    }
+
+    @InboundChannelAdapter(channel = Source.OUTPUT, poller = @Poller(fixedRate = "5000"))
+    public Message<?> generate() {
+        String value = data[RANDOM.nextInt(data.length)];
+        System.out.println("Sending: " + value);
+        return MessageBuilder.withPayload(value)
+                .setHeader("partitionKey", value)
+                .build();
+    }
+
+}
+
+
+
+
application.yml
+
+
spring:
+  cloud:
+    stream:
+      bindings:
+        output:
+          destination: partitioned.topic
+          producer:
+            partition-key-expression: headers['partitionKey']
+            partition-count: 12
+
+
+
+ + + + + +
+ + +The topic must be provisioned to have enough partitions to achieve the desired concurrency for all consumer groups. +The above configuration supports up to 12 consumer instances (6 if their concurrency is 2, 4 if their concurrency is 3, and so on). +It is generally best to “over-provision” the partitions to allow for future increases in consumers or concurrency. +
+
+
+ + + + + +
+ + +The preceding configuration uses the default partitioning (key.hashCode() % partitionCount). +This may or may not provide a suitably balanced algorithm, depending on the key values. +You can override this default by using the partitionSelectorExpression or partitionSelectorClass properties. +
+
+
+

Since partitions are natively handled by Kafka, no special configuration is needed on the consumer side. +Kafka allocates partitions across the instances.

+
+
+

The following Spring Boot application listens to a Kafka stream and prints (to the console) the partition ID to which each message goes:

+
+
+
+
@SpringBootApplication
+@EnableBinding(Sink.class)
+public class KafkaPartitionConsumerApplication {
+
+    public static void main(String[] args) {
+        new SpringApplicationBuilder(KafkaPartitionConsumerApplication.class)
+            .web(false)
+            .run(args);
+    }
+
+    @StreamListener(Sink.INPUT)
+    public void listen(@Payload String in, @Header(KafkaHeaders.RECEIVED_PARTITION_ID) int partition) {
+        System.out.println(in + " received from partition " + partition);
+    }
+
+}
+
+
+
+
application.yml
+
+
spring:
+  cloud:
+    stream:
+      bindings:
+        input:
+          destination: partitioned.topic
+          group: myGroup
+
+
+
+

You can add instances as needed. +Kafka rebalances the partition allocations. +If the instance count (or instance count * concurrency) exceeds the number of partitions, some consumers are idle.

+
+
+
+
+ + + + + + + \ No newline at end of file diff --git a/spring-cloud-stream-binder-kafka/3.0.0.RELEASE/reference/html/spring-cloud-stream-binder-kafka.html b/spring-cloud-stream-binder-kafka/3.0.0.RELEASE/reference/html/spring-cloud-stream-binder-kafka.html new file mode 100644 index 00000000..593b8370 --- /dev/null +++ b/spring-cloud-stream-binder-kafka/3.0.0.RELEASE/reference/html/spring-cloud-stream-binder-kafka.html @@ -0,0 +1,3818 @@ + + + + + + + + +Spring Cloud Stream Kafka Binder Reference Guide + + + + + + + + + + +
+
+
+
+

3.0.0.RELEASE

+
+
+
+

Reference Guide

+
+
+
+

This guide describes the Apache Kafka implementation of the Spring Cloud Stream Binder. +It contains information about its design, usage, and configuration options, as well as information on how the Stream Cloud Stream concepts map onto Apache Kafka specific constructs. +In addition, this guide explains the Kafka Streams binding capabilities of Spring Cloud Stream.

+
+
+
+
+

1. Apache Kafka Binder

+
+
+

1.1. Usage

+
+

To use Apache Kafka binder, you need to add spring-cloud-stream-binder-kafka as a dependency to your Spring Cloud Stream application, as shown in the following example for Maven:

+
+
+
+
<dependency>
+  <groupId>org.springframework.cloud</groupId>
+  <artifactId>spring-cloud-stream-binder-kafka</artifactId>
+</dependency>
+
+
+
+

Alternatively, you can also use the Spring Cloud Stream Kafka Starter, as shown in the following example for Maven:

+
+
+
+
<dependency>
+  <groupId>org.springframework.cloud</groupId>
+  <artifactId>spring-cloud-starter-stream-kafka</artifactId>
+</dependency>
+
+
+
+
+

1.2. Overview

+
+

The following image shows a simplified diagram of how the Apache Kafka binder operates:

+
+
+
+kafka binder +
+
Figure 1. Kafka Binder
+
+
+

The Apache Kafka Binder implementation maps each destination to an Apache Kafka topic. +The consumer group maps directly to the same Apache Kafka concept. +Partitioning also maps directly to Apache Kafka partitions as well.

+
+
+

The binder currently uses the Apache Kafka kafka-clients version 2.3.1. +This client can communicate with older brokers (see the Kafka documentation), but certain features may not be available. +For example, with versions earlier than 0.11.x.x, native headers are not supported. +Also, 0.11.x.x does not support the autoAddPartitions property.

+
+
+
+

1.3. Configuration Options

+
+

This section contains the configuration options used by the Apache Kafka binder.

+
+
+

For common configuration options and properties pertaining to binder, see the core documentation.

+
+
+

1.3.1. Kafka Binder Properties

+
+
+
spring.cloud.stream.kafka.binder.brokers
+
+

A list of brokers to which the Kafka binder connects.

+
+

Default: localhost.

+
+
+
spring.cloud.stream.kafka.binder.defaultBrokerPort
+
+

brokers allows hosts specified with or without port information (for example, host1,host2:port2). +This sets the default port when no port is configured in the broker list.

+
+

Default: 9092.

+
+
+
spring.cloud.stream.kafka.binder.configuration
+
+

Key/Value map of client properties (both producers and consumer) passed to all clients created by the binder. +Due to the fact that these properties are used by both producers and consumers, usage should be restricted to common properties — for example, security settings. +Unknown Kafka producer or consumer properties provided through this configuration are filtered out and not allowed to propagate. +Properties here supersede any properties set in boot.

+
+

Default: Empty map.

+
+
+
spring.cloud.stream.kafka.binder.consumerProperties
+
+

Key/Value map of arbitrary Kafka client consumer properties. +In addition to support known Kafka consumer properties, unknown consumer properties are allowed here as well. +Properties here supersede any properties set in boot and in the configuration property above.

+
+

Default: Empty map.

+
+
+
spring.cloud.stream.kafka.binder.headers
+
+

The list of custom headers that are transported by the binder. +Only required when communicating with older applications (⇐ 1.3.x) with a kafka-clients version < 0.11.0.0. Newer versions support headers natively.

+
+

Default: empty.

+
+
+
spring.cloud.stream.kafka.binder.healthTimeout
+
+

The time to wait to get partition information, in seconds. +Health reports as down if this timer expires.

+
+

Default: 10.

+
+
+
spring.cloud.stream.kafka.binder.requiredAcks
+
+

The number of required acks on the broker. +See the Kafka documentation for the producer acks property.

+
+

Default: 1.

+
+
+
spring.cloud.stream.kafka.binder.minPartitionCount
+
+

Effective only if autoCreateTopics or autoAddPartitions is set. +The global minimum number of partitions that the binder configures on topics on which it produces or consumes data. +It can be superseded by the partitionCount setting of the producer or by the value of instanceCount * concurrency settings of the producer (if either is larger).

+
+

Default: 1.

+
+
+
spring.cloud.stream.kafka.binder.producerProperties
+
+

Key/Value map of arbitrary Kafka client producer properties. +In addition to support known Kafka producer properties, unknown producer properties are allowed here as well. +Properties here supersede any properties set in boot and in the configuration property above.

+
+

Default: Empty map.

+
+
+
spring.cloud.stream.kafka.binder.replicationFactor
+
+

The replication factor of auto-created topics if autoCreateTopics is active. +Can be overridden on each binding.

+
+

Default: 1.

+
+
+
spring.cloud.stream.kafka.binder.autoCreateTopics
+
+

If set to true, the binder creates new topics automatically. +If set to false, the binder relies on the topics being already configured. +In the latter case, if the topics do not exist, the binder fails to start.

+
+ + + + + +
+ + +This setting is independent of the auto.create.topics.enable setting of the broker and does not influence it. +If the server is set to auto-create topics, they may be created as part of the metadata retrieval request, with default broker settings. +
+
+
+

Default: true.

+
+
+
spring.cloud.stream.kafka.binder.autoAddPartitions
+
+

If set to true, the binder creates new partitions if required. +If set to false, the binder relies on the partition size of the topic being already configured. +If the partition count of the target topic is smaller than the expected value, the binder fails to start.

+
+

Default: false.

+
+
+
spring.cloud.stream.kafka.binder.transaction.transactionIdPrefix
+
+

Enables transactions in the binder. See transaction.id in the Kafka documentation and Transactions in the spring-kafka documentation. +When transactions are enabled, individual producer properties are ignored and all producers use the spring.cloud.stream.kafka.binder.transaction.producer.* properties.

+
+

Default null (no transactions)

+
+
+
spring.cloud.stream.kafka.binder.transaction.producer.*
+
+

Global producer properties for producers in a transactional binder. +See spring.cloud.stream.kafka.binder.transaction.transactionIdPrefix and Kafka Producer Properties and the general producer properties supported by all binders.

+
+

Default: See individual producer properties.

+
+
+
spring.cloud.stream.kafka.binder.headerMapperBeanName
+
+

The bean name of a KafkaHeaderMapper used for mapping spring-messaging headers to and from Kafka headers. +Use this, for example, if you wish to customize the trusted packages in a BinderHeaderMapper bean that uses JSON deserialization for the headers. +If this custom BinderHeaderMapper bean is not made available to the binder using this property, then the binder will look for a header mapper bean with the name kafkaBinderHeaderMapper that is of type BinderHeaderMapper before falling back to a default BinderHeaderMapper created by the binder.

+
+

Default: none.

+
+
+
+
+
+
+

1.3.2. Kafka Consumer Properties

+
+ + + + + +
+ + +To avoid repetition, Spring Cloud Stream supports setting values for all channels, in the format of spring.cloud.stream.kafka.default.consumer.<property>=<value>. +
+
+
+

The following properties are available for Kafka consumers only and +must be prefixed with spring.cloud.stream.kafka.bindings.<channelName>.consumer..

+
+
+
+
admin.configuration
+
+

Since version 2.1.1, this property is deprecated in favor of topic.properties, and support for it will be removed in a future version.

+
+
admin.replicas-assignment
+
+

Since version 2.1.1, this property is deprecated in favor of topic.replicas-assignment, and support for it will be removed in a future version.

+
+
admin.replication-factor
+
+

Since version 2.1.1, this property is deprecated in favor of topic.replication-factor, and support for it will be removed in a future version.

+
+
autoRebalanceEnabled
+
+

When true, topic partitions is automatically rebalanced between the members of a consumer group. +When false, each consumer is assigned a fixed set of partitions based on spring.cloud.stream.instanceCount and spring.cloud.stream.instanceIndex. +This requires both the spring.cloud.stream.instanceCount and spring.cloud.stream.instanceIndex properties to be set appropriately on each launched instance. +The value of the spring.cloud.stream.instanceCount property must typically be greater than 1 in this case.

+
+

Default: true.

+
+
+
ackEachRecord
+
+

When autoCommitOffset is true, this setting dictates whether to commit the offset after each record is processed. +By default, offsets are committed after all records in the batch of records returned by consumer.poll() have been processed. +The number of records returned by a poll can be controlled with the max.poll.records Kafka property, which is set through the consumer configuration property. +Setting this to true may cause a degradation in performance, but doing so reduces the likelihood of redelivered records when a failure occurs. +Also, see the binder requiredAcks property, which also affects the performance of committing offsets.

+
+

Default: false.

+
+
+
autoCommitOffset
+
+

Whether to autocommit offsets when a message has been processed. +If set to false, a header with the key kafka_acknowledgment of the type org.springframework.kafka.support.Acknowledgment header is present in the inbound message. +Applications may use this header for acknowledging messages. +See the examples section for details. +When this property is set to false, Kafka binder sets the ack mode to org.springframework.kafka.listener.AbstractMessageListenerContainer.AckMode.MANUAL and the application is responsible for acknowledging records. +Also see ackEachRecord.

+
+

Default: true.

+
+
+
autoCommitOnError
+
+

Effective only if autoCommitOffset is set to true. +If set to false, it suppresses auto-commits for messages that result in errors and commits only for successful messages. It allows a stream to automatically replay from the last successfully processed message, in case of persistent failures. +If set to true, it always auto-commits (if auto-commit is enabled). +If not set (the default), it effectively has the same value as enableDlq, auto-committing erroneous messages if they are sent to a DLQ and not committing them otherwise.

+
+

Default: not set.

+
+
+
resetOffsets
+
+

Whether to reset offsets on the consumer to the value provided by startOffset. +Must be false if a KafkaRebalanceListener is provided; see Using a KafkaRebalanceListener.

+
+

Default: false.

+
+
+
startOffset
+
+

The starting offset for new groups. +Allowed values: earliest and latest. +If the consumer group is set explicitly for the consumer 'binding' (through spring.cloud.stream.bindings.<channelName>.group), 'startOffset' is set to earliest. Otherwise, it is set to latest for the anonymous consumer group. +Also see resetOffsets (earlier in this list).

+
+

Default: null (equivalent to earliest).

+
+
+
enableDlq
+
+

When set to true, it enables DLQ behavior for the consumer. +By default, messages that result in errors are forwarded to a topic named error.<destination>.<group>. +The DLQ topic name can be configurable by setting the dlqName property. +This provides an alternative option to the more common Kafka replay scenario for the case when the number of errors is relatively small and replaying the entire original topic may be too cumbersome. +See Dead-Letter Topic Processing processing for more information. +Starting with version 2.0, messages sent to the DLQ topic are enhanced with the following headers: x-original-topic, x-exception-message, and x-exception-stacktrace as byte[]. +By default, a failed record is sent to the same partition number in the DLQ topic as the original record. +See Dead-Letter Topic Partition Selection for how to change that behavior. +Not allowed when destinationIsPattern is true.

+
+

Default: false.

+
+
+
dlqPartitions
+
+

When enableDlq is true, and this property is not set, a dead letter topic with the same number of partitions as the primary topic(s) is created. +Usually, dead-letter records are sent to the same partition in the dead-letter topic as the original record. +This behavior can be changed; see Dead-Letter Topic Partition Selection. +If this property is set to 1 and there is no DqlPartitionFunction bean, all dead-letter records will be written to partition 0. +If this property is greater than 1, you MUST provide a DlqPartitionFunction bean. +Note that the actual partition count is affected by the binder’s minPartitionCount property.

+
+

Default: none

+
+
+
configuration
+
+

Map with a key/value pair containing generic Kafka consumer properties. +In addition to having Kafka consumer properties, other configuration properties can be passed here. +For example some properties needed by the application such as spring.cloud.stream.kafka.bindings.input.consumer.configuration.foo=bar.

+
+

Default: Empty map.

+
+
+
dlqName
+
+

The name of the DLQ topic to receive the error messages.

+
+

Default: null (If not specified, messages that result in errors are forwarded to a topic named error.<destination>.<group>).

+
+
+
dlqProducerProperties
+
+

Using this, DLQ-specific producer properties can be set. +All the properties available through kafka producer properties can be set through this property. +When native decoding is enabled on the consumer (i.e., useNativeDecoding: true) , the application must provide corresponding key/value serializers for DLQ. +This must be provided in the form of dlqProducerProperties.configuration.key.serializer and dlqProducerProperties.configuration.value.serializer.

+
+

Default: Default Kafka producer properties.

+
+
+
standardHeaders
+
+

Indicates which standard headers are populated by the inbound channel adapter. +Allowed values: none, id, timestamp, or both. +Useful if using native deserialization and the first component to receive a message needs an id (such as an aggregator that is configured to use a JDBC message store).

+
+

Default: none

+
+
+
converterBeanName
+
+

The name of a bean that implements RecordMessageConverter. Used in the inbound channel adapter to replace the default MessagingMessageConverter.

+
+

Default: null

+
+
+
idleEventInterval
+
+

The interval, in milliseconds, between events indicating that no messages have recently been received. +Use an ApplicationListener<ListenerContainerIdleEvent> to receive these events. +See Example: Pausing and Resuming the Consumer for a usage example.

+
+

Default: 30000

+
+
+
destinationIsPattern
+
+

When true, the destination is treated as a regular expression Pattern used to match topic names by the broker. +When true, topics are not provisioned, and enableDlq is not allowed, because the binder does not know the topic names during the provisioning phase. +Note, the time taken to detect new topics that match the pattern is controlled by the consumer property metadata.max.age.ms, which (at the time of writing) defaults to 300,000ms (5 minutes). +This can be configured using the configuration property above.

+
+

Default: false

+
+
+
topic.properties
+
+

A Map of Kafka topic properties used when provisioning new topics — for example, spring.cloud.stream.kafka.bindings.input.consumer.topic.properties.message.format.version=0.9.0.0

+
+

Default: none.

+
+
+
topic.replicas-assignment
+
+

A Map<Integer, List<Integer>> of replica assignments, with the key being the partition and the value being the assignments. +Used when provisioning new topics. +See the NewTopic Javadocs in the kafka-clients jar.

+
+

Default: none.

+
+
+
topic.replication-factor
+
+

The replication factor to use when provisioning topics. Overrides the binder-wide setting. +Ignored if replicas-assignments is present.

+
+

Default: none (the binder-wide default of 1 is used).

+
+
+
pollTimeout
+
+

Timeout used for polling in pollable consumers.

+
+

Default: 5 seconds.

+
+
+
+
+
+
+

1.3.3. Consuming Batches

+
+

Starting with version 3.0, when spring.cloud.stream.binding.<name>.consumer.batch-mode is set to true, all of the records received by polling the Kafka Consumer will be presented as a List<?> to the listener method. +Otherwise, the method will be called with one record at a time. +The size of the batch is controlled by Kafka consumer properties max.poll.records, min.fetch.bytes, fetch.max.wait.ms; refer to the Kafka documentation for more information.

+
+
+ + + + + +
+ + +Retry within the binder is not supported when using batch mode, so maxAttempts will be overridden to 1. +You can configure a SeekToCurrentBatchErrorHandler (using a ListenerContainerCustomizer) to achieve similar functionality to retry in the binder. +You can also use a manual AckMode and call Ackowledgment.nack(index, sleep) to commit the offsets for a partial batch and have the remaining records redelivered. +Refer to the Spring for Apache Kafka documentation for more information about these techniques. +
+
+
+
+

1.3.4. Kafka Producer Properties

+
+ + + + + +
+ + +To avoid repetition, Spring Cloud Stream supports setting values for all channels, in the format of spring.cloud.stream.kafka.default.producer.<property>=<value>. +
+
+
+

The following properties are available for Kafka producers only and +must be prefixed with spring.cloud.stream.kafka.bindings.<channelName>.producer..

+
+
+
+
admin.configuration
+
+

Since version 2.1.1, this property is deprecated in favor of topic.properties, and support for it will be removed in a future version.

+
+
admin.replicas-assignment
+
+

Since version 2.1.1, this property is deprecated in favor of topic.replicas-assignment, and support for it will be removed in a future version.

+
+
admin.replication-factor
+
+

Since version 2.1.1, this property is deprecated in favor of topic.replication-factor, and support for it will be removed in a future version.

+
+
bufferSize
+
+

Upper limit, in bytes, of how much data the Kafka producer attempts to batch before sending.

+
+

Default: 16384.

+
+
+
sync
+
+

Whether the producer is synchronous.

+
+

Default: false.

+
+
+
sendTimeoutExpression
+
+

A SpEL expression evaluated against the outgoing message used to evaluate the time to wait for ack when synchronous publish is enabled — for example, headers['mySendTimeout']. +The value of the timeout is in milliseconds. +With versions before 3.0, the payload could not be used unless native encoding was being used because, by the time this expression was evaluated, the payload was already in the form of a byte[]. +Now, the expression is evaluated before the payload is converted.

+
+

Default: none.

+
+
+
batchTimeout
+
+

How long the producer waits to allow more messages to accumulate in the same batch before sending the messages. +(Normally, the producer does not wait at all and simply sends all the messages that accumulated while the previous send was in progress.) A non-zero value may increase throughput at the expense of latency.

+
+

Default: 0.

+
+
+
messageKeyExpression
+
+

A SpEL expression evaluated against the outgoing message used to populate the key of the produced Kafka message — for example, headers['myKey']. +With versions before 3.0, the payload could not be used unless native encoding was being used because, by the time this expression was evaluated, the payload was already in the form of a byte[]. +Now, the expression is evaluated before the payload is converted.

+
+

Default: none.

+
+
+
headerPatterns
+
+

A comma-delimited list of simple patterns to match Spring messaging headers to be mapped to the Kafka Headers in the ProducerRecord. +Patterns can begin or end with the wildcard character (asterisk). +Patterns can be negated by prefixing with !. +Matching stops after the first match (positive or negative). +For example !ask,as* will pass ash but not ask. +id and timestamp are never mapped.

+
+

Default: * (all headers - except the id and timestamp)

+
+
+
configuration
+
+

Map with a key/value pair containing generic Kafka producer properties.

+
+

Default: Empty map.

+
+
+
topic.properties
+
+

A Map of Kafka topic properties used when provisioning new topics — for example, spring.cloud.stream.kafka.bindings.output.producer.topic.properties.message.format.version=0.9.0.0

+
+
topic.replicas-assignment
+
+

A Map<Integer, List<Integer>> of replica assignments, with the key being the partition and the value being the assignments. +Used when provisioning new topics. +See the NewTopic Javadocs in the kafka-clients jar.

+
+

Default: none.

+
+
+
topic.replication-factor
+
+

The replication factor to use when provisioning topics. Overrides the binder-wide setting. +Ignored if replicas-assignments is present.

+
+

Default: none (the binder-wide default of 1 is used).

+
+
+
useTopicHeader
+
+

Set to true to override the default binding destination (topic name) with the value of the KafkaHeaders.TOPIC message header in the outbound message. +If the header is not present, the default binding destination is used. +Default: false.

+
+
recordMetadataChannel
+
+

The bean name of a MessageChannel to which successful send results should be sent; the bean must exist in the application context. +The message sent to the channel is the sent message (after conversion, if any) with an additional header KafkaHeaders.RECORD_METADATA. +The header contains a RecordMetadata object provided by the Kafka client; it includes the partition and offset where the record was written in the topic.

+
+
+
+
+

ResultMetadata meta = sendResultMsg.getHeaders().get(KafkaHeaders.RECORD_METADATA, RecordMetadata.class)

+
+
+

Failed sends go the producer error channel (if configured); see Error Channels. +Default: null

+
+
+

+

+
+
+ + + + + +
+ + +The Kafka binder uses the partitionCount setting of the producer as a hint to create a topic with the given partition count (in conjunction with the minPartitionCount, the maximum of the two being the value being used). +Exercise caution when configuring both minPartitionCount for a binder and partitionCount for an application, as the larger value is used. +If a topic already exists with a smaller partition count and autoAddPartitions is disabled (the default), the binder fails to start. +If a topic already exists with a smaller partition count and autoAddPartitions is enabled, new partitions are added. +If a topic already exists with a larger number of partitions than the maximum of (minPartitionCount or partitionCount), the existing partition count is used. +
+
+
+
+
compression
+
+

Set the compression.type producer property. +Supported values are none, gzip, snappy and lz4. +If you override the kafka-clients jar to 2.1.0 (or later), as discussed in the Spring for Apache Kafka documentation, and wish to use zstd compression, use spring.cloud.stream.kafka.bindings.<binding-name>.producer.configuration.compression.type=zstd.

+
+

Default: none.

+
+
+
+
+
+
+

1.3.5. Usage examples

+
+

In this section, we show the use of the preceding properties for specific scenarios.

+
+
+
Example: Setting autoCommitOffset to false and Relying on Manual Acking
+
+

This example illustrates how one may manually acknowledge offsets in a consumer application.

+
+
+

This example requires that spring.cloud.stream.kafka.bindings.input.consumer.autoCommitOffset be set to false. +Use the corresponding input channel name for your example.

+
+
+
+
@SpringBootApplication
+@EnableBinding(Sink.class)
+public class ManuallyAcknowdledgingConsumer {
+
+ public static void main(String[] args) {
+     SpringApplication.run(ManuallyAcknowdledgingConsumer.class, args);
+ }
+
+ @StreamListener(Sink.INPUT)
+ public void process(Message<?> message) {
+     Acknowledgment acknowledgment = message.getHeaders().get(KafkaHeaders.ACKNOWLEDGMENT, Acknowledgment.class);
+     if (acknowledgment != null) {
+         System.out.println("Acknowledgment provided");
+         acknowledgment.acknowledge();
+     }
+ }
+}
+
+
+
+
+
Example: Security Configuration
+
+

Apache Kafka 0.9 supports secure connections between client and brokers. +To take advantage of this feature, follow the guidelines in the Apache Kafka Documentation as well as the Kafka 0.9 security guidelines from the Confluent documentation. +Use the spring.cloud.stream.kafka.binder.configuration option to set security properties for all clients created by the binder.

+
+
+

For example, to set security.protocol to SASL_SSL, set the following property:

+
+
+
+
spring.cloud.stream.kafka.binder.configuration.security.protocol=SASL_SSL
+
+
+
+

All the other security properties can be set in a similar manner.

+
+
+

When using Kerberos, follow the instructions in the reference documentation for creating and referencing the JAAS configuration.

+
+
+

Spring Cloud Stream supports passing JAAS configuration information to the application by using a JAAS configuration file and using Spring Boot properties.

+
+
+
Using JAAS Configuration Files
+
+

The JAAS and (optionally) krb5 file locations can be set for Spring Cloud Stream applications by using system properties. +The following example shows how to launch a Spring Cloud Stream application with SASL and Kerberos by using a JAAS configuration file:

+
+
+
+
 java -Djava.security.auth.login.config=/path.to/kafka_client_jaas.conf -jar log.jar \
+   --spring.cloud.stream.kafka.binder.brokers=secure.server:9092 \
+   --spring.cloud.stream.bindings.input.destination=stream.ticktock \
+   --spring.cloud.stream.kafka.binder.configuration.security.protocol=SASL_PLAINTEXT
+
+
+
+
+
Using Spring Boot Properties
+
+

As an alternative to having a JAAS configuration file, Spring Cloud Stream provides a mechanism for setting up the JAAS configuration for Spring Cloud Stream applications by using Spring Boot properties.

+
+
+

The following properties can be used to configure the login context of the Kafka client:

+
+
+
+
spring.cloud.stream.kafka.binder.jaas.loginModule
+
+

The login module name. Not necessary to be set in normal cases.

+
+

Default: com.sun.security.auth.module.Krb5LoginModule.

+
+
+
spring.cloud.stream.kafka.binder.jaas.controlFlag
+
+

The control flag of the login module.

+
+

Default: required.

+
+
+
spring.cloud.stream.kafka.binder.jaas.options
+
+

Map with a key/value pair containing the login module options.

+
+

Default: Empty map.

+
+
+
+
+
+

The following example shows how to launch a Spring Cloud Stream application with SASL and Kerberos by using Spring Boot configuration properties:

+
+
+
+
 java --spring.cloud.stream.kafka.binder.brokers=secure.server:9092 \
+   --spring.cloud.stream.bindings.input.destination=stream.ticktock \
+   --spring.cloud.stream.kafka.binder.autoCreateTopics=false \
+   --spring.cloud.stream.kafka.binder.configuration.security.protocol=SASL_PLAINTEXT \
+   --spring.cloud.stream.kafka.binder.jaas.options.useKeyTab=true \
+   --spring.cloud.stream.kafka.binder.jaas.options.storeKey=true \
+   --spring.cloud.stream.kafka.binder.jaas.options.keyTab=/etc/security/keytabs/kafka_client.keytab \
+   --spring.cloud.stream.kafka.binder.jaas.options.principal=kafka-client-1@EXAMPLE.COM
+
+
+
+

The preceding example represents the equivalent of the following JAAS file:

+
+
+
+
KafkaClient {
+    com.sun.security.auth.module.Krb5LoginModule required
+    useKeyTab=true
+    storeKey=true
+    keyTab="/etc/security/keytabs/kafka_client.keytab"
+    principal="kafka-client-1@EXAMPLE.COM";
+};
+
+
+
+

If the topics required already exist on the broker or will be created by an administrator, autocreation can be turned off and only client JAAS properties need to be sent.

+
+
+ + + + + +
+ + +Do not mix JAAS configuration files and Spring Boot properties in the same application. +If the -Djava.security.auth.login.config system property is already present, Spring Cloud Stream ignores the Spring Boot properties. +
+
+
+ + + + + +
+ + +Be careful when using the autoCreateTopics and autoAddPartitions with Kerberos. +Usually, applications may use principals that do not have administrative rights in Kafka and Zookeeper. +Consequently, relying on Spring Cloud Stream to create/modify topics may fail. +In secure environments, we strongly recommend creating topics and managing ACLs administratively by using Kafka tooling. +
+
+
+
+
+
Example: Pausing and Resuming the Consumer
+
+

If you wish to suspend consumption but not cause a partition rebalance, you can pause and resume the consumer. +This is facilitated by adding the Consumer as a parameter to your @StreamListener. +To resume, you need an ApplicationListener for ListenerContainerIdleEvent instances. +The frequency at which events are published is controlled by the idleEventInterval property. +Since the consumer is not thread-safe, you must call these methods on the calling thread.

+
+
+

The following simple application shows how to pause and resume:

+
+
+
+
@SpringBootApplication
+@EnableBinding(Sink.class)
+public class Application {
+
+	public static void main(String[] args) {
+		SpringApplication.run(Application.class, args);
+	}
+
+	@StreamListener(Sink.INPUT)
+	public void in(String in, @Header(KafkaHeaders.CONSUMER) Consumer<?, ?> consumer) {
+		System.out.println(in);
+		consumer.pause(Collections.singleton(new TopicPartition("myTopic", 0)));
+	}
+
+	@Bean
+	public ApplicationListener<ListenerContainerIdleEvent> idleListener() {
+		return event -> {
+			System.out.println(event);
+			if (event.getConsumer().paused().size() > 0) {
+				event.getConsumer().resume(event.getConsumer().paused());
+			}
+		};
+	}
+
+}
+
+
+
+
+
+
+

1.4. Transactional Binder

+
+

Enable transactions by setting spring.cloud.stream.kafka.binder.transaction.transactionIdPrefix to a non-empty value, e.g. tx-. +When used in a processor application, the consumer starts the transaction; any records sent on the consumer thread participate in the same transaction. +When the listener exits normally, the listener container will send the offset to the transaction and commit it. +A common producer factory is used for all producer bindings configured using spring.cloud.stream.kafka.binder.transaction.producer.* properties; individual binding Kafka producer properties are ignored.

+
+
+ + + + + +
+ + +Normal binder retries (and dead lettering) are not supported with transactions because the retries will run in the original transaction, which may be rolled back and any published records will be rolled back too. +When retries are enabled (the common property maxAttempts is greater than zero) the retry properties are used to configure a DefaultAfterRollbackProcessor to enable retries at the container level. +Similarly, instead of publishing dead-letter records within the transaction, this functionality is moved to the listener container, again via the DefaultAfterRollbackProcessor which runs after the main transaction has rolled back. +
+
+
+

If you wish to use transactions in a source application, or from some arbitrary thread for producer-only transaction (e.g. @Scheduled method), you must get a reference to the transactional producer factory and define a KafkaTransactionManager bean using it.

+
+
+
+
+
+
@Bean
+public PlatformTransactionManager transactionManager(BinderFactory binders) {
+    ProducerFactory<byte[], byte[]> pf = ((KafkaMessageChannelBinder) binders.getBinder(null,
+            MessageChannel.class)).getTransactionalProducerFactory();
+    return new KafkaTransactionManager<>(pf);
+}
+
+
+
+
+
+

Notice that we get a reference to the binder using the BinderFactory; use null in the first argument when there is only one binder configured. +If more than one binder is configured, use the binder name to get the reference. +Once we have a reference to the binder, we can obtain a reference to the ProducerFactory and create a transaction manager.

+
+
+

Then you would use normal Spring transaction support, e.g. TransactionTemplate or @Transactional, for example:

+
+
+
+
+
+
public static class Sender {
+
+    @Transactional
+    public void doInTransaction(MessageChannel output, List<String> stuffToSend) {
+        stuffToSend.forEach(stuff -> output.send(new GenericMessage<>(stuff)));
+    }
+
+}
+
+
+
+
+
+

If you wish to synchronize producer-only transactions with those from some other transaction manager, use a ChainedTransactionManager.

+
+
+
+

1.5. Error Channels

+
+

Starting with version 1.3, the binder unconditionally sends exceptions to an error channel for each consumer destination and can also be configured to send async producer send failures to an error channel. +See [spring-cloud-stream-overview-error-handling] for more information.

+
+
+

The payload of the ErrorMessage for a send failure is a KafkaSendFailureException with properties:

+
+
+
    +
  • +

    failedMessage: The Spring Messaging Message<?> that failed to be sent.

    +
  • +
  • +

    record: The raw ProducerRecord that was created from the failedMessage

    +
  • +
+
+
+

There is no automatic handling of producer exceptions (such as sending to a Dead-Letter queue). +You can consume these exceptions with your own Spring Integration flow.

+
+
+
+

1.6. Kafka Metrics

+
+

Kafka binder module exposes the following metrics:

+
+
+

spring.cloud.stream.binder.kafka.offset: This metric indicates how many messages have not been yet consumed from a given binder’s topic by a given consumer group. +The metrics provided are based on the Mircometer metrics library. The metric contains the consumer group information, topic and the actual lag in committed offset from the latest offset on the topic. +This metric is particularly useful for providing auto-scaling feedback to a PaaS platform.

+
+
+
+

1.7. Tombstone Records (null record values)

+
+

When using compacted topics, a record with a null value (also called a tombstone record) represents the deletion of a key. +To receive such messages in a @StreamListener method, the parameter must be marked as not required to receive a null value argument.

+
+
+
+
+
+
@StreamListener(Sink.INPUT)
+public void in(@Header(KafkaHeaders.RECEIVED_MESSAGE_KEY) byte[] key,
+               @Payload(required = false) Customer customer) {
+    // customer is null if a tombstone record
+    ...
+}
+
+
+
+
+
+
+

1.8. Using a KafkaRebalanceListener

+
+

Applications may wish to seek topics/partitions to arbitrary offsets when the partitions are initially assigned, or perform other operations on the consumer. +Starting with version 2.1, if you provide a single KafkaRebalanceListener bean in the application context, it will be wired into all Kafka consumer bindings.

+
+
+
+
+
+
public interface KafkaBindingRebalanceListener {
+
+	/**
+	 * Invoked by the container before any pending offsets are committed.
+	 * @param bindingName the name of the binding.
+	 * @param consumer the consumer.
+	 * @param partitions the partitions.
+	 */
+	default void onPartitionsRevokedBeforeCommit(String bindingName, Consumer<?, ?> consumer,
+			Collection<TopicPartition> partitions) {
+
+	}
+
+	/**
+	 * Invoked by the container after any pending offsets are committed.
+	 * @param bindingName the name of the binding.
+	 * @param consumer the consumer.
+	 * @param partitions the partitions.
+	 */
+	default void onPartitionsRevokedAfterCommit(String bindingName, Consumer<?, ?> consumer, Collection<TopicPartition> partitions) {
+
+	}
+
+	/**
+	 * Invoked when partitions are initially assigned or after a rebalance.
+	 * Applications might only want to perform seek operations on an initial assignment.
+	 * @param bindingName the name of the binding.
+	 * @param consumer the consumer.
+	 * @param partitions the partitions.
+	 * @param initial true if this is the initial assignment.
+	 */
+	default void onPartitionsAssigned(String bindingName, Consumer<?, ?> consumer, Collection<TopicPartition> partitions,
+			boolean initial) {
+
+	}
+
+}
+
+
+
+
+
+

You cannot set the resetOffsets consumer property to true when you provide a rebalance listener.

+
+
+
+

1.9. Dead-Letter Topic Processing

+
+

1.9.1. Dead-Letter Topic Partition Selection

+
+

By default, records are published to the Dead-Letter topic using the same partition as the original record. +This means the Dead-Letter topic must have at least as many partitions as the original record.

+
+
+

To change this behavior, add a DlqPartitionFunction implementation as a @Bean to the application context. +Only one such bean can be present. +The function is provided with the consumer group, the failed ConsumerRecord and the exception. +For example, if you always want to route to partition 0, you might use:

+
+
+
+
+
+
@Bean
+public DlqPartitionFunction partitionFunction() {
+    return (group, record, ex) -> 0;
+}
+
+
+
+
+
+ + + + + +
+ + +If you set a consumer binding’s dlqPartitions property to 1 (and the binder’s minPartitionCount is equal to 1), there is no need to supply a DlqPartitionFunction; the framework will always use partition 0. +If you set a consumer binding’s dlqPartitions property to a value greater than 1 (or the binder’s minPartitionCount is greater than 1), you must provide a DlqPartitionFunction bean, even if the partition count is the same as the original topic’s. +
+
+
+
+

1.9.2. Handling Records in a Dead-Letter Topic

+
+

Because the framework cannot anticipate how users would want to dispose of dead-lettered messages, it does not provide any standard mechanism to handle them. +If the reason for the dead-lettering is transient, you may wish to route the messages back to the original topic. +However, if the problem is a permanent issue, that could cause an infinite loop. +The sample Spring Boot application within this topic is an example of how to route those messages back to the original topic, but it moves them to a “parking lot” topic after three attempts. +The application is another spring-cloud-stream application that reads from the dead-letter topic. +It terminates when no messages are received for 5 seconds.

+
+
+

The examples assume the original destination is so8400out and the consumer group is so8400.

+
+
+

There are a couple of strategies to consider:

+
+
+
    +
  • +

    Consider running the rerouting only when the main application is not running. +Otherwise, the retries for transient errors are used up very quickly.

    +
  • +
  • +

    Alternatively, use a two-stage approach: Use this application to route to a third topic and another to route from there back to the main topic.

    +
  • +
+
+
+

The following code listings show the sample application:

+
+
+
application.properties
+
+
spring.cloud.stream.bindings.input.group=so8400replay
+spring.cloud.stream.bindings.input.destination=error.so8400out.so8400
+
+spring.cloud.stream.bindings.output.destination=so8400out
+
+spring.cloud.stream.bindings.parkingLot.destination=so8400in.parkingLot
+
+spring.cloud.stream.kafka.binder.configuration.auto.offset.reset=earliest
+
+spring.cloud.stream.kafka.binder.headers=x-retries
+
+
+
+
Application
+
+
@SpringBootApplication
+@EnableBinding(TwoOutputProcessor.class)
+public class ReRouteDlqKApplication implements CommandLineRunner {
+
+    private static final String X_RETRIES_HEADER = "x-retries";
+
+    public static void main(String[] args) {
+        SpringApplication.run(ReRouteDlqKApplication.class, args).close();
+    }
+
+    private final AtomicInteger processed = new AtomicInteger();
+
+    @Autowired
+    private MessageChannel parkingLot;
+
+    @StreamListener(Processor.INPUT)
+    @SendTo(Processor.OUTPUT)
+    public Message<?> reRoute(Message<?> failed) {
+        processed.incrementAndGet();
+        Integer retries = failed.getHeaders().get(X_RETRIES_HEADER, Integer.class);
+        if (retries == null) {
+            System.out.println("First retry for " + failed);
+            return MessageBuilder.fromMessage(failed)
+                    .setHeader(X_RETRIES_HEADER, new Integer(1))
+                    .setHeader(BinderHeaders.PARTITION_OVERRIDE,
+                            failed.getHeaders().get(KafkaHeaders.RECEIVED_PARTITION_ID))
+                    .build();
+        }
+        else if (retries.intValue() < 3) {
+            System.out.println("Another retry for " + failed);
+            return MessageBuilder.fromMessage(failed)
+                    .setHeader(X_RETRIES_HEADER, new Integer(retries.intValue() + 1))
+                    .setHeader(BinderHeaders.PARTITION_OVERRIDE,
+                            failed.getHeaders().get(KafkaHeaders.RECEIVED_PARTITION_ID))
+                    .build();
+        }
+        else {
+            System.out.println("Retries exhausted for " + failed);
+            parkingLot.send(MessageBuilder.fromMessage(failed)
+                    .setHeader(BinderHeaders.PARTITION_OVERRIDE,
+                            failed.getHeaders().get(KafkaHeaders.RECEIVED_PARTITION_ID))
+                    .build());
+        }
+        return null;
+    }
+
+    @Override
+    public void run(String... args) throws Exception {
+        while (true) {
+            int count = this.processed.get();
+            Thread.sleep(5000);
+            if (count == this.processed.get()) {
+                System.out.println("Idle, terminating");
+                return;
+            }
+        }
+    }
+
+    public interface TwoOutputProcessor extends Processor {
+
+        @Output("parkingLot")
+        MessageChannel parkingLot();
+
+    }
+
+}
+
+
+
+
+
+

1.10. Partitioning with the Kafka Binder

+
+

Apache Kafka supports topic partitioning natively.

+
+
+

Sometimes it is advantageous to send data to specific partitions — for example, when you want to strictly order message processing (all messages for a particular customer should go to the same partition).

+
+
+

The following example shows how to configure the producer and consumer side:

+
+
+
+
@SpringBootApplication
+@EnableBinding(Source.class)
+public class KafkaPartitionProducerApplication {
+
+    private static final Random RANDOM = new Random(System.currentTimeMillis());
+
+    private static final String[] data = new String[] {
+            "foo1", "bar1", "qux1",
+            "foo2", "bar2", "qux2",
+            "foo3", "bar3", "qux3",
+            "foo4", "bar4", "qux4",
+            };
+
+    public static void main(String[] args) {
+        new SpringApplicationBuilder(KafkaPartitionProducerApplication.class)
+            .web(false)
+            .run(args);
+    }
+
+    @InboundChannelAdapter(channel = Source.OUTPUT, poller = @Poller(fixedRate = "5000"))
+    public Message<?> generate() {
+        String value = data[RANDOM.nextInt(data.length)];
+        System.out.println("Sending: " + value);
+        return MessageBuilder.withPayload(value)
+                .setHeader("partitionKey", value)
+                .build();
+    }
+
+}
+
+
+
+
application.yml
+
+
spring:
+  cloud:
+    stream:
+      bindings:
+        output:
+          destination: partitioned.topic
+          producer:
+            partition-key-expression: headers['partitionKey']
+            partition-count: 12
+
+
+
+ + + + + +
+ + +The topic must be provisioned to have enough partitions to achieve the desired concurrency for all consumer groups. +The above configuration supports up to 12 consumer instances (6 if their concurrency is 2, 4 if their concurrency is 3, and so on). +It is generally best to “over-provision” the partitions to allow for future increases in consumers or concurrency. +
+
+
+ + + + + +
+ + +The preceding configuration uses the default partitioning (key.hashCode() % partitionCount). +This may or may not provide a suitably balanced algorithm, depending on the key values. +You can override this default by using the partitionSelectorExpression or partitionSelectorClass properties. +
+
+
+

Since partitions are natively handled by Kafka, no special configuration is needed on the consumer side. +Kafka allocates partitions across the instances.

+
+
+

The following Spring Boot application listens to a Kafka stream and prints (to the console) the partition ID to which each message goes:

+
+
+
+
@SpringBootApplication
+@EnableBinding(Sink.class)
+public class KafkaPartitionConsumerApplication {
+
+    public static void main(String[] args) {
+        new SpringApplicationBuilder(KafkaPartitionConsumerApplication.class)
+            .web(false)
+            .run(args);
+    }
+
+    @StreamListener(Sink.INPUT)
+    public void listen(@Payload String in, @Header(KafkaHeaders.RECEIVED_PARTITION_ID) int partition) {
+        System.out.println(in + " received from partition " + partition);
+    }
+
+}
+
+
+
+
application.yml
+
+
spring:
+  cloud:
+    stream:
+      bindings:
+        input:
+          destination: partitioned.topic
+          group: myGroup
+
+
+
+

You can add instances as needed. +Kafka rebalances the partition allocations. +If the instance count (or instance count * concurrency) exceeds the number of partitions, some consumers are idle.

+
+
+
+
+
+

2. Kafka Streams Binder

+
+
+

2.1. Usage

+
+

For using the Kafka Streams binder, you just need to add it to your Spring Cloud Stream application, using the following maven coordinates:

+
+
+
+
<dependency>
+  <groupId>org.springframework.cloud</groupId>
+  <artifactId>spring-cloud-stream-binder-kafka-streams</artifactId>
+</dependency>
+
+
+
+

A quick way to bootstrap a new project for Kafka Streams binder is to use Spring Initializr and then select "Cloud Streams" and "Spring for Kafka Streams" as shown below

+
+
+
+spring initializr kafka streams +
+
+
+
+

2.2. Overview

+
+

Spring Cloud Stream includes a binder implementation designed explicitly for Apache Kafka Streams binding. +With this native integration, a Spring Cloud Stream "processor" application can directly use the +Apache Kafka Streams APIs in the core business logic.

+
+
+

Kafka Streams binder implementation builds on the foundations provided by the Spring for Apache Kafka project.

+
+
+

Kafka Streams binder provides binding capabilities for the three major types in Kafka Streams - KStream, KTable and GlobalKTable.

+
+
+

Kafka Streams applications typically follow a model in which the records are read from an inbound topic, apply business logic, and then write the transformed records to an outbound topic. +Alternatively, a Processor application with no outbound destination can be defined as well.

+
+
+

In the following sections, we are going to look at the details of Spring Cloud Stream’s integration with Kafka Streams.

+
+
+
+

2.3. Programming Model

+
+

When using the programming model provided by Kafka Streams binder, both the high-level Streams DSL and a mix of both the higher level and the lower level Processor-API can be used as options. +When mixing both higher and lower level API’s, this is usually achieved by invoking transform or process API methods on KStream.

+
+
+

2.3.1. Functional Style

+
+

Starting with Spring Cloud Stream 3.0.0, Kafka Streams binder allows the applications to be designed and developed using the functional programming style that is available in Java 8. +This means that the applications can be concisely represented as a lambda expression of types java.util.function.Function or java.util.function.Consumer.

+
+
+

Let’s take a very basic example.

+
+
+
+
@SpringBootApplication
+public class SimpleConsumerApplication {
+
+    @Bean
+    public java.util.function.Consumer<KStream<Object, String>> process() {
+
+        return input ->
+                input.foreach((key, value) -> {
+                    System.out.println("Key: " + key + " Value: " + value);
+                });
+    }
+}
+
+
+
+

Albeit simple, this is a complete standalone Spring Boot application that is leveraging Kafka Streams for stream processing. +This is a consumer application with no outbound binding and only a single inbound binding. +The application consumes data and it simply logs the information from the KStream key and value on the standard output. +The application contains the SpringBootApplication annotation and a method that is marked as Bean. +The bean method is of type java.util.function.Consumer which is parameterized with KStream. +Then in the implementation, we are returning a Consumer object that is essentially a lambda expression. +Inside the lambda expression, the code for processing the data is provided.

+
+
+

In this application, there is a single input binding that is of type KStream. +The binder creates this binding for the application with a name process-in-0, i.e. the name of the function bean name followed by a dash character (-) and the literal in followed by another dash and then the ordinal position of the parameter. +You use this binding name to set other properties such as destination. +For example, spring.cloud.stream.bindings.process-in-0.destination=my-topic.

+
+
+ + + + + +
+ + +If the destination property is not set on the binding, a topic is created with the same name as the binding (if there are sufficient privileges for the application) or that topic is expected to be already available. +
+
+
+

Once built as a uber-jar (e.g., kstream-consumer-app.jar), you can run the above example like the following.

+
+
+
+
java -jar kstream-consumer-app.jar --spring.cloud.stream.bindings.process-in-0.destination=my-topic
+
+
+
+

Here is another example, where it is a full processor with both input and output bindings. +This is the classic word-count example in which the application receives data from a topic, the number of occurrences for each word is then computed in a tumbling time-window.

+
+
+
+
@SpringBootApplication
+public class WordCountProcessorApplication {
+
+  @Bean
+  public Function<KStream<Object, String>, KStream<?, WordCount>> process() {
+
+    return input -> input
+                .flatMapValues(value -> Arrays.asList(value.toLowerCase().split("\\W+")))
+                .map((key, value) -> new KeyValue<>(value, value))
+                .groupByKey(Serialized.with(Serdes.String(), Serdes.String()))
+                .windowedBy(TimeWindows.of(5000))
+                .count(Materialized.as("word-counts-state-store"))
+                .toStream()
+                .map((key, value) -> new KeyValue<>(key.key(), new WordCount(key.key(), value,
+                        new Date(key.window().start()), new Date(key.window().end()))));
+  }
+
+	public static void main(String[] args) {
+		SpringApplication.run(WordCountProcessorApplication.class, args);
+	}
+}
+
+
+
+

Here again, this is a complete Spring Boot application. The difference here from the first application is that the bean method is of type java.util.function.Function. +The first parameterized type for the Function is for the input KStream and the second one is for the output. +In the method body, a lambda expression is provided that is of type Function and as implementation, the actual business logic is given. +Similar to the previously discussed Consumer based application, the input binding here is named as process-in-0 by default. For the output, the binding name is automatically also set to process-out-0.

+
+
+

Once built as an uber-jar (e.g., wordcount-processor.jar), you can run the above example like the following.

+
+
+
+
java -jar wordcount-processor.jar --spring.cloud.stream.bindings.process-in-0.destination=words --spring.cloud.stream.bindings.process-out-0.destination=counts
+
+
+
+

This application will consume messages from the Kafka topic words and the computed results are published to an output +topic counts.

+
+
+

Spring Cloud Stream will ensure that the messages from both the incoming and outgoing topics are automatically bound as +KStream objects. As a developer, you can exclusively focus on the business aspects of the code, i.e. writing the logic +required in the processor. Setting up Kafka Streams specific configuration required by the Kafka Streams infrastructure +is automatically handled by the framework.

+
+
+

The two examples we saw above have a single KStream input binding. In both cases, the bindings received the records from a single topic. +If you want to multiplex multiple topics into a single KStream binding, you can provide comma separated Kafka topics as destinations below.

+
+
+

spring.cloud.stream.bindings.process-in-0.destination=topic-1,topic-2,topic-3

+
+
+
Multiple Input Bindings
+
+

Many non-trivial Kafka Streams applications often consume data from more than one topic through multiple bindings. +For instance, one topic is consumed as Kstream and another as KTable or GlobalKTable. +There are many reasons why an application might want to receive data as a table type. +Think of a use-case where the underlying topic is populated through a change data capture (CDC) mechanism from a database or perhaps the application only cares about the latest updates for downstream processing. +If the application specifies that the data needs to be bound as KTable or GlobalKTable, then Kafka Streams binder will properly bind the destination to a KTable or GlobalKTable and make them available for the application to operate upon. +We will look at a few different scenarios how multiple input bindings are handled in the Kafka Streams binder.

+
+
+
BiFunction in Kafka Streams Binder
+
+

Here is an example where we have two inputs and an output. In this case, the application can leverage on java.util.function.BiFunction.

+
+
+
+
@Bean
+public BiFunction<KStream<String, Long>, KTable<String, String>, KStream<String, Long>> process() {
+    return (userClicksStream, userRegionsTable) -> (userClicksStream
+            .leftJoin(userRegionsTable, (clicks, region) -> new RegionWithClicks(region == null ?
+                            "UNKNOWN" : region, clicks),
+                    Joined.with(Serdes.String(), Serdes.Long(), null))
+            .map((user, regionWithClicks) -> new KeyValue<>(regionWithClicks.getRegion(),
+                    regionWithClicks.getClicks()))
+            .groupByKey(Grouped.with(Serdes.String(), Serdes.Long()))
+            .reduce(Long::sum)
+            .toStream());
+}
+
+
+
+

Here again, the basic theme is the same as in the previous examples, but here we have two inputs. +Java’s BiFunction support is used to bind the inputs to the desired destinations. +The default binding names generated by the binder for the inputs are process-in-0 and process-in-1 respectively. The default output binding is process-out-0. +In this example, the first parameter of BiFunction is bound as a KStream for the first input and the second parameter is bound as a KTable for the second input.

+
+
+
+
BiConsumer in Kafka Streams Binder
+
+

If there are two inputs, but no outputs, in that case we can use java.util.function.BiConsumer as shown below.

+
+
+
+
@Bean
+public BiConsumer<KStream<String, Long>, KTable<String, String>> process() {
+    return (userClicksStream, userRegionsTable) -> {}
+}
+
+
+
+
+
Beyond two inputs
+
+

What if you have more than two inputs? +There are situations in which you need more than two inputs. In that case, the binder allows you to chain partial functions. +In functional programming jargon, this technique is generally known as currying. +With the functional programming support added as part of Java 8, Java now enables you to write curried functions. +Spring Cloud Stream Kafka Streams binder can make use of this feature to enable multiple input bindings.

+
+
+

Let’s see an example.

+
+
+
+
@Bean
+public Function<KStream<Long, Order>,
+        Function<GlobalKTable<Long, Customer>,
+                Function<GlobalKTable<Long, Product>, KStream<Long, EnrichedOrder>>>> enrichOrder() {
+
+    return orders -> (
+              customers -> (
+                    products -> (
+                        orders.join(customers,
+                            (orderId, order) -> order.getCustomerId(),
+                                (order, customer) -> new CustomerOrder(customer, order))
+                                .join(products,
+                                        (orderId, customerOrder) -> customerOrder
+                                                .productId(),
+                                        (customerOrder, product) -> {
+                                            EnrichedOrder enrichedOrder = new EnrichedOrder();
+                                            enrichedOrder.setProduct(product);
+                                            enrichedOrder.setCustomer(customerOrder.customer);
+                                            enrichedOrder.setOrder(customerOrder.order);
+                                            return enrichedOrder;
+                                        })
+                        )
+                )
+    );
+}
+
+
+
+

Let’s look at the details of the binding model presented above. +In this model, we have 3 partially applied functions on the inbound. Let’s call them as f(x), f(y) and f(z). +If we expand these functions in the sense of true mathematical functions, it will look like these: f(x) → (fy) → f(z) → KStream<Long, EnrichedOrder>. +The x variable stands for KStream<Long, Order>, the y variable stands for GlobalKTable<Long, Customer> and the z variable stands for GlobalKTable<Long, Product>. +The first function f(x) has the first input binding of the application (KStream<Long, Order>) and its output is the function, f(y). +The function f(y) has the second input binding for the application (GlobalKTable<Long, Customer>) and its output is yet another function, f(z). +The input for the function f(z) is the third input for the application (GlobalKTable<Long, Product>) and its output is KStream<Long, EnrichedOrder> which is the final output binding for the application. +The input from the three partial functions which are KStream, GlobalKTable, GlobalKTable respectively are available for you in the method body for implementing the business logic as part of the lambda expression.

+
+
+

Input bindings are named as enrichOrder-in-0, enrichOrder-in-1 and enrichOrder-in-2 respectively. Output binding is named as enrichOrder-out-0.

+
+
+

With curried functions, you can virtually have any number of inputs. However, keep in mind that, anything more than a smaller number of inputs and partially applied functions for them as above in Java might lead to unreadable code. +Therefore if your Kafka Streams application requires more than a reasonably smaller number of input bindings and you want to use this functional model, then you may want to rethink your design and decompose the application appropriately.

+
+
+
+
+
Multiple Output Bindings
+
+

Kafka Streams allows to write outbound data into multiple topics. This feature is known as branching in Kafka Streams. +When using multiple output bindings, you need to provide an array of KStream (KStream[]) as the outbound return type.

+
+
+

Here is an example:

+
+
+
+
@Bean
+public Function<KStream<Object, String>, KStream<?, WordCount>[]> process() {
+
+    Predicate<Object, WordCount> isEnglish = (k, v) -> v.word.equals("english");
+    Predicate<Object, WordCount> isFrench = (k, v) -> v.word.equals("french");
+    Predicate<Object, WordCount> isSpanish = (k, v) -> v.word.equals("spanish");
+
+    return input -> input
+            .flatMapValues(value -> Arrays.asList(value.toLowerCase().split("\\W+")))
+            .groupBy((key, value) -> value)
+            .windowedBy(TimeWindows.of(5000))
+            .count(Materialized.as("WordCounts-branch"))
+            .toStream()
+            .map((key, value) -> new KeyValue<>(null, new WordCount(key.key(), value,
+                    new Date(key.window().start()), new Date(key.window().end()))))
+            .branch(isEnglish, isFrench, isSpanish);
+}
+
+
+
+

The programming model remains the same, however the outbound parameterized type is KStream[]. +The default output binding names are process-out-0, process-out-1, process-out-2 respectively. +The reason why the binder generates three output bindings is because it detects the length of the returned KStream array.

+
+
+
+
Summary of Function based Programming Styles for Kafka Streams
+
+

In summary, the following table shows the various options that can be used in the functional paradigm.

+
+ +++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Number of InputsNumber of OutputsComponent to use

1

0

java.util.function.Consumer

2

0

java.util.function.BiConsumer

1

1..n

java.util.function.Function

2

1..n

java.util.function.BiFunction

>= 3

0..n

Use curried functions

+
+
    +
  • +

    In the case of more than one output in this table, the type simply becomes KStream[].

    +
  • +
+
+
+
+
+

2.3.2. Imperative programming model.

+
+

Although the functional programming model outlined above is the preferred approach, you can still use the classic StreamListener based approach if you prefer.

+
+
+

Here are some examples.

+
+
+

Following is the equivalent of the Word count example using StreamListener.

+
+
+
+
@SpringBootApplication
+@EnableBinding(KafkaStreamsProcessor.class)
+public class WordCountProcessorApplication {
+
+    @StreamListener("input")
+    @SendTo("output")
+    public KStream<?, WordCount> process(KStream<?, String> input) {
+        return input
+                .flatMapValues(value -> Arrays.asList(value.toLowerCase().split("\\W+")))
+                .groupBy((key, value) -> value)
+                .windowedBy(TimeWindows.of(5000))
+                .count(Materialized.as("WordCounts-multi"))
+                .toStream()
+                .map((key, value) -> new KeyValue<>(null, new WordCount(key.key(), value, new Date(key.window().start()), new Date(key.window().end()))));
+    }
+
+    public static void main(String[] args) {
+        SpringApplication.run(WordCountProcessorApplication.class, args);
+    }
+
+
+
+

As you can see, this is a bit more verbose since you need to provide EnableBinding and the other extra annotations like StreamListener and SendTo to make it a complete application. +EnableBinding is where you specify your binding interface that contains your bindings. +In this case, we are using the stock KafkaStreamsProcessor binding interface that has the following contracts.

+
+
+
+
public interface KafkaStreamsProcessor {
+
+	@Input("input")
+	KStream<?, ?> input();
+
+	@Output("output")
+	KStream<?, ?> output();
+
+}
+
+
+
+

Binder will create bindings for the input KStream and output KStream since you are using a binding interface that contains those declarations.

+
+
+

In addition to the obvious differences in the programming model offered in the functional style, one particular thing that needs to be mentioned here is that the binding names are what you specify in the binding interface. +For example, in the above application, since we are using KafkaStreamsProcessor, the binding names are input and output. +Binding properties need to use those names. For instance spring.cloud.stream.bindings.input.destination, spring.cloud.stream.bindings.output.destination etc. +Keep in mind that this is fundamentally different from the functional style since there the binder generates binding names for the application. +This is because the application does not provide any binding interfaces in the functional model using EnableBinding.

+
+
+

Here is another example of a sink where we have two inputs.

+
+
+
+
@EnableBinding(KStreamKTableBinding.class)
+.....
+.....
+@StreamListener
+public void process(@Input("inputStream") KStream<String, PlayEvent> playEvents,
+                    @Input("inputTable") KTable<Long, Song> songTable) {
+                    ....
+                    ....
+}
+
+interface KStreamKTableBinding {
+
+    @Input("inputStream")
+    KStream<?, ?> inputStream();
+
+    @Input("inputTable")
+    KTable<?, ?> inputTable();
+}
+
+
+
+

Following is the StreamListener equivalent of the same BiFunction based processor that we saw above.

+
+
+
+
@EnableBinding(KStreamKTableBinding.class)
+....
+....
+
+@StreamListener
+@SendTo("output")
+public KStream<String, Long> process(@Input("input") KStream<String, Long> userClicksStream,
+                                     @Input("inputTable") KTable<String, String> userRegionsTable) {
+....
+....
+}
+
+interface KStreamKTableBinding extends KafkaStreamsProcessor {
+
+    @Input("inputX")
+    KTable<?, ?> inputTable();
+}
+
+
+
+

Finally, here is the StreamListener equivalent of the application with three inputs and curried functions.

+
+
+
+
@EnableBinding(CustomGlobalKTableProcessor.class)
+...
+...
+    @StreamListener
+    @SendTo("output")
+    public KStream<Long, EnrichedOrder> process(
+            @Input("input-1") KStream<Long, Order> ordersStream,
+            @Input("input-"2) GlobalKTable<Long, Customer> customers,
+            @Input("input-3") GlobalKTable<Long, Product> products) {
+
+        KStream<Long, CustomerOrder> customerOrdersStream = ordersStream.join(
+                customers, (orderId, order) -> order.getCustomerId(),
+                (order, customer) -> new CustomerOrder(customer, order));
+
+        return customerOrdersStream.join(products,
+                (orderId, customerOrder) -> customerOrder.productId(),
+                (customerOrder, product) -> {
+                    EnrichedOrder enrichedOrder = new EnrichedOrder();
+                    enrichedOrder.setProduct(product);
+                    enrichedOrder.setCustomer(customerOrder.customer);
+                    enrichedOrder.setOrder(customerOrder.order);
+                    return enrichedOrder;
+                });
+        }
+
+    interface CustomGlobalKTableProcessor {
+
+            @Input("input-1")
+            KStream<?, ?> input1();
+
+            @Input("input-2")
+            GlobalKTable<?, ?> input2();
+
+            @Input("input-3")
+            GlobalKTable<?, ?> input3();
+
+            @Output("output")
+            KStream<?, ?> output();
+    }
+
+
+
+

You might notice that the above two examples are even more verbose since in addition to provide EnableBinding, you also need to write your own custom binding interface as well. +Using the functional model, you can avoid all those ceremonial details.

+
+
+

Before we move on from looking at the general programming model offered by Kafka Streams binder, here is the StreamListener version of multiple output bindings.

+
+
+
+
EnableBinding(KStreamProcessorWithBranches.class)
+public static class WordCountProcessorApplication {
+
+    @Autowired
+    private TimeWindows timeWindows;
+
+    @StreamListener("input")
+    @SendTo({"output1","output2","output3})
+    public KStream<?, WordCount>[] process(KStream<Object, String> input) {
+
+			Predicate<Object, WordCount> isEnglish = (k, v) -> v.word.equals("english");
+			Predicate<Object, WordCount> isFrench =  (k, v) -> v.word.equals("french");
+			Predicate<Object, WordCount> isSpanish = (k, v) -> v.word.equals("spanish");
+
+			return input
+					.flatMapValues(value -> Arrays.asList(value.toLowerCase().split("\\W+")))
+					.groupBy((key, value) -> value)
+					.windowedBy(timeWindows)
+					.count(Materialized.as("WordCounts-1"))
+					.toStream()
+					.map((key, value) -> new KeyValue<>(null, new WordCount(key.key(), value, new Date(key.window().start()), new Date(key.window().end()))))
+					.branch(isEnglish, isFrench, isSpanish);
+    }
+
+    interface KStreamProcessorWithBranches {
+
+    		@Input("input")
+    		KStream<?, ?> input();
+
+    		@Output("output1")
+    		KStream<?, ?> output1();
+
+    		@Output("output2")
+    		KStream<?, ?> output2();
+
+    		@Output("output3")
+    		KStream<?, ?> output3();
+    	}
+}
+
+
+
+

To recap, we have reviewed the various programming model choices when using the Kafka Streams binder.

+
+
+

The binder provides binding capabilities for KStream, KTable and GlobalKTable on the input. +KTable and GlobalKTable bindings are only available on the input. +Binder supports both input and output bindings for KStream.

+
+
+

The upshot of the programming model of Kafka Streams binder is that the binder provides you the flexibility of going with a fully functional programming model or using the StreamListener based imperative approach.

+
+
+
+
+

2.4. Ancillaries to the programming model

+
+

2.4.1. Multiple Kafka Streams processors within a single application

+
+

Binder allows to have multiple Kafka Streams processors within a single Spring Cloud Stream application. +You can have an application as below.

+
+
+
+
@Bean
+public java.util.function.Function<KStream<Object, String>, KStream<Object, String>> process() {
+   ...
+}
+
+@Bean
+public java.util.function.Consumer<KStream<Object, String>> anotherProcess() {
+  ...
+}
+
+@Bean
+public java.util.function.BiFunction<KStream<Object, String>, KTable<Integer, String>, KStream<Object, String>> yetAnotherProcess() {
+   ...
+}
+
+
+
+

In this case, the binder will create 3 separate Kafka Streams objects with different application ID’s (more on this below). +However, if you have more than one processor in the application, you have to tell Spring Cloud Stream, which functions need to be activated. +Here is how you activate the functions.

+
+
+

spring.cloud.stream.function.definition: process;anotherProcess;yetAnotherProcess

+
+
+

If you want certain functions to be not activated right away, you can remove that from this list.

+
+
+

This is also true when you have a single Kafka Streams processor and other types of Function beans in the same application that is handled through a different binder (for e.g., a function bean that is based on the regular Kafka Message Channel binder)

+
+
+
+

2.4.2. Kafka Streams Application ID

+
+

Application id is a mandatory property that you need to provide for a Kafka Streams application. +Spring Cloud Stream Kafka Streams binder allows you to configure this application id in multiple ways.

+
+
+

If you only have one single processor or StreamListener in the application, then you can set this at the binder level using the following property:

+
+
+

spring.cloud.stream.kafka.streams.binder.applicationId.

+
+
+

As a convenience, if you only have a single processor, you can also use spring.application.name as the property to delegate the application id.

+
+
+

If you have multiple Kafka Streams processors in the application, then you need to set the application id per processor. +In the case of the functional model, you can attach it to each function as a property.

+
+
+

For e.g. imagine that you have the following functions.

+
+
+
+
@Bean
+public java.util.function.Consumer<KStream<Object, String>> process() {
+   ...
+}
+
+
+
+

and

+
+
+
+
@Bean
+public java.util.function.Consumer<KStream<Object, String>> anotherProcess() {
+  ...
+}
+
+
+
+

Then you can set the application id for each, using the following binder level properties.

+
+
+

spring.cloud.stream.kafka.streams.binder.functions.process.applicationId

+
+
+

and

+
+
+

spring.cloud.stream.kafka.streams.binder.functions.anotherProcess.applicationId

+
+
+

In the case of StreamListener, you need to set this on the first input binding on the processor.

+
+
+

For e.g. imagine that you have the following two StreamListener based processors.

+
+
+
+
@StreamListener
+@SendTo("output")
+public KStream<String, String> process(@Input("input") <KStream<Object, String>> input) {
+   ...
+}
+
+@StreamListener
+@SendTo("anotherOutput")
+public KStream<String, String> anotherProcess(@Input("anotherInput") <KStream<Object, String>> input) {
+   ...
+}
+
+
+
+

Then you must set the application id for this using the following binding property.

+
+
+

spring.cloud.stream.kafka.streams.bindings.input.applicationId

+
+
+

and

+
+
+

spring.cloud.stream.kafka.streams.bindings.anotherInput.applicationId

+
+
+

For function based model also, this approach of setting application id at the binding level will work. +However, setting per function at the binder level as we have seen above is much easier if you are using the functional model.

+
+
+

For production deployments, it is highly recommended to explicitly specify the application ID through configuration. +This is especially going to be very critical if you are auto scaling your application in which case you need to make sure that you are deploying each instance with the same application ID.

+
+
+

If the application does not provide an application ID, then in that case the binder will auto generate a static application ID for you. +This is convenient in development scenarios as it avoids the need for explicitly providing the application ID. +The generated application ID in this manner will be static over application restarts. +In the case of functional model, the generated application ID will be the function bean name followed by the literal applicationID, for e.g process-applicationID if process if the function bean name. +In the case of StreamListener, instead of using the function bean name, the generated application ID will be use the containing class name followed by the method name followed by the literal applicationId.

+
+
+
Summary of setting Application ID
+
+
    +
  • +

    By default, binder will auto generate the application ID per function or StreamListener methods.

    +
  • +
  • +

    If you have a single processor, then you can use spring.kafka.streams.applicationId, spring.application.name or spring.cloud.stream.kafka.streams.binder.applicationId.

    +
  • +
  • +

    If you have multiple processors, then application ID can be set per function using the property - spring.cloud.stream.kafka.streams.binder.functions.<function-name>.applicationId. +In the case of StreamListener, this can be done using spring.cloud.stream.kafka.streams.bindings.input.applicationId, assuming that the input binding name is input.

    +
  • +
+
+
+
+
+

2.4.3. Overriding the default binding names generated by the binder with the functional style

+
+

By default, the binder uses the strategy discussed above to generate the binding name when using the functional style, i.e. <function-bean-name>-<in>|<out>-[0..n], for e.g. process-in-0, process-out-0 etc. +If you want to override those binding names, you can do that by specifying the following properties.

+
+
+

spring.cloud.stream.function.bindings.<default binding name>. Default binding name is the original binding name generated by the binder.

+
+
+

For e.g. lets say, you have this function.

+
+
+
+
@Bean
+public BiFunction<KStream<String, Long>, KTable<String, String>, KStream<String, Long>> process() {
+...
+}
+
+
+
+

Binder will generate bindings with names, process-in-0, process-in-1 and process-out-0. +Now, if you want to change them to something else completely, maybe more domain specific binding names, then you can do so as below.

+
+
+

springc.cloud.stream.function.bindings.process-in-0=users

+
+
+

springc.cloud.stream.function.bindings.process-in-0=regions

+
+
+

and

+
+
+

spring.cloud.stream.function.bindings.process-out-0=clicks

+
+
+

After that, you must set all the binding level properties on these new binding names.

+
+
+

Please keep in mind that with the functional programming model described above, adhering to the default binding names make sense in most situations. +The only reason you may still want to do this overriding is when you have larger number of configuration properties and you want to map the bindings to something more domain friendly.

+
+
+
+

2.4.4. Setting up bootstrap server configuration

+
+

When running Kafka Streams applications, you must provide the Kafka broker server information. +If you don’t provide this information, the binder expects that you are running the broker at the default localhost:9092. +If that is not the case, then you need to override that. There are a couple of ways to do that.

+
+
+
    +
  • +

    Using the boot property - spring.kafka.bootstrapServers

    +
  • +
  • +

    Binder level property - spring.cloud.stream.kafka.streams.binder.brokers

    +
  • +
+
+
+

When it comes to the binder level property, it doesn’t matter if you use the broker property provided through the regular Kafka binder - spring.cloud.stream.kafka.binder.brokers. +Kafka Streams binder will first check if Kafka Streams binder specific broker property is set (spring.cloud.stream.kafka.streams.binder.brokers) and if not found, it looks for spring.cloud.stream.kafka.binder.brokers.

+
+
+
+
+

2.5. Record serialization and deserialization

+
+

Kafka Streams binder allows you to serialize and deserialize records in two ways. +One is the native serialization and deserialization facilities provided by Kafka and the other one is the message conversion capabilities of Spring Cloud Stream framework. +Lets look at some details.

+
+
+

2.5.1. Inbound deserialization

+
+

Keys are always deserialized using native Serdes.

+
+
+

For values, by default, deserialization on the inbound is natively performed by Kafka. +Please note that this is a major change on default behavior from previous versions of Kafka Streams binder where the deserialization was done by the framework.

+
+
+

Kafka Streams binder will try to infer matching Serde types by looking at the type signature of java.util.function.Function|Consumer or StreamListener. +Here is the order that it matches the Serdes.

+
+
+
    +
  • +

    If the application provides a bean of type Serde and if the return type is parameterized with the actual type of the incoming key or value type, then it will use that Serde for inbound deserialization. +For e.g. if you have the following in the application, the binder detects that the incoming value type for the KStream matches with a type that is parameterized on a Serde bean. +It will use that for inbound deserialization.

    +
  • +
+
+
+
+
@Bean
+public Serde<Foo() customSerde{
+ ...
+}
+
+@Bean
+public Function<KStream<String, Foo>, KStream<String, Foo>> process() {
+}
+
+
+
+
    +
  • +

    Next, it looks at the types and see if they are one of the types exposed by Kafka Streams. If so, use them. +Here are the Serde types that the binder will try to match from Kafka Streams.

    +
    +
    +
    Integer, Long, Short, Double, Float, byte[], UUID and String.
    +
    +
    +
  • +
  • +

    If none of the Serdes provided by Kafka Streams don’t match the types, then it will use JsonSerde provided by Spring Kafka. In this case, the binder assumes that the types are JSON friendly. +This is useful if you have multiple value objects as inputs since the binder will internally infer them to correct Java types. +Before falling back to the JsonSerde though, the binder checks at the default Serde`s set in the Kafka Streams configuration to see if it is a `Serde that it can match with the incoming KStream’s types.

    +
  • +
+
+
+

If none of the above strategies worked, then the applications must provide the `Serde`s through configuration. +This can be configured in two ways - binding or default.

+
+
+

First the binder will look if a Serde is provided at the binding level. +For e.g. if you have the following processor,

+
+
+
+
@Bean
+public BiFunction<KStream<CustomKey, AvroIn1>, KTable<CustomKey, AvroIn2>, KStream<CustomKey, AvroOutput>> process() {...}
+
+
+
+

then, you can provide a binding level Serde using the following:

+
+
+
+
spring.cloud.stream.kafka.streams.bindings.process-in-0.consumer.keySerde=CustomKeySerde
+spring.cloud.stream.kafka.streams.bindings.process-in-0.consumer.valueSerde=io.confluent.kafka.streams.serdes.avro.SpecificAvroSerde
+
+spring.cloud.stream.kafka.streams.bindings.process-in-1.consumer.keySerde=CustomKeySerde
+spring.cloud.stream.kafka.streams.bindings.process-in-1.consumer.valueSerde=io.confluent.kafka.streams.serdes.avro.SpecificAvroSerde
+
+
+
+ + + + + +
+ + +If you provide Serde as abover per input binding, then that will takes higher precedence and the binder will stay away from any Serde inference. +
+
+
+

If you want the default key/value Serdes to be used for inbound deserialization, you can do so at the binder level.

+
+
+
+
spring.cloud.stream.kafka.streams.binder.configuration.default.key.serde
+spring.cloud.stream.kafka.streams.binder.configuration.default.value.serde
+
+
+
+

If you don’t want the native decoding provided by Kafka, you can rely on the message conversion features that Spring Cloud Stream provides. +Since native decoding is the default, in order to let Spring Cloud Stream deserialize the inbound value object, you need to explicitly disable native decoding.

+
+
+

For e.g. if you have the same BiFunction processor as above, then spring.cloud.stream.bindings.process-in-0.consumer.nativeDecoding: false +You need to disable native decoding for all the inputs individually. Otherwise, native decoding will still be applied for those you do not disable.

+
+
+

By default, Spring Cloud Stream will use application/json as the content type and use an appropriate json message converter. +You can use custom message converters by using the following property and an appropriate MessageConverter bean.

+
+
+
+
spring.cloud.stream.bindings.process-in-0.contentType
+
+
+
+
+

2.5.2. Outbound serialization

+
+

Outbound serialization pretty much follows the same rules as above for inbound deserialization. +As with the inbound deserialization, one major change from the previous versions of Spring Cloud Stream is that the serialization on the outbound is handled by Kafka natively. +Before 3.0 versions of the binder, this was done by the framework itself.

+
+
+

Keys on the outbound are always serialized by Kafka using a matching Serde that is inferred by the binder. +If it can’t infer the type of the key, then that needs to be specified using configuration.

+
+
+

Value serdes are inferred using the same rules used for inbound deserialization. +First it matches to see if the outbound type is from a provided bean in the application. +If not, it checks to see if it matches with a Serde exposed by Kafka such as - Integer, Long, Short, Double, Float, byte[], UUID and String. +If that doesnt’t work, then it falls back to JsonSerde provided by the Spring Kafka project, but first look at the default Serde configuration to see if there is a match. +Keep in mind that all these happen transparently to the application. +If none of these work, then the user has to provide the Serde to use by configuration.

+
+
+

Lets say you are using the same BiFunction processor as above. Then you can configure outbound key/value Serdes as following.

+
+
+
+
spring.cloud.stream.kafka.streams.bindings.process-out-0.producer.keySerde=CustomKeySerde
+spring.cloud.stream.kafka.streams.bindings.process-out-0.producer.valueSerde=io.confluent.kafka.streams.serdes.avro.SpecificAvroSerde
+
+
+
+

If Serde inference fails, and no binding level Serdes are provided, then the binder falls back to the JsonSerde, but look at the default Serdes for a match.

+
+
+

Default serdes are configured in the same way as above where it is described under deserialization.

+
+
+

spring.cloud.stream.kafka.streams.binder.configuration.default.key.serde +spring.cloud.stream.kafka.streams.binder.configuration.default.value.serde

+
+
+

If your application uses the branching feature and has multiple output bindings, then these have to be configured per binding. +Once again, if the binder is capable of inferring the Serde types, you don’t need to do this configuration.

+
+
+

If you don’t want the native encoding provided by Kafka, but want to use the framework provided message conversion, then you need to explicitly disable native encoding since since native encoding is the default. +For e.g. if you have the same BiFunction processor as above, then spring.cloud.stream.bindings.process-out-0.producer.nativeEncoding: false +You need to disable native encoding for all the output individually in the case of branching. Otherwise, native encoding will still be applied for those you don’t disable.

+
+
+

When conversion is done by Spring Cloud Stream, by default, it will use application/json as the content type and use an appropriate json message converter. +You can use custom message converters by using the following property and a corresponding MessageConverter bean.

+
+
+
+
spring.cloud.stream.bindings.process-out-0.contentType
+
+
+
+

When native encoding/decoding is disabled, binder will not do any inference as in the case of native Serdes. +Applications need to explicitly provide all the configuration options. +For that reason, it is generally advised to stay with the default options for de/serialization and stick with native de/serialization provided by Kafka Streams when you write Spring Cloud Stream Kafka Streams applications. +The one scenario in which you must use message conversion capabilities provided by the framework is when your upstream producer is using a specific serialization strategy. +In that case, you want to use a matching deserialization strategy as native mechanisms may fail. +When relying on the default Serde mechanism, the applications must ensure that the binder has a way forward with correctly map the inbound and outbound with a proper Serde, as otherwise things might fail.

+
+
+

It is worth to mention that the data de/serialization approaches outlined above are only applicable on the edges of your processors, i.e. - inbound and outbound. +Your business logic might still need to call Kafka Streams API’s that explicitly need Serde objects. +Those are still the responsibility of the application and must be handled accordingly by the developer.

+
+
+
+
+

2.6. Error Handling

+
+

Apache Kafka Streams provides the capability for natively handling exceptions from deserialization errors. +For details on this support, please see this. +Out of the box, Apache Kafka Streams provides two kinds of deserialization exception handlers - LogAndContinueExceptionHandler and LogAndFailExceptionHandler. +As the name indicates, the former will log the error and continue processing the next records and the latter will log the error and fail. LogAndFailExceptionHandler is the default deserialization exception handler.

+
+
+

2.6.1. Handling Deserialization Exceptions in the Binder

+
+

Kafka Streams binder allows to specify the deserialization exception handlers above using the following property.

+
+
+
+
spring.cloud.stream.kafka.streams.binder.deserializationExceptionHandler: logAndContinue
+
+
+
+

or

+
+
+
+
spring.cloud.stream.kafka.streams.binder.deserializationExceptionHandler: logAndFail
+
+
+
+

In addition to the above two deserialization exception handlers, the binder also provides a third one for sending the erroneous records (poison pills) to a DLQ (dead letter queue) topic. +Here is how you enable this DLQ exception handler.

+
+
+
+
spring.cloud.stream.kafka.streams.binder.deserializationExceptionHandler: sendToDlq
+
+
+
+

When the above property is set, all the records in deserialization error are automatically sent to the DLQ topic.

+
+
+

You can set the topic name where the DLQ messages are published as below.

+
+
+
+
spring.cloud.stream.kafka.streams.bindings.process-in-0.consumer.dlqName: custom-dlq (Change the binding name accordingly)
+
+
+
+

If this is set, then the error records are sent to the topic custom-dlq. +If this is not set, then it will create a DLQ topic with the name error.<input-topic-name>.<application-id>. +For instance, if your binding’s destination topic is inputTopic and the application ID is process-applicationId, then the default DLQ topic is error.inputTopic.process-applicationId. +It is always recommended to explicitly create a DLQ topic for each input binding if it is your intention to enable DLQ.

+
+
+
+

2.6.2. DLQ per input consumer binding

+
+

The property spring.cloud.stream.kafka.streams.binder.deserializationExceptionHandler is applicable for the entire application. +This implies that if there are multiple functions or StreamListener methods in the same application, this property is applied to all of them. +However, if you have multiple processors or multiple input bindings within a single processor, then you can use the finer-grained DLQ control that the binder provides per input consumer binding.

+
+
+

If you have the following processor,

+
+
+
+
@Bean
+public BiFunction<KStream<String, Long>, KTable<String, String>, KStream<String, Long>> process() {
+...
+}
+
+
+
+

and you only want to enable DLQ on the first input binding and logAndSkip on the second binding, then you can do so on the consumer as below.

+
+
+

spring.cloud.stream.kafka.streams.bindings.process-in-0.consumer.deserializationExceptionHandler: sendToDlq +spring.cloud.stream.kafka.streams.bindings.process-in-1.consumer.deserializationExceptionHandler: logAndSkip

+
+
+

Setting deserialization exception handlers this way has a higher precedence than setting at the binder level.

+
+
+
+

2.6.3. DLQ partitioning

+
+

By default, records are published to the Dead-Letter topic using the same partition as the original record. +This means the Dead-Letter topic must have at least as many partitions as the original record.

+
+
+

To change this behavior, add a DlqPartitionFunction implementation as a @Bean to the application context. +Only one such bean can be present. +The function is provided with the consumer group (which is the same as the application ID in most situations), the failed ConsumerRecord and the exception. +For example, if you always want to route to partition 0, you might use:

+
+
+
+
@Bean
+public DlqPartitionFunction partitionFunction() {
+    return (group, record, ex) -> 0;
+}
+
+
+
+ + + + + +
+ + +If you set a consumer binding’s dlqPartitions property to 1 (and the binder’s minPartitionCount is equal to 1), there is no need to supply a DlqPartitionFunction; the framework will always use partition 0. +If you set a consumer binding’s dlqPartitions property to a value greater than 1 (or the binder’s minPartitionCount is greater than 1), you must provide a DlqPartitionFunction bean, even if the partition count is the same as the original topic’s. +
+
+
+

A couple of things to keep in mind when using the exception handling feature in Kafka Streams binder.

+
+
+
    +
  • +

    The property spring.cloud.stream.kafka.streams.binder.deserializationExceptionHandler is applicable for the entire application. +This implies that if there are multiple functions or StreamListener methods in the same application, this property is applied to all of them.

    +
  • +
  • +

    The exception handling for deserialization works consistently with native deserialization and framework provided message conversion.

    +
  • +
+
+
+
+

2.6.4. Handling Production Exceptions in the Binder

+
+

Unlike the support for deserialization exception handlers as described above, the binder does not provide such first class mechanisms for handling production exceptions. +However, you still can configure production exception handlers using the StreamsBuilderFactoryBean customizer which you can find more details about, in a subsequent section below.

+
+
+
+
+

2.7. State Store

+
+

State stores are created automatically by Kafka Streams when the high level DSL is used and appropriate calls are made those trigger a state store.

+
+
+

If you want to materialize an incoming KTable binding as a named state store, then you can do so by using the following strategy.

+
+
+

Lets say you have the following function.

+
+
+
+
@Bean
+public BiFunction<KStream<String, Long>, KTable<String, String>, KStream<String, Long>> process() {
+   ...
+}
+
+
+
+

Then by setting the following property, the incoming KTable data will be materialized in to the named state store.

+
+
+
+
spring.cloud.stream.kafka.streams.bindings.process-in-1.consumer.materializedAs: incoming-store
+
+
+
+

You can define custom state stores as beans in your application and those will be detected and added to the Kafka Streams builder by the binder. +Especially when the processor API is used, you need to register a state store manually. +In order to do so, you can create the StateStore as a bean in the application. +Here are examples of defining such beans.

+
+
+
+
@Bean
+public StoreBuilder myStore() {
+    return Stores.keyValueStoreBuilder(
+            Stores.persistentKeyValueStore("my-store"), Serdes.Long(),
+            Serdes.Long());
+}
+
+@Bean
+public StoreBuilder otherStore() {
+    return Stores.windowStoreBuilder(
+            Stores.persistentWindowStore("other-store",
+                    1L, 3, 3L, false), Serdes.Long(),
+            Serdes.Long());
+}
+
+
+
+

These state stores can be then accessed by the applications directly.

+
+
+

During the bootstrap, the above beans will be processed by the binder and passed on to the Streams builder object.

+
+
+

Accessing the state store:

+
+
+
+
Processor<Object, Product>() {
+
+    WindowStore<Object, String> state;
+
+    @Override
+    public void init(ProcessorContext processorContext) {
+        state = (WindowStore)processorContext.getStateStore("mystate");
+    }
+    ...
+}
+
+
+
+

This will not work when it comes to registering global state stores. +In order to register a global state store, please see the section below on customizing StreamsBuilderFactoryBean.

+
+
+
+

2.8. Interactive Queries

+
+

Kafka Streams binder API exposes a class called InteractiveQueryService to interactively query the state stores. +You can access this as a Spring bean in your application. An easy way to get access to this bean from your application is to autowire the bean.

+
+
+
+
@Autowired
+private InteractiveQueryService interactiveQueryService;
+
+
+
+

Once you gain access to this bean, then you can query for the particular state-store that you are interested. See below.

+
+
+
+
ReadOnlyKeyValueStore<Object, Object> keyValueStore =
+						interactiveQueryService.getQueryableStoreType("my-store", QueryableStoreTypes.keyValueStore());
+
+
+
+

During the startup, the above method call to retrieve the store might fail. +For e.g it might still be in the middle of initializing the state store. +In such cases, it will be useful to retry this operation. +Kafka Streams binder provides a simple retry mechanism to accommodate this.

+
+
+

Following are the two properties that you can use to control this retrying.

+
+
+
    +
  • +

    spring.cloud.stream.kafka.streams.binder.stateStoreRetry.maxAttempts - Default is 1 .

    +
  • +
  • +

    spring.cloud.stream.kafka.streams.binder.stateStoreRetry.backOffInterval - Default is 1000 milliseconds.

    +
  • +
+
+
+

If there are multiple instances of the kafka streams application running, then before you can query them interactively, you need to identify which application instance hosts the particular key that you are querying. +InteractiveQueryService API provides methods for identifying the host information.

+
+
+

In order for this to work, you must configure the property application.server as below:

+
+
+
+
spring.cloud.stream.kafka.streams.binder.configuration.application.server: <server>:<port>
+
+
+
+

Here are some code snippets:

+
+
+
+
org.apache.kafka.streams.state.HostInfo hostInfo = interactiveQueryService.getHostInfo("store-name",
+						key, keySerializer);
+
+if (interactiveQueryService.getCurrentHostInfo().equals(hostInfo)) {
+
+    //query from the store that is locally available
+}
+else {
+    //query from the remote host
+}
+
+
+
+
+

2.9. Health Indicator

+
+

The health indicator requires the dependency spring-boot-starter-actuator. For maven use:

+
+
+
+
<dependency>
+  <groupId>org.springframework.boot</groupId>
+  <artifactId>spring-boot-starter-actuator</artifactId>
+</dependency>
+
+
+
+

Spring Cloud Stream Kafka Streams Binder provides a health indicator to check the state of the underlying streams threads. +Spring Cloud Stream defines a property management.health.binders.enabled to enable the health indicator. See the +Spring Cloud Stream documentation.

+
+
+

The health indicator provides the following details for each stream thread’s metadata:

+
+
+
    +
  • +

    Thread name

    +
  • +
  • +

    Thread state: CREATED, RUNNING, PARTITIONS_REVOKED, PARTITIONS_ASSIGNED, PENDING_SHUTDOWN or DEAD

    +
  • +
  • +

    Active tasks: task ID and partitions

    +
  • +
  • +

    Standby tasks: task ID and partitions

    +
  • +
+
+
+

By default, only the global status is visible (UP or DOWN). To show the details, the property management.endpoint.health.show-details must be set to ALWAYS or WHEN_AUTHORIZED. +For more details about the health information, see the +Spring Boot Actuator documentation.

+
+
+ + + + + +
+ + +The status of the health indicator is UP if all the Kafka threads registered are in the RUNNING state. +
+
+
+

Since there are three individual binders in Kafka Streams binder (KStream, KTable and GlobalKTable), all of them will report the health status. +When enabling show-details, some of the information reported may be redundant.

+
+
+

When there are multiple Kafka Streams processors present in the same application, then the health checks will be reported for all of them and will be categorized by the application ID of Kafka Streams.

+
+
+
+

2.10. Accessing Kafka Streams Metrics

+
+

Spring Cloud Stream Kafka Streams binder provides a basic mechanism for accessing Kafka Streams metrics exported through a Micrometer MeterRegistry. +Kafka Streams metrics that are available through KafkaStreams#metrics() are exported to this meter registry by the binder. +The metrics exported are from the consumers, producers, admin-client and the stream itself.

+
+
+

The metrics exported by the binder are exported with the format of metrics group name followed by a dot and then the actual metric name. +All dashes in the original metric information is replaced with dots.

+
+
+

For e.g. the metric name network-io-total from the metric group consumer-metrics is available in the micrometer registry as consumer.metrics.network.io.total. +Similarly, the metric commit-total from stream-metrics is available as stream.metrics.commit.total.

+
+
+

If you have multiple Kafka Streams processors in the same application, then the metric name will be prepended with the corresponding application ID of the Kafka Streams. +The application ID in this case will be preserved as is, i.e. no dashes will be converted to dots etc. +For example, if the application ID of the first processor is processor-1, then the metric name network-io-total from the metric group consumer-metrics is available in the micrometer registry as processor-1.consumer.metrics.network.io.total.

+
+
+

You can either programmatically access the Micrometer MeterRegistry in the application and then iterate through the available gauges or use Spring Boot actuator to access the metrics through a REST endpoint. +When accessing through the Boot actuator endpoint, make sure to add metrics to the property management.endpoints.web.exposure.include. +Then you can access /acutator/metrics to get a list of all the available metrics which then can be individually accessed through the same URI (/actuator/metrics/<metric-name>).

+
+
+

Anything beyond the info level metrics available through KafkaStreams#metrics(), (for e.g. the debugging level metrics) are still only available through JMX after you set the metrics.recording.level to DEBUG. +Kafka Streams, by default, set this level to INFO. +Please see this section from Kafka Streams documentation for more details. +In a future release, binder may support exporting these DEBUG level metrics through Micrometer.

+
+
+
+

2.11. Mixing high level DSL and low level Processor API

+
+

Kafka Streams provides two variants of APIs. +It has a higher level DSL like API where you can chain various operations that maybe familiar to a lot of functional programmers. +Kafka Streams also gives access to a low level Processor API. +The processor API, although very powerful and gives the ability to control things in a much lower level, is imperative in nature. +Kafka Streams binder for Spring Cloud Stream, allows you to use either the high level DSL or mixing both the DSL and the processor API. +Mixing both of these variants give you a lot of options to control various use cases in an application. +Applications can use the transform or process method API calls to get access to the processor API.

+
+
+

Here is a look at how one may combine both the DSL and the processor API in a Spring Cloud Stream application using the process API.

+
+
+
+
@Bean
+public Consumer<KStream<Object, String>> process() {
+    return input ->
+        input.process(() -> new Processor<Object, String>() {
+            @Override
+            @SuppressWarnings("unchecked")
+            public void init(ProcessorContext context) {
+               this.context = context;
+            }
+
+            @Override
+            public void process(Object key, String value) {
+                //business logic
+            }
+
+            @Override
+            public void close() {
+
+        });
+}
+
+
+
+

Here is an example using the transform API.

+
+
+
+
@Bean
+public Consumer<KStream<Object, String>> process() {
+    return (input, a) ->
+        input.transform(() -> new Transformer<Object, String, KeyValue<Object, String>>() {
+            @Override
+            public void init(ProcessorContext context) {
+
+            }
+
+            @Override
+            public void close() {
+
+            }
+
+            @Override
+            public KeyValue<Object, String> transform(Object key, String value) {
+                // business logic - return transformed KStream;
+            }
+        });
+}
+
+
+
+

The process API method call is a terminal operation while the transform API is non terminal and gives you a potentially transformed KStream using which you can continue further processing using either the DSL or the processor API.

+
+
+
+

2.12. Partition support on the outbound

+
+

A Kafka Streams processor usually sends the processed output into an outbound Kafka topic. +If the outbound topic is partitioned and the processor needs to send the outgoing data into particular partitions, the applications needs to provide a bean of type StreamPartitioner. +See StreamPartitioner for more details. +Let’s see some examples.

+
+
+

This is the same processor we already saw multiple times,

+
+
+
+
@Bean
+public Function<KStream<Object, String>, KStream<?, WordCount>> process() {
+
+    ...
+}
+
+
+
+

Here is the output binding destination:

+
+
+
+
spring.cloud.stream.bindings.process-out-0.destination: outputTopic
+
+
+
+

If the topic outputTopic has 4 partitions, if you don’t provide a partitioning strategy, Kafka Streams will use default partitioning strategy which may not be the outcome you want depending on the particular use case. +Let’s say, you want to send any key that matches to spring to partition 0, cloud to partition 1, stream to partition 2, and everything else to partition 3. +This is what you need to do in the application.

+
+
+
+
@Bean
+public StreamPartitioner<String, WordCount> streamPartitioner() {
+    return (t, k, v, n) -> {
+        if (k.equals("spring")) {
+            return 0;
+        }
+        else if (k.equals("cloud")) {
+            return 1;
+        }
+        else if (k.equals("stream")) {
+            return 2;
+        }
+        else {
+            return 3;
+        }
+    };
+}
+
+
+
+

This is a rudimentary implementation, however, you have access to the key/value of the record, the topic name and the total number of partitions. +Therefore, you can implement complex partitioning strategies if need be.

+
+
+

You also need to provide this bean name along with the application configuration.

+
+
+
+
spring.cloud.stream.kafka.streams.bindings.process-out-0.producer.streamPartitionerBeanName: streamPartitioner
+
+
+
+

Each output topic in the application needs to be configured separately like this.

+
+
+
+

2.13. StreamsBuilderFactoryBean customizer

+
+

It is often required to customize the StreamsBuilderFactoryBean that creates the KafkaStreams objects. +Based on the underlying support provided by Spring Kafka, the binder allows you to customize the StreamsBuilderFactoryBean. +You can use the StreamsBuilderFactoryBeanCustomizer to customize the StreamsBuilderFactoryBean itself. +Then, once you get access to the StreamsBuilderFactoryBean through this customizer, you can customize the corresponding KafkaStreams using KafkaStreamsCustomzier. +Both of these customizers are part of the Spring for Apache Kafka project.

+
+
+

Here is an example of using the StreamsBuilderFactoryBeanCustomizer.

+
+
+
+
@Bean
+public StreamsBuilderFactoryBeanCustomizer streamsBuilderFactoryBeanCustomizer() {
+    return sfb -> sfb.setStateListener((newState, oldState) -> {
+         //Do some action here!
+    });
+}
+
+
+
+

The above is shown as an illustration of the things you can do to customize the StreamsBuilderFactoryBean. +You can essentially call any available mutation operations from StreamsBuilderFactoryBean to customize it. +This customizer will be invoked by the binder right before the factory bean is started.

+
+
+

Once you get access to the StreamsBuilderFactoryBean, you can also customize the underlying KafkaStreams object. +Here is a blueprint for doing so.

+
+
+
+
@Bean
+public StreamsBuilderFactoryBeanCustomizer streamsBuilderFactoryBeanCustomizer() {
+    return factoryBean -> {
+        factoryBean.setKafkaStreamsCustomizer(new KafkaStreamsCustomizer() {
+            @Override
+            public void customize(KafkaStreams kafkaStreams) {
+                kafkaStreams.setUncaughtExceptionHandler((t, e) -> {
+
+                });
+            }
+        });
+    };
+}
+
+
+
+

KafkaStreamsCustomizer will be called by the StreamsBuilderFactoryBeabn right before the underlying KafkaStreams gets started.

+
+
+

There can only be one StreamsBuilderFactoryBeanCustomizer in the entire application. +Then how do we account for multiple Kafka Streams processors as each of them are backed up by individual StreamsBuilderFactoryBean objects? +In that case, if the customization needs to be different for those processors, then the application needs to apply some filter based on the application ID.

+
+
+

For e.g,

+
+
+
+
@Bean
+public StreamsBuilderFactoryBeanCustomizer streamsBuilderFactoryBeanCustomizer() {
+
+    return factoryBean -> {
+        if (factoryBean.getStreamsConfiguration().getProperty(StreamsConfig.APPLICATION_ID_CONFIG)
+                .equals("processor1-application-id")) {
+            factoryBean.setKafkaStreamsCustomizer(new KafkaStreamsCustomizer() {
+                @Override
+                public void customize(KafkaStreams kafkaStreams) {
+                    kafkaStreams.setUncaughtExceptionHandler((t, e) -> {
+
+                    });
+                }
+            });
+        }
+    };
+
+
+
+

2.13.1. Using Customizer to register a global state store

+
+

As mentioned above, the binder does not provide a first class way to register global state stores as a feature. +For that, you need to use the customizer. +Here is how that can be done.

+
+
+
+
@Bean
+public StreamsBuilderFactoryBeanCustomizer customizer() {
+    return fb -> {
+        try {
+            final StreamsBuilder streamsBuilder = fb.getObject();
+            streamsBuilder.addGlobalStore(...);
+        }
+        catch (Exception e) {
+
+        }
+    };
+}
+
+
+
+

Again, if you have multiple processors, you want to attach the global state store to the right StreamsBuilder by filtering out the other StreamsBuilderFactoryBean objects using the application id as outlined above.

+
+
+
+

2.13.2. Using customizer to register a production exception handler

+
+

In the error handling section, we indicated that the binder does not provide a first class way to deal with production exceptions. +Though that is the case, you can still use the StreamsBuilderFacotryBean customizer to register production exception handlers. See below.

+
+
+
+
@Bean
+public StreamsBuilderFactoryBeanCustomizer customizer() {
+    return fb -> {
+        fb.getStreamsConfiguration().put(StreamsConfig.DEFAULT_PRODUCTION_EXCEPTION_HANDLER_CLASS_CONFIG,
+                            CustomProductionExceptionHandler.class);
+    };
+}
+
+
+
+

Once again, if you have multiple processors, you may want to set it appropriately against the correct StreamsBuilderFactoryBean. +You may also add such production exception handlers using the configuration property (See below for more on that), but this is an option if you choose to go with a programmatic approach.

+
+
+
+
+

2.14. Timestamp extractor

+
+

Kafka Streams allows you to control the processing of the consumer records based on various notions of timestamp. +By default, Kafka Streams extracts the timestamp metadata embedded in the consumer record. +You can change this default behavior by providing a different TimestampExtractor implementation per input binding. +Here are some details on how that can be done.

+
+
+
+
@Bean
+public Function<KStream<Long, Order>,
+        Function<KTable<Long, Customer>,
+                Function<GlobalKTable<Long, Product>, KStream<Long, Order>>>> process() {
+    return orderStream ->
+            customers ->
+                products -> orderStream;
+}
+
+@Bean
+public TimestampExtractor timestampExtractor() {
+    return new WallclockTimestampExtractor();
+}
+
+
+
+

Then you set the above TimestampExtractor bean name per consumer binding.

+
+
+
+
spring.cloud.stream.kafka.streams.bindings.process-in-0.consumer.timestampExtractorBeanName=timestampExtractor
+spring.cloud.stream.kafka.streams.bindings.process-in-1.consumer.timestampExtractorBeanName=timestampExtractor
+spring.cloud.stream.kafka.streams.bindings.process-in-2.consumer.timestampExtractorBeanName=timestampExtractor"
+
+
+
+

If you skip an input consumer binding for setting a custom timestamp extractor, that consumer will use the default settings.

+
+
+
+

2.15. Multi binders with Kafka Streams based binders and regular Kafka Binder

+
+

You can have an application where you have both a function/consumer/supplier that is based on the regular Kafka binder and a Kafka Streams based processor. +However, you cannot mix both of them within a single function or consumer.

+
+
+

Here is an example, where you have both binder based components within the same application.

+
+
+
+
@Bean
+public Function<String, String> process() {
+    return s -> s;
+}
+
+@Bean
+public Function<KStream<Object, String>, KStream<?, WordCount>> kstreamProcess() {
+
+    return input -> input;
+}
+
+
+
+

This is the relevant parts from the configuration:

+
+
+
+
spring.cloud.stream.function.definition=process;kstreamProcess
+spring.cloud.stream.bindings.process-in-0.destination=foo
+spring.cloud.stream.bindings.process-out-0.destination=bar
+spring.cloud.stream.bindings.kstreamProcess-in-0.destination=bar
+spring.cloud.stream.bindings.kstreamProcess-out-0.destination=foobar
+
+
+
+

Things become a bit more complex if you have the same application as above, but is dealing with two different Kafka clusters, for e.g. the regular process is acting upon both Kafka cluster 1 and cluster 2 (receiving data from cluster-1 and sending to cluster-2) and the Kafka Streams processor is acting upon Kafka cluster 2. +Then you have to use the multi binder facilities provided by Spring Cloud Stream.

+
+
+

Here is how your configuration may change in that scenario.

+
+
+
+
# multi binder configuration
+spring.cloud.stream.binders.kafka1.type: kafka
+spring.cloud.stream.binders.kafka1.environment.spring.cloud.stream.kafka.streams.binder.brokers=${kafkaCluster-1} #Replace kafkaCluster-1 with the approprate IP of the cluster
+spring.cloud.stream.binders.kafka2.type: kafka
+spring.cloud.stream.binders.kafka2.environment.spring.cloud.stream.kafka.streams.binder.brokers=${kafkaCluster-2} #Replace kafkaCluster-2 with the approprate IP of the cluster
+spring.cloud.stream.binders.kafka3.type: kstream
+spring.cloud.stream.binders.kafka3.environment.spring.cloud.stream.kafka.streams.binder.brokers=${kafkaCluster-2} #Replace kafkaCluster-2 with the approprate IP of the cluster
+
+spring.cloud.stream.function.definition=process;kstreamProcess
+
+# From cluster 1 to cluster 2 with regular process function
+spring.cloud.stream.bindings.process-in-0.destination=foo
+spring.cloud.stream.bindings.process-in-0.binder=kafka1 # source from cluster 1
+spring.cloud.stream.bindings.process-out-0.destination=bar
+spring.cloud.stream.bindings.process-out-0.binder=kafka2 # send to cluster 2
+
+# Kafka Streams processor on cluster 2
+spring.cloud.stream.bindings.kstreamProcess-in-0.destination=bar
+spring.cloud.stream.bindings.kstreamProcess-in-0.binder=kafka3
+spring.cloud.stream.bindings.kstreamProcess-out-0.destination=foobar
+spring.cloud.stream.bindings.kstreamProcess-out-0.binder=kafka3
+
+
+
+

Pay attention to the above configuration. +We have two kinds of binders, but 3 binders all in all, first one is the regular Kafka binder based on cluster 1 (kafka1), then another Kafka binder based on cluster 2 (kafka2) and finally the kstream one (kafka3). +The first processor in the application receives data from kafka1 and publishes to kafka2 where both binders are based on regular Kafka binder but differnt clusters. +The second processor, which is a Kafka Streams processor consumes data from kafka3 which is the same cluster as kafka2, but a different binder type.

+
+
+

Since there are three different binder types available in the Kafka Streams family of binders - kstream, ktable and globalktable - if your application has multiple bindings based on any of these binders, that needs to be explicitly provided as the binder type.

+
+
+

For e.g if you have a processor as below,

+
+
+
+
@Bean
+public Function<KStream<Long, Order>,
+        Function<KTable<Long, Customer>,
+                Function<GlobalKTable<Long, Product>, KStream<Long, EnrichedOrder>>>> enrichOrder() {
+
+    ...
+}
+
+
+
+

then, this has to be configured in a multi binder scenario as the following. +Please note that this is only needed if you have a true multi-binder scenario where there are multiple processors dealing with multiple clusters within a single application. +In that case, the binders need to be explicitly provided with the bindings to distinguish from other processor’s binder types and clusters.

+
+
+
+
spring.cloud.stream.binders.kafka1.type: kstream
+spring.cloud.stream.binders.kafka1.environment.spring.cloud.stream.kafka.streams.binder.brokers=${kafkaCluster-2}
+spring.cloud.stream.binders.kafka2.type: ktable
+spring.cloud.stream.binders.kafka2.environment.spring.cloud.stream.kafka.streams.binder.brokers=${kafkaCluster-2}
+spring.cloud.stream.binders.kafka3.type: globalktable
+spring.cloud.stream.binders.kafka3.environment.spring.cloud.stream.kafka.streams.binder.brokers=${kafkaCluster-2}
+
+spring.cloud.stream.bindings.enrichOrder-in-0.binder=kafka1  #kstream
+spring.cloud.stream.bindings.enrichOrder-in-1.binder=kafka2  #ktablr
+spring.cloud.stream.bindings.enrichOrder-in-2.binder=kafka3  #globalktable
+spring.cloud.stream.bindings.enrichOrder-out-0.binder=kafka1 #kstream
+
+# rest of the configuration is omitted.
+
+
+
+
+

2.16. State Cleanup

+
+

By default, the Kafkastreams.cleanup() method is called when the binding is stopped. +See the Spring Kafka documentation. +To modify this behavior simply add a single CleanupConfig @Bean (configured to clean up on start, stop, or neither) to the application context; the bean will be detected and wired into the factory bean.

+
+
+
+

2.17. Configuration Options

+
+

This section contains the configuration options used by the Kafka Streams binder.

+
+
+

For common configuration options and properties pertaining to binder, refer to the core documentation.

+
+
+

2.17.1. Kafka Streams Binder Properties

+
+

The following properties are available at the binder level and must be prefixed with spring.cloud.stream.kafka.streams.binder.

+
+
+
+
configuration
+
+

Map with a key/value pair containing properties pertaining to Apache Kafka Streams API. + This property must be prefixed with spring.cloud.stream.kafka.streams.binder.. +Following are some examples of using this property.

+
+
+
+
+
+
spring.cloud.stream.kafka.streams.binder.configuration.default.key.serde=org.apache.kafka.common.serialization.Serdes$StringSerde
+spring.cloud.stream.kafka.streams.binder.configuration.default.value.serde=org.apache.kafka.common.serialization.Serdes$StringSerde
+spring.cloud.stream.kafka.streams.binder.configuration.commit.interval.ms=1000
+
+
+
+

For more information about all the properties that may go into streams configuration, see StreamsConfig JavaDocs in Apache Kafka Streams docs. +All configuration that you can set from StreamsConfig can be set through this. +When using this property, it is applicable against the entire application since this is a binder level property. +If you have more than processors in the application, all of them will acquire these properties. +In the case of properties like application.id, this will become problematic and therefore you have to carefully examine how the properties from StreamsConfig are mapped using this binder level configuration property.

+
+
+
+
functions.<function-bean-name>.applicationId
+
+

Applicable only for functional style processors. +This can be used for setting application ID per function in the application. +In the case of multiple functions, this is a handy way to set the application ID.

+
+
functions.<function-bean-name>.configuration
+
+

Applicable only for functional style processors. +Map with a key/value pair containing properties pertaining to Apache Kafka Streams API. +This is similar to the binder level configuration property describe above, but this level of configuration property is restricted only against the named function. +When you have multiple processors and you want to restrict access to the configuration based on particular functions, you might want to use this. +All StreamsConfig properties can be used here.

+
+
brokers
+
+

Broker URL

+
+

Default: localhost

+
+
+
zkNodes
+
+

Zookeeper URL

+
+

Default: localhost

+
+
+
deserializationExceptionHandler
+
+

Deserialization error handler type. +This handler is applied at the binder level and thus applied against all input binding in the application. +There is a way to control it in a more fine-grained way at the consumer binding level. +Possible values are - logAndContinue, logAndFail or sendToDlq

+
+

Default: logAndFail

+
+
+
applicationId
+
+

Convenient way to set the application.id for the Kafka Streams application globally at the binder level. +If the application contains multiple functions or StreamListener methods, then the application id should be set differently. +See above where setting the application id is discussed in detail.

+
+

Default: application will generate a static application ID. See the application ID section for more details.

+
+
+
stateStoreRetry.maxAttempts
+
+

Max attempts for trying to connect to a state store.

+
+

Default: 1

+
+
+
stateStoreRetry.backoffPeriod
+
+

Backoff period when trying to connect to a state store on a retry.

+
+

Default: 1000 ms

+
+
+
+
+
+
+

2.17.2. Kafka Streams Producer Properties

+
+

The following properties are only available for Kafka Streams producers and must be prefixed with spring.cloud.stream.kafka.streams.bindings.<binding name>.producer. +For convenience, if there are multiple output bindings and they all require a common value, that can be configured by using the prefix spring.cloud.stream.kafka.streams.default.producer..

+
+
+
+
keySerde
+
+

key serde to use

+
+

Default: See the above discussion on message de/serialization

+
+
+
valueSerde
+
+

value serde to use

+
+

Default: See the above discussion on message de/serialization

+
+
+
useNativeEncoding
+
+

flag to enable/disable native encoding

+
+

Default: true.

+
+
+
+
+
+

streamPartitionerBeanName: + Custom outbound partitioner bean name to be used at the consumer. + Applications can provide custom StreamPartitioner as a Spring bean and the name of this bean can be provided to the producer to use instead of the default one.

+
+
+

+ +Default: See the discussion above on outbound partition support.

+
+
+
+

2.17.3. Kafka Streams Consumer Properties

+
+

The following properties are available for Kafka Streams consumers and must be prefixed with spring.cloud.stream.kafka.streams.bindings.<binding-name>.consumer. +For convenience, if there are multiple input bindings and they all require a common value, that can be configured by using the prefix spring.cloud.stream.kafka.streams.default.consumer..

+
+
+
+
applicationId
+
+

Setting application.id per input binding. This is only preferred for StreamListener based processors, for function based processors see other approaches outlined above.

+
+

Default: See above.

+
+
+
keySerde
+
+

key serde to use

+
+

Default: See the above discussion on message de/serialization

+
+
+
valueSerde
+
+

value serde to use

+
+

Default: See the above discussion on message de/serialization

+
+
+
materializedAs
+
+

state store to materialize when using incoming KTable types

+
+

Default: none.

+
+
+
useNativeDecoding
+
+

flag to enable/disable native decoding

+
+

Default: true.

+
+
+
dlqName
+
+

DLQ topic name.

+
+

Default: See above on the discussion of error handling and DLQ.

+
+
+
startOffset
+
+

Offset to start from if there is no committed offset to consume from. +This is mostly used when the consumer is consuming from a topic for the first time. +Kafka Streams uses earliest as the default strategy and the binder uses the same default. +This can be overridden to latest using this property.

+
+

Default: earliest.

+
+
+
+
+
+

Note: Using resetOffsets on the consumer does not have any effect on Kafka Streams binder. +Unlike the message channel based binder, Kafka Streams binder does not seek to beginning or end on demand.

+
+
+
+
deserializationExceptionHandler
+
+

Deserialization error handler type. +This handler is applied per consumer binding as opposed to the binder level property described before. +Possible values are - logAndContinue, logAndFail or sendToDlq

+
+

Default: logAndFail

+
+
+
timestampExtractorBeanName
+
+

Specific time stamp extractor bean name to be used at the consumer. +Applications can provide TimestampExtractor as a Spring bean and the name of this bean can be provided to the consumer to use instead of the default one.

+
+

Default: See the discussion above on timestamp extractors.

+
+
+
+
+
+
+

2.17.4. Special note on concurrency

+
+

In Kafka Streams, you can control of the number of threads a processor can create using the num.stream.threads property. +This, you can do using the various configuration options described above under binder, functions, producer or consumer level. +You can also use the concurrency property that core Spring Cloud Stream provides for this purpose. +When using this, you need to use it on the consumer. +When you have more than one input bindings either in a function or StreamListener, set this on the first input binding. +For e.g. when setting spring.cloud.stream.bindings.process-in-0.consumer.concurrency, it will be translated as num.stream.threads by the binder.

+
+
+
+
+
+

Appendices

+
+

Appendix A: Building

+
+
+

A.1. Basic Compile and Test

+
+

To build the source you will need to install JDK 1.7.

+
+
+

The build uses the Maven wrapper so you don’t have to install a specific +version of Maven. To enable the tests, you should have Kafka server 0.9 or above running +before building. See below for more information on running the servers.

+
+
+

The main build command is

+
+
+
+
$ ./mvnw clean install
+
+
+
+

You can also add '-DskipTests' if you like, to avoid running the tests.

+
+
+ + + + + +
+ + +You can also install Maven (>=3.3.3) yourself and run the mvn command +in place of ./mvnw in the examples below. If you do that you also +might need to add -P spring if your local Maven settings do not +contain repository declarations for spring pre-release artifacts. +
+
+
+ + + + + +
+ + +Be aware that you might need to increase the amount of memory +available to Maven by setting a MAVEN_OPTS environment variable with +a value like -Xmx512m -XX:MaxPermSize=128m. We try to cover this in +the .mvn configuration, so if you find you have to do it to make a +build succeed, please raise a ticket to get the settings added to +source control. +
+
+
+

The projects that require middleware generally include a +docker-compose.yml, so consider using +Docker Compose to run the middeware servers +in Docker containers.

+
+
+
+

A.2. Documentation

+
+

There is a "full" profile that will generate documentation.

+
+
+
+

A.3. Working with the code

+
+

If you don’t have an IDE preference we would recommend that you use +Spring Tools Suite or +Eclipse when working with the code. We use the +m2eclipe eclipse plugin for maven support. Other IDEs and tools +should also work without issue.

+
+
+

A.3.1. Importing into eclipse with m2eclipse

+
+

We recommend the m2eclipe eclipse plugin when working with +eclipse. If you don’t already have m2eclipse installed it is available from the "eclipse +marketplace".

+
+
+

Unfortunately m2e does not yet support Maven 3.3, so once the projects +are imported into Eclipse you will also need to tell m2eclipse to use +the .settings.xml file for the projects. If you do not do this you +may see many different errors related to the POMs in the +projects. Open your Eclipse preferences, expand the Maven +preferences, and select User Settings. In the User Settings field +click Browse and navigate to the Spring Cloud project you imported +selecting the .settings.xml file in that project. Click Apply and +then OK to save the preference changes.

+
+
+ + + + + +
+ + +Alternatively you can copy the repository settings from .settings.xml into your own ~/.m2/settings.xml. +
+
+
+
+

A.3.2. Importing into eclipse without m2eclipse

+
+

If you prefer not to use m2eclipse you can generate eclipse project metadata using the +following command:

+
+
+
+
$ ./mvnw eclipse:eclipse
+
+
+
+

The generated eclipse projects can be imported by selecting import existing projects +from the file menu.

+
+
+

[[contributing] +== Contributing

+
+
+

Spring Cloud is released under the non-restrictive Apache 2.0 license, +and follows a very standard Github development process, using Github +tracker for issues and merging pull requests into master. If you want +to contribute even something trivial please do not hesitate, but +follow the guidelines below.

+
+
+
+
+

A.4. Sign the Contributor License Agreement

+
+

Before we accept a non-trivial patch or pull request we will need you to sign the +contributor’s agreement. +Signing the contributor’s agreement does not grant anyone commit rights to the main +repository, but it does mean that we can accept your contributions, and you will get an +author credit if we do. Active contributors might be asked to join the core team, and +given the ability to merge pull requests.

+
+
+
+

A.5. Code Conventions and Housekeeping

+
+

None of these is essential for a pull request, but they will all help. They can also be +added after the original pull request but before a merge.

+
+
+
    +
  • +

    Use the Spring Framework code format conventions. If you use Eclipse +you can import formatter settings using the +eclipse-code-formatter.xml file from the +Spring +Cloud Build project. If using IntelliJ, you can use the +Eclipse Code Formatter +Plugin to import the same file.

    +
  • +
  • +

    Make sure all new .java files to have a simple Javadoc class comment with at least an +@author tag identifying you, and preferably at least a paragraph on what the class is +for.

    +
  • +
  • +

    Add the ASF license header comment to all new .java files (copy from existing files +in the project)

    +
  • +
  • +

    Add yourself as an @author to the .java files that you modify substantially (more +than cosmetic changes).

    +
  • +
  • +

    Add some Javadocs and, if you change the namespace, some XSD doc elements.

    +
  • +
  • +

    A few unit tests would help a lot as well — someone has to do it.

    +
  • +
  • +

    If no-one else is using your branch, please rebase it against the current master (or +other target branch in the main project).

    +
  • +
  • +

    When writing a commit message please follow these conventions, +if you are fixing an existing issue please add Fixes gh-XXXX at the end of the commit +message (where XXXX is the issue number).

    +
  • +
+
+
+
+
+
+ + + + + + + \ No newline at end of file diff --git a/spring-cloud-stream-binder-kafka/3.0.0.RELEASE/reference/htmlsingle/Guardfile b/spring-cloud-stream-binder-kafka/3.0.0.RELEASE/reference/htmlsingle/Guardfile new file mode 100644 index 00000000..bdd4d729 --- /dev/null +++ b/spring-cloud-stream-binder-kafka/3.0.0.RELEASE/reference/htmlsingle/Guardfile @@ -0,0 +1,20 @@ +require 'asciidoctor' +require 'erb' + +guard 'shell' do + watch(/.*\.adoc$/) {|m| + Asciidoctor.render_file('index.adoc', \ + :in_place => true, \ + :safe => Asciidoctor::SafeMode::UNSAFE, \ + :attributes=> { \ + 'source-highlighter' => 'prettify', \ + 'icons' => 'font', \ + 'linkcss'=> 'true', \ + 'copycss' => 'true', \ + 'doctype' => 'book'}) + } +end + +guard 'livereload' do + watch(%r{^.+\.(css|js|html)$}) +end diff --git a/spring-cloud-stream-binder-kafka/3.0.0.RELEASE/reference/htmlsingle/css/spring.css b/spring-cloud-stream-binder-kafka/3.0.0.RELEASE/reference/htmlsingle/css/spring.css new file mode 100644 index 00000000..40821db3 --- /dev/null +++ b/spring-cloud-stream-binder-kafka/3.0.0.RELEASE/reference/htmlsingle/css/spring.css @@ -0,0 +1 @@ +@import url("https://fonts.googleapis.com/css?family=Karla:400,700|Montserrat:400,700");/*! normalize.css v2.1.2 | MIT License | git.io/normalize */article,aside,details,figcaption,figure,footer,header,hgroup,main,nav,section,summary{display:block}audio,canvas,video{display:inline-block}audio:not([controls]){display:none;height:0}[hidden],template{display:none}script{display:none !important}html,body{font-size:100%}html{font-family:Karla, sans-serif;-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%}*,*:before,*:after{-moz-box-sizing:border-box;-webkit-box-sizing:border-box;box-sizing:border-box}body{background:white;color:#000;padding:0;margin:0;font-size:16px;font-family:Karla, sans-serif;font-weight:normal;font-style:normal;line-height:1.6em;position:relative;cursor:auto}a:hover{cursor:pointer}img,object,embed{max-width:100%;height:auto}object,embed{height:100%}img{-ms-interpolation-mode:bicubic}#map_canvas img,#map_canvas embed,#map_canvas object,.map_canvas img,.map_canvas embed,.map_canvas object{max-width:none !important}.left{float:left !important}.right{float:right !important}.text-left{text-align:left !important}.text-right{text-align:right !important}.text-center{text-align:center !important}.text-justify{text-align:justify !important}.hide{display:none}.antialiased{-webkit-font-smoothing:antialiased}img{display:inline-block;vertical-align:middle}textarea{height:auto;min-height:50px}select{width:100%}object,svg{display:inline-block;vertical-align:middle}.center{margin-left:auto;margin-right:auto}.spread{width:100%}p.lead,.paragraph.lead>p,#preamble>.sectionbody>.paragraph:first-of-type p{line-height:1.6}.subheader,.admonitionblock td.content>.title,.audioblock>.title,.exampleblock>.title,.imageblock>.title,.listingblock>.title,.literalblock>.title,.stemblock>.title,.openblock>.title,.paragraph>.title,.quoteblock>.title,table.tableblock>.title,.verseblock>.title,.videoblock>.title,.dlist>.title,.olist>.title,.ulist>.title,.qlist>.title,.hdlist>.title{line-height:1.45;color:#0b0a0a;font-weight:bold;margin-top:0;margin-bottom:0.8em}div,dl,dt,dd,ul,ol,li,h1,h2,h3,#toctitle,.sidebarblock>.content>.title,h4,h5,h6,pre,form,p,blockquote,th,td{margin:0;padding:0;direction:ltr}a{color:#097dff;line-height:inherit;text-decoration:none}a:hover,a:focus{color:#016be2;text-decoration:underline}a img{border:none}p{font-family:inherit;font-weight:normal;font-size:1em;line-height:1.6;margin-bottom:1.25em;text-rendering:optimizeLegibility}p aside{font-size:0.875em;line-height:1.35;font-style:italic}h1,h2,h3,#toctitle,.sidebarblock>.content>.title,h4,h5,h6{font-family:Montserrat, sans-serif;font-weight:400;font-style:normal;color:#000;text-rendering:optimizeLegibility;margin-top:1em;margin-bottom:0.5em;line-height:1.0125em}h1 small,h2 small,h3 small,#toctitle small,.sidebarblock>.content>.title small,h4 small,h5 small,h6 small{font-size:60%;color:#867c74;line-height:0}h1{font-size:2.125em}h2{font-size:1.6875em}h3,#toctitle,.sidebarblock>.content>.title{font-size:1.375em}h4{font-size:1.125em}h5{font-size:1.125em}h6{font-size:1em}hr{border:solid #ddddd8;border-width:1px 0 0;clear:both;margin:1.25em 0 1.1875em;height:0}em,i{font-style:italic;line-height:inherit}strong,b{font-weight:bold;line-height:inherit}small{font-size:60%;line-height:inherit}code{font-family:Monaco, Menlo, Consolas, "Courier New", monospace;font-weight:normal;color:#3d3d3c;word-break:break-word}ul,ol,dl{font-size:1em;line-height:1.6;margin-bottom:1.25em;list-style-position:outside;font-family:inherit}ul,ol{margin-left:1.5em}ul.no-bullet,ol.no-bullet{margin-left:1.5em}ul li ul,ul li ol{margin-left:1.25em;margin-bottom:0;font-size:1em}ul.square li ul,ul.circle li ul,ul.disc li ul{list-style:inherit}ul.square{list-style-type:square}ul.circle{list-style-type:circle}ul.disc{list-style-type:disc}ul.no-bullet{list-style:none}ol li ul,ol li ol{margin-left:1.25em;margin-bottom:0}dl dt{margin-bottom:0.3125em;font-weight:bold}dl dd{margin-bottom:1.25em}abbr,acronym{text-transform:uppercase;font-size:90%;color:#000;border-bottom:1px dotted #dddddd;cursor:help}abbr{text-transform:none}blockquote{margin:0 0 1.25em;padding:0.5625em 1.25em 0 1.1875em;border-left:1px solid #dddddd}blockquote cite{display:block;font-size:0.9375em;color:rgba(0,0,0,0.6)}blockquote cite:before{content:"\2014 \0020"}blockquote cite a,blockquote cite a:visited{color:rgba(0,0,0,0.6)}blockquote,blockquote p{line-height:1.6;color:rgba(0,0,0,0.85)}.vcard{display:inline-block;margin:0 0 1.25em 0;border:1px solid #dddddd;padding:0.625em 0.75em}.vcard li{margin:0;display:block}.vcard .fn{font-weight:bold;font-size:0.9375em}.vevent .summary{font-weight:bold}.vevent abbr{cursor:auto;text-decoration:none;font-weight:bold;border:none;padding:0 0.0625em}#tocbot{padding:0 0 1rem 0;line-height:1.5rem;padding-left:25px}.mobile-toc{padding:0 0 1rem 0;line-height:1.5rem}.mobile-toc li a{display:block;padding:.3rem 0}#tocbot ol li{list-style:none;padding:0;margin:0}#tocbot ol{margin:0;padding:0;padding-left:0.6rem}#tocbot .toc-link{display:block;padding-top:4px;padding-bottom:4px;outline:none}table{background:white;margin-bottom:1.25em;border:solid 1px #cacaca;border-spacing:0}table thead,table tfoot{background:#f7f8f7;font-weight:bold}table thead tr th,table thead tr td,table tfoot tr th,table tfoot tr td{padding:0.5em 0.625em 0.625em;font-size:inherit;color:#000;text-align:left}table tr th,table tr td{padding:0.5625em 0.625em;font-size:inherit;color:#000}table thead tr th,table tfoot tr th,table tbody tr td,table tr td,table tfoot tr td{display:table-cell;line-height:1.6}body{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;tab-size:4}h1,h2,h3,#toctitle,.sidebarblock>.content>.title,h4,h5,h6{line-height:1.2;word-spacing:-0.05em}.clearfix:before,.clearfix:after,.float-group:before,.float-group:after{content:" ";display:table}.clearfix:after,.float-group:after{clear:both}*:not(pre)>code{font-size:0.8525em;font-style:normal !important;letter-spacing:0;padding:0.1em 0.3em 0.2em;background-color:rgba(0,0,0,0.05);border-radius:4px;text-rendering:optimizeSpeed}pre,pre>code{line-height:1.85;color:rgba(0,0,0,0.9);font-family:Monaco, Menlo, Consolas, "Courier New", monospace;font-weight:normal;text-rendering:optimizeSpeed;word-break:normal}pre{overflow:auto}em em{font-style:normal}strong strong{font-weight:normal}.keyseq{color:#6b625c}kbd{font-family:Monaco, Menlo, Consolas, "Courier New", monospace;display:inline-block;color:#000;font-size:0.65em;line-height:1.45;background-color:#f7f7f7;border:1px solid #ccc;-webkit-border-radius:3px;border-radius:3px;-webkit-box-shadow:0 1px 0 rgba(0,0,0,0.2),0 0 0 0.1em white inset;box-shadow:0 1px 0 rgba(0,0,0,0.2),0 0 0 0.1em white inset;margin:0 0.15em;padding:0.2em 0.5em;vertical-align:middle;position:relative;top:-0.1em;white-space:nowrap}.keyseq kbd:first-child{margin-left:0}.keyseq kbd:last-child{margin-right:0}.menuseq,.menu{color:#191715}b.button:before,b.button:after{position:relative;top:-1px;font-weight:normal}b.button:before{content:"[";padding:0 3px 0 2px}b.button:after{content:"]";padding:0 2px 0 3px}p a>code:hover{color:rgba(0,0,0,0.9)}#toc{border-bottom:1px solid #ddddd8;padding-bottom:0.5em}#toc>ul{margin-left:0.125em}#toc ul.sectlevel0>li>a{font-style:italic}#toc ul.sectlevel0 ul.sectlevel1{margin:0.5em 0}#toc ul{list-style-type:none}#toc li{line-height:1.3334}#toc a{text-decoration:none}#toc a:active{text-decoration:underline}#toctitle{color:#0b0a0a;font-size:1.2em;display:none}body.toc2{padding-top:90px;text-rendering:optimizeLegibility}#content #toc{border-style:solid;border-width:1px;border-color:#d7d7d7;margin-bottom:1.25em;padding:1.25em;background:#f1f1f1;-webkit-border-radius:4px;border-radius:4px}#content #toc>:first-child{margin-top:0}#content #toc>:last-child{margin-bottom:0}#footer{padding-bottom:2rem}#footer #footer-text{padding:2rem 0;border-top:1px solid #efefed}#footer-text{color:rgba(0,0,0,0.6);line-height:1.44}.sect1{padding-bottom:0.625em}.sect1+.sect1{border-top:1px solid #efefed}#content h1>a.anchor,h2>a.anchor,h3>a.anchor,#toctitle>a.anchor,.sidebarblock>.content>.title>a.anchor,h4>a.anchor,h5>a.anchor,h6>a.anchor{position:absolute;z-index:1001;width:1.5ex;margin-left:-1.5ex;margin-top:0.1rem;display:block;visibility:hidden;text-align:center;font-weight:normal;color:rgba(0,0,0,0.2)}#content h1>a.anchor:hover,h2>a.anchor:hover,h3>a.anchor:hover,#toctitle>a.anchor:hover,.sidebarblock>.content>.title>a.anchor:hover,h4>a.anchor:hover,h5>a.anchor:hover,h6>a.anchor:hover{color:#097dff;text-decoration:none}#content h1>a.anchor:before,h2>a.anchor:before,h3>a.anchor:before,#toctitle>a.anchor:before,.sidebarblock>.content>.title>a.anchor:before,h4>a.anchor:before,h5>a.anchor:before,h6>a.anchor:before{content:"\0023";font-size:0.85em;display:block;padding-top:0.1em}#content h1:hover>a.anchor,#content h1>a.anchor:hover,h2:hover>a.anchor,h2>a.anchor:hover,h3:hover>a.anchor,#toctitle:hover>a.anchor,.sidebarblock>.content>.title:hover>a.anchor,h3>a.anchor:hover,#toctitle>a.anchor:hover,.sidebarblock>.content>.title>a.anchor:hover,h4:hover>a.anchor,h4>a.anchor:hover,h5:hover>a.anchor,h5>a.anchor:hover,h6:hover>a.anchor,h6>a.anchor:hover{visibility:visible}#content h1>a.link,h2>a.link,h3>a.link,#toctitle>a.link,.sidebarblock>.content>.title>a.link,h4>a.link,h5>a.link,h6>a.link{color:#000;text-decoration:none}#content h1>a.link:hover,h2>a.link:hover,h3>a.link:hover,#toctitle>a.link:hover,.sidebarblock>.content>.title>a.link:hover,h4>a.link:hover,h5>a.link:hover,h6>a.link:hover{color:#262321}.audioblock,.imageblock,.literalblock,.listingblock,.stemblock,.videoblock{margin-bottom:1.25em}.admonitionblock td.content>.title,.audioblock>.title,.exampleblock>.title,.imageblock>.title,.listingblock>.title,.literalblock>.title,.stemblock>.title,.openblock>.title,.paragraph>.title,.quoteblock>.title,table.tableblock>.title,.verseblock>.title,.videoblock>.title,.dlist>.title,.olist>.title,.ulist>.title,.qlist>.title,.hdlist>.title{text-rendering:optimizeLegibility;text-align:left;font-family:Karla, sans-serif;font-size:1rem}table.tableblock>caption.title{white-space:nowrap;overflow:visible;max-width:0;padding:0.6rem 0}table.tableblock #preamble>.sectionbody>.paragraph:first-of-type p{font-size:inherit}.admonitionblock>table{border-collapse:separate;border:0;background:none;width:100%}.admonitionblock>table td.icon{text-align:center;vertical-align:top;padding-top:0.8em;width:80px}.admonitionblock>table td.icon img{max-width:initial}.admonitionblock>table td.icon .title{font-weight:bold;font-family:Montserrat, sans-serif;text-transform:uppercase}.admonitionblock>table td.content{padding-left:0em;padding-right:1.25em;border-left:1px solid #ddddd8}.admonitionblock>table td.content>:last-child>:last-child{margin-bottom:0}.exampleblock>.content{border-style:solid;border-width:0;border-color:#e6e6e6;margin-bottom:1.25em;padding:1.25em;background:#f1f1f1;border-radius:4px}.exampleblock>.content>:first-child{margin-top:0}.exampleblock>.content>:last-child{margin-bottom:0}.sidebarblock{border-style:solid;border-width:0;border-color:#d7d7d7;margin-bottom:1.25em;padding:1.25em;background:#f1f1f1;border-radius:4px;overflow:scroll}.sidebarblock>:first-child{margin-top:0}.sidebarblock>:last-child{margin-bottom:0}.sidebarblock>.content>.title{color:#0b0a0a;margin-top:0;text-align:center}.exampleblock>.content>:last-child>:last-child,.exampleblock>.content .olist>ol>li:last-child>:last-child,.exampleblock>.content .ulist>ul>li:last-child>:last-child,.exampleblock>.content .qlist>ol>li:last-child>:last-child,.sidebarblock>.content>:last-child>:last-child,.sidebarblock>.content .olist>ol>li:last-child>:last-child,.sidebarblock>.content .ulist>ul>li:last-child>:last-child,.sidebarblock>.content .qlist>ol>li:last-child>:last-child{margin-bottom:0}.literalblock pre,.listingblock pre:not(.highlight),.listingblock pre[class="highlight"],.listingblock pre[class^="highlight "],.listingblock pre.CodeRay,.listingblock pre.prettyprint{background:#282c33;color:#e6e1dc;border-radius:4px}.sidebarblock .literalblock pre,.sidebarblock .listingblock pre:not(.highlight),.sidebarblock .listingblock pre[class="highlight"],.sidebarblock .listingblock pre[class^="highlight "],.sidebarblock .listingblock pre.CodeRay,.sidebarblock .listingblock pre.prettyprint{background:#282c33;color:#e6e1dc}.literalblock pre,.literalblock pre[class],.listingblock pre,.listingblock pre[class],.listingblock pre:not(.highlight){padding:1em 1.5rem;font-size:0.8125em}.literalblock pre.nowrap,.literalblock pre[class].nowrap,.listingblock pre.nowrap,.listingblock pre[class].nowrap{overflow-x:auto}.literalblock.output pre{color:whitesmoke;background-color:rgba(0,0,0,0.9)}.listingblock{white-space:nowrap}.listingblock pre.highlightjs{padding:0.2rem 0}.listingblock pre.highlightjs>code{padding:1em 1.5rem;border-radius:4px}.listingblock>.content{position:relative}.listingblock code[data-lang]:before{display:none;content:attr(data-lang);position:absolute;font-size:0.8em;font-weight:bold;top:0.425rem;right:0.5rem;line-height:1;text-transform:uppercase;color:#999}.listingblock code[data-lang]:before{display:block}.listingblock.terminal pre .command:before{content:attr(data-prompt);padding-right:0.5em;color:#999}.listingblock.terminal pre .command:not([data-prompt]):before{content:"$"}table.pyhltable{border-collapse:separate;border:0;margin-bottom:0;background:none}table.pyhltable td{vertical-align:top;padding-top:0;padding-bottom:0;line-height:1.45}table.pyhltable td.code{padding-left:.75em;padding-right:0}pre.pygments .lineno,table.pyhltable td:not(.code){color:#999;padding-left:0;padding-right:.5em;border-right:1px solid #ddddd8}pre.pygments .lineno{display:block;margin-right:.25em}table.pyhltable .linenodiv{background:none !important;padding-right:0 !important}.quoteblock{margin:0 1em 1.25em 1.5em;display:block;text-align:left;padding-left:20px}.quoteblock blockquote,.quoteblock blockquote p{color:rgba(0,0,0,0.85);line-height:1.75;letter-spacing:0}.quoteblock blockquote{margin:0;padding:0;border:0;position:relative}.quoteblock blockquote:before{content:"\201c";font-size:2.75em;font-weight:bold;line-height:0.6em;margin-left:0em;margin-right:1rem;margin-top:0.8rem;color:rgba(0,0,0,0.1);position:absolute;top:0;left:-30px}.quoteblock blockquote>.paragraph:last-child p{margin-bottom:0}.quoteblock .attribution{margin-right:0.5ex}.quoteblock .quoteblock{margin-left:0;margin-right:0;padding:0.5em 0;border-left:3px solid rgba(0,0,0,0.6)}.quoteblock .quoteblock blockquote{padding:0 0 0 0.75em}.quoteblock .quoteblock blockquote:before{display:none}.verseblock{margin:0 1em 1.25em 0;background-color:#f1f1f1;padding:1rem 1.4rem;border-radius:4px}.verseblock pre{font-family:Monaco, Menlo, Consolas, "Courier New", monospace;font-size:0.9rem;color:rgba(0,0,0,0.85);font-weight:300;text-rendering:optimizeLegibility}.verseblock pre strong{font-weight:400}.verseblock .attribution{margin-top:1.25rem;margin-left:0.5ex}.quoteblock .attribution,.verseblock .attribution{font-size:0.9375em;line-height:1.45;font-style:italic}.quoteblock .attribution br,.verseblock .attribution br{display:none}.quoteblock .attribution cite,.verseblock .attribution cite{display:block;letter-spacing:-0.025em;color:rgba(0,0,0,0.6)}.quoteblock.abstract{margin:0 0 1.25em 0;display:block}.quoteblock.abstract blockquote,.quoteblock.abstract blockquote p{text-align:left;word-spacing:0}.quoteblock.abstract blockquote:before,.quoteblock.abstract blockquote p:first-of-type:before{display:none}table.tableblock{max-width:100%;border-collapse:separate;overflow-x:scroll}table.tableblock td>.paragraph:last-child p>p:last-child,table.tableblock th>p:last-child,table.tableblock td>p:last-child{margin-bottom:0}table.tableblock,th.tableblock,td.tableblock{border:0 solid #cacaca;background:white}table.grid-all th.tableblock,table.grid-all td.tableblock{border-width:0 1px 1px 0}table.grid-all tfoot>tr>th.tableblock,table.grid-all tfoot>tr>td.tableblock{border-width:1px 1px 0 0}table.grid-cols th.tableblock,table.grid-cols td.tableblock{border-width:0 1px 0 0}table.grid-all *>tr>.tableblock:last-child,table.grid-cols *>tr>.tableblock:last-child{border-right-width:0}table.grid-rows th.tableblock,table.grid-rows td.tableblock{border-width:0 0 1px 0}table.grid-all tbody>tr:last-child>th.tableblock,table.grid-all tbody>tr:last-child>td.tableblock,table.grid-all thead:last-child>tr>th.tableblock,table.grid-rows tbody>tr:last-child>th.tableblock,table.grid-rows tbody>tr:last-child>td.tableblock,table.grid-rows thead:last-child>tr>th.tableblock{border-bottom-width:0}table.grid-rows tfoot>tr>th.tableblock,table.grid-rows tfoot>tr>td.tableblock{border-width:1px 0 0 0}table.frame-all{border-width:1px}table.frame-sides{border-width:0 1px}table.frame-topbot{border-width:1px 0}th.halign-left,td.halign-left{text-align:left}th.halign-right,td.halign-right{text-align:right}th.halign-center,td.halign-center{text-align:center}th.valign-top,td.valign-top{vertical-align:top}th.valign-bottom,td.valign-bottom{vertical-align:bottom}th.valign-middle,td.valign-middle{vertical-align:middle}table thead th,table tfoot th{font-weight:bold}tbody tr th{display:table-cell;line-height:1.6;background:#f7f8f7}tbody tr th,tbody tr th p,tfoot tr th,tfoot tr th p{color:#34302d;font-weight:bold}p.tableblock>code:only-child{background:none;padding:0}p.tableblock{font-size:1em}td>div.verse{white-space:pre}ol{margin-left:1.75em}ul li ol{margin-left:1.5em}dl dd{margin-left:1.125em}dl dd:last-child,dl dd:last-child>:last-child{margin-bottom:0}ol>li p,ul>li p,ul dd,ol dd,.olist .olist,.ulist .ulist,.ulist .olist,.olist .ulist{margin-bottom:0.625em}ul.unstyled,ol.unnumbered,ul.checklist,ul.none{list-style-type:none}ul.unstyled,ol.unnumbered,ul.checklist{margin-left:0.625em}ul.checklist li>p:first-child>.fa-square-o:first-child,ul.checklist li>p:first-child>.fa-check-square-o:first-child{width:1em;font-size:0.85em}ul.checklist li>p:first-child>input[type="checkbox"]:first-child{width:1em;position:relative;top:1px}ul.inline{margin:0 auto 0.625em auto;margin-left:-1.375em;margin-right:0;padding:0;list-style:none;overflow:hidden}ul.inline>li{list-style:none;float:left;margin-left:1.375em;display:block}ul.inline>li>*{display:block}.unstyled dl dt{font-weight:normal;font-style:normal}ol.arabic{list-style-type:decimal}ol.decimal{list-style-type:decimal-leading-zero}ol.loweralpha{list-style-type:lower-alpha}ol.upperalpha{list-style-type:upper-alpha}ol.lowerroman{list-style-type:lower-roman}ol.upperroman{list-style-type:upper-roman}ol.lowergreek{list-style-type:lower-greek}.hdlist>table,.colist>table{border:0;background:none}.hdlist>table>tbody>tr,.colist>table>tbody>tr{background:none}td.hdlist1,td.hdlist2{vertical-align:top;padding:0 0.625em}td.hdlist1{font-weight:bold;padding-bottom:1.25em}.literalblock+.colist,.listingblock+.colist{margin-top:-0.5em}.colist>table tr>td:first-of-type{padding:0 0.75em;line-height:1}.colist>table tr>td:first-of-type img{max-width:initial}.colist>table tr>td:last-of-type{padding:0.25em 0}.thumb,.th{line-height:0;display:inline-block;border:solid 4px white;-webkit-box-shadow:0 0 0 1px #dddddd;box-shadow:0 0 0 1px #dddddd}.imageblock.left,.imageblock[style*="float: left"]{margin:0.25em 0.625em 1.25em 0}.imageblock.right,.imageblock[style*="float: right"]{margin:0.25em 0 1.25em 0.625em}.imageblock>.title{margin-bottom:0}.imageblock.thumb,.imageblock.th{border-width:6px}.imageblock.thumb>.title,.imageblock.th>.title{padding:0 0.125em}.image.left,.image.right{margin-top:0.25em;margin-bottom:0.25em;display:inline-block;line-height:0}.image.left{margin-right:0.625em}.image.right{margin-left:0.625em}a.image{text-decoration:none;display:inline-block}a.image object{pointer-events:none}sup.footnote,sup.footnoteref{font-size:0.875em;position:static;vertical-align:super}sup.footnote a,sup.footnoteref a{text-decoration:none}sup.footnote a:active,sup.footnoteref a:active{text-decoration:underline}#footnotes{padding-top:0.75em;padding-bottom:0.75em;margin-bottom:0.625em}#footnotes hr{width:20%;min-width:6.25em;margin:-0.25em 0 0.75em 0;border-width:1px 0 0 0}#footnotes .footnote{padding:0 0.375em 0 0.225em;line-height:1.3334;font-size:0.875em;margin-left:1.2em;text-indent:-1.05em;margin-bottom:0.2em}#footnotes .footnote a:first-of-type{font-weight:bold;text-decoration:none}#footnotes .footnote:last-of-type{margin-bottom:0}#content #footnotes{margin-top:-0.625em;margin-bottom:0;padding:0.75em 0}.gist .file-data>table{border:0;background:#fff;width:100%;margin-bottom:0}.gist .file-data>table td.line-data{width:99%}div.unbreakable{page-break-inside:avoid}.big{font-size:larger}.small{font-size:smaller}.underline{text-decoration:underline}.overline{text-decoration:overline}.line-through{text-decoration:line-through}.aqua{color:#00bfbf}.aqua-background{background-color:#00fafa}.black{color:black}.black-background{background-color:black}.blue{color:#0000bf}.blue-background{background-color:#0000fa}.fuchsia{color:#bf00bf}.fuchsia-background{background-color:#fa00fa}.gray{color:#606060}.gray-background{background-color:#7d7d7d}.green{color:#006000}.green-background{background-color:#007d00}.lime{color:#00bf00}.lime-background{background-color:#00fa00}.maroon{color:#600000}.maroon-background{background-color:#7d0000}.navy{color:#000060}.navy-background{background-color:#00007d}.olive{color:#606000}.olive-background{background-color:#7d7d00}.purple{color:#600060}.purple-background{background-color:#7d007d}.red{color:#bf0000}.red-background{background-color:#fa0000}.silver{color:#909090}.silver-background{background-color:#bcbcbc}.teal{color:#006060}.teal-background{background-color:#007d7d}.white{color:#bfbfbf}.white-background{background-color:#fafafa}.yellow{color:#bfbf00}.yellow-background{background-color:#fafa00}span.icon>.fa{cursor:default}.admonitionblock td.icon [class^="fa icon-"]{font-size:2.5em;cursor:default}.admonitionblock td.icon .icon-note:before{content:"\f05a";color:#3f6a22}.admonitionblock td.icon .icon-tip:before{content:"\f0eb";color:#0077b9}.admonitionblock td.icon .icon-warning:before{content:"\f071";color:#d88400}.admonitionblock td.icon .icon-caution:before{content:"\f06d";color:#bf3400}.admonitionblock td.icon .icon-important:before{content:"\f06a";color:#bf0000}.conum[data-value]{display:inline-block;color:#000 !important;background-color:#ffe157;-webkit-border-radius:100px;border-radius:100px;text-align:center;font-size:0.75em;width:1.67em;height:1.67em;line-height:1.67em;font-family:"Open Sans", "DejaVu Sans", sans-serif;font-style:normal;font-weight:bold}.conum[data-value] *{color:#fff !important}.conum[data-value]+b{display:none}.conum[data-value]:after{content:attr(data-value)}pre .conum[data-value]{position:relative;top:0;color:#000 !important;background-color:#ffe157;font-size:12px}b.conum *{color:inherit !important}.conum:not([data-value]):empty{display:none}.admonitionblock{background-color:#ecf1e8;padding:0.8em 0;margin:30px 0;width:auto;border-radius:4px;overflow-x:scroll}.admonitionblock.important{border-left:0px solid #e20000;background-color:#f9ebeb}.admonitionblock.warning{border-left:0px solid #d88400;background-color:#fff9e4}.admonitionblock.tip{border-left:0px solid #0077b9;background-color:#e9f1f6}.admonitionblock.caution{border-left:0px solid #e20000;background-color:#f9ebeb}.admonitionblock .exampleblock>.content{border:0 none;background-color:#fff}#toc a:hover{text-decoration:underline}.admonitionblock>table{margin-bottom:0}.admonitionblock>table td.content{border-left:none}@media print{#tocbot a.toc-link.node-name--H4{display:none}}.is-collapsible{max-height:1000px;overflow:hidden;transition:all 200ms ease-in-out}.is-collapsed{max-height:0}div.back-action,#toc.toc2 div.back-action{padding:0.8rem 0 0 0}div.back-action a,#toc.toc2 div.back-action a{position:relative;display:inline-block;padding:0.6rem 1.2rem;padding-left:35px}div.back-action a span,#toc.toc2 div.back-action a span{position:absolute;left:5px;top:5px;display:block;color:#333;height:26px;width:26px;border-radius:13px}div.back-action a i,#toc.toc2 div.back-action a i{position:absolute;top:5px;left:5px}div.back-action a:hover span,#toc.toc2 div.back-action a:hover span{color:#000}#tocbot.desktop-toc{padding-top:0.8rem}#header-spring{position:absolute;text-rendering:optimizeLegibility;top:0;left:0;right:0;height:90px;margin:0 1rem;padding:0 1rem;border-bottom:1px solid #ddddd8;border-top:3px solid #6BB344}#header-spring h1{margin:0;padding:0;font-size:22px;text-align:left;line-height:86px;padding-left:0.6rem}#header-spring h1 svg{width:200px}#header-spring h1 svg .st0{fill:#6BB344}#header-spring h1 svg .st2{fill:#444}body.book #header-spring{position:relative;top:auto;left:auto;right:auto;margin:0}body.book #header>h1:only-child{border:0 none;padding-bottom:1.2rem;font-size:1.8rem}body.book #header,body.book #content,body.book #footnotes,body.book #footer{margin:0 auto}body.toc2 #header-spring{position:absolute;left:0;right:0;top:0}body.toc2 #header>h1:only-child{font-size:2.2rem}body.toc2 #header,body.toc2 #content,body.toc2 #footnotes,body.toc2 #footer{margin:0 auto}body.toc2 #content{padding-top:2rem}#header,#content,#footnotes,#footer{width:100%;margin-right:auto;margin-top:0;margin-bottom:0;max-width:62.5em;*zoom:1;position:relative;padding-left:0.9375em;padding-right:0.9375em}#header:before,#header:after,#content:before,#content:after,#footnotes:before,#footnotes:after,#footer:before,#footer:after{content:" ";display:table}#header:after,#content:after,#footnotes:after,#footer:after{clear:both}#content{margin-top:1.25em}#content:before{content:none}#header>h1:first-child{margin-top:2.55rem;margin-bottom:0.5em;margin-bottom:0.5em}#header>h1:first-child+#toc{margin-top:8px;border-top:0 none}#header>h1:only-child,body.toc2 #header>h1:nth-last-child(2){border-bottom:1px solid #ddddd8;padding-bottom:8px}#header .details{border-bottom:1px solid #ddddd8;line-height:1.45;padding-top:0;padding-bottom:2.25em;padding-left:0.25em;color:rgba(0,0,0,0.6);display:-ms-flexbox;display:-webkit-flex;display:flex;-ms-flex-flow:row wrap;-webkit-flex-flow:row wrap;flex-flow:row wrap}#header .details span:first-child{margin-left:-0.125em}#header .details span.email a{color:rgba(0,0,0,0.85)}#header .details br{display:none}#header .details br+span:before{content:"\00a0\2013\00a0"}#header .details br+span.author:before{content:"\00a0\22c5\00a0";color:rgba(0,0,0,0.85)}#header .details br+span#revremark:before{content:"\00a0|\00a0"}#header #revnumber{text-transform:capitalize}#header #revnumber:after{content:"\00a0"}#content>h1:first-child:not([class]){color:rgba(0,0,0,0.85);border-bottom:1px solid #ddddd8;padding-bottom:8px;margin-top:0;padding-top:1.5rem;margin-bottom:1.25rem}h1{font-size:2.2rem;letter-spacing:-1px}h1,h2,h3,h4,h5,h6{font-weight:normal;font-family:Montserrat, Arial, Helvetica, sans-serif}h1:focus,h2:focus,h3:focus,h4:focus,h5:focus,h6:focus{box-shadow:none;outline:none}h2,h3,h4,h5,h6{padding:.8rem 0 .4rem}h1{font-size:1.75em}h2{font-size:1.6rem;letter-spacing:-1px}h3{font-size:1.5rem}h4{font-size:1.4rem}h5{font-size:1.3rem}h6{font-size:1.2rem}pre.highlight{background:#232323;color:#e6e1dc;border-radius:4px}pre.highlight code{color:#e6e1dc}pre.highlight a,#toc.toc2 a{color:#000;font-size:1rem}pre.highlight ul.sectlevel1,#toc.toc2 ul.sectlevel1{padding-left:0.2rem}pre.highlight ul.sectlevel1 li,#toc.toc2 ul.sectlevel1 li{line-height:1.4rem}::selection{background-color:#d1ff79}.literalblock pre::selection,.listingblock pre[class="highlight"]::selection,.highlight::selection,pre::selection,.highlight code::selection,.highlight code span::selection{background:rgba(255,255,255,0.2) !important}body.book #header{margin-bottom:2rem}body.toc2 #header{margin-bottom:0}.desktop-toc{display:none}.admonitionblock td.icon{display:none}.admonitionblock>table td.content{padding-left:1.25em}@media only screen and (min-width: 768px){#toctitle{font-size:1.375em}.sect1{padding-bottom:1.25em}.mobile-toc{display:none}.desktop-toc{display:block}.literalblock pre,.literalblock pre[class],.listingblock pre,.listingblock pre[class]{font-size:0.90625em}.admonitionblock td.icon{display:table-cell}.admonitionblock>table td.content{padding-left:0}body.toc2{padding-right:0}body.toc2 #toc.toc2{position:absolute;margin-top:0 !important;width:15em;top:0;border-top-width:0 !important;border-bottom-width:0 !important;margin-left:-15.9375em;z-index:1000;padding:0 1em 1.25em 0em;overflow:auto}body.toc2 #toc.toc2 #toctitle{margin-top:0;margin-bottom:0.8rem;font-size:1.2em}body.toc2 #toc.toc2>ul{font-size:0.9em;margin-bottom:0}body.toc2 #toc.toc2 ul ul{margin-left:0;padding-left:1em}body.toc2 #toc.toc2 ul.sectlevel0 ul.sectlevel1{padding-left:0;margin-top:0.5em;margin-bottom:0.5em}body.toc2 #header,body.toc2 #content,body.toc2 #footnotes,body.toc2 #footer{padding-left:15.9375em;max-width:none}body.book #header-spring h1{max-width:1400px;margin:0 auto}body.book #header,body.book #content,body.book #footnotes,body.book #footer{max-width:1400px}body.is-position-fixed #toc.toc2{position:fixed;height:100%}h1,h2,h3,#toctitle,.sidebarblock>.content>.title,h4,h5,h6{line-height:1.2}h1{font-size:1.75em}h2{font-size:1.6em}h3,#toctitle,.sidebarblock>.content>.title{font-size:1.5em}h4{font-size:1.4em}h5{font-size:1.2em}h6{font-size:1.2em}#tocbot a.toc-link.node-name--H1{font-style:italic}#tocbot ol{margin:0;padding:0;padding-left:0.6rem}#tocbot ol li{list-style:none;padding:0 0;margin:0;display:block}#tocbot{z-index:999}#tocbot .toc-link{position:relative;display:block;z-index:999;padding-right:5px;padding-top:4px;padding-bottom:4px}#tocbot .is-active-link{padding-right:3px;border-right:3px solid #6BB344}}@media only screen and (min-width: 768px){#tocbot>ul.toc-list{margin-bottom:0.5em;margin-left:0.125em}#tocbot ul.sectlevel0,#tocbot a.toc-link.node-name--H1+ul{padding-left:0}#tocbot a.toc-link{height:100%}.is-collapsible{max-height:3000px;overflow:hidden}.is-collapsed{max-height:0}.is-active-link{font-weight:700}}@media only screen and (min-width: 768px){body.toc2 #header,body.toc2 #content,body.toc2 #footer{background-repeat:repeat-y;background-position:14em 0;background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAMAAAAoyzS7AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyhpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNi1jMTQwIDc5LjE2MDQ1MSwgMjAxNy8wNS8wNi0wMTowODoyMSAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENDIDIwMTggKE1hY2ludG9zaCkiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6RDE0NUNENzNGMTVGMTFFODk5RjI5ODk3QURGRjcxMkEiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6RDE0NUNENzRGMTVGMTFFODk5RjI5ODk3QURGRjcxMkEiPiA8eG1wTU06RGVyaXZlZEZyb20gc3RSZWY6aW5zdGFuY2VJRD0ieG1wLmlpZDpEMTQ1Q0Q3MUYxNUYxMUU4OTlGMjk4OTdBREZGNzEyQSIgc3RSZWY6ZG9jdW1lbnRJRD0ieG1wLmRpZDpEMTQ1Q0Q3MkYxNUYxMUU4OTlGMjk4OTdBREZGNzEyQSIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/PjmGxxYAAAAGUExURd3d2AAAAJlCnKAAAAAMSURBVHjaYmAACDAAAAIAAU9tWeEAAAAASUVORK5CYII=)}}@media only screen and (min-width: 1280px){body.toc2{padding-right:0}body.toc2 #toc.toc2{width:25em;left:auto;margin-left:-26.9375em}body.toc2 #toc.toc2 #toctitle{font-size:1.375em}body.toc2 #toc.toc2>ul{font-size:0.95em}body.toc2 #toc.toc2 ul ul{padding-left:1.25em}body.toc2 body.toc2.toc-right{padding-left:0;padding-right:20em}body.toc2 #header,body.toc2 #content,body.toc2 #footnotes,body.toc2 #footer{padding-left:26.9375em;max-width:1400px}body.toc2 #header-spring h1{margin:0 auto;max-width:1400px}.literalblock pre,.literalblock pre[class],.listingblock pre,.listingblock pre[class]{font-size:0.8125em}body.toc2 #header,body.toc2 #content,body.toc2 #footer{background-repeat:repeat-y;background-position:24em 0;background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAMAAAAoyzS7AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyhpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNi1jMTQwIDc5LjE2MDQ1MSwgMjAxNy8wNS8wNi0wMTowODoyMSAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENDIDIwMTggKE1hY2ludG9zaCkiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6RDE0NUNENzNGMTVGMTFFODk5RjI5ODk3QURGRjcxMkEiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6RDE0NUNENzRGMTVGMTFFODk5RjI5ODk3QURGRjcxMkEiPiA8eG1wTU06RGVyaXZlZEZyb20gc3RSZWY6aW5zdGFuY2VJRD0ieG1wLmlpZDpEMTQ1Q0Q3MUYxNUYxMUU4OTlGMjk4OTdBREZGNzEyQSIgc3RSZWY6ZG9jdW1lbnRJRD0ieG1wLmRpZDpEMTQ1Q0Q3MkYxNUYxMUU4OTlGMjk4OTdBREZGNzEyQSIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/PjmGxxYAAAAGUExURd3d2AAAAJlCnKAAAAAMSURBVHjaYmAACDAAAAIAAU9tWeEAAAAASUVORK5CYII=)}} diff --git a/spring-cloud-stream-binder-kafka/3.0.0.RELEASE/reference/htmlsingle/favicon.ico b/spring-cloud-stream-binder-kafka/3.0.0.RELEASE/reference/htmlsingle/favicon.ico new file mode 100644 index 00000000..1a4956e6 Binary files /dev/null and b/spring-cloud-stream-binder-kafka/3.0.0.RELEASE/reference/htmlsingle/favicon.ico differ diff --git a/spring-cloud-stream-binder-kafka/3.0.0.RELEASE/reference/htmlsingle/images/kafka-binder.png b/spring-cloud-stream-binder-kafka/3.0.0.RELEASE/reference/htmlsingle/images/kafka-binder.png new file mode 100644 index 00000000..7c6c4c02 Binary files /dev/null and b/spring-cloud-stream-binder-kafka/3.0.0.RELEASE/reference/htmlsingle/images/kafka-binder.png differ diff --git a/spring-cloud-stream-binder-kafka/3.0.0.RELEASE/reference/htmlsingle/images/kafka-streams-initializr.png b/spring-cloud-stream-binder-kafka/3.0.0.RELEASE/reference/htmlsingle/images/kafka-streams-initializr.png new file mode 100644 index 00000000..3f101489 Binary files /dev/null and b/spring-cloud-stream-binder-kafka/3.0.0.RELEASE/reference/htmlsingle/images/kafka-streams-initializr.png differ diff --git a/spring-cloud-stream-binder-kafka/3.0.0.RELEASE/reference/htmlsingle/images/spring-initializr-kafka-streams.png b/spring-cloud-stream-binder-kafka/3.0.0.RELEASE/reference/htmlsingle/images/spring-initializr-kafka-streams.png new file mode 100644 index 00000000..f629e9df Binary files /dev/null and b/spring-cloud-stream-binder-kafka/3.0.0.RELEASE/reference/htmlsingle/images/spring-initializr-kafka-streams.png differ diff --git a/spring-cloud-stream-binder-kafka/3.0.0.RELEASE/reference/htmlsingle/js/highlight/highlight.min.js b/spring-cloud-stream-binder-kafka/3.0.0.RELEASE/reference/htmlsingle/js/highlight/highlight.min.js new file mode 100644 index 00000000..dcbbb4c7 --- /dev/null +++ b/spring-cloud-stream-binder-kafka/3.0.0.RELEASE/reference/htmlsingle/js/highlight/highlight.min.js @@ -0,0 +1,2 @@ +/*! highlight.js v9.13.1 | BSD3 License | git.io/hljslicense */ +!function(e){var n="object"==typeof window&&window||"object"==typeof self&&self;"undefined"!=typeof exports?e(exports):n&&(n.hljs=e({}),"function"==typeof define&&define.amd&&define([],function(){return n.hljs}))}(function(e){function n(e){return e.replace(/&/g,"&").replace(//g,">")}function t(e){return e.nodeName.toLowerCase()}function r(e,n){var t=e&&e.exec(n);return t&&0===t.index}function a(e){return k.test(e)}function i(e){var n,t,r,i,o=e.className+" ";if(o+=e.parentNode?e.parentNode.className:"",t=M.exec(o))return w(t[1])?t[1]:"no-highlight";for(o=o.split(/\s+/),n=0,r=o.length;r>n;n++)if(i=o[n],a(i)||w(i))return i}function o(e){var n,t={},r=Array.prototype.slice.call(arguments,1);for(n in e)t[n]=e[n];return r.forEach(function(e){for(n in e)t[n]=e[n]}),t}function c(e){var n=[];return function r(e,a){for(var i=e.firstChild;i;i=i.nextSibling)3===i.nodeType?a+=i.nodeValue.length:1===i.nodeType&&(n.push({event:"start",offset:a,node:i}),a=r(i,a),t(i).match(/br|hr|img|input/)||n.push({event:"stop",offset:a,node:i}));return a}(e,0),n}function u(e,r,a){function i(){return e.length&&r.length?e[0].offset!==r[0].offset?e[0].offset"}function c(e){l+=""}function u(e){("start"===e.event?o:c)(e.node)}for(var s=0,l="",f=[];e.length||r.length;){var g=i();if(l+=n(a.substring(s,g[0].offset)),s=g[0].offset,g===e){f.reverse().forEach(c);do u(g.splice(0,1)[0]),g=i();while(g===e&&g.length&&g[0].offset===s);f.reverse().forEach(o)}else"start"===g[0].event?f.push(g[0].node):f.pop(),u(g.splice(0,1)[0])}return l+n(a.substr(s))}function s(e){return e.v&&!e.cached_variants&&(e.cached_variants=e.v.map(function(n){return o(e,{v:null},n)})),e.cached_variants||e.eW&&[o(e)]||[e]}function l(e){function n(e){return e&&e.source||e}function t(t,r){return new RegExp(n(t),"m"+(e.cI?"i":"")+(r?"g":""))}function r(a,i){if(!a.compiled){if(a.compiled=!0,a.k=a.k||a.bK,a.k){var o={},c=function(n,t){e.cI&&(t=t.toLowerCase()),t.split(" ").forEach(function(e){var t=e.split("|");o[t[0]]=[n,t[1]?Number(t[1]):1]})};"string"==typeof a.k?c("keyword",a.k):B(a.k).forEach(function(e){c(e,a.k[e])}),a.k=o}a.lR=t(a.l||/\w+/,!0),i&&(a.bK&&(a.b="\\b("+a.bK.split(" ").join("|")+")\\b"),a.b||(a.b=/\B|\b/),a.bR=t(a.b),a.endSameAsBegin&&(a.e=a.b),a.e||a.eW||(a.e=/\B|\b/),a.e&&(a.eR=t(a.e)),a.tE=n(a.e)||"",a.eW&&i.tE&&(a.tE+=(a.e?"|":"")+i.tE)),a.i&&(a.iR=t(a.i)),null==a.r&&(a.r=1),a.c||(a.c=[]),a.c=Array.prototype.concat.apply([],a.c.map(function(e){return s("self"===e?a:e)})),a.c.forEach(function(e){r(e,a)}),a.starts&&r(a.starts,i);var u=a.c.map(function(e){return e.bK?"\\.?("+e.b+")\\.?":e.b}).concat([a.tE,a.i]).map(n).filter(Boolean);a.t=u.length?t(u.join("|"),!0):{exec:function(){return null}}}}r(e)}function f(e,t,a,i){function o(e){return new RegExp(e.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"),"m")}function c(e,n){var t,a;for(t=0,a=n.c.length;a>t;t++)if(r(n.c[t].bR,e))return n.c[t].endSameAsBegin&&(n.c[t].eR=o(n.c[t].bR.exec(e)[0])),n.c[t]}function u(e,n){if(r(e.eR,n)){for(;e.endsParent&&e.parent;)e=e.parent;return e}return e.eW?u(e.parent,n):void 0}function s(e,n){return!a&&r(n.iR,e)}function p(e,n){var t=R.cI?n[0].toLowerCase():n[0];return e.k.hasOwnProperty(t)&&e.k[t]}function d(e,n,t,r){var a=r?"":j.classPrefix,i='',i+n+o}function h(){var e,t,r,a;if(!E.k)return n(k);for(a="",t=0,E.lR.lastIndex=0,r=E.lR.exec(k);r;)a+=n(k.substring(t,r.index)),e=p(E,r),e?(M+=e[1],a+=d(e[0],n(r[0]))):a+=n(r[0]),t=E.lR.lastIndex,r=E.lR.exec(k);return a+n(k.substr(t))}function b(){var e="string"==typeof E.sL;if(e&&!L[E.sL])return n(k);var t=e?f(E.sL,k,!0,B[E.sL]):g(k,E.sL.length?E.sL:void 0);return E.r>0&&(M+=t.r),e&&(B[E.sL]=t.top),d(t.language,t.value,!1,!0)}function v(){y+=null!=E.sL?b():h(),k=""}function m(e){y+=e.cN?d(e.cN,"",!0):"",E=Object.create(e,{parent:{value:E}})}function N(e,n){if(k+=e,null==n)return v(),0;var t=c(n,E);if(t)return t.skip?k+=n:(t.eB&&(k+=n),v(),t.rB||t.eB||(k=n)),m(t,n),t.rB?0:n.length;var r=u(E,n);if(r){var a=E;a.skip?k+=n:(a.rE||a.eE||(k+=n),v(),a.eE&&(k=n));do E.cN&&(y+=I),E.skip||E.sL||(M+=E.r),E=E.parent;while(E!==r.parent);return r.starts&&(r.endSameAsBegin&&(r.starts.eR=r.eR),m(r.starts,"")),a.rE?0:n.length}if(s(n,E))throw new Error('Illegal lexeme "'+n+'" for mode "'+(E.cN||"")+'"');return k+=n,n.length||1}var R=w(e);if(!R)throw new Error('Unknown language: "'+e+'"');l(R);var x,E=i||R,B={},y="";for(x=E;x!==R;x=x.parent)x.cN&&(y=d(x.cN,"",!0)+y);var k="",M=0;try{for(var C,A,S=0;;){if(E.t.lastIndex=S,C=E.t.exec(t),!C)break;A=N(t.substring(S,C.index),C[0]),S=C.index+A}for(N(t.substr(S)),x=E;x.parent;x=x.parent)x.cN&&(y+=I);return{r:M,value:y,language:e,top:E}}catch(O){if(O.message&&-1!==O.message.indexOf("Illegal"))return{r:0,value:n(t)};throw O}}function g(e,t){t=t||j.languages||B(L);var r={r:0,value:n(e)},a=r;return t.filter(w).filter(x).forEach(function(n){var t=f(n,e,!1);t.language=n,t.r>a.r&&(a=t),t.r>r.r&&(a=r,r=t)}),a.language&&(r.second_best=a),r}function p(e){return j.tabReplace||j.useBR?e.replace(C,function(e,n){return j.useBR&&"\n"===e?"
":j.tabReplace?n.replace(/\t/g,j.tabReplace):""}):e}function d(e,n,t){var r=n?y[n]:t,a=[e.trim()];return e.match(/\bhljs\b/)||a.push("hljs"),-1===e.indexOf(r)&&a.push(r),a.join(" ").trim()}function h(e){var n,t,r,o,s,l=i(e);a(l)||(j.useBR?(n=document.createElementNS("http://www.w3.org/1999/xhtml","div"),n.innerHTML=e.innerHTML.replace(/\n/g,"").replace(//g,"\n")):n=e,s=n.textContent,r=l?f(l,s,!0):g(s),t=c(n),t.length&&(o=document.createElementNS("http://www.w3.org/1999/xhtml","div"),o.innerHTML=r.value,r.value=u(t,c(o),s)),r.value=p(r.value),e.innerHTML=r.value,e.className=d(e.className,l,r.language),e.result={language:r.language,re:r.r},r.second_best&&(e.second_best={language:r.second_best.language,re:r.second_best.r}))}function b(e){j=o(j,e)}function v(){if(!v.called){v.called=!0;var e=document.querySelectorAll("pre code");E.forEach.call(e,h)}}function m(){addEventListener("DOMContentLoaded",v,!1),addEventListener("load",v,!1)}function N(n,t){var r=L[n]=t(e);r.aliases&&r.aliases.forEach(function(e){y[e]=n})}function R(){return B(L)}function w(e){return e=(e||"").toLowerCase(),L[e]||L[y[e]]}function x(e){var n=w(e);return n&&!n.disableAutodetect}var E=[],B=Object.keys,L={},y={},k=/^(no-?highlight|plain|text)$/i,M=/\blang(?:uage)?-([\w-]+)\b/i,C=/((^(<[^>]+>|\t|)+|(?:\n)))/gm,I="
",j={classPrefix:"hljs-",tabReplace:null,useBR:!1,languages:void 0};return e.highlight=f,e.highlightAuto=g,e.fixMarkup=p,e.highlightBlock=h,e.configure=b,e.initHighlighting=v,e.initHighlightingOnLoad=m,e.registerLanguage=N,e.listLanguages=R,e.getLanguage=w,e.autoDetection=x,e.inherit=o,e.IR="[a-zA-Z]\\w*",e.UIR="[a-zA-Z_]\\w*",e.NR="\\b\\d+(\\.\\d+)?",e.CNR="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",e.BNR="\\b(0b[01]+)",e.RSR="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",e.BE={b:"\\\\[\\s\\S]",r:0},e.ASM={cN:"string",b:"'",e:"'",i:"\\n",c:[e.BE]},e.QSM={cN:"string",b:'"',e:'"',i:"\\n",c:[e.BE]},e.PWM={b:/\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|they|like|more)\b/},e.C=function(n,t,r){var a=e.inherit({cN:"comment",b:n,e:t,c:[]},r||{});return a.c.push(e.PWM),a.c.push({cN:"doctag",b:"(?:TODO|FIXME|NOTE|BUG|XXX):",r:0}),a},e.CLCM=e.C("//","$"),e.CBCM=e.C("/\\*","\\*/"),e.HCM=e.C("#","$"),e.NM={cN:"number",b:e.NR,r:0},e.CNM={cN:"number",b:e.CNR,r:0},e.BNM={cN:"number",b:e.BNR,r:0},e.CSSNM={cN:"number",b:e.NR+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",r:0},e.RM={cN:"regexp",b:/\//,e:/\/[gimuy]*/,i:/\n/,c:[e.BE,{b:/\[/,e:/\]/,r:0,c:[e.BE]}]},e.TM={cN:"title",b:e.IR,r:0},e.UTM={cN:"title",b:e.UIR,r:0},e.METHOD_GUARD={b:"\\.\\s*"+e.UIR,r:0},e});hljs.registerLanguage("bash",function(e){var t={cN:"variable",v:[{b:/\$[\w\d#@][\w\d_]*/},{b:/\$\{(.*?)}/}]},s={cN:"string",b:/"/,e:/"/,c:[e.BE,t,{cN:"variable",b:/\$\(/,e:/\)/,c:[e.BE]}]},a={cN:"string",b:/'/,e:/'/};return{aliases:["sh","zsh"],l:/\b-?[a-z\._]+\b/,k:{keyword:"if then else elif fi for while in do done case esac function",literal:"true false",built_in:"break cd continue eval exec exit export getopts hash pwd readonly return shift test times trap umask unset alias bind builtin caller command declare echo enable help let local logout mapfile printf read readarray source type typeset ulimit unalias set shopt autoload bg bindkey bye cap chdir clone comparguments compcall compctl compdescribe compfiles compgroups compquote comptags comptry compvalues dirs disable disown echotc echoti emulate fc fg float functions getcap getln history integer jobs kill limit log noglob popd print pushd pushln rehash sched setcap setopt stat suspend ttyctl unfunction unhash unlimit unsetopt vared wait whence where which zcompile zformat zftp zle zmodload zparseopts zprof zpty zregexparse zsocket zstyle ztcp",_:"-ne -eq -lt -gt -f -d -e -s -l -a"},c:[{cN:"meta",b:/^#![^\n]+sh\s*$/,r:10},{cN:"function",b:/\w[\w\d_]*\s*\(\s*\)\s*\{/,rB:!0,c:[e.inherit(e.TM,{b:/\w[\w\d_]*/})],r:0},e.HCM,s,a,t]}});hljs.registerLanguage("dockerfile",function(e){return{aliases:["docker"],cI:!0,k:"from maintainer expose env arg user onbuild stopsignal",c:[e.HCM,e.ASM,e.QSM,e.NM,{bK:"run cmd entrypoint volume add copy workdir label healthcheck shell",starts:{e:/[^\\]\n/,sL:"bash"}}],i:")?[^\s\(]+(\s+[^\s\(]+)\s*=/,r:5,c:[{b:e.UIR+"\\s*\\(",rB:!0,r:0,c:[e.UTM]},{cN:"type",b://,k:"reified",r:0},{cN:"params",b:/\(/,e:/\)/,endsParent:!0,k:t,r:0,c:[{b:/:/,e:/[=,\/]/,eW:!0,c:[{cN:"type",b:e.UIR},e.CLCM,e.CBCM],r:0},e.CLCM,e.CBCM,s,l,c,e.CNM]},e.CBCM]},{cN:"class",bK:"class interface trait",e:/[:\{(]|$/,eE:!0,i:"extends implements",c:[{bK:"public protected internal private constructor"},e.UTM,{cN:"type",b://,eB:!0,eE:!0,r:0},{cN:"type",b:/[,:]\s*/,e:/[<\(,]|$/,eB:!0,rE:!0},s,l]},c,{cN:"meta",b:"^#!/usr/bin/env",e:"$",i:"\n"},o]}});hljs.registerLanguage("java",function(e){var a="[À-ʸa-zA-Z_$][À-ʸa-zA-Z_$0-9]*",t=a+"(<"+a+"(\\s*,\\s*"+a+")*>)?",r="false synchronized int abstract float private char boolean var static null if const for true while long strictfp finally protected import native final void enum else break transient catch instanceof byte super volatile case assert short package default double public try this switch continue throws protected public private module requires exports do",s="\\b(0[bB]([01]+[01_]+[01]+|[01]+)|0[xX]([a-fA-F0-9]+[a-fA-F0-9_]+[a-fA-F0-9]+|[a-fA-F0-9]+)|(([\\d]+[\\d_]+[\\d]+|[\\d]+)(\\.([\\d]+[\\d_]+[\\d]+|[\\d]+))?|\\.([\\d]+[\\d_]+[\\d]+|[\\d]+))([eE][-+]?\\d+)?)[lLfF]?",c={cN:"number",b:s,r:0};return{aliases:["jsp"],k:r,i:/<\/|#/,c:[e.C("/\\*\\*","\\*/",{r:0,c:[{b:/\w+@/,r:0},{cN:"doctag",b:"@[A-Za-z]+"}]}),e.CLCM,e.CBCM,e.ASM,e.QSM,{cN:"class",bK:"class interface",e:/[{;=]/,eE:!0,k:"class interface",i:/[:"\[\]]/,c:[{bK:"extends implements"},e.UTM]},{bK:"new throw return else",r:0},{cN:"function",b:"("+t+"\\s+)+"+e.UIR+"\\s*\\(",rB:!0,e:/[{;=]/,eE:!0,k:r,c:[{b:e.UIR+"\\s*\\(",rB:!0,r:0,c:[e.UTM]},{cN:"params",b:/\(/,e:/\)/,k:r,r:0,c:[e.ASM,e.QSM,e.CNM,e.CBCM]},e.CLCM,e.CBCM]},c,{cN:"meta",b:"@[A-Za-z]+"}]}});hljs.registerLanguage("xml",function(s){var e="[A-Za-z0-9\\._:-]+",t={eW:!0,i:/`]+/}]}]}]};return{aliases:["html","xhtml","rss","atom","xjb","xsd","xsl","plist"],cI:!0,c:[{cN:"meta",b:"",r:10,c:[{b:"\\[",e:"\\]"}]},s.C("",{r:10}),{b:"<\\!\\[CDATA\\[",e:"\\]\\]>",r:10},{cN:"meta",b:/<\?xml/,e:/\?>/,r:10},{b:/<\?(php)?/,e:/\?>/,sL:"php",c:[{b:"/\\*",e:"\\*/",skip:!0},{b:'b"',e:'"',skip:!0},{b:"b'",e:"'",skip:!0},s.inherit(s.ASM,{i:null,cN:null,c:null,skip:!0}),s.inherit(s.QSM,{i:null,cN:null,c:null,skip:!0})]},{cN:"tag",b:"|$)",e:">",k:{name:"style"},c:[t],starts:{e:"",rE:!0,sL:["css","xml"]}},{cN:"tag",b:"|$)",e:">",k:{name:"script"},c:[t],starts:{e:"",rE:!0,sL:["actionscript","javascript","handlebars","xml"]}},{cN:"tag",b:"",c:[{cN:"name",b:/[^\/><\s]+/,r:0},t]}]}});hljs.registerLanguage("properties",function(r){var t="[ \\t\\f]*",e="[ \\t\\f]+",s="("+t+"[:=]"+t+"|"+e+")",n="([^\\\\\\W:= \\t\\f\\n]|\\\\.)+",a="([^\\\\:= \\t\\f\\n]|\\\\.)+",c={e:s,r:0,starts:{cN:"string",e:/$/,r:0,c:[{b:"\\\\\\n"}]}};return{cI:!0,i:/\S/,c:[r.C("^\\s*[!#]","$"),{b:n+s,rB:!0,c:[{cN:"attr",b:n,endsParent:!0,r:0}],starts:c},{b:a+s,rB:!0,r:0,c:[{cN:"meta",b:a,endsParent:!0,r:0}],starts:c},{cN:"attr",r:0,b:a+t+"$"}]}});hljs.registerLanguage("diff",function(e){return{aliases:["patch"],c:[{cN:"meta",r:10,v:[{b:/^@@ +\-\d+,\d+ +\+\d+,\d+ +@@$/},{b:/^\*\*\* +\d+,\d+ +\*\*\*\*$/},{b:/^\-\-\- +\d+,\d+ +\-\-\-\-$/}]},{cN:"comment",v:[{b:/Index: /,e:/$/},{b:/={3,}/,e:/$/},{b:/^\-{3}/,e:/$/},{b:/^\*{3} /,e:/$/},{b:/^\+{3}/,e:/$/},{b:/\*{5}/,e:/\*{5}$/}]},{cN:"addition",b:"^\\+",e:"$"},{cN:"deletion",b:"^\\-",e:"$"},{cN:"addition",b:"^\\!",e:"$"}]}});hljs.registerLanguage("shell",function(s){return{aliases:["console"],c:[{cN:"meta",b:"^\\s{0,3}[\\w\\d\\[\\]()@-]*[>%$#]",starts:{e:"$",sL:"bash"}}]}});hljs.registerLanguage("asciidoc",function(e){return{aliases:["adoc"],c:[e.C("^/{4,}\\n","\\n/{4,}$",{r:10}),e.C("^//","$",{r:0}),{cN:"title",b:"^\\.\\w.*$"},{b:"^[=\\*]{4,}\\n",e:"\\n^[=\\*]{4,}$",r:10},{cN:"section",r:10,v:[{b:"^(={1,5}) .+?( \\1)?$"},{b:"^[^\\[\\]\\n]+?\\n[=\\-~\\^\\+]{2,}$"}]},{cN:"meta",b:"^:.+?:",e:"\\s",eE:!0,r:10},{cN:"meta",b:"^\\[.+?\\]$",r:0},{cN:"quote",b:"^_{4,}\\n",e:"\\n_{4,}$",r:10},{cN:"code",b:"^[\\-\\.]{4,}\\n",e:"\\n[\\-\\.]{4,}$",r:10},{b:"^\\+{4,}\\n",e:"\\n\\+{4,}$",c:[{b:"<",e:">",sL:"xml",r:0}],r:10},{cN:"bullet",b:"^(\\*+|\\-+|\\.+|[^\\n]+?::)\\s+"},{cN:"symbol",b:"^(NOTE|TIP|IMPORTANT|WARNING|CAUTION):\\s+",r:10},{cN:"strong",b:"\\B\\*(?![\\*\\s])",e:"(\\n{2}|\\*)",c:[{b:"\\\\*\\w",r:0}]},{cN:"emphasis",b:"\\B'(?!['\\s])",e:"(\\n{2}|')",c:[{b:"\\\\'\\w",r:0}],r:0},{cN:"emphasis",b:"_(?![_\\s])",e:"(\\n{2}|_)",r:0},{cN:"string",v:[{b:"``.+?''"},{b:"`.+?'"}]},{cN:"code",b:"(`.+?`|\\+.+?\\+)",r:0},{cN:"code",b:"^[ \\t]",e:"$",r:0},{b:"^'{3,}[ \\t]*$",r:10},{b:"(link:)?(http|https|ftp|file|irc|image:?):\\S+\\[.*?\\]",rB:!0,c:[{b:"(link|image:?):",r:0},{cN:"link",b:"\\w",e:"[^\\[]+",r:0},{cN:"string",b:"\\[",e:"\\]",eB:!0,eE:!0,r:0}],r:10}]}});hljs.registerLanguage("aspectj",function(e){var t="false synchronized int abstract float private char boolean static null if const for true while long throw strictfp finally protected import native final return void enum else extends implements break transient new catch instanceof byte super volatile case assert short package default double public try this switch continue throws privileged aspectOf adviceexecution proceed cflowbelow cflow initialization preinitialization staticinitialization withincode target within execution getWithinTypeName handler thisJoinPoint thisJoinPointStaticPart thisEnclosingJoinPointStaticPart declare parents warning error soft precedence thisAspectInstance",i="get set args call";return{k:t,i:/<\/|#/,c:[e.C("/\\*\\*","\\*/",{r:0,c:[{b:/\w+@/,r:0},{cN:"doctag",b:"@[A-Za-z]+"}]}),e.CLCM,e.CBCM,e.ASM,e.QSM,{cN:"class",bK:"aspect",e:/[{;=]/,eE:!0,i:/[:;"\[\]]/,c:[{bK:"extends implements pertypewithin perthis pertarget percflowbelow percflow issingleton"},e.UTM,{b:/\([^\)]*/,e:/[)]+/,k:t+" "+i,eE:!1}]},{cN:"class",bK:"class interface",e:/[{;=]/,eE:!0,r:0,k:"class interface",i:/[:"\[\]]/,c:[{bK:"extends implements"},e.UTM]},{bK:"pointcut after before around throwing returning",e:/[)]/,eE:!1,i:/["\[\]]/,c:[{b:e.UIR+"\\s*\\(",rB:!0,c:[e.UTM]}]},{b:/[:]/,rB:!0,e:/[{;]/,r:0,eE:!1,k:t,i:/["\[\]]/,c:[{b:e.UIR+"\\s*\\(",k:t+" "+i,r:0},e.QSM]},{bK:"new throw",r:0},{cN:"function",b:/\w+ +\w+(\.)?\w+\s*\([^\)]*\)\s*((throws)[\w\s,]+)?[\{;]/,rB:!0,e:/[{;=]/,k:t,eE:!0,c:[{b:e.UIR+"\\s*\\(",rB:!0,r:0,c:[e.UTM]},{cN:"params",b:/\(/,e:/\)/,r:0,k:t,c:[e.ASM,e.QSM,e.CNM,e.CBCM]},e.CLCM,e.CBCM]},e.CNM,{cN:"meta",b:"@[A-Za-z]+"}]}});hljs.registerLanguage("gradle",function(e){return{cI:!0,k:{keyword:"task project allprojects subprojects artifacts buildscript configurations dependencies repositories sourceSets description delete from into include exclude source classpath destinationDir includes options sourceCompatibility targetCompatibility group flatDir doLast doFirst flatten todir fromdir ant def abstract break case catch continue default do else extends final finally for if implements instanceof native new private protected public return static switch synchronized throw throws transient try volatile while strictfp package import false null super this true antlrtask checkstyle codenarc copy boolean byte char class double float int interface long short void compile runTime file fileTree abs any append asList asWritable call collect compareTo count div dump each eachByte eachFile eachLine every find findAll flatten getAt getErr getIn getOut getText grep immutable inject inspect intersect invokeMethods isCase join leftShift minus multiply newInputStream newOutputStream newPrintWriter newReader newWriter next plus pop power previous print println push putAt read readBytes readLines reverse reverseEach round size sort splitEachLine step subMap times toInteger toList tokenize upto waitForOrKill withPrintWriter withReader withStream withWriter withWriterAppend write writeLine"},c:[e.CLCM,e.CBCM,e.ASM,e.QSM,e.NM,e.RM]}});hljs.registerLanguage("json",function(e){var i={literal:"true false null"},n=[e.QSM,e.CNM],r={e:",",eW:!0,eE:!0,c:n,k:i},t={b:"{",e:"}",c:[{cN:"attr",b:/"/,e:/"/,c:[e.BE],i:"\\n"},e.inherit(r,{b:/:/})],i:"\\S"},c={b:"\\[",e:"\\]",c:[e.inherit(r)],i:"\\S"};return n.splice(n.length,0,t,c),{c:n,k:i,i:"\\S"}});hljs.registerLanguage("sql",function(e){var t=e.C("--","$");return{cI:!0,i:/[<>{}*]/,c:[{bK:"begin end start commit rollback savepoint lock alter create drop rename call delete do handler insert load replace select truncate update set show pragma grant merge describe use explain help declare prepare execute deallocate release unlock purge reset change stop analyze cache flush optimize repair kill install uninstall checksum restore check backup revoke comment with",e:/;/,eW:!0,l:/[\w\.]+/,k:{keyword:"as abort abs absolute acc acce accep accept access accessed accessible account acos action activate add addtime admin administer advanced advise aes_decrypt aes_encrypt after agent aggregate ali alia alias allocate allow alter always analyze ancillary and any anydata anydataset anyschema anytype apply archive archived archivelog are as asc ascii asin assembly assertion associate asynchronous at atan atn2 attr attri attrib attribu attribut attribute attributes audit authenticated authentication authid authors auto autoallocate autodblink autoextend automatic availability avg backup badfile basicfile before begin beginning benchmark between bfile bfile_base big bigfile bin binary_double binary_float binlog bit_and bit_count bit_length bit_or bit_xor bitmap blob_base block blocksize body both bound buffer_cache buffer_pool build bulk by byte byteordermark bytes cache caching call calling cancel capacity cascade cascaded case cast catalog category ceil ceiling chain change changed char_base char_length character_length characters characterset charindex charset charsetform charsetid check checksum checksum_agg child choose chr chunk class cleanup clear client clob clob_base clone close cluster_id cluster_probability cluster_set clustering coalesce coercibility col collate collation collect colu colum column column_value columns columns_updated comment commit compact compatibility compiled complete composite_limit compound compress compute concat concat_ws concurrent confirm conn connec connect connect_by_iscycle connect_by_isleaf connect_by_root connect_time connection consider consistent constant constraint constraints constructor container content contents context contributors controlfile conv convert convert_tz corr corr_k corr_s corresponding corruption cos cost count count_big counted covar_pop covar_samp cpu_per_call cpu_per_session crc32 create creation critical cross cube cume_dist curdate current current_date current_time current_timestamp current_user cursor curtime customdatum cycle data database databases datafile datafiles datalength date_add date_cache date_format date_sub dateadd datediff datefromparts datename datepart datetime2fromparts day day_to_second dayname dayofmonth dayofweek dayofyear days db_role_change dbtimezone ddl deallocate declare decode decompose decrement decrypt deduplicate def defa defau defaul default defaults deferred defi defin define degrees delayed delegate delete delete_all delimited demand dense_rank depth dequeue des_decrypt des_encrypt des_key_file desc descr descri describ describe descriptor deterministic diagnostics difference dimension direct_load directory disable disable_all disallow disassociate discardfile disconnect diskgroup distinct distinctrow distribute distributed div do document domain dotnet double downgrade drop dumpfile duplicate duration each edition editionable editions element ellipsis else elsif elt empty enable enable_all enclosed encode encoding encrypt end end-exec endian enforced engine engines enqueue enterprise entityescaping eomonth error errors escaped evalname evaluate event eventdata events except exception exceptions exchange exclude excluding execu execut execute exempt exists exit exp expire explain export export_set extended extent external external_1 external_2 externally extract failed failed_login_attempts failover failure far fast feature_set feature_value fetch field fields file file_name_convert filesystem_like_logging final finish first first_value fixed flash_cache flashback floor flush following follows for forall force foreign form forma format found found_rows freelist freelists freepools fresh from from_base64 from_days ftp full function general generated get get_format get_lock getdate getutcdate global global_name globally go goto grant grants greatest group group_concat group_id grouping grouping_id groups gtid_subtract guarantee guard handler hash hashkeys having hea head headi headin heading heap help hex hierarchy high high_priority hosts hour http id ident_current ident_incr ident_seed identified identity idle_time if ifnull ignore iif ilike ilm immediate import in include including increment index indexes indexing indextype indicator indices inet6_aton inet6_ntoa inet_aton inet_ntoa infile initial initialized initially initrans inmemory inner innodb input insert install instance instantiable instr interface interleaved intersect into invalidate invisible is is_free_lock is_ipv4 is_ipv4_compat is_not is_not_null is_used_lock isdate isnull isolation iterate java join json json_exists keep keep_duplicates key keys kill language large last last_day last_insert_id last_value lax lcase lead leading least leaves left len lenght length less level levels library like like2 like4 likec limit lines link list listagg little ln load load_file lob lobs local localtime localtimestamp locate locator lock locked log log10 log2 logfile logfiles logging logical logical_reads_per_call logoff logon logs long loop low low_priority lower lpad lrtrim ltrim main make_set makedate maketime managed management manual map mapping mask master master_pos_wait match matched materialized max maxextents maximize maxinstances maxlen maxlogfiles maxloghistory maxlogmembers maxsize maxtrans md5 measures median medium member memcompress memory merge microsecond mid migration min minextents minimum mining minus minute minvalue missing mod mode model modification modify module monitoring month months mount move movement multiset mutex name name_const names nan national native natural nav nchar nclob nested never new newline next nextval no no_write_to_binlog noarchivelog noaudit nobadfile nocheck nocompress nocopy nocycle nodelay nodiscardfile noentityescaping noguarantee nokeep nologfile nomapping nomaxvalue nominimize nominvalue nomonitoring none noneditionable nonschema noorder nopr nopro noprom nopromp noprompt norely noresetlogs noreverse normal norowdependencies noschemacheck noswitch not nothing notice notnull notrim novalidate now nowait nth_value nullif nulls num numb numbe nvarchar nvarchar2 object ocicoll ocidate ocidatetime ociduration ociinterval ociloblocator ocinumber ociref ocirefcursor ocirowid ocistring ocitype oct octet_length of off offline offset oid oidindex old on online only opaque open operations operator optimal optimize option optionally or oracle oracle_date oradata ord ordaudio orddicom orddoc order ordimage ordinality ordvideo organization orlany orlvary out outer outfile outline output over overflow overriding package pad parallel parallel_enable parameters parent parse partial partition partitions pascal passing password password_grace_time password_lock_time password_reuse_max password_reuse_time password_verify_function patch path patindex pctincrease pctthreshold pctused pctversion percent percent_rank percentile_cont percentile_disc performance period period_add period_diff permanent physical pi pipe pipelined pivot pluggable plugin policy position post_transaction pow power pragma prebuilt precedes preceding precision prediction prediction_cost prediction_details prediction_probability prediction_set prepare present preserve prior priority private private_sga privileges procedural procedure procedure_analyze processlist profiles project prompt protection public publishingservername purge quarter query quick quiesce quota quotename radians raise rand range rank raw read reads readsize rebuild record records recover recovery recursive recycle redo reduced ref reference referenced references referencing refresh regexp_like register regr_avgx regr_avgy regr_count regr_intercept regr_r2 regr_slope regr_sxx regr_sxy reject rekey relational relative relaylog release release_lock relies_on relocate rely rem remainder rename repair repeat replace replicate replication required reset resetlogs resize resource respect restore restricted result result_cache resumable resume retention return returning returns reuse reverse revoke right rlike role roles rollback rolling rollup round row row_count rowdependencies rowid rownum rows rtrim rules safe salt sample save savepoint sb1 sb2 sb4 scan schema schemacheck scn scope scroll sdo_georaster sdo_topo_geometry search sec_to_time second section securefile security seed segment select self sequence sequential serializable server servererror session session_user sessions_per_user set sets settings sha sha1 sha2 share shared shared_pool short show shrink shutdown si_averagecolor si_colorhistogram si_featurelist si_positionalcolor si_stillimage si_texture siblings sid sign sin size size_t sizes skip slave sleep smalldatetimefromparts smallfile snapshot some soname sort soundex source space sparse spfile split sql sql_big_result sql_buffer_result sql_cache sql_calc_found_rows sql_small_result sql_variant_property sqlcode sqldata sqlerror sqlname sqlstate sqrt square standalone standby start starting startup statement static statistics stats_binomial_test stats_crosstab stats_ks_test stats_mode stats_mw_test stats_one_way_anova stats_t_test_ stats_t_test_indep stats_t_test_one stats_t_test_paired stats_wsr_test status std stddev stddev_pop stddev_samp stdev stop storage store stored str str_to_date straight_join strcmp strict string struct stuff style subdate subpartition subpartitions substitutable substr substring subtime subtring_index subtype success sum suspend switch switchoffset switchover sync synchronous synonym sys sys_xmlagg sysasm sysaux sysdate sysdatetimeoffset sysdba sysoper system system_user sysutcdatetime table tables tablespace tan tdo template temporary terminated tertiary_weights test than then thread through tier ties time time_format time_zone timediff timefromparts timeout timestamp timestampadd timestampdiff timezone_abbr timezone_minute timezone_region to to_base64 to_date to_days to_seconds todatetimeoffset trace tracking transaction transactional translate translation treat trigger trigger_nestlevel triggers trim truncate try_cast try_convert try_parse type ub1 ub2 ub4 ucase unarchived unbounded uncompress under undo unhex unicode uniform uninstall union unique unix_timestamp unknown unlimited unlock unnest unpivot unrecoverable unsafe unsigned until untrusted unusable unused update updated upgrade upped upper upsert url urowid usable usage use use_stored_outlines user user_data user_resources users using utc_date utc_timestamp uuid uuid_short validate validate_password_strength validation valist value values var var_samp varcharc vari varia variab variabl variable variables variance varp varraw varrawc varray verify version versions view virtual visible void wait wallet warning warnings week weekday weekofyear wellformed when whene whenev wheneve whenever where while whitespace with within without work wrapped xdb xml xmlagg xmlattributes xmlcast xmlcolattval xmlelement xmlexists xmlforest xmlindex xmlnamespaces xmlpi xmlquery xmlroot xmlschema xmlserialize xmltable xmltype xor year year_to_month years yearweek",literal:"true false null unknown",built_in:"array bigint binary bit blob bool boolean char character date dec decimal float int int8 integer interval number numeric real record serial serial8 smallint text time timestamp varchar varying void"},c:[{cN:"string",b:"'",e:"'",c:[e.BE,{b:"''"}]},{cN:"string",b:'"',e:'"',c:[e.BE,{b:'""'}]},{cN:"string",b:"`",e:"`",c:[e.BE]},e.CNM,e.CBCM,t,e.HCM]},e.CBCM,t,e.HCM]}});hljs.registerLanguage("go",function(e){var t={keyword:"break default func interface select case map struct chan else goto package switch const fallthrough if range type continue for import return var go defer bool byte complex64 complex128 float32 float64 int8 int16 int32 int64 string uint8 uint16 uint32 uint64 int uint uintptr rune",literal:"true false iota nil",built_in:"append cap close complex copy imag len make new panic print println real recover delete"};return{aliases:["golang"],k:t,i:"",rB:!0,e:"\\s*=>",c:[{cN:"params",v:[{b:r},{b:/\(\s*\)/},{b:/\(/,e:/\)/,eB:!0,eE:!0,k:t,c:s}]}]},{b://,sL:"xml",c:[{b:/<\w+\s*\/>/,skip:!0},{b:/<\w+/,e:/(\/\w+|\w+\/)>/,skip:!0,c:[{b:/<\w+\s*\/>/,skip:!0},"self"]}]}],r:0},{cN:"function",bK:"function",e:/\{/,eE:!0,c:[e.inherit(e.TM,{b:r}),{cN:"params",b:/\(/,e:/\)/,eB:!0,eE:!0,c:s}],i:/\[|%/},{b:/\$[(.]/},e.METHOD_GUARD,{cN:"class",bK:"class",e:/[{;=]/,eE:!0,i:/[:"\[\]]/,c:[{bK:"extends"},e.UTM]},{bK:"constructor",e:/\{/,eE:!0}],i:/#(?!!)/}}); \ No newline at end of file diff --git a/spring-cloud-stream-binder-kafka/3.0.0.RELEASE/reference/htmlsingle/js/highlight/styles/a11y-dark.min.css b/spring-cloud-stream-binder-kafka/3.0.0.RELEASE/reference/htmlsingle/js/highlight/styles/a11y-dark.min.css new file mode 100644 index 00000000..b93b742a --- /dev/null +++ b/spring-cloud-stream-binder-kafka/3.0.0.RELEASE/reference/htmlsingle/js/highlight/styles/a11y-dark.min.css @@ -0,0 +1,99 @@ +/* a11y-dark theme */ +/* Based on the Tomorrow Night Eighties theme: https://github.com/isagalaev/highlight.js/blob/master/src/styles/tomorrow-night-eighties.css */ +/* @author: ericwbailey */ + +/* Comment */ +.hljs-comment, +.hljs-quote { + color: #d4d0ab; +} + +/* Red */ +.hljs-variable, +.hljs-template-variable, +.hljs-tag, +.hljs-name, +.hljs-selector-id, +.hljs-selector-class, +.hljs-regexp, +.hljs-deletion { + color: #ffa07a; +} + +/* Orange */ +.hljs-number, +.hljs-built_in, +.hljs-builtin-name, +.hljs-literal, +.hljs-type, +.hljs-params, +.hljs-meta, +.hljs-link { + color: #f5ab35; +} + +/* Yellow */ +.hljs-attribute { + color: #ffd700; +} + +/* Green */ +.hljs-string, +.hljs-symbol, +.hljs-bullet, +.hljs-addition { + color: #abe338; +} + +/* Blue */ +.hljs-title, +.hljs-section { + color: #00e0e0; +} + +/* Purple */ +.hljs-keyword, +.hljs-selector-tag { + color: #dcc6e0; +} + +.hljs { + display: block; + overflow-x: auto; + background: #2b2b2b; + color: #f8f8f2; + padding: 0.5em; +} + +.hljs-emphasis { + font-style: italic; +} + +.hljs-strong { + font-weight: bold; +} + +@media screen and (-ms-high-contrast: active) { + .hljs-addition, + .hljs-attribute, + .hljs-built_in, + .hljs-builtin-name, + .hljs-bullet, + .hljs-comment, + .hljs-link, + .hljs-literal, + .hljs-meta, + .hljs-number, + .hljs-params, + .hljs-string, + .hljs-symbol, + .hljs-type, + .hljs-quote { + color: highlight; + } + + .hljs-keyword, + .hljs-selector-tag { + font-weight: bold; + } +} diff --git a/spring-cloud-stream-binder-kafka/3.0.0.RELEASE/reference/htmlsingle/js/highlight/styles/an-old-hope.min.css b/spring-cloud-stream-binder-kafka/3.0.0.RELEASE/reference/htmlsingle/js/highlight/styles/an-old-hope.min.css new file mode 100644 index 00000000..a6d56f4b --- /dev/null +++ b/spring-cloud-stream-binder-kafka/3.0.0.RELEASE/reference/htmlsingle/js/highlight/styles/an-old-hope.min.css @@ -0,0 +1,89 @@ +/* + +An Old Hope – Star Wars Syntax (c) Gustavo Costa +Original theme - Ocean Dark Theme – by https://github.com/gavsiu +Based on Jesse Leite's Atom syntax theme 'An Old Hope' – https://github.com/JesseLeite/an-old-hope-syntax-atom + +*/ + +/* Death Star Comment */ +.hljs-comment, +.hljs-quote +{ + color: #B6B18B; +} + +/* Darth Vader */ +.hljs-variable, +.hljs-template-variable, +.hljs-tag, +.hljs-name, +.hljs-selector-id, +.hljs-selector-class, +.hljs-regexp, +.hljs-deletion +{ + color: #EB3C54; +} + +/* Threepio */ +.hljs-number, +.hljs-built_in, +.hljs-builtin-name, +.hljs-literal, +.hljs-type, +.hljs-params, +.hljs-meta, +.hljs-link +{ + color: #E7CE56; +} + +/* Luke Skywalker */ +.hljs-attribute +{ + color: #EE7C2B; +} + +/* Obi Wan Kenobi */ +.hljs-string, +.hljs-symbol, +.hljs-bullet, +.hljs-addition +{ + color: #4FB4D7; +} + +/* Yoda */ +.hljs-title, +.hljs-section +{ + color: #78BB65; +} + +/* Mace Windu */ +.hljs-keyword, +.hljs-selector-tag +{ + color: #B45EA4; +} + +/* Millenium Falcon */ +.hljs +{ + display: block; + overflow-x: auto; + background: #1C1D21; + color: #c0c5ce; + padding: 0.5em; +} + +.hljs-emphasis +{ + font-style: italic; +} + +.hljs-strong +{ + font-weight: bold; +} diff --git a/spring-cloud-stream-binder-kafka/3.0.0.RELEASE/reference/htmlsingle/js/highlight/styles/atom-one-dark-reasonable.min.css b/spring-cloud-stream-binder-kafka/3.0.0.RELEASE/reference/htmlsingle/js/highlight/styles/atom-one-dark-reasonable.min.css new file mode 100644 index 00000000..fd41c996 --- /dev/null +++ b/spring-cloud-stream-binder-kafka/3.0.0.RELEASE/reference/htmlsingle/js/highlight/styles/atom-one-dark-reasonable.min.css @@ -0,0 +1,77 @@ +/* + +Atom One Dark With support for ReasonML by Gidi Morris, based off work by Daniel Gamage + +Original One Dark Syntax theme from https://github.com/atom/one-dark-syntax + +*/ +.hljs { + display: block; + overflow-x: auto; + padding: 0.5em; + line-height: 1.3em; + color: #abb2bf; + background: #282c34; + border-radius: 5px; +} +.hljs-keyword, .hljs-operator { + color: #F92672; +} +.hljs-pattern-match { + color: #F92672; +} +.hljs-pattern-match .hljs-constructor { + color: #61aeee; +} +.hljs-function { + color: #61aeee; +} +.hljs-function .hljs-params { + color: #A6E22E; +} +.hljs-function .hljs-params .hljs-typing { + color: #FD971F; +} +.hljs-module-access .hljs-module { + color: #7e57c2; +} +.hljs-constructor { + color: #e2b93d; +} +.hljs-constructor .hljs-string { + color: #9CCC65; +} +.hljs-comment, .hljs-quote { + color: #b18eb1; + font-style: italic; +} +.hljs-doctag, .hljs-formula { + color: #c678dd; +} +.hljs-section, .hljs-name, .hljs-selector-tag, .hljs-deletion, .hljs-subst { + color: #e06c75; +} +.hljs-literal { + color: #56b6c2; +} +.hljs-string, .hljs-regexp, .hljs-addition, .hljs-attribute, .hljs-meta-string { + color: #98c379; +} +.hljs-built_in, .hljs-class .hljs-title { + color: #e6c07b; +} +.hljs-attr, .hljs-variable, .hljs-template-variable, .hljs-type, .hljs-selector-class, .hljs-selector-attr, .hljs-selector-pseudo, .hljs-number { + color: #d19a66; +} +.hljs-symbol, .hljs-bullet, .hljs-link, .hljs-meta, .hljs-selector-id, .hljs-title { + color: #61aeee; +} +.hljs-emphasis { + font-style: italic; +} +.hljs-strong { + font-weight: bold; +} +.hljs-link { + text-decoration: underline; +} diff --git a/spring-cloud-stream-binder-kafka/3.0.0.RELEASE/reference/htmlsingle/js/highlight/styles/atom-one-dark.min.css b/spring-cloud-stream-binder-kafka/3.0.0.RELEASE/reference/htmlsingle/js/highlight/styles/atom-one-dark.min.css new file mode 100644 index 00000000..1616aafe --- /dev/null +++ b/spring-cloud-stream-binder-kafka/3.0.0.RELEASE/reference/htmlsingle/js/highlight/styles/atom-one-dark.min.css @@ -0,0 +1,96 @@ +/* + +Atom One Dark by Daniel Gamage +Original One Dark Syntax theme from https://github.com/atom/one-dark-syntax + +base: #282c34 +mono-1: #abb2bf +mono-2: #818896 +mono-3: #5c6370 +hue-1: #56b6c2 +hue-2: #61aeee +hue-3: #c678dd +hue-4: #98c379 +hue-5: #e06c75 +hue-5-2: #be5046 +hue-6: #d19a66 +hue-6-2: #e6c07b + +*/ + +.hljs { + display: block; + overflow-x: auto; + padding: 0.5em; + color: #abb2bf; + background: #282c34; +} + +.hljs-comment, +.hljs-quote { + color: #5c6370; + font-style: italic; +} + +.hljs-doctag, +.hljs-keyword, +.hljs-formula { + color: #c678dd; +} + +.hljs-section, +.hljs-name, +.hljs-selector-tag, +.hljs-deletion, +.hljs-subst { + color: #e06c75; +} + +.hljs-literal { + color: #56b6c2; +} + +.hljs-string, +.hljs-regexp, +.hljs-addition, +.hljs-attribute, +.hljs-meta-string { + color: #98c379; +} + +.hljs-built_in, +.hljs-class .hljs-title { + color: #e6c07b; +} + +.hljs-attr, +.hljs-variable, +.hljs-template-variable, +.hljs-type, +.hljs-selector-class, +.hljs-selector-attr, +.hljs-selector-pseudo, +.hljs-number { + color: #d19a66; +} + +.hljs-symbol, +.hljs-bullet, +.hljs-link, +.hljs-meta, +.hljs-selector-id, +.hljs-title { + color: #61aeee; +} + +.hljs-emphasis { + font-style: italic; +} + +.hljs-strong { + font-weight: bold; +} + +.hljs-link { + text-decoration: underline; +} diff --git a/spring-cloud-stream-binder-kafka/3.0.0.RELEASE/reference/htmlsingle/js/highlight/styles/atom-one-light.min.css b/spring-cloud-stream-binder-kafka/3.0.0.RELEASE/reference/htmlsingle/js/highlight/styles/atom-one-light.min.css new file mode 100644 index 00000000..d5bd1d2a --- /dev/null +++ b/spring-cloud-stream-binder-kafka/3.0.0.RELEASE/reference/htmlsingle/js/highlight/styles/atom-one-light.min.css @@ -0,0 +1,96 @@ +/* + +Atom One Light by Daniel Gamage +Original One Light Syntax theme from https://github.com/atom/one-light-syntax + +base: #fafafa +mono-1: #383a42 +mono-2: #686b77 +mono-3: #a0a1a7 +hue-1: #0184bb +hue-2: #4078f2 +hue-3: #a626a4 +hue-4: #50a14f +hue-5: #e45649 +hue-5-2: #c91243 +hue-6: #986801 +hue-6-2: #c18401 + +*/ + +.hljs { + display: block; + overflow-x: auto; + padding: 0.5em; + color: #383a42; + background: #fafafa; +} + +.hljs-comment, +.hljs-quote { + color: #a0a1a7; + font-style: italic; +} + +.hljs-doctag, +.hljs-keyword, +.hljs-formula { + color: #a626a4; +} + +.hljs-section, +.hljs-name, +.hljs-selector-tag, +.hljs-deletion, +.hljs-subst { + color: #e45649; +} + +.hljs-literal { + color: #0184bb; +} + +.hljs-string, +.hljs-regexp, +.hljs-addition, +.hljs-attribute, +.hljs-meta-string { + color: #50a14f; +} + +.hljs-built_in, +.hljs-class .hljs-title { + color: #c18401; +} + +.hljs-attr, +.hljs-variable, +.hljs-template-variable, +.hljs-type, +.hljs-selector-class, +.hljs-selector-attr, +.hljs-selector-pseudo, +.hljs-number { + color: #986801; +} + +.hljs-symbol, +.hljs-bullet, +.hljs-link, +.hljs-meta, +.hljs-selector-id, +.hljs-title { + color: #4078f2; +} + +.hljs-emphasis { + font-style: italic; +} + +.hljs-strong { + font-weight: bold; +} + +.hljs-link { + text-decoration: underline; +} diff --git a/spring-cloud-stream-binder-kafka/3.0.0.RELEASE/reference/htmlsingle/js/highlight/styles/dracula.min.css b/spring-cloud-stream-binder-kafka/3.0.0.RELEASE/reference/htmlsingle/js/highlight/styles/dracula.min.css new file mode 100644 index 00000000..d591db68 --- /dev/null +++ b/spring-cloud-stream-binder-kafka/3.0.0.RELEASE/reference/htmlsingle/js/highlight/styles/dracula.min.css @@ -0,0 +1,76 @@ +/* + +Dracula Theme v1.2.0 + +https://github.com/zenorocha/dracula-theme + +Copyright 2015, All rights reserved + +Code licensed under the MIT license +http://zenorocha.mit-license.org + +@author Éverton Ribeiro +@author Zeno Rocha + +*/ + +.hljs { + display: block; + overflow-x: auto; + padding: 0.5em; + background: #282a36; +} + +.hljs-keyword, +.hljs-selector-tag, +.hljs-literal, +.hljs-section, +.hljs-link { + color: #8be9fd; +} + +.hljs-function .hljs-keyword { + color: #ff79c6; +} + +.hljs, +.hljs-subst { + color: #f8f8f2; +} + +.hljs-string, +.hljs-title, +.hljs-name, +.hljs-type, +.hljs-attribute, +.hljs-symbol, +.hljs-bullet, +.hljs-addition, +.hljs-variable, +.hljs-template-tag, +.hljs-template-variable { + color: #f1fa8c; +} + +.hljs-comment, +.hljs-quote, +.hljs-deletion, +.hljs-meta { + color: #6272a4; +} + +.hljs-keyword, +.hljs-selector-tag, +.hljs-literal, +.hljs-title, +.hljs-section, +.hljs-doctag, +.hljs-type, +.hljs-name, +.hljs-strong { + font-weight: bold; +} + +.hljs-emphasis { + font-style: italic; +} diff --git a/spring-cloud-stream-binder-kafka/3.0.0.RELEASE/reference/htmlsingle/js/highlight/styles/github.min.css b/spring-cloud-stream-binder-kafka/3.0.0.RELEASE/reference/htmlsingle/js/highlight/styles/github.min.css new file mode 100644 index 00000000..791932b8 --- /dev/null +++ b/spring-cloud-stream-binder-kafka/3.0.0.RELEASE/reference/htmlsingle/js/highlight/styles/github.min.css @@ -0,0 +1,99 @@ +/* + +github.com style (c) Vasily Polovnyov + +*/ + +.hljs { + display: block; + overflow-x: auto; + padding: 0.5em; + color: #333; + background: #f8f8f8; +} + +.hljs-comment, +.hljs-quote { + color: #998; + font-style: italic; +} + +.hljs-keyword, +.hljs-selector-tag, +.hljs-subst { + color: #333; + font-weight: bold; +} + +.hljs-number, +.hljs-literal, +.hljs-variable, +.hljs-template-variable, +.hljs-tag .hljs-attr { + color: #008080; +} + +.hljs-string, +.hljs-doctag { + color: #d14; +} + +.hljs-title, +.hljs-section, +.hljs-selector-id { + color: #900; + font-weight: bold; +} + +.hljs-subst { + font-weight: normal; +} + +.hljs-type, +.hljs-class .hljs-title { + color: #458; + font-weight: bold; +} + +.hljs-tag, +.hljs-name, +.hljs-attribute { + color: #000080; + font-weight: normal; +} + +.hljs-regexp, +.hljs-link { + color: #009926; +} + +.hljs-symbol, +.hljs-bullet { + color: #990073; +} + +.hljs-built_in, +.hljs-builtin-name { + color: #0086b3; +} + +.hljs-meta { + color: #999; + font-weight: bold; +} + +.hljs-deletion { + background: #fdd; +} + +.hljs-addition { + background: #dfd; +} + +.hljs-emphasis { + font-style: italic; +} + +.hljs-strong { + font-weight: bold; +} diff --git a/spring-cloud-stream-binder-kafka/3.0.0.RELEASE/reference/htmlsingle/js/highlight/styles/monokai-sublime.min.css b/spring-cloud-stream-binder-kafka/3.0.0.RELEASE/reference/htmlsingle/js/highlight/styles/monokai-sublime.min.css new file mode 100644 index 00000000..2864170d --- /dev/null +++ b/spring-cloud-stream-binder-kafka/3.0.0.RELEASE/reference/htmlsingle/js/highlight/styles/monokai-sublime.min.css @@ -0,0 +1,83 @@ +/* + +Monokai Sublime style. Derived from Monokai by noformnocontent http://nn.mit-license.org/ + +*/ + +.hljs { + display: block; + overflow-x: auto; + padding: 0.5em; + background: #23241f; +} + +.hljs, +.hljs-tag, +.hljs-subst { + color: #f8f8f2; +} + +.hljs-strong, +.hljs-emphasis { + color: #a8a8a2; +} + +.hljs-bullet, +.hljs-quote, +.hljs-number, +.hljs-regexp, +.hljs-literal, +.hljs-link { + color: #ae81ff; +} + +.hljs-code, +.hljs-title, +.hljs-section, +.hljs-selector-class { + color: #a6e22e; +} + +.hljs-strong { + font-weight: bold; +} + +.hljs-emphasis { + font-style: italic; +} + +.hljs-keyword, +.hljs-selector-tag, +.hljs-name, +.hljs-attr { + color: #f92672; +} + +.hljs-symbol, +.hljs-attribute { + color: #66d9ef; +} + +.hljs-params, +.hljs-class .hljs-title { + color: #f8f8f2; +} + +.hljs-string, +.hljs-type, +.hljs-built_in, +.hljs-builtin-name, +.hljs-selector-id, +.hljs-selector-attr, +.hljs-selector-pseudo, +.hljs-addition, +.hljs-variable, +.hljs-template-variable { + color: #e6db74; +} + +.hljs-comment, +.hljs-deletion, +.hljs-meta { + color: #75715e; +} diff --git a/spring-cloud-stream-binder-kafka/3.0.0.RELEASE/reference/htmlsingle/js/highlight/styles/monokai.min.css b/spring-cloud-stream-binder-kafka/3.0.0.RELEASE/reference/htmlsingle/js/highlight/styles/monokai.min.css new file mode 100644 index 00000000..775d53f9 --- /dev/null +++ b/spring-cloud-stream-binder-kafka/3.0.0.RELEASE/reference/htmlsingle/js/highlight/styles/monokai.min.css @@ -0,0 +1,70 @@ +/* +Monokai style - ported by Luigi Maselli - http://grigio.org +*/ + +.hljs { + display: block; + overflow-x: auto; + padding: 0.5em; + background: #272822; color: #ddd; +} + +.hljs-tag, +.hljs-keyword, +.hljs-selector-tag, +.hljs-literal, +.hljs-strong, +.hljs-name { + color: #f92672; +} + +.hljs-code { + color: #66d9ef; +} + +.hljs-class .hljs-title { + color: white; +} + +.hljs-attribute, +.hljs-symbol, +.hljs-regexp, +.hljs-link { + color: #bf79db; +} + +.hljs-string, +.hljs-bullet, +.hljs-subst, +.hljs-title, +.hljs-section, +.hljs-emphasis, +.hljs-type, +.hljs-built_in, +.hljs-builtin-name, +.hljs-selector-attr, +.hljs-selector-pseudo, +.hljs-addition, +.hljs-variable, +.hljs-template-tag, +.hljs-template-variable { + color: #a6e22e; +} + +.hljs-comment, +.hljs-quote, +.hljs-deletion, +.hljs-meta { + color: #75715e; +} + +.hljs-keyword, +.hljs-selector-tag, +.hljs-literal, +.hljs-doctag, +.hljs-title, +.hljs-section, +.hljs-type, +.hljs-selector-id { + font-weight: bold; +} diff --git a/spring-cloud-stream-binder-kafka/3.0.0.RELEASE/reference/htmlsingle/js/highlight/styles/solarized-light.min.css b/spring-cloud-stream-binder-kafka/3.0.0.RELEASE/reference/htmlsingle/js/highlight/styles/solarized-light.min.css new file mode 100644 index 00000000..fdcfcc72 --- /dev/null +++ b/spring-cloud-stream-binder-kafka/3.0.0.RELEASE/reference/htmlsingle/js/highlight/styles/solarized-light.min.css @@ -0,0 +1,84 @@ +/* + +Orginal Style from ethanschoonover.com/solarized (c) Jeremy Hull + +*/ + +.hljs { + display: block; + overflow-x: auto; + padding: 0.5em; + background: #fdf6e3; + color: #657b83; +} + +.hljs-comment, +.hljs-quote { + color: #93a1a1; +} + +/* Solarized Green */ +.hljs-keyword, +.hljs-selector-tag, +.hljs-addition { + color: #859900; +} + +/* Solarized Cyan */ +.hljs-number, +.hljs-string, +.hljs-meta .hljs-meta-string, +.hljs-literal, +.hljs-doctag, +.hljs-regexp { + color: #2aa198; +} + +/* Solarized Blue */ +.hljs-title, +.hljs-section, +.hljs-name, +.hljs-selector-id, +.hljs-selector-class { + color: #268bd2; +} + +/* Solarized Yellow */ +.hljs-attribute, +.hljs-attr, +.hljs-variable, +.hljs-template-variable, +.hljs-class .hljs-title, +.hljs-type { + color: #b58900; +} + +/* Solarized Orange */ +.hljs-symbol, +.hljs-bullet, +.hljs-subst, +.hljs-meta, +.hljs-meta .hljs-keyword, +.hljs-selector-attr, +.hljs-selector-pseudo, +.hljs-link { + color: #cb4b16; +} + +/* Solarized Red */ +.hljs-built_in, +.hljs-deletion { + color: #dc322f; +} + +.hljs-formula { + background: #eee8d5; +} + +.hljs-emphasis { + font-style: italic; +} + +.hljs-strong { + font-weight: bold; +} diff --git a/spring-cloud-stream-binder-kafka/3.0.0.RELEASE/reference/htmlsingle/js/highlight/styles/zenburn.min.css b/spring-cloud-stream-binder-kafka/3.0.0.RELEASE/reference/htmlsingle/js/highlight/styles/zenburn.min.css new file mode 100644 index 00000000..07be5020 --- /dev/null +++ b/spring-cloud-stream-binder-kafka/3.0.0.RELEASE/reference/htmlsingle/js/highlight/styles/zenburn.min.css @@ -0,0 +1,80 @@ +/* + +Zenburn style from voldmar.ru (c) Vladimir Epifanov +based on dark.css by Ivan Sagalaev + +*/ + +.hljs { + display: block; + overflow-x: auto; + padding: 0.5em; + background: #3f3f3f; + color: #dcdcdc; +} + +.hljs-keyword, +.hljs-selector-tag, +.hljs-tag { + color: #e3ceab; +} + +.hljs-template-tag { + color: #dcdcdc; +} + +.hljs-number { + color: #8cd0d3; +} + +.hljs-variable, +.hljs-template-variable, +.hljs-attribute { + color: #efdcbc; +} + +.hljs-literal { + color: #efefaf; +} + +.hljs-subst { + color: #8f8f8f; +} + +.hljs-title, +.hljs-name, +.hljs-selector-id, +.hljs-selector-class, +.hljs-section, +.hljs-type { + color: #efef8f; +} + +.hljs-symbol, +.hljs-bullet, +.hljs-link { + color: #dca3a3; +} + +.hljs-deletion, +.hljs-string, +.hljs-built_in, +.hljs-builtin-name { + color: #cc9393; +} + +.hljs-addition, +.hljs-comment, +.hljs-quote, +.hljs-meta { + color: #7f9f7f; +} + + +.hljs-emphasis { + font-style: italic; +} + +.hljs-strong { + font-weight: bold; +} diff --git a/spring-cloud-stream-binder-kafka/3.0.0.RELEASE/reference/htmlsingle/js/toc.js b/spring-cloud-stream-binder-kafka/3.0.0.RELEASE/reference/htmlsingle/js/toc.js new file mode 100644 index 00000000..a6e933bf --- /dev/null +++ b/spring-cloud-stream-binder-kafka/3.0.0.RELEASE/reference/htmlsingle/js/toc.js @@ -0,0 +1,107 @@ +var toctitle = document.getElementById('toctitle'); +var path = window.location.pathname; +if (toctitle != null) { + var oldtoc = toctitle.nextElementSibling; + var newtoc = document.createElement('div'); + newtoc.setAttribute('id', 'tocbot'); + newtoc.setAttribute('class', 'js-toc desktop-toc'); + oldtoc.setAttribute('class', 'mobile-toc'); + oldtoc.parentNode.appendChild(newtoc); + tocbot.init({ + contentSelector: '#content', + headingSelector: 'h1, h2, h3, h4, h5', + positionFixedSelector: 'body', + fixedSidebarOffset: 90, + smoothScroll: false + }); + if (!path.endsWith("index.html") && !path.endsWith("/")) { + var link = document.createElement("a"); + link.setAttribute("href", "index.html"); + link.innerHTML = " Back to index"; + var block = document.createElement("div"); + block.setAttribute('class', 'back-action'); + block.appendChild(link); + var toc = document.getElementById('toc'); + var next = document.getElementById('toctitle').nextElementSibling; + toc.insertBefore(block, next); + } +} + +var headerHtml = '
\n' + + '

\n' + + '\n' + + '\n' + + '\n' + + '\n' + + '\n' + + '\n' + + '\n' + + '\n' + + '\n' + + '\n' + + '\n' + + '\n' + + '\n' + + '\n' + + '\n' + + '\n' + + '\n' + + '\n' + + '\n' + + '\n' + + '\n' + + '\n' + + '\n' + + '\n' + + '\n' + + '\n' + + '\n' + + '\n' + + '\n' + + '\n' + + '\n' + + '\n' + + '\n' + + '\n' + + '\n' + + '\n' + + '\n' + + '\n' + + '\n' + + '\n' + + '

\n' + + '
'; + +var header = document.createElement("div"); +header.innerHTML = headerHtml; +document.body.insertBefore(header, document.body.firstChild); \ No newline at end of file diff --git a/spring-cloud-stream-binder-kafka/3.0.0.RELEASE/reference/htmlsingle/js/tocbot/tocbot.css b/spring-cloud-stream-binder-kafka/3.0.0.RELEASE/reference/htmlsingle/js/tocbot/tocbot.css new file mode 100644 index 00000000..0632de23 --- /dev/null +++ b/spring-cloud-stream-binder-kafka/3.0.0.RELEASE/reference/htmlsingle/js/tocbot/tocbot.css @@ -0,0 +1 @@ +.toc{overflow-y:auto}.toc>.toc-list{overflow:hidden;position:relative}.toc>.toc-list li{list-style:none}.toc-list{margin:0;padding-left:10px}a.toc-link{color:currentColor;height:100%}.is-collapsible{max-height:1000px;overflow:hidden;transition:all 300ms ease-in-out}.is-collapsed{max-height:0}.is-position-fixed{position:fixed !important;top:0}.is-active-link{font-weight:700}.toc-link::before{background-color:#EEE;content:' ';display:inline-block;height:inherit;left:0;margin-top:-1px;position:absolute;width:2px}.is-active-link::before{background-color:#54BC4B} diff --git a/spring-cloud-stream-binder-kafka/3.0.0.RELEASE/reference/htmlsingle/js/tocbot/tocbot.min.js b/spring-cloud-stream-binder-kafka/3.0.0.RELEASE/reference/htmlsingle/js/tocbot/tocbot.min.js new file mode 100644 index 00000000..943d8fdb --- /dev/null +++ b/spring-cloud-stream-binder-kafka/3.0.0.RELEASE/reference/htmlsingle/js/tocbot/tocbot.min.js @@ -0,0 +1 @@ +!function(e){function t(o){if(n[o])return n[o].exports;var l=n[o]={i:o,l:!1,exports:{}};return e[o].call(l.exports,l,l.exports,t),l.l=!0,l.exports}var n={};t.m=e,t.c=n,t.d=function(e,n,o){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:o})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=0)}([function(e,t,n){(function(o){var l,i,s;!function(n,o){i=[],l=o(n),void 0!==(s="function"==typeof l?l.apply(t,i):l)&&(e.exports=s)}(void 0!==o?o:this.window||this.global,function(e){"use strict";function t(){for(var e={},t=0;te.fixedSidebarOffset?-1===n.className.indexOf(e.positionFixedClass)&&(n.className+=h+e.positionFixedClass):n.className=n.className.split(h+e.positionFixedClass).join("")}function s(t){var n=document.documentElement.scrollTop||f.scrollTop;e.positionFixedSelector&&i();var o,l=t;if(m&&null!==document.querySelector(e.tocSelector)&&l.length>0){d.call(l,function(t,i){if(t.offsetTop>n+e.headingsOffset+10){return o=l[0===i?i:i-1],!0}if(i===l.length-1)return o=l[l.length-1],!0});var s=document.querySelector(e.tocSelector).querySelectorAll("."+e.linkClass);u.call(s,function(t){t.className=t.className.split(h+e.activeLinkClass).join("")});var c=document.querySelector(e.tocSelector).querySelectorAll("."+e.listItemClass);u.call(c,function(t){t.className=t.className.split(h+e.activeListItemClass).join("")});var a=document.querySelector(e.tocSelector).querySelector("."+e.linkClass+".node-name--"+o.nodeName+'[href="#'+o.id+'"]');-1===a.className.indexOf(e.activeLinkClass)&&(a.className+=h+e.activeLinkClass);var p=a.parentNode;p&&-1===p.className.indexOf(e.activeListItemClass)&&(p.className+=h+e.activeListItemClass);var C=document.querySelector(e.tocSelector).querySelectorAll("."+e.listClass+"."+e.collapsibleClass);u.call(C,function(t){-1===t.className.indexOf(e.isCollapsedClass)&&(t.className+=h+e.isCollapsedClass)}),a.nextSibling&&-1!==a.nextSibling.className.indexOf(e.isCollapsedClass)&&(a.nextSibling.className=a.nextSibling.className.split(h+e.isCollapsedClass).join("")),r(a.parentNode.parentNode)}}function r(t){return-1!==t.className.indexOf(e.collapsibleClass)&&-1!==t.className.indexOf(e.isCollapsedClass)?(t.className=t.className.split(h+e.isCollapsedClass).join(""),r(t.parentNode.parentNode)):t}function c(t){var n=t.target||t.srcElement;"string"==typeof n.className&&-1!==n.className.indexOf(e.linkClass)&&(m=!1)}function a(){m=!0}var u=[].forEach,d=[].some,f=document.body,m=!0,h=" ";return{enableTocAnimation:a,disableTocAnimation:c,render:n,updateToc:s}}},function(e,t){e.exports=function(e){function t(e){return e[e.length-1]}function n(e){return+e.nodeName.split("H").join("")}function o(t){var o={id:t.id,children:[],nodeName:t.nodeName,headingLevel:n(t),textContent:t.textContent.trim()};return e.includeHtml&&(o.childNodes=t.childNodes),o}function l(l,i){for(var s=o(l),r=n(l),c=i,a=t(c),u=a?a.headingLevel:0,d=r-u;d>0;)a=t(c),a&&void 0!==a.children&&(c=a.children),d--;return r>=e.collapseDepth&&(s.isCollapsed=!0),c.push(s),c}function i(t,n){var o=n;e.ignoreSelector&&(o=n.split(",").map(function(t){return t.trim()+":not("+e.ignoreSelector+")"}));try{return document.querySelector(t).querySelectorAll(o)}catch(e){return console.warn("Element not found: "+t),null}}function s(e){return r.call(e,function(e,t){return l(o(t),e.nest),e},{nest:[]})}var r=[].reduce;return{nestHeadingsArray:s,selectHeadings:i}}},function(e,t){function n(e){function t(e){return"a"===e.tagName.toLowerCase()&&(e.hash.length>0||"#"===e.href.charAt(e.href.length-1))&&(n(e.href)===s||n(e.href)+"#"===s)}function n(e){return e.slice(0,e.lastIndexOf("#"))}function l(e){var t=document.getElementById(e.substring(1));t&&(/^(?:a|select|input|button|textarea)$/i.test(t.tagName)||(t.tabIndex=-1),t.focus())}!function(){document.documentElement.style}();var i=e.duration,s=location.hash?n(location.href):location.href;!function(){function n(n){!t(n.target)||n.target.className.indexOf("no-smooth-scroll")>-1||"#"===n.target.href.charAt(n.target.href.length-2)&&"!"===n.target.href.charAt(n.target.href.length-1)||-1===n.target.className.indexOf(e.linkClass)||o(n.target.hash,{duration:i,callback:function(){l(n.target.hash)}})}document.body.addEventListener("click",n,!1)}()}function o(e,t){function n(e){s=e-i,window.scrollTo(0,c.easing(s,r,u,d)),s