projects
/
demos
/
kafka
/
chat
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
NEU
[demos/kafka/chat]
/
src
/
test
/
java
/
de
/
juplo
/
kafka
/
chat
/
backend
/
persistence
/
kafka
/
KafkaServicesConfiguration.java
diff --git
a/src/test/java/de/juplo/kafka/chat/backend/persistence/kafka/KafkaServicesConfiguration.java
b/src/test/java/de/juplo/kafka/chat/backend/persistence/kafka/KafkaServicesConfiguration.java
index
b7eb711
..
3b4bc16
100644
(file)
--- a/
src/test/java/de/juplo/kafka/chat/backend/persistence/kafka/KafkaServicesConfiguration.java
+++ b/
src/test/java/de/juplo/kafka/chat/backend/persistence/kafka/KafkaServicesConfiguration.java
@@
-22,7
+22,8
@@
import org.springframework.kafka.support.serializer.JsonSerializer;
import java.time.Clock;
import java.time.ZoneId;
import java.time.Clock;
import java.time.ZoneId;
-import java.util.Properties;
+import java.util.HashMap;
+import java.util.Map;
@ConditionalOnProperty(
@ConditionalOnProperty(
@@
-67,7
+68,7
@@
public class KafkaServicesConfiguration
@Bean
Producer<Integer, ChatRoomTo> chatRoomChannelProducer(
@Bean
Producer<Integer, ChatRoomTo> chatRoomChannelProducer(
-
Properties
defaultProducerProperties,
+
Map<String, String>
defaultProducerProperties,
IntegerSerializer integerSerializer,
JsonSerializer<ChatRoomTo> chatRoomSerializer)
{
IntegerSerializer integerSerializer,
JsonSerializer<ChatRoomTo> chatRoomSerializer)
{
@@
-92,12
+93,12
@@
public class KafkaServicesConfiguration
@Bean
Consumer<Integer, ChatRoomTo> chatRoomChannelConsumer(
@Bean
Consumer<Integer, ChatRoomTo> chatRoomChannelConsumer(
-
Properties
defaultConsumerProperties,
+
Map<String, String>
defaultConsumerProperties,
IntegerDeserializer integerDeserializer,
JsonDeserializer<ChatRoomTo> chatRoomDeserializer)
{
IntegerDeserializer integerDeserializer,
JsonDeserializer<ChatRoomTo> chatRoomDeserializer)
{
-
Properties properties = new Properties(defaultConsumerProperties
);
- properties.
setProperty
(
+
Map<String, String> properties = new HashMap<>(
);
+ properties.
put
(
ConsumerConfig.GROUP_ID_CONFIG,
"chat_room_channel");
return new KafkaConsumer<>(
ConsumerConfig.GROUP_ID_CONFIG,
"chat_room_channel");
return new KafkaConsumer<>(
@@
-142,7
+143,7
@@
public class KafkaServicesConfiguration
@Bean
Producer<String, MessageTo> chatMessageChannelProducer(
@Bean
Producer<String, MessageTo> chatMessageChannelProducer(
-
Properties
defaultProducerProperties,
+
Map<String, String>
defaultProducerProperties,
StringSerializer stringSerializer,
JsonSerializer<MessageTo> messageSerializer)
{
StringSerializer stringSerializer,
JsonSerializer<MessageTo> messageSerializer)
{
@@
-167,12
+168,12
@@
public class KafkaServicesConfiguration
@Bean
Consumer<String, MessageTo> chatMessageChannelConsumer(
@Bean
Consumer<String, MessageTo> chatMessageChannelConsumer(
-
Properties
defaultConsumerProperties,
+
Map<String, String>
defaultConsumerProperties,
StringDeserializer stringDeserializer,
JsonDeserializer<MessageTo> messageDeserializer)
{
StringDeserializer stringDeserializer,
JsonDeserializer<MessageTo> messageDeserializer)
{
-
Properties properties = new Properties(defaultConsumerProperties
);
- properties.
setProperty
(
+
Map<String, String> properties = new HashMap<>(
);
+ properties.
put
(
ConsumerConfig.GROUP_ID_CONFIG,
"chat_message_channel");
return new KafkaConsumer<>(
ConsumerConfig.GROUP_ID_CONFIG,
"chat_message_channel");
return new KafkaConsumer<>(
@@
-195,35
+196,27
@@
public class KafkaServicesConfiguration
}
@Bean
}
@Bean
-
Properties
defaultProducerProperties(ChatBackendProperties chatBackendProperties)
+
Map<String, String>
defaultProducerProperties(ChatBackendProperties chatBackendProperties)
{
{
- Properties properties = new Properties();
- properties.setProperty(
+ return Map.of(
ProducerConfig.CLIENT_ID_CONFIG,
ProducerConfig.CLIENT_ID_CONFIG,
- chatBackendProperties.getKafka().getClientId());
- properties.setProperty(
+ chatBackendProperties.getKafka().getClientId(),
ProducerConfig.BOOTSTRAP_SERVERS_CONFIG,
chatBackendProperties.getKafka().getBootstrapServers());
ProducerConfig.BOOTSTRAP_SERVERS_CONFIG,
chatBackendProperties.getKafka().getBootstrapServers());
- return properties;
}
@Bean
}
@Bean
-
Properties
defaultConsumerProperties(ChatBackendProperties chatBackendProperties)
+
Map<String, String>
defaultConsumerProperties(ChatBackendProperties chatBackendProperties)
{
{
- Properties properties = new Properties();
- properties.setProperty(
+ return Map.of(
ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG,
ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG,
- chatBackendProperties.getKafka().getBootstrapServers());
- properties.setProperty(
+ chatBackendProperties.getKafka().getBootstrapServers(),
ConsumerConfig.CLIENT_ID_CONFIG,
ConsumerConfig.CLIENT_ID_CONFIG,
- chatBackendProperties.getKafka().getClientId());
- properties.setProperty(
+ chatBackendProperties.getKafka().getClientId(),
ConsumerConfig.ENABLE_AUTO_COMMIT_CONFIG,
ConsumerConfig.ENABLE_AUTO_COMMIT_CONFIG,
- "false");
- properties.setProperty(
+ "false",
ConsumerConfig.AUTO_OFFSET_RESET_CONFIG,
"earliest");
ConsumerConfig.AUTO_OFFSET_RESET_CONFIG,
"earliest");
- return properties;
}
@Bean
}
@Bean