commit
c4531f27fa
32 changed files with 925 additions and 0 deletions
@ -0,0 +1,57 @@ |
|||||||
|
# Mobile Tools for Java (J2ME) |
||||||
|
.mtj.tmp/ |
||||||
|
|
||||||
|
# IntelliJ IDEA project dir |
||||||
|
.idea/ |
||||||
|
out/ |
||||||
|
|
||||||
|
# Mac file attribute |
||||||
|
.DS_Store/ |
||||||
|
.DS_Store |
||||||
|
|
||||||
|
# Package Files # |
||||||
|
# *.jar |
||||||
|
*.war |
||||||
|
*.ear |
||||||
|
|
||||||
|
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml |
||||||
|
hs_err_pid* |
||||||
|
|
||||||
|
*.zip |
||||||
|
/out |
||||||
|
*.iml |
||||||
|
*/target/ |
||||||
|
.idea |
||||||
|
*/*.iml |
||||||
|
logs/ |
||||||
|
*/logs/ |
||||||
|
/${log4j.rootpath}logs |
||||||
|
target/ |
||||||
|
*.bin |
||||||
|
*.log |
||||||
|
/logic/src/main/resources/servers.info |
||||||
|
|
||||||
|
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. |
||||||
|
|
||||||
|
# dependencies |
||||||
|
node_modules/ |
||||||
|
/.pnp |
||||||
|
.pnp.js |
||||||
|
|
||||||
|
# testing |
||||||
|
/coverage |
||||||
|
|
||||||
|
# production |
||||||
|
/build |
||||||
|
|
||||||
|
# misc |
||||||
|
.env.local |
||||||
|
.env.development.local |
||||||
|
.env.test.local |
||||||
|
.env.production.local |
||||||
|
|
||||||
|
npm-debug.log* |
||||||
|
yarn-debug.log* |
||||||
|
yarn-error.log* |
||||||
|
|
||||||
|
/log |
||||||
@ -0,0 +1,44 @@ |
|||||||
|
- 接入层 entry |
||||||
|
- 逻辑层 logic |
||||||
|
- 内存存储层 router |
||||||
|
- 固化存储层 das |
||||||
|
|
||||||
|
|
||||||
|
功能组件: |
||||||
|
1.0 |
||||||
|
- IOC: guice |
||||||
|
- 通信层: netty |
||||||
|
- 序列化: protobuf |
||||||
|
- 内存存储: |
||||||
|
- Caffeine |
||||||
|
- Memcache |
||||||
|
- 分布式缓存:redis |
||||||
|
- 注册中心:etcd、直连 |
||||||
|
- 处理队列:disruptor |
||||||
|
- 持久化:mysql |
||||||
|
- 日志:log4j2 |
||||||
|
- 监控:prometheus、grafana |
||||||
|
|
||||||
|
- ID生成器 |
||||||
|
|
||||||
|
2.0 |
||||||
|
- quarkus |
||||||
|
|
||||||
|
|
||||||
|
集群负载均衡: |
||||||
|
子网1,子网2,公网 |
||||||
|
子网1和2不相通 |
||||||
|
|
||||||
|
|
||||||
|
entry <--> client 通信 |
||||||
|
entry <--> logic dubbo service |
||||||
|
client jconsle cmd |
||||||
|
|
||||||
|
router <--> cache |
||||||
|
das <--> db |
||||||
|
router <--> das |
||||||
|
|
||||||
|
das shardingjdbc |
||||||
|
table struct, sharding roles |
||||||
|
logic biz |
||||||
|
|
||||||
@ -0,0 +1,15 @@ |
|||||||
|
<?xml version="1.0" encoding="UTF-8"?> |
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0" |
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
||||||
|
<parent> |
||||||
|
<artifactId>so-im</artifactId> |
||||||
|
<groupId>net.sopod</groupId> |
||||||
|
<version>1.0.0</version> |
||||||
|
</parent> |
||||||
|
<modelVersion>4.0.0</modelVersion> |
||||||
|
|
||||||
|
<artifactId>im-client</artifactId> |
||||||
|
|
||||||
|
|
||||||
|
</project> |
||||||
@ -0,0 +1,11 @@ |
|||||||
|
package net.sopod.soim.client; |
||||||
|
|
||||||
|
/** |
||||||
|
* Main |
||||||
|
* |
||||||
|
* @author tmy |
||||||
|
* @date 2022-03-27 22:32 |
||||||
|
*/ |
||||||
|
public class ClientMain { |
||||||
|
|
||||||
|
} |
||||||
@ -0,0 +1,13 @@ |
|||||||
|
package net.sopod.soim.client.server; |
||||||
|
|
||||||
|
/** |
||||||
|
* ClientInitial |
||||||
|
* |
||||||
|
* @author tmy |
||||||
|
* @date 2022-03-27 22:36 |
||||||
|
*/ |
||||||
|
public class ClientInitial { |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
} |
||||||
@ -0,0 +1,15 @@ |
|||||||
|
<?xml version="1.0" encoding="UTF-8"?> |
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0" |
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
||||||
|
<parent> |
||||||
|
<artifactId>so-im</artifactId> |
||||||
|
<groupId>net.sopod</groupId> |
||||||
|
<version>1.0.0</version> |
||||||
|
</parent> |
||||||
|
<modelVersion>4.0.0</modelVersion> |
||||||
|
|
||||||
|
<artifactId>im-common</artifactId> |
||||||
|
|
||||||
|
|
||||||
|
</project> |
||||||
@ -0,0 +1,14 @@ |
|||||||
|
package net.sopod.soim.common.cache; |
||||||
|
|
||||||
|
/** |
||||||
|
* CacheNames |
||||||
|
* |
||||||
|
* @author tmy |
||||||
|
* @date 2022-03-26 00:15 |
||||||
|
*/ |
||||||
|
public interface CacheNames { |
||||||
|
|
||||||
|
/** 验证码 */ |
||||||
|
String CAPTCHA_KEY = "soim:auth::soim:captcha:"; |
||||||
|
|
||||||
|
} |
||||||
@ -0,0 +1,13 @@ |
|||||||
|
package net.sopod.soim.common.config.registry; |
||||||
|
|
||||||
|
/** |
||||||
|
* EtcdRegistry |
||||||
|
* |
||||||
|
* @author tmy |
||||||
|
* @date 2022-03-27 17:00 |
||||||
|
*/ |
||||||
|
public class EtcdRegistry { |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
} |
||||||
@ -0,0 +1,13 @@ |
|||||||
|
package net.sopod.soim.common.config.registry; |
||||||
|
|
||||||
|
/** |
||||||
|
* Registry |
||||||
|
* |
||||||
|
* @author tmy |
||||||
|
* @date 2022-03-27 17:00 |
||||||
|
*/ |
||||||
|
public class Registry { |
||||||
|
|
||||||
|
private Registry registry; |
||||||
|
|
||||||
|
} |
||||||
@ -0,0 +1,13 @@ |
|||||||
|
package net.sopod.soim.common.exception; |
||||||
|
|
||||||
|
/** |
||||||
|
* ConvertException |
||||||
|
* |
||||||
|
* @author tmy |
||||||
|
* @date 2022-03-27 17:18 |
||||||
|
*/ |
||||||
|
public class ConvertException extends Exception { |
||||||
|
|
||||||
|
private Throwable originException; |
||||||
|
|
||||||
|
} |
||||||
@ -0,0 +1 @@ |
|||||||
|
log4j2.contextSelector=org.apache.logging.log4j.core.async.AsyncLoggerContextSelector |
||||||
@ -0,0 +1,97 @@ |
|||||||
|
<?xml version="1.0" encoding="UTF-8"?> |
||||||
|
<Configuration> |
||||||
|
<!-- 异步日志--> |
||||||
|
<!-- 然后在src/java/resources目录添加log4j2.component.properties配置文件--> |
||||||
|
<!-- # 设置异步日志系统属性--> |
||||||
|
<!--log4j2.contextSelector=org.apache.logging.log4j.core.async.AsyncLoggerContextSelector--> |
||||||
|
|
||||||
|
<Properties> |
||||||
|
<!-- 日志输出级别 --> |
||||||
|
<Property name="LOG_INFO_LEVEL" value="info"/> |
||||||
|
<!-- error级别日志 --> |
||||||
|
<Property name="LOG_ERROR_LEVEL" value="error"/> |
||||||
|
<!-- 在当前目录下创建名为log目录做日志存放的目录 --> |
||||||
|
<Property name="LOG_HOME" value="./log"/> |
||||||
|
<!-- 档案日志存放目录 --> |
||||||
|
<Property name="LOG_ARCHIVE" value="./log/archive"/> |
||||||
|
<!-- 模块名称, 影响日志配置名,日志文件名,根据自己项目进行配置 --> |
||||||
|
<Property name="LOG_MODULE_NAME" value="ci-server"/> |
||||||
|
<!-- 日志文件大小,超过这个大小将被压缩 --> |
||||||
|
<Property name="LOG_MAX_SIZE" value="100 MB"/> |
||||||
|
<!-- 保留多少天以内的日志 --> |
||||||
|
<Property name="LOG_DAYS" value="15"/> |
||||||
|
<!--输出日志的格式:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度, %msg:日志消息,%n是换行符 --> |
||||||
|
<!-- <Property name="LOG_PATTERN" value="%d [%t] %-5level %logger{0} - %msg%n"/>--> |
||||||
|
<Property name="LOG_PATTERN" value="%d [%t] %-5level %logger{0} - %msg%n"/> |
||||||
|
<!--interval属性用来指定多久滚动一次--> |
||||||
|
<Property name="TIME_BASED_INTERVAL" value="1"/> |
||||||
|
|
||||||
|
<Property name="LOG_EXCEPTION_CONVERSION_WORD">%xwEx</Property> |
||||||
|
<Property name="LOG_LEVEL_PATTERN">%5p</Property> |
||||||
|
<Property name="LOG_DATEFORMAT_PATTERN">yyyy-MM-dd HH:mm:ss.SSS</Property> |
||||||
|
<Property name="CONSOLE_LOG_PATTERN">%clr{%d{${sys:LOG_DATEFORMAT_PATTERN}}}{faint} %clr{${sys:LOG_LEVEL_PATTERN}} %clr{%pid}{magenta} %clr{---}{faint} %clr{[%15.15t]}{faint} %clr{%-40.40c{1.}}{cyan} %clr{:}{faint} %m%n${sys:LOG_EXCEPTION_CONVERSION_WORD}</Property> |
||||||
|
<Property name="FILE_LOG_PATTERN">%d{${LOG_DATEFORMAT_PATTERN}} ${LOG_LEVEL_PATTERN} %pid --- [%t] %-40.40c{1.} : %m%n${sys:LOG_EXCEPTION_CONVERSION_WORD}</Property> |
||||||
|
</Properties> |
||||||
|
|
||||||
|
<Appenders> |
||||||
|
<!-- 控制台输出 --> |
||||||
|
<Console name="STDOUT" target="SYSTEM_OUT" follow="true"> |
||||||
|
<!--输出日志的格式--> |
||||||
|
<PatternLayout pattern="${LOG_PATTERN}"/> |
||||||
|
<!--控制台只输出level及其以上级别的信息(onMatch),其他的直接拒绝(onMismatch)--> |
||||||
|
<ThresholdFilter level="${LOG_INFO_LEVEL}" onMatch="ACCEPT" onMismatch="DENY"/> |
||||||
|
</Console> |
||||||
|
|
||||||
|
<!-- 这个会打印出所有的info级别以上,error级别一下的日志,每次大小超过size或者满足TimeBasedTriggeringPolicy,则日志会自动存入按年月日建立的文件夹下面并进行压缩,作为存档--> |
||||||
|
<!--异步日志会自动批量刷新,所以将immediateFlush属性设置为false--> |
||||||
|
<RollingRandomAccessFile name="RollingRandomAccessFileInfo" |
||||||
|
fileName="${LOG_HOME}/${LOG_MODULE_NAME}-info.log" |
||||||
|
filePattern="${LOG_ARCHIVE}/${LOG_MODULE_NAME}-info-%d{yyyy-MM-dd}-%i.log.gz" |
||||||
|
immediateFlush="false"> |
||||||
|
<Filters> |
||||||
|
<!--如果是error级别拒绝,设置 onMismatch="NEUTRAL" 可以让日志经过后续的过滤器--> |
||||||
|
<ThresholdFilter level="${LOG_ERROR_LEVEL}" onMatch="DENY" onMismatch="NEUTRAL"/> |
||||||
|
<!--如果是info\warn输出--> |
||||||
|
<ThresholdFilter level="${LOG_INFO_LEVEL}" onMatch="ACCEPT" onMismatch="DENY"/> |
||||||
|
</Filters> |
||||||
|
<PatternLayout pattern="${LOG_PATTERN}"/> |
||||||
|
<Policies> |
||||||
|
<!--interval属性用来指定多久滚动一次,根据当前filePattern设置是1天滚动一次--> |
||||||
|
<TimeBasedTriggeringPolicy interval="${TIME_BASED_INTERVAL}"/> |
||||||
|
<SizeBasedTriggeringPolicy size="${LOG_MAX_SIZE}"/> |
||||||
|
</Policies> |
||||||
|
<!-- DefaultRolloverStrategy属性如不设置,则默认同一文件夹下最多保存7个文件--> |
||||||
|
<DefaultRolloverStrategy max="${LOG_DAYS}"/> |
||||||
|
</RollingRandomAccessFile> |
||||||
|
|
||||||
|
<!--只记录error级别以上的日志,与info级别的日志分不同的文件保存--> |
||||||
|
<RollingRandomAccessFile name="RollingRandomAccessFileError" |
||||||
|
fileName="${LOG_HOME}/${LOG_MODULE_NAME}-error.log" |
||||||
|
filePattern="${LOG_ARCHIVE}/${LOG_MODULE_NAME}-error-%d{yyyy-MM-dd}-%i.log.gz" |
||||||
|
immediateFlush="false"> |
||||||
|
<Filters> |
||||||
|
<ThresholdFilter level="${LOG_ERROR_LEVEL}" onMatch="ACCEPT" onMismatch="DENY"/> |
||||||
|
</Filters> |
||||||
|
<PatternLayout pattern="${LOG_PATTERN}"/> |
||||||
|
<Policies> |
||||||
|
<TimeBasedTriggeringPolicy interval="${TIME_BASED_INTERVAL}"/> |
||||||
|
<SizeBasedTriggeringPolicy size="${LOG_MAX_SIZE}"/> |
||||||
|
</Policies> |
||||||
|
<DefaultRolloverStrategy max="${LOG_DAYS}"/> |
||||||
|
</RollingRandomAccessFile> |
||||||
|
</Appenders> |
||||||
|
|
||||||
|
<Loggers> |
||||||
|
<!-- 开发环境使用 --> |
||||||
|
<Root level="${LOG_INFO_LEVEL}"> |
||||||
|
<AppenderRef ref="STDOUT"/> |
||||||
|
</Root>--> |
||||||
|
|
||||||
|
<!-- 测试,生产环境使用 --> |
||||||
|
<!--<Root level="${LOG_INFO_LEVEL}" includeLocation="false"> |
||||||
|
<AppenderRef ref="STDOUT"/> |
||||||
|
<AppenderRef ref="RollingRandomAccessFileInfo"/> |
||||||
|
<AppenderRef ref="RollingRandomAccessFileError"/> |
||||||
|
</Root>--> |
||||||
|
</Loggers> |
||||||
|
</Configuration> |
||||||
@ -0,0 +1,26 @@ |
|||||||
|
<?xml version="1.0" encoding="UTF-8"?> |
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0" |
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
||||||
|
<parent> |
||||||
|
<artifactId>so-im</artifactId> |
||||||
|
<groupId>net.sopod</groupId> |
||||||
|
<version>1.0.0</version> |
||||||
|
</parent> |
||||||
|
<modelVersion>4.0.0</modelVersion> |
||||||
|
|
||||||
|
<artifactId>im-data</artifactId> |
||||||
|
|
||||||
|
<dependencies> |
||||||
|
<dependency> |
||||||
|
<groupId>net.sopod</groupId> |
||||||
|
<artifactId>im-common</artifactId> |
||||||
|
<version>${soim.version}</version> |
||||||
|
</dependency> |
||||||
|
<dependency> |
||||||
|
<groupId>io.netty</groupId> |
||||||
|
<artifactId>netty-buffer</artifactId> |
||||||
|
</dependency> |
||||||
|
</dependencies> |
||||||
|
|
||||||
|
</project> |
||||||
@ -0,0 +1,25 @@ |
|||||||
|
package net.sopod.soim.data.constant; |
||||||
|
|
||||||
|
/** |
||||||
|
* PlatformType |
||||||
|
* |
||||||
|
* @author tmy |
||||||
|
* @date 2022-03-27 17:36 |
||||||
|
*/ |
||||||
|
public enum PlatformType { |
||||||
|
|
||||||
|
IM_CLIENT, |
||||||
|
|
||||||
|
IM_ENTRY, |
||||||
|
|
||||||
|
IM_ROUTER, |
||||||
|
|
||||||
|
IM_DAS, |
||||||
|
|
||||||
|
IM_LOGIC, |
||||||
|
|
||||||
|
IM_USER, |
||||||
|
|
||||||
|
IM_GROUP; |
||||||
|
|
||||||
|
} |
||||||
@ -0,0 +1,28 @@ |
|||||||
|
package net.sopod.soim.data.constant; |
||||||
|
|
||||||
|
/** |
||||||
|
* SerializeType |
||||||
|
* |
||||||
|
* @author tmy |
||||||
|
* @date 2022-03-27 17:14 |
||||||
|
*/ |
||||||
|
public enum SerializeType { |
||||||
|
|
||||||
|
json, |
||||||
|
|
||||||
|
protobuf; |
||||||
|
|
||||||
|
|
||||||
|
public static interface Converter { |
||||||
|
|
||||||
|
<T> T deserialize(byte[] data, Class<T> clazz) throws Exception; |
||||||
|
|
||||||
|
byte[] serialize(Object pojo); |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
public static void main(String[] args) { |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
@ -0,0 +1,11 @@ |
|||||||
|
package net.sopod.soim.data.net; |
||||||
|
|
||||||
|
/** |
||||||
|
* Ping |
||||||
|
* |
||||||
|
* @author tmy |
||||||
|
* @date 2022-03-26 01:04 |
||||||
|
*/ |
||||||
|
public class Ping { |
||||||
|
|
||||||
|
} |
||||||
@ -0,0 +1,10 @@ |
|||||||
|
package net.sopod.soim.data.net; |
||||||
|
|
||||||
|
/** |
||||||
|
* Pomg |
||||||
|
* |
||||||
|
* @author tmy |
||||||
|
* @date 2022-03-26 01:04 |
||||||
|
*/ |
||||||
|
public class Pong { |
||||||
|
} |
||||||
@ -0,0 +1,159 @@ |
|||||||
|
package net.sopod.soim.data.serialize; |
||||||
|
|
||||||
|
import io.netty.buffer.ByteBuf; |
||||||
|
|
||||||
|
import java.util.Random; |
||||||
|
|
||||||
|
/** |
||||||
|
* Struct |
||||||
|
* 是否是事件,是否需要返回值 |
||||||
|
* |
||||||
|
* @author tmy |
||||||
|
* @date 2022-03-27 17:13 |
||||||
|
*/ |
||||||
|
public class ImMessage { |
||||||
|
|
||||||
|
public static final short MAGIC = 0x7a20; |
||||||
|
|
||||||
|
public static final int MESSAGE_HEAD_LEN = 17; |
||||||
|
|
||||||
|
public static final ImMessage PROTOCOL_ERROR; |
||||||
|
|
||||||
|
public static final ImMessage MAGIC_ERROR; |
||||||
|
|
||||||
|
static { |
||||||
|
Random random = new Random(); |
||||||
|
PROTOCOL_ERROR = new ImMessage().setSerialNo(random.nextInt()); |
||||||
|
MAGIC_ERROR = new ImMessage().setSerialNo(random.nextInt()); |
||||||
|
} |
||||||
|
|
||||||
|
/** 协议版本 */ |
||||||
|
//private int version;
|
||||||
|
|
||||||
|
/** 协议总长度 */ |
||||||
|
//private int protocolLength;
|
||||||
|
|
||||||
|
/** 请求序列号 */ |
||||||
|
private int serialNo; |
||||||
|
|
||||||
|
/** 服务编号 */ |
||||||
|
private int serviceNo; |
||||||
|
|
||||||
|
/** 请求体序列化格式 Ordinal */ |
||||||
|
private int serializeType; |
||||||
|
|
||||||
|
/** 压缩算法 */ |
||||||
|
private int zipType; |
||||||
|
|
||||||
|
/** 平台号 */ |
||||||
|
private int platformNo; |
||||||
|
|
||||||
|
/** 请求体长度 */ |
||||||
|
private int bodyLength; |
||||||
|
|
||||||
|
private byte[] body; |
||||||
|
|
||||||
|
/** |
||||||
|
* 从 bytebuf 流读取 |
||||||
|
*/ |
||||||
|
public static ImMessage read(ByteBuf buf) { |
||||||
|
int bufLen = buf.readableBytes(); |
||||||
|
if (bufLen < MESSAGE_HEAD_LEN) { |
||||||
|
return PROTOCOL_ERROR; |
||||||
|
} |
||||||
|
short magic = buf.readShort(); |
||||||
|
if (magic != MAGIC) { |
||||||
|
return MAGIC_ERROR; |
||||||
|
} |
||||||
|
ImMessage msg = new ImMessage() |
||||||
|
.setSerialNo(buf.readInt()) |
||||||
|
.setServiceNo(buf.readInt()) |
||||||
|
.setSerializeType(buf.readByte()) |
||||||
|
.setZipType(buf.readByte()) |
||||||
|
.setPlatformNo(buf.readByte()); |
||||||
|
msg.bodyLength = buf.readInt(); |
||||||
|
if (bufLen != MESSAGE_HEAD_LEN + msg.getBodyLength()) { |
||||||
|
return PROTOCOL_ERROR; |
||||||
|
} |
||||||
|
byte[] body = new byte[msg.getBodyLength()]; |
||||||
|
buf.readBytes(body); |
||||||
|
msg.setBody(body); |
||||||
|
return msg; |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 写入到 bytebuf 流 |
||||||
|
*/ |
||||||
|
public void write(ByteBuf buf) { |
||||||
|
buf.writeShort(MAGIC) |
||||||
|
.writeInt(this.serialNo) |
||||||
|
.writeInt(this.serviceNo) |
||||||
|
.writeByte(this.serializeType) |
||||||
|
.writeByte(this.zipType) |
||||||
|
.writeByte(this.platformNo); |
||||||
|
if (this.body == null) { |
||||||
|
buf.writeInt(0); |
||||||
|
} else { |
||||||
|
buf.writeInt(this.body.length) |
||||||
|
.writeBytes(this.body); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public int getSerialNo() { |
||||||
|
return serialNo; |
||||||
|
} |
||||||
|
|
||||||
|
public ImMessage setSerialNo(int serialNo) { |
||||||
|
this.serialNo = serialNo; |
||||||
|
return this; |
||||||
|
} |
||||||
|
|
||||||
|
public int getServiceNo() { |
||||||
|
return serviceNo; |
||||||
|
} |
||||||
|
|
||||||
|
public ImMessage setServiceNo(int serviceNo) { |
||||||
|
this.serviceNo = serviceNo; |
||||||
|
return this; |
||||||
|
} |
||||||
|
|
||||||
|
public int getSerializeType() { |
||||||
|
return serializeType; |
||||||
|
} |
||||||
|
|
||||||
|
public ImMessage setSerializeType(int serializeType) { |
||||||
|
this.serializeType = serializeType; |
||||||
|
return this; |
||||||
|
} |
||||||
|
|
||||||
|
public int getZipType() { |
||||||
|
return zipType; |
||||||
|
} |
||||||
|
|
||||||
|
public ImMessage setZipType(int zipType) { |
||||||
|
this.zipType = zipType; |
||||||
|
return this; |
||||||
|
} |
||||||
|
|
||||||
|
public int getPlatformNo() { |
||||||
|
return platformNo; |
||||||
|
} |
||||||
|
|
||||||
|
public ImMessage setPlatformNo(int platformNo) { |
||||||
|
this.platformNo = platformNo; |
||||||
|
return this; |
||||||
|
} |
||||||
|
|
||||||
|
public int getBodyLength() { |
||||||
|
return bodyLength; |
||||||
|
} |
||||||
|
|
||||||
|
public byte[] getBody() { |
||||||
|
return body; |
||||||
|
} |
||||||
|
|
||||||
|
public ImMessage setBody(byte[] body) { |
||||||
|
this.body = body; |
||||||
|
return this; |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,51 @@ |
|||||||
|
<?xml version="1.0" encoding="UTF-8"?> |
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0" |
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
||||||
|
<parent> |
||||||
|
<artifactId>so-im</artifactId> |
||||||
|
<groupId>net.sopod</groupId> |
||||||
|
<version>1.0.0</version> |
||||||
|
</parent> |
||||||
|
<modelVersion>4.0.0</modelVersion> |
||||||
|
|
||||||
|
<artifactId>im-entry</artifactId> |
||||||
|
|
||||||
|
<properties> |
||||||
|
<mainClass>net.sopod.soim.entry.EntryMain</mainClass> |
||||||
|
</properties> |
||||||
|
|
||||||
|
<dependencies> |
||||||
|
<dependency> |
||||||
|
<groupId>net.sopod</groupId> |
||||||
|
<artifactId>im-common</artifactId> |
||||||
|
<version>${soim.version}</version> |
||||||
|
</dependency> |
||||||
|
<dependency> |
||||||
|
<groupId>org.projectlombok</groupId> |
||||||
|
<artifactId>lombok</artifactId> |
||||||
|
</dependency> |
||||||
|
<dependency> |
||||||
|
<groupId>io.netty</groupId> |
||||||
|
<artifactId>netty-all</artifactId> |
||||||
|
</dependency> |
||||||
|
</dependencies> |
||||||
|
|
||||||
|
<build> |
||||||
|
<plugins> |
||||||
|
<!-- maven 打包集成插件 --> |
||||||
|
<plugin> |
||||||
|
<groupId>org.apache.maven.plugins</groupId> |
||||||
|
<artifactId>maven-assembly-plugin</artifactId> |
||||||
|
<configuration> |
||||||
|
<archive> |
||||||
|
<manifest> |
||||||
|
<mainClass>${mainClass}</mainClass> |
||||||
|
</manifest> |
||||||
|
</archive> |
||||||
|
</configuration> |
||||||
|
</plugin> |
||||||
|
</plugins> |
||||||
|
</build> |
||||||
|
|
||||||
|
</project> |
||||||
@ -0,0 +1,27 @@ |
|||||||
|
package net.sopod.soim.entry; |
||||||
|
|
||||||
|
import net.sopod.soim.entry.model.A; |
||||||
|
import org.slf4j.Logger; |
||||||
|
import org.slf4j.LoggerFactory; |
||||||
|
|
||||||
|
/** |
||||||
|
* EntryMain |
||||||
|
* |
||||||
|
* @author tmy |
||||||
|
* @date 2022-03-26 00:06 |
||||||
|
*/ |
||||||
|
public class EntryMain { |
||||||
|
|
||||||
|
private static final Logger logger = LoggerFactory.getLogger(EntryMain.class); |
||||||
|
|
||||||
|
public static void main(String[] args) { |
||||||
|
logger.info("info"); |
||||||
|
logger.warn("warn"); |
||||||
|
logger.error("error..."); |
||||||
|
|
||||||
|
A a = new A(); |
||||||
|
a.setName("太极拳"); |
||||||
|
System.out.println(a); |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
@ -0,0 +1,16 @@ |
|||||||
|
package net.sopod.soim.entry.model; |
||||||
|
|
||||||
|
import lombok.Data; |
||||||
|
|
||||||
|
/** |
||||||
|
* A |
||||||
|
* |
||||||
|
* @author tmy |
||||||
|
* @date 2022-03-27 17:01 |
||||||
|
*/ |
||||||
|
@Data |
||||||
|
public class A { |
||||||
|
|
||||||
|
private String name; |
||||||
|
|
||||||
|
} |
||||||
@ -0,0 +1,16 @@ |
|||||||
|
<?xml version="1.0" encoding="UTF-8"?> |
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0" |
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
||||||
|
<parent> |
||||||
|
<artifactId>so-im</artifactId> |
||||||
|
<groupId>net.sopod</groupId> |
||||||
|
<version>1.0.0</version> |
||||||
|
<relativePath>../../pom.xml</relativePath> |
||||||
|
</parent> |
||||||
|
<modelVersion>4.0.0</modelVersion> |
||||||
|
|
||||||
|
<artifactId>im-user-api</artifactId> |
||||||
|
|
||||||
|
|
||||||
|
</project> |
||||||
@ -0,0 +1,13 @@ |
|||||||
|
package net.sopod.soim.logic.api.user.service; |
||||||
|
|
||||||
|
/** |
||||||
|
* UserService |
||||||
|
* |
||||||
|
* @author tmy |
||||||
|
* @date 2022-03-27 22:42 |
||||||
|
*/ |
||||||
|
public interface UserService { |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
} |
||||||
@ -0,0 +1,15 @@ |
|||||||
|
<?xml version="1.0" encoding="UTF-8"?> |
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0" |
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
||||||
|
<parent> |
||||||
|
<artifactId>so-im</artifactId> |
||||||
|
<groupId>net.sopod</groupId> |
||||||
|
<version>1.0.0</version> |
||||||
|
</parent> |
||||||
|
<modelVersion>4.0.0</modelVersion> |
||||||
|
|
||||||
|
<artifactId>im-logic-api</artifactId> |
||||||
|
|
||||||
|
|
||||||
|
</project> |
||||||
@ -0,0 +1,15 @@ |
|||||||
|
<?xml version="1.0" encoding="UTF-8"?> |
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0" |
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
||||||
|
<parent> |
||||||
|
<artifactId>im-logic</artifactId> |
||||||
|
<groupId>net.sopod</groupId> |
||||||
|
<version>1.0.0</version> |
||||||
|
</parent> |
||||||
|
<modelVersion>4.0.0</modelVersion> |
||||||
|
|
||||||
|
<artifactId>im-logic-user</artifactId> |
||||||
|
|
||||||
|
|
||||||
|
</project> |
||||||
@ -0,0 +1,15 @@ |
|||||||
|
package net.sopod.soim.logic.user; |
||||||
|
|
||||||
|
/** |
||||||
|
* UserMain |
||||||
|
* |
||||||
|
* @author tmy |
||||||
|
* @date 2022-03-26 01:41 |
||||||
|
*/ |
||||||
|
public class UserMain { |
||||||
|
|
||||||
|
public static void main(String[] args) { |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
@ -0,0 +1,19 @@ |
|||||||
|
<?xml version="1.0" encoding="UTF-8"?> |
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0" |
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
||||||
|
<parent> |
||||||
|
<artifactId>so-im</artifactId> |
||||||
|
<groupId>net.sopod</groupId> |
||||||
|
<version>1.0.0</version> |
||||||
|
</parent> |
||||||
|
<modelVersion>4.0.0</modelVersion> |
||||||
|
|
||||||
|
<artifactId>im-logic</artifactId> |
||||||
|
<packaging>pom</packaging> |
||||||
|
<modules> |
||||||
|
<module>im-logic-user</module> |
||||||
|
</modules> |
||||||
|
|
||||||
|
|
||||||
|
</project> |
||||||
@ -0,0 +1,173 @@ |
|||||||
|
<?xml version="1.0" encoding="UTF-8"?> |
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0" |
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
||||||
|
<modelVersion>4.0.0</modelVersion> |
||||||
|
|
||||||
|
<groupId>net.sopod</groupId> |
||||||
|
<artifactId>so-im</artifactId> |
||||||
|
<packaging>pom</packaging> |
||||||
|
<version>1.0.0</version> |
||||||
|
<modules> |
||||||
|
<module>im-common</module> |
||||||
|
<module>im-data</module> |
||||||
|
<module>im-entry</module> |
||||||
|
<module>im-logic</module> |
||||||
|
<module>im-client</module> |
||||||
|
<module>im-logic-api</module> |
||||||
|
<module>im-logic-api/im-user-api</module> |
||||||
|
</modules> |
||||||
|
|
||||||
|
<properties> |
||||||
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> |
||||||
|
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> |
||||||
|
<maven.compiler.encoding>UTF-8</maven.compiler.encoding> |
||||||
|
<maven.compiler.source>11</maven.compiler.source> |
||||||
|
<maven.compiler.target>11</maven.compiler.target> |
||||||
|
<maven.compiler.compilerVersion>11</maven.compiler.compilerVersion> |
||||||
|
<jackson.version>2.12.5</jackson.version> |
||||||
|
<logback.version>1.2.11</logback.version> |
||||||
|
<log4j.version>2.17.2</log4j.version> |
||||||
|
<soim.version>1.0.0</soim.version> |
||||||
|
<netty.version>4.1.72.Final</netty.version> |
||||||
|
</properties> |
||||||
|
|
||||||
|
<dependencyManagement> |
||||||
|
<dependencies> |
||||||
|
<dependency> |
||||||
|
<groupId>io.netty</groupId> |
||||||
|
<artifactId>netty-all</artifactId> |
||||||
|
<version>${netty.version}</version> |
||||||
|
</dependency> |
||||||
|
<dependency> |
||||||
|
<groupId>io.netty</groupId> |
||||||
|
<artifactId>netty-buffer</artifactId> |
||||||
|
<version>${netty.version}</version> |
||||||
|
</dependency> |
||||||
|
<dependency> |
||||||
|
<groupId>com.google.protobuf</groupId> |
||||||
|
<artifactId>protobuf-java</artifactId> |
||||||
|
<version>3.15.8</version> |
||||||
|
</dependency> |
||||||
|
<dependency> |
||||||
|
<groupId>com.lmax</groupId> |
||||||
|
<artifactId>disruptor</artifactId> |
||||||
|
<version>3.4.4</version> |
||||||
|
</dependency> |
||||||
|
<dependency> |
||||||
|
<groupId>org.reflections</groupId> |
||||||
|
<artifactId>reflections</artifactId> |
||||||
|
<version>0.9.12</version> |
||||||
|
</dependency> |
||||||
|
<dependency> |
||||||
|
<groupId>com.google.inject</groupId> |
||||||
|
<artifactId>guice</artifactId> |
||||||
|
<version>4.1.0</version> |
||||||
|
</dependency> |
||||||
|
<dependency> |
||||||
|
<groupId>com.google.guava</groupId> |
||||||
|
<artifactId>guava</artifactId> |
||||||
|
<version>20.0</version> |
||||||
|
</dependency> |
||||||
|
<dependency> |
||||||
|
<groupId>org.apache.commons</groupId> |
||||||
|
<artifactId>commons-lang3</artifactId> |
||||||
|
<version>3.4</version> |
||||||
|
</dependency> |
||||||
|
|
||||||
|
<dependency> |
||||||
|
<groupId>mysql</groupId> |
||||||
|
<artifactId>mysql-connector-java</artifactId> |
||||||
|
<version>5.1.33</version> |
||||||
|
</dependency> |
||||||
|
<dependency> |
||||||
|
<groupId>com.zaxxer</groupId> |
||||||
|
<artifactId>HikariCP</artifactId> |
||||||
|
<version>3.4.5</version> |
||||||
|
</dependency> |
||||||
|
|
||||||
|
<!--slf4j --> |
||||||
|
<dependency> |
||||||
|
<groupId>org.slf4j</groupId> |
||||||
|
<artifactId>slf4j-api</artifactId> |
||||||
|
<version>1.7.36</version> |
||||||
|
</dependency> |
||||||
|
<dependency> |
||||||
|
<groupId>org.apache.logging.log4j</groupId> |
||||||
|
<artifactId>log4j-api</artifactId> |
||||||
|
<version>${log4j.version}</version> |
||||||
|
</dependency> |
||||||
|
<dependency> |
||||||
|
<groupId>org.apache.logging.log4j</groupId> |
||||||
|
<artifactId>log4j-core</artifactId> |
||||||
|
<version>${log4j.version}</version> |
||||||
|
</dependency> |
||||||
|
<dependency> <!-- 桥接:告诉Slf4j使用Log4j2 --> |
||||||
|
<groupId>org.apache.logging.log4j</groupId> |
||||||
|
<artifactId>log4j-slf4j-impl</artifactId> |
||||||
|
<version>${log4j.version}</version> |
||||||
|
</dependency> |
||||||
|
<dependency> |
||||||
|
<groupId>org.projectlombok</groupId> |
||||||
|
<artifactId>lombok</artifactId> |
||||||
|
<version>1.18.22</version> |
||||||
|
<scope>provided</scope> |
||||||
|
</dependency> |
||||||
|
</dependencies> |
||||||
|
</dependencyManagement> |
||||||
|
|
||||||
|
<dependencies> |
||||||
|
<!--slf4j --> |
||||||
|
<dependency> |
||||||
|
<groupId>org.slf4j</groupId> |
||||||
|
<artifactId>slf4j-api</artifactId> |
||||||
|
</dependency> |
||||||
|
<dependency> |
||||||
|
<groupId>org.apache.logging.log4j</groupId> |
||||||
|
<artifactId>log4j-api</artifactId> |
||||||
|
</dependency> |
||||||
|
<dependency> |
||||||
|
<groupId>org.apache.logging.log4j</groupId> |
||||||
|
<artifactId>log4j-core</artifactId> |
||||||
|
</dependency> |
||||||
|
<dependency> <!-- 桥接:告诉Slf4j使用Log4j2 --> |
||||||
|
<groupId>org.apache.logging.log4j</groupId> |
||||||
|
<artifactId>log4j-slf4j-impl</artifactId> |
||||||
|
</dependency> |
||||||
|
<dependency> |
||||||
|
<groupId>com.lmax</groupId> |
||||||
|
<artifactId>disruptor</artifactId> |
||||||
|
</dependency> |
||||||
|
</dependencies> |
||||||
|
|
||||||
|
<build> |
||||||
|
<plugins> |
||||||
|
<!-- maven 打包集成插件 --> |
||||||
|
<plugin> |
||||||
|
<groupId>org.apache.maven.plugins</groupId> |
||||||
|
<artifactId>maven-assembly-plugin</artifactId> |
||||||
|
<configuration> |
||||||
|
<finalName>${project.build.finalName}</finalName> |
||||||
|
<archive> |
||||||
|
<manifest> |
||||||
|
</manifest> |
||||||
|
</archive> |
||||||
|
<descriptorRefs> |
||||||
|
<descriptorRef>jar-with-dependencies</descriptorRef> |
||||||
|
</descriptorRefs> |
||||||
|
<appendAssemblyId>false</appendAssemblyId> |
||||||
|
</configuration> |
||||||
|
<executions> |
||||||
|
<execution> |
||||||
|
<id>make-assembly</id> |
||||||
|
<phase>package</phase> |
||||||
|
<goals> |
||||||
|
<goal>single</goal> |
||||||
|
</goals> |
||||||
|
</execution> |
||||||
|
</executions> |
||||||
|
</plugin> |
||||||
|
</plugins> |
||||||
|
</build> |
||||||
|
|
||||||
|
</project> |
||||||
Loading…
Reference in new issue