aboutsummaryrefslogtreecommitdiff
path: root/juick-notifications/src/main/java/com/juick/components/Notifications.java
diff options
context:
space:
mode:
Diffstat (limited to 'juick-notifications/src/main/java/com/juick/components/Notifications.java')
-rw-r--r--juick-notifications/src/main/java/com/juick/components/Notifications.java11
1 files changed, 4 insertions, 7 deletions
diff --git a/juick-notifications/src/main/java/com/juick/components/Notifications.java b/juick-notifications/src/main/java/com/juick/components/Notifications.java
index 5f6630fb..ce89de32 100644
--- a/juick-notifications/src/main/java/com/juick/components/Notifications.java
+++ b/juick-notifications/src/main/java/com/juick/components/Notifications.java
@@ -22,7 +22,6 @@ import com.google.android.gcm.server.*;
import com.juick.ExternalToken;
import com.juick.User;
import com.juick.formatters.PlainTextFormatter;
-import com.juick.server.component.MessageEvent;
import com.juick.util.MessageUtils;
import com.turo.pushy.apns.ApnsClient;
import com.turo.pushy.apns.PushNotificationResponse;
@@ -33,7 +32,6 @@ import org.apache.commons.text.StringEscapeUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
-import org.springframework.context.ApplicationListener;
import org.springframework.core.ParameterizedTypeReference;
import org.springframework.http.HttpMethod;
import org.springframework.stereotype.Component;
@@ -41,6 +39,7 @@ import org.springframework.web.client.RestTemplate;
import javax.annotation.Nonnull;
import javax.annotation.PostConstruct;
+import javax.annotation.PreDestroy;
import javax.inject.Inject;
import java.io.IOException;
import java.util.*;
@@ -52,7 +51,7 @@ import java.util.stream.Collectors;
* @author Ugnich Anton
*/
@Component
-public class Notifications implements NotificationClientListener, AutoCloseable, ApplicationListener<MessageEvent> {
+public class Notifications implements NotificationClientListener {
private static Logger logger = LoggerFactory.getLogger(Notifications.class);
@Inject
@@ -78,9 +77,7 @@ public class Notifications implements NotificationClientListener, AutoCloseable,
public void init() throws IOException {
mpnsClient.setListener(this);
}
- @Override
- public void onApplicationEvent(@Nonnull MessageEvent event) {
- com.juick.Message jmsg = event.getMessage();
+ public void messageReceived(@Nonnull com.juick.Message jmsg) {
User pmTo = jmsg.getTo();
final List<User> users = new ArrayList<>();
@@ -205,7 +202,7 @@ public class Notifications implements NotificationClientListener, AutoCloseable,
}
}
- @Override
+ @PreDestroy
public void close() throws Exception {
apns.close();