Skip to content

Commit

Permalink
apply comments
Browse files Browse the repository at this point in the history
  • Loading branch information
chickenchickenlove committed May 17, 2024
1 parent d21e4c3 commit bac2380
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 76 deletions.
16 changes: 8 additions & 8 deletions samples/sample-07/README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@ services:

The config of `group.protocol = conumser` should be added to `Consumer` configuration to apply new consumer rebalance protocol.

```java
@Bean
public ConsumerFactory<String, String> consumerFactory() {
final Map<String, Object> props = new HashMap<>();
...
props.put(ConsumerConfig.GROUP_PROTOCOL_CONFIG, "consumer");
...
}
The `group.protocol` can be configured in the `resources/application.yaml` as follows:

```yaml
spring:
kafka:
consumer:
properties:
group.protocol: consumer
```

Next, the `Consumer` created by `@KafkaListener` will request a subscription to the `test-topic` from the `Broker`.
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.kafka.annotation.EnableKafka;

/**
* New consumer rebalance protocol sample which purpose is only to demonstrate the application
Expand All @@ -28,6 +29,7 @@
* @since 3.3
*/

@EnableKafka
@SpringBootApplication
public class Sample07Application {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
/**
* New consumer rebalance protocol sample which purpose is only to demonstrate the application
* of the New Consumer Rebalance Protocol in Spring Kafka.
* Each consumer subscribe test-topic with different group id. then, new consumer rebalance protocol
* will be completed successfully.
* Each consumer will subscribe test-topic with different group id.
* Then, new consumer rebalance protocol will be completed successfully.
*
* @author Sanghyeok An.
*
Expand Down
8 changes: 8 additions & 0 deletions samples/sample-07/src/main/resources/application.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,11 @@ spring:
stop:
command: down
timeout: 10s
kafka:
consumer:
bootstrap-servers: localhost:10000
group-id: sample07
key-deserializer: org.apache.kafka.common.serialization.StringDeserializer
value-deserializer: org.apache.kafka.common.serialization.StringDeserializer
properties:
group.protocol: consumer

0 comments on commit bac2380

Please sign in to comment.