1 package de.juplo.kafka.chat.backend.implementation.kafka.messages;
3 import de.juplo.kafka.chat.backend.domain.Message;
6 import java.time.LocalDateTime;
13 public class EventChatMessageReceivedTo extends AbstractMessageTo
20 public EventChatMessageReceivedTo()
22 super(ToType.EVENT_CHATMESSAGE_RECEIVED);
26 public Message toMessage(long offset, LocalDateTime timestamp)
28 return new Message(Message.MessageKey.of(user, id), offset, timestamp, text);
31 public static EventChatMessageReceivedTo from(Message message)
33 return EventChatMessageReceivedTo.of(
34 message.getUsername(),
36 message.getMessageText());
40 public static EventChatMessageReceivedTo of(String user, Long id, String text)
42 EventChatMessageReceivedTo to = new EventChatMessageReceivedTo();