diff --git a/docs/src/main/asciidoc/kafka/kafka_tips.adoc b/docs/src/main/asciidoc/kafka/kafka_tips.adoc index 4b2b77f9b..ee72a9086 100644 --- a/docs/src/main/asciidoc/kafka/kafka_tips.adoc +++ b/docs/src/main/asciidoc/kafka/kafka_tips.adoc @@ -127,13 +127,13 @@ spring.cloud.stream.bindings.processData-in-0.consumer.retry-template-name=.consumer.startOffset` and setting it to either `earliest` or `latest`. @@ -275,12 +275,12 @@ When you do that and then start the consumer application, each time you start, i ==== Problem Statement Using Kafka binder, I know that it can set the offset to either `earliest` or `latest`, but I have a requirement to seek the offset to something in the middle, an arbitrary offset. -Is there a way to achieve this using Spring Cloud Stream Kafka biner? +Is there a way to achieve this using Spring Cloud Stream Kafka binder? ==== Solution Previously we saw how Kafka binder allows you to tackle basic offset management. -By default, the binder does not allow you to rewind to an arbitrary offset, at least through the mechanism we saw in that reipce. +By default, the binder does not allow you to rewind to an arbitrary offset, at least through the mechanism we saw in that recipe. However, there are some low-level strategies that the binder provides to achieve this use case. Let's explore them. @@ -347,7 +347,7 @@ public void onPartitionsAssigned(String bindingName, Consumer consumer, Co consumer.seek(tp, offset); } catch (Exception e) { - // Handle excpetions carefully. + // Handle exceptions carefully. } } }); @@ -363,9 +363,9 @@ When consumer `seek` fails, it may throw some runtime exceptions and you need to When we add a second consumer, a rebalance will occur and some partitions will be moved around. Let's say that the new consumer gets partitions `2` and `3`. -When this new Spring Cloud Stream consumer calls this `onPartitionsAssigned` method, it will see that this is the initial assignment for partititon `2` and `3` on this consumer. -Therefore, it will do the seek operation becuase of the conditional check on the `initial` argument. -In the case of the first consumer, it now only has partitons `0` and `1` +When this new Spring Cloud Stream consumer calls this `onPartitionsAssigned` method, it will see that this is the initial assignment for partition `2` and `3` on this consumer. +Therefore, it will do the seek operation because of the conditional check on the `initial` argument. +In the case of the first consumer, it now only has partitions `0` and `1` However, for this consumer it was simply a rebalance event and not considered as an intial assignment. Thus, it will not re-seek to the given offsets because of the conditional check on the `initial` argument. @@ -518,19 +518,19 @@ All you have to do is to provide the following property to enable native seriali spring.cloud.stream.kafka.bindings..producer.useNativeEncoding: true ``` -Then, you need to also set the serailzers. +Then, you need to also set the serializers. There are a couple of ways to do this. ``` -spring.cloud.stream.kafka.bindings..producer.configurarion.key.serializer: org.apache.kafka.common.serialization.StringSerializer -spring.cloud.stream.kafka.bindings..producer.configurarion.value.serializer: org.apache.kafka.common.serialization.StringSerializer +spring.cloud.stream.kafka.bindings..producer.configuration.key.serializer: org.apache.kafka.common.serialization.StringSerializer +spring.cloud.stream.kafka.bindings..producer.configuration.value.serializer: org.apache.kafka.common.serialization.StringSerializer ``` or using the binder configuration. ``` -spring.cloud.stream.kafka.binder.configurarion.key.serializer: org.apache.kafka.common.serialization.StringSerializer -spring.cloud.stream.kafka.binder.configurarion.value.serializer: org.apache.kafka.common.serialization.StringSerializer +spring.cloud.stream.kafka.binder.configuration.key.serializer: org.apache.kafka.common.serialization.StringSerializer +spring.cloud.stream.kafka.binder.configuration.value.serializer: org.apache.kafka.common.serialization.StringSerializer ``` When using the binder way, it is applied against all the bindings whereas setting them at the bindings are per binding. @@ -540,8 +540,8 @@ On the deserializing side, you just need to provide the deserializers as configu For example, ``` -spring.cloud.stream.kafka.bindings..consumer.configurarion.key.deserializer: org.apache.kafka.common.serialization.StringDeserializer -spring.cloud.stream.kafka.bindings..producer.configurarion.value.deserializer: org.apache.kafka.common.serialization.StringDeserializer +spring.cloud.stream.kafka.bindings..consumer.configuration.key.deserializer: org.apache.kafka.common.serialization.StringDeserializer +spring.cloud.stream.kafka.bindings..producer.configuration.value.deserializer: org.apache.kafka.common.serialization.StringDeserializer ``` You can also set them at the binder level. @@ -552,7 +552,7 @@ There is an optional property that you can set to force native decoding. spring.cloud.stream.kafka.bindings..consumer.useNativeDecoding: true ``` -However, in the case of Kafka binder, this is unncessary, as by the time it reaches the binder, Kafka already deserializes them using the configured deserializers. +However, in the case of Kafka binder, this is unnecessary, as by the time it reaches the binder, Kafka already deserializes them using the configured deserializers. === Explain how offset resetting work in Kafka Streams binder @@ -593,7 +593,7 @@ Keep in mind that, once there are committed offsets, these setting are *not* hon ==== Problem Statement -I have a Kafka producer application and I want to keep track of all my successful sedings. +I have a Kafka producer application and I want to keep track of all my successful sendings. ==== Solution