You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -4075,19 +4075,19 @@ The following Spring Boot example overrides the default factories:
4075
4075
[source, java]
4076
4076
----
4077
4077
@Bean
4078
-
public ConsumerFactory<Foo, Bar> kafkaConsumerFactory(KafkaProperties properties,
4079
-
JsonDeserializer customDeserializer) {
4080
-
4081
-
return new DefaultKafkaConsumerFactory<>(properties.buildConsumerProperties(),
4082
-
customDeserializer, customDeserializer);
4078
+
public ConsumerFactory<String, Thing> kafkaConsumerFactory(JsonDeserializer customValueDeserializer) {
4079
+
Map<String, Object> properties = new HashMap<>();
4080
+
// properties.put(..., ...)
4081
+
// ...
4082
+
return new DefaultKafkaConsumerFactory<>(properties,
4083
+
new StringDeserializer(), customValueDeserializer);
4083
4084
}
4084
4085
4085
4086
@Bean
4086
-
public ProducerFactory<Foo, Bar> kafkaProducerFactory(KafkaProperties properties,
4087
-
JsonSerializer customSerializer) {
4087
+
public ProducerFactory<String, Thing> kafkaProducerFactory(JsonSerializer customValueSerializer) {
4088
4088
4089
4089
return new DefaultKafkaProducerFactory<>(properties.buildProducerProperties(),
4090
-
customSerializer, customSerializer);
4090
+
new StringSerializer(), customValueSerializer);
4091
4091
}
4092
4092
----
4093
4093
=====
@@ -4163,31 +4163,35 @@ public static JavaType thing1Thing2JavaTypeForTopic(String topic, byte[] data, H
4163
4163
4164
4164
When constructing the serializer/deserializer programmatically for use in the producer/consumer factory, since version 2.3, you can use the fluent API, which simplifies configuration.
4165
4165
4166
-
The following example assumes you are using Spring Boot:
4167
-
4168
4166
====
4169
4167
[source, java]
4170
4168
----
4171
4169
@Bean
4172
-
public DefaultKafkaProducerFactory pf(KafkaProperties properties) {
0 commit comments