Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
闫逍旭
committed
Mar 9, 2016
1 parent
3e58ff1
commit addf519
Showing
6 changed files
with
85 additions
and
117 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 0 additions & 50 deletions
50
mpush-core/src/main/java/com/shinemo/mpush/core/router/UserManager.java
This file was deleted.
Oops, something went wrong.
37 changes: 37 additions & 0 deletions
37
mpush-core/src/main/java/com/shinemo/mpush/core/router/UserOnlineOfflineListener.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,37 @@ | |||
package com.shinemo.mpush.core.router; | |||
|
|||
import com.google.common.eventbus.Subscribe; | |||
import com.shinemo.mpush.api.event.UserOfflineEvent; | |||
import com.shinemo.mpush.api.event.UserOnlineEvent; | |||
import com.shinemo.mpush.common.EventBus; | |||
import com.shinemo.mpush.common.manage.user.UserManager; | |||
import com.shinemo.mpush.tools.redis.manage.RedisManage; | |||
import org.slf4j.Logger; | |||
import org.slf4j.LoggerFactory; | |||
|
|||
/** | |||
* Created by ohun on 2015/12/23. | |||
*/ | |||
public final class UserOnlineOfflineListener { | |||
public static final Logger LOGGER = LoggerFactory.getLogger(UserOnlineOfflineListener.class); | |||
|
|||
public static final String ONLINE_CHANNEL = "/mpush/online/"; | |||
|
|||
public static final String OFFLINE_CHANNEL = "/mpush/offline/"; | |||
|
|||
public UserOnlineOfflineListener() { | |||
EventBus.INSTANCE.register(this); | |||
} | |||
|
|||
@Subscribe | |||
void onUserOnline(UserOnlineEvent event) { | |||
UserManager.INSTANCE.userOnline(event.getUserId()); | |||
RedisManage.publish(ONLINE_CHANNEL, event.getUserId()); | |||
} | |||
|
|||
@Subscribe | |||
void onUserOffline(UserOfflineEvent event) { | |||
UserManager.INSTANCE.userOffline(event.getUserId()); | |||
RedisManage.publish(OFFLINE_CHANNEL, event.getUserId()); | |||
} | |||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters