@Override
- public Mono<Message> persistMessage(
+ public Mono<Message> handleMessage(
Message.MessageKey key,
LocalDateTime timestamp,
String text)
}));
});
}
-
- @Override
- public MessageHandlingStrategy handleMessage(Message message)
- {
- }
}
LocalDateTime timestamp,
String text)
{
- return strategy.persistMessage(key, timestamp, text);
+ return strategy.handleMessage(key, timestamp, text);
}
+ /**
+ * {@code synchronized} ist nicht nötig, da Aufruf immer indirekt über
+ * {@link #persistMessage(Message.MessageKey, LocalDateTime, String)}
+ */
protected void addMessage(Message message) throws MessageMutationException
{
Message existingMessage = messages.get(message.getKey());
+++ /dev/null
-package de.juplo.kafka.chat.backend.persistence.kafka;
-
-import de.juplo.kafka.chat.backend.domain.Message;
-import lombok.RequiredArgsConstructor;
-import org.apache.kafka.clients.consumer.Consumer;
-import org.apache.kafka.common.TopicPartition;
-
-
-@RequiredArgsConstructor
-class MessageHandler
-{
- private final Consumer consumer;
- private final TopicPartition tp;
-
-
- void handleMessage(Message message)
- {
-
- }
-}
interface MessageHandlingStrategy
{
- Mono<Message> persistMessage(
+ Mono<Message> handleMessage(
Message.MessageKey key,
LocalDateTime timestamp,
String text);
-
- MessageHandlingStrategy handleMessage(Message message);
}