From fe761771ce3cb65b00dc3a826c51b9f20ff6c72d Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Fri, 5 Oct 2018 01:38:04 +0300 Subject: TopEvent: Announce in Fediverse, like in XMPP/Telegram --- .../service/component/NotificationListener.java | 3 +++ .../java/com/juick/service/component/TopEvent.java | 21 +++++++++++++++++++++ 2 files changed, 24 insertions(+) create mode 100644 juick-common/src/main/java/com/juick/service/component/TopEvent.java (limited to 'juick-common/src') diff --git a/juick-common/src/main/java/com/juick/service/component/NotificationListener.java b/juick-common/src/main/java/com/juick/service/component/NotificationListener.java index 8092e258..38d0490a 100644 --- a/juick-common/src/main/java/com/juick/service/component/NotificationListener.java +++ b/juick-common/src/main/java/com/juick/service/component/NotificationListener.java @@ -19,4 +19,7 @@ public interface NotificationListener { @Async @EventListener void processMessageReadEvent(MessageReadEvent messageReadEvent); + @Async + @EventListener + void processTopEvent(TopEvent topEvent); } diff --git a/juick-common/src/main/java/com/juick/service/component/TopEvent.java b/juick-common/src/main/java/com/juick/service/component/TopEvent.java new file mode 100644 index 00000000..b7e24957 --- /dev/null +++ b/juick-common/src/main/java/com/juick/service/component/TopEvent.java @@ -0,0 +1,21 @@ +package com.juick.service.component; + +import com.juick.Message; +import org.springframework.context.ApplicationEvent; + +public class TopEvent extends ApplicationEvent { + private Message message; + /** + * Create a new ApplicationEvent. + * + * @param source the object on which the event initially occurred (never {@code null}) + */ + public TopEvent(Object source, Message message) { + super(source); + this.message = message; + } + + public Message getMessage() { + return message; + } +} -- cgit v1.2.3