import java.time.ZoneId;
import java.util.HashMap;
import java.util.Map;
+import java.util.Properties;
@ConditionalOnProperty(
@Bean
Producer<Integer, ChatRoomTo> chatRoomChannelProducer(
- Map<String, Object> defaultProducerProperties,
+ Properties defaultProducerProperties,
IntegerSerializer integerSerializer,
JsonSerializer<ChatRoomTo> chatRoomSerializer)
{
@Bean
Consumer<Integer, ChatRoomTo> chatRoomChannelConsumer(
- Map<String, Object> defaultConsumerProperties,
+ Properties defaultConsumerProperties,
IntegerDeserializer integerDeserializer,
JsonDeserializer<ChatRoomTo> chatRoomDeserializer)
{
- Map<String, Object> properties = new HashMap<>(defaultConsumerProperties);
+ Map<String, Object> properties = new HashMap<>();
+ defaultConsumerProperties.forEach((key, value) -> properties.put(key.toString(), value));
properties.put(
ConsumerConfig.GROUP_ID_CONFIG,
"chat_room_channel");
@Bean
Producer<String, MessageTo> chatMessageChannelProducer(
- Map<String, Object> defaultProducerProperties,
+ Properties defaultProducerProperties,
StringSerializer stringSerializer,
JsonSerializer<MessageTo> messageSerializer)
{
@Bean
Consumer<String, MessageTo> chatMessageChannelConsumer(
- Map<String, Object> defaultConsumerProperties,
+ Properties defaultConsumerProperties,
StringDeserializer stringDeserializer,
JsonDeserializer<MessageTo> messageDeserializer)
{
- Map<String, Object> properties = new HashMap<>(defaultConsumerProperties);
+ Map<String, Object> properties = new HashMap<>();
+ defaultConsumerProperties.forEach((key, value) -> properties.put(key.toString(), value));
properties.put(
ConsumerConfig.GROUP_ID_CONFIG,
"chat_message_channel");
}
@Bean
- Map<String, Object> defaultProducerProperties(ChatBackendProperties chatBackendProperties)
+ Properties defaultProducerProperties(ChatBackendProperties chatBackendProperties)
{
- return Map.of(
+ Properties properties = new Properties();
+ properties.setProperty(
ProducerConfig.CLIENT_ID_CONFIG,
- chatBackendProperties.getKafka().getClientId(),
+ chatBackendProperties.getKafka().getClientId());
+ properties.setProperty(
ProducerConfig.BOOTSTRAP_SERVERS_CONFIG,
chatBackendProperties.getKafka().getBootstrapServers());
+ return properties;
}
@Bean
- Map<String, Object> defaultConsumerProperties(ChatBackendProperties chatBackendProperties)
+ Properties defaultConsumerProperties(ChatBackendProperties chatBackendProperties)
{
- return Map.of(
+ Properties properties = new Properties();
+ properties.setProperty(
ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG,
- chatBackendProperties.getKafka().getBootstrapServers(),
+ chatBackendProperties.getKafka().getBootstrapServers());
+ properties.setProperty(
ConsumerConfig.CLIENT_ID_CONFIG,
- chatBackendProperties.getKafka().getClientId(),
+ chatBackendProperties.getKafka().getClientId());
+ properties.setProperty(
ConsumerConfig.ENABLE_AUTO_COMMIT_CONFIG,
- "false",
+ "false");
+ properties.setProperty(
ConsumerConfig.AUTO_OFFSET_RESET_CONFIG,
"earliest");
+ return properties;
}
@Bean