1
- package com .baeldung .partitioningstrategy ;
1
+ package com .baeldung .spring .kafka .partitioningstrategy ;
2
+
3
+ import java .util .HashMap ;
4
+ import java .util .Map ;
2
5
3
6
import org .apache .kafka .clients .consumer .ConsumerConfig ;
4
7
import org .apache .kafka .clients .consumer .KafkaConsumer ;
12
15
import org .springframework .kafka .core .KafkaTemplate ;
13
16
import org .springframework .kafka .core .ProducerFactory ;
14
17
15
- import java .util .HashMap ;
16
- import java .util .Map ;
17
-
18
18
@ SpringBootApplication
19
19
public class KafkaApplication {
20
20
@@ -26,7 +26,7 @@ public KafkaTemplate<String, String> kafkaTemplate() {
26
26
@ Bean
27
27
public ProducerFactory <String , String > producerFactory () {
28
28
Map <String , Object > configProps = new HashMap <>();
29
- configProps .put (ProducerConfig .BOOTSTRAP_SERVERS_CONFIG , "localhost:9092 " );
29
+ configProps .put (ProducerConfig .BOOTSTRAP_SERVERS_CONFIG , "localhost:9095 " );
30
30
configProps .put (ProducerConfig .KEY_SERIALIZER_CLASS_CONFIG , StringSerializer .class );
31
31
configProps .put (ProducerConfig .VALUE_SERIALIZER_CLASS_CONFIG , StringSerializer .class );
32
32
return new DefaultKafkaProducerFactory <>(configProps );
@@ -35,7 +35,7 @@ public ProducerFactory<String, String> producerFactory() {
35
35
@ Bean
36
36
public KafkaConsumer <String , String > kafkaConsumer () {
37
37
Map <String , Object > configProps = new HashMap <>();
38
- configProps .put (ConsumerConfig .BOOTSTRAP_SERVERS_CONFIG , "localhost:9092 " );
38
+ configProps .put (ConsumerConfig .BOOTSTRAP_SERVERS_CONFIG , "localhost:9095 " );
39
39
configProps .put (ConsumerConfig .KEY_DESERIALIZER_CLASS_CONFIG , StringDeserializer .class );
40
40
configProps .put (ConsumerConfig .VALUE_DESERIALIZER_CLASS_CONFIG , StringDeserializer .class );
41
41
configProps .put (ConsumerConfig .GROUP_ID_CONFIG , "test-group" ); // Set a unique group ID
0 commit comments