From 15753b2ebdac2ab49cf5682c417851a0653e136e Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Tue, 25 Sep 2018 12:49:57 +0300 Subject: notifications server refactoring --- .../com/juick/service/component/MessageReadEvent.java | 12 +++++++----- .../juick/service/component/NotificationListener.java | 16 ++++++++++++++++ 2 files changed, 23 insertions(+), 5 deletions(-) create mode 100644 juick-common/src/main/java/com/juick/service/component/NotificationListener.java (limited to 'juick-common/src/main/java/com/juick/service/component') diff --git a/juick-common/src/main/java/com/juick/service/component/MessageReadEvent.java b/juick-common/src/main/java/com/juick/service/component/MessageReadEvent.java index 82cfadd5..b314b89b 100644 --- a/juick-common/src/main/java/com/juick/service/component/MessageReadEvent.java +++ b/juick-common/src/main/java/com/juick/service/component/MessageReadEvent.java @@ -4,22 +4,24 @@ import com.juick.Message; import com.juick.User; import org.springframework.context.ApplicationEvent; +import java.util.List; + public class MessageReadEvent extends ApplicationEvent { - private User user; + private List users; private Message message; /** * Create a new ApplicationEvent. * * @param source the object on which the event initially occurred (never {@code null}) */ - public MessageReadEvent(Object source, User user, Message message) { + public MessageReadEvent(Object source, List users, Message message) { super(source); - this.user = user; + this.users = users; this.message = message; } - public User getUser() { - return user; + public List getUsers() { + return users; } public Message getMessage() { 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 new file mode 100644 index 00000000..e4ccb13b --- /dev/null +++ b/juick-common/src/main/java/com/juick/service/component/NotificationListener.java @@ -0,0 +1,16 @@ +package com.juick.service.component; + +import org.springframework.context.event.EventListener; + +public interface NotificationListener { + @EventListener + void processMessageEvent(MessageEvent messageEvent); + @EventListener + void processSubscribeEvent(SubscribeEvent subscribeEvent); + @EventListener + void processLikeEvent(LikeEvent likeEvent); + @EventListener + void processPingEvent(PingEvent pingEvent); + @EventListener + void processMessageReadEvent(MessageReadEvent messageReadEvent); +} -- cgit v1.2.3