diff --git a/.gitignore b/.gitignore
index 61f3420f..4f89ac43 100644
--- a/.gitignore
+++ b/.gitignore
@@ -3,6 +3,7 @@
*.project
*/.settings/
*/target/
+*/logs/
*/bin/
*/WebContent/
*/.DS_Store
@@ -10,6 +11,7 @@
.idea/
target/
+logs/
# Mobile Tools for Java (J2ME)
.mtj.tmp/
diff --git a/Changelog.md b/Changelog.md
index fc7e5191..e38e3309 100644
--- a/Changelog.md
+++ b/Changelog.md
@@ -1,3 +1,8 @@
+#### v0.8.2
+* 支持别名、标签设置及推送
+* 存储推送消息到缓存
+* 支持离线消息重复
+
#### v0.8.0
1. 增加本地ip和外网ip配置项
diff --git a/README.md b/README.md
index f88658dd..f1bcf920 100644
--- a/README.md
+++ b/README.md
@@ -6,21 +6,35 @@
## 源码
* group [https://github.com/mpusher/](https://github.com/mpusher/) 源代码空间
-* server [https://github.com/mpusher/mpush](https://github.com/mpusher/mpush) 服务端源码
-* alloc [https://github.com/mpusher/alloc](https://github.com/mpusher/alloc) 调度器源码
-* mpns [https://github.com/mpusher/mpns](https://github.com/mpusher/mpns) 个性化推送中心源码
-* java-client [https://github.com/mpusher/mpush-client-java](https://github.com/mpusher/mpush-client-java) 纯java客户端源码
-* android sdk&demo [https://github.com/mpusher/mpush-android](https://github.com/mpusher/mpush-android) 安卓SDK和DEMO源码
-* IOS sdk(swift) [https://github.com/mpusher/mpush-client-swift](https://github.com/mpusher/mpush-client-swift) swift版客户端源码
-* IOS sdk(OC) [https://github.com/mpusher/mpush-client-oc](https://github.com/mpusher/mpush-client-oc) Object C 客户端源码
+* server [https://github.com/dengly/mpush](https://github.com/dengly/mpush) 服务端源码
+* alloc [https://github.com/dengly/alloc](https://github.com/dengly/alloc) 调度器源码
+* mpns [https://github.com/dengly/mpns](https://github.com/dengly/mpns) 个性化推送中心源码
+* java-client [https://github.com/dengly/mpush-client-java](https://github.com/dengly/mpush-client-java) 纯java客户端源码
+* android sdk&demo [https://github.com/dengly/mpush-android](https://github.com/dengly/mpush-android) 安卓SDK和DEMO源码
+* IOS sdk(swift) [https://github.com/dengly/mpush-client-swift](https://github.com/dengly/mpush-client-swift) swift版客户端源码
+* IOS sdk(OC) [https://github.com/dengly/mpush-client-oc](https://github.com/dengly/mpush-client-oc) Object C 客户端源码
ps:由于源码分别在github和码云有两份,最新的代码以github为主
+## 模块说明
+* conf - 配置模块,仅仅是配置文件
+* mpush-api - api接口
+* mpush-boot - 启动模块,用于启动服务
+* mpush-cache - redis数据缓存,redis操作管理,redis订阅发布
+* mpush-client - MPush客户端
+* mpush-common - 通用模块
+* mpush-core - 核心模块
+* mpush-monitor - 监控模块
+* mpush-netty - netty连接模块
+* mpush-test - 单元测试模块
+* mpush-tools - 工具模块
+* mpush-zk - zookeeper模块
+
## 服务调用关系
-
+
## 源码测试
-1. ```git clone https://github.com/mpusher/mpush.git```
+1. ```git clone https://github.com/dengly/mpush.git```
2. 导入到eclipse或Intellij IDEA
3. 打开```mpush-test```模块,所有的测试代码都在该模块下
4. 修改配置文件```src/test/resource/application.conf```文件修改方式参照 服务部署第6点
@@ -39,9 +53,9 @@ ps:由于源码分别在github和码云有两份,最新的代码以github为
3. 安装```Redis``` (安装配置步骤略)
-4. 下载mpush server 最新的正式包[https://github.com/mpusher/mpush/releases](https://github.com/mpusher/mpush/releases)
+4. 下载mpush server 最新的正式包[https://github.com/dengly/mpush/releases](https://github.com/dengly/mpush/releases)
-5. 解压下载的tar包`tar -zvxf mpush-release-0.0.2.tar.gz`到 mpush 目录, 结构如下
+5. 解压下载的tar包`tar -zvxf mpush-release-0.8.2.tar.gz`到 mpush 目录, 结构如下
>
>drwxrwxr-x 2 shinemo shinemo 4096 Aug 20 09:30 bin —> 启动脚本
@@ -85,7 +99,54 @@ ps:由于源码分别在github和码云有两份,最新的代码以github为
```
启动入口`com.mpush.bootstrap.ServerLauncher.java`
-
+
+## 推送说明
+
+#### http推送接口信息体
+```json
+{
+ "userId":"",
+ "alias":"",
+ "tags":"",
+ "title":"",
+ "content":"",
+ "flags":"",
+ "msgType":"",
+ "extras":{
+ "expire":""
+ }
+}
+```
+
+参数说明
+
+参数 | 类型 | 是否必传 | 说明
+--- | --- | --- | ---
+userId | String | 否 | 用户id
+alias | String | 否 | 别名
+tags | String | 否 | 标签
+title | String | 是 | 标题
+content | String | 是 | 内容
+msgType | int | 是 | 推送类型,1通知 - 会在通知栏显示,2消息 - 不会在通知栏显示,业务自定义消息,3通知+消息
+flags | int | 否 | 特性字段,0x01:声音,0x02:震动,0x03:闪灯
+extras | object | 否 | 扩展
+expire | int | 否 | 过期时间,单位为秒,默认1800,即30分钟
+
+> * `userId`、`alias`、`tags`三者必须有且只能有一种,多个用英文逗号分隔
+> * `userId`和`alias` 全局唯一
+> * `userId`、`alias`、`tags`长度都小于128,且只能是英文字符、数组和英文符号`-`或`_`
+
+#### 内部推送接口信息体
+`com.mpush.api.push.PushMsg`
+
+参数说明
+
+参数 | 类型 | 是否必传 | 说明
+--- | --- | --- | ---
+msgId | String | 是 | 信息id
+content | String | 是 | 内容
+msgType | com.mpush.api.push.MsgType | 是 | 推送类型,1通知 - 会在通知栏显示,2消息 - 不会在通知栏显示,业务自定义消息,3通知+消息
+
## 配置文件详解
```java
##################################################################################################################
@@ -324,4 +385,12 @@ mp {
}
}
```
-11. 未完待续...
+
+## 独立部署
+1. 打包 `mvn clean package -Pzip`
+2. 打好的包位置: `mpush-boot/target/mpush-release-版本号.tar.gz`
+3. 解压 `tar -zvxf mpush-release-版本号.tar.gz`
+4. `cd mpush-版本号`
+5. `vim conf/mpush.conf`
+6. `chmod +x bin/*.sh`
+7. `bin/mp.sh start`
\ No newline at end of file
diff --git a/TODO b/TODO
new file mode 100644
index 00000000..c4fa058c
--- /dev/null
+++ b/TODO
@@ -0,0 +1,3 @@
+* 将用户id、别名、标签、登录设备信息、离线信息存储到数据库
+* 推送消息存储到数据库
+* 添加信息接收结果
\ No newline at end of file
diff --git a/conf/mpush.conf b/conf/mpush.conf
new file mode 100644
index 00000000..fdba08e2
--- /dev/null
+++ b/conf/mpush.conf
@@ -0,0 +1,22 @@
+mp.log-level=debug
+mp.core.min-heartbeat=3m
+mp.security.private-key="MIIBNgIBADANBgkqhkiG9w0BAQEFAASCASAwggEcAgEAAoGBAKCE8JYKhsbydMPbiO7BJVq1pbuJWJHFxOR7L8Hv3ZVkSG4eNC8DdwAmDHYu/wadfw0ihKFm2gKDcLHp5yz5UQ8PZ8FyDYvgkrvGV0ak4nc40QDJWws621dm01e/INlGKOIStAAsxOityCLv0zm5Vf3+My/YaBvZcB5mGUsPbx8fAgEAAoGAAy0+WanRqwRHXUzt89OsupPXuNNqBlCEqgTqGAt4Nimq6Ur9u2R1KXKXUotxjp71Ubw6JbuUWvJg+5Rmd9RjT0HOUEQF3rvzEepKtaraPhV5ejEIrB+nJWNfGye4yzLdfEXJBGUQzrG+wNe13izfRNXI4dN/6Q5npzqaqv0E1CkCAQACAQACAQACAQACAQA="
+mp.security.public-key="MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCghPCWCobG8nTD24juwSVataW7iViRxcTkey/B792VZEhuHjQvA3cAJgx2Lv8GnX8NIoShZtoCg3Cx6ecs+VEPD2fBcg2L4JK7xldGpOJ3ONEAyVsLOttXZtNXvyDZRijiErQALMTorcgi79M5uVX9/jMv2Ggb2XAeZhlLD28fHwIDAQAB"
+mp.zk.server-address="10.0.0.231:2181"
+mp.redis { //redis 集群配置
+ nodes:["10.0.0.211:6380","10.0.0.211:6381","10.0.0.212:6380","10.0.0.212:6381"] //格式是ip:port
+ cluster-model:cluster //single, cluster
+ maxAttempts=3 // 出现异常最大重试次数
+ soTimeout=2000 // 读取数据超时时间
+ connectionTimeout=2000 // 连接超时时间
+}
+mp.net.local-ip="192.168.31.169" //本地ip, 默认取第一个网卡的本地IP
+mp.net.public-ip="192.168.31.169" //外网ip, 默认取第一个网卡的外网IP
+mp.net.ws-server-port=0 //websocket对外端口, 0表示禁用websocket
+mp.net.gateway-server-net=tcp // 网关服务使用的网络 udp/tcp
+mp.net.connect-server-port=3000 //接入服务的端口号
+mp.http.proxy-enabled=true //启用Http代理功能
+mp.snowflake { //雪花算法
+ workerId=0 // 工作机器ID(0~31)
+ datacenterId=0 // 数据中心ID(0~31)
+}
diff --git a/conf/reference.conf b/conf/reference.conf
index 238d9a3b..e6033663 100644
--- a/conf/reference.conf
+++ b/conf/reference.conf
@@ -144,8 +144,11 @@ mp {
redis {
cluster-model=single //single,cluster,sentinel
sentinel-master:""
- nodes:[] s//["127.0.0.1:6379"]格式ip:port
- password="" //your password
+ nodes:[] //["127.0.0.1:6379"]格式ip:port
+ password="" // 密码
+ maxAttempts=1 // 出现异常最大重试次数
+ soTimeout=2000 // 读取数据超时时间
+ connectionTimeout=2000 // 连接超时时间
config {
maxTotal:8,
maxIdle:4,
@@ -236,4 +239,10 @@ mp {
thread-pool-factory:"com.mpush.tools.thread.pool.DefaultThreadPoolFactory"
dns-mapping-manager:"com.mpush.common.net.HttpProxyDnsMappingManager"
}
+
+ #雪花算法
+ snowflake {
+ workerId=0 // 工作机器ID(0~31)
+ datacenterId=0 // 数据中心ID(0~31)
+ }
}
\ No newline at end of file
diff --git a/mpush-api/pom.xml b/mpush-api/pom.xml
index ca2d84bd..430f8e97 100644
--- a/mpush-api/pom.xml
+++ b/mpush-api/pom.xml
@@ -8,7 +8,7 @@
mpush
com.github.mpusher
- 0.8.1
+ 0.8.2
../pom.xml
diff --git a/mpush-api/src/main/java/com/mpush/api/Constants.java b/mpush-api/src/main/java/com/mpush/api/Constants.java
index 169f0ab0..d1635715 100644
--- a/mpush-api/src/main/java/com/mpush/api/Constants.java
+++ b/mpush-api/src/main/java/com/mpush/api/Constants.java
@@ -34,6 +34,8 @@ public interface Constants {
String EMPTY_STRING = "";
String ANY_HOST = "0.0.0.0";
String KICK_CHANNEL_PREFIX = "/mpush/kick/";
+ // 过期时间,单位为秒,默认1800,即30分钟
+ int EXPIRE_TIME = 1800;
static String getKickChannel(String hostAndPort) {
return KICK_CHANNEL_PREFIX + hostAndPort;
diff --git a/mpush-api/src/main/java/com/mpush/api/MPushContext.java b/mpush-api/src/main/java/com/mpush/api/MPushContext.java
index 2d1d1f48..636e00af 100644
--- a/mpush-api/src/main/java/com/mpush/api/MPushContext.java
+++ b/mpush-api/src/main/java/com/mpush/api/MPushContext.java
@@ -28,6 +28,8 @@
/**
* Created by ohun on 2017/6/21.
*
+ * MPush上下文
+ *
* @author ohun@live.cn (夜色)
*/
public interface MPushContext {
diff --git a/mpush-api/src/main/java/com/mpush/api/common/Condition.java b/mpush-api/src/main/java/com/mpush/api/common/Condition.java
index b596d9cc..306ddf7d 100644
--- a/mpush-api/src/main/java/com/mpush/api/common/Condition.java
+++ b/mpush-api/src/main/java/com/mpush/api/common/Condition.java
@@ -25,6 +25,8 @@
/**
* Created by ohun on 16/10/24.
*
+ * 条件
+ *
* @author ohun@live.cn (夜色)
*/
public interface Condition extends Predicate