diff --git a/cim-boot-server/pom.xml b/cim-boot-server/pom.xml index 18657a4..591572b 100644 --- a/cim-boot-server/pom.xml +++ b/cim-boot-server/pom.xml @@ -6,7 +6,7 @@ com.farsunset cim-boot-server - 1.2.0 + 4.2.0 org.springframework.boot @@ -17,10 +17,10 @@ 1.8 - 4.1.70.Final - 3.19.2 - 8.0.22 - 2.8.0 + 4.1.79.Final + 3.21.5 + 8.0.30 + 2.11.1 3.0.0 @@ -132,7 +132,7 @@ commons-io commons-io - 2.7 + 2.11.0 diff --git a/cim-boot-server/run.bat b/cim-boot-server/run.bat index 826a9da..c3f3078 100644 --- a/cim-boot-server/run.bat +++ b/cim-boot-server/run.bat @@ -1 +1 @@ -java -Dcom.sun.akuma.Daemon=daemonized -Dspring.profiles.active=pro -jar ./cim-boot-server-4.0.0.jar \ No newline at end of file +java -Dcom.sun.akuma.Daemon=daemonized -Dspring.profiles.active=pro -jar ./cim-boot-server-4.2.0.jar \ No newline at end of file diff --git a/cim-boot-server/run.sh b/cim-boot-server/run.sh index 9c0e3ce..409113e 100755 --- a/cim-boot-server/run.sh +++ b/cim-boot-server/run.sh @@ -1,3 +1,3 @@ #! /bin/bash -java -Dcom.sun.akuma.Daemon=daemonized -Dspring.profiles.active=pro -jar ./cim-boot-server-4.0.0.jar & \ No newline at end of file +java -Dcom.sun.akuma.Daemon=daemonized -Dspring.profiles.active=pro -jar ./cim-boot-server-4.2.0.jar & \ No newline at end of file diff --git a/cim-boot-server/src/main/java/com/farsunset/cim/BootApplication.java b/cim-boot-server/src/main/java/com/farsunset/cim/BootApplication.java index 6c2dc67..5637805 100644 --- a/cim-boot-server/src/main/java/com/farsunset/cim/BootApplication.java +++ b/cim-boot-server/src/main/java/com/farsunset/cim/BootApplication.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2019 Xia Jun(3979434@qq.com). + * Copyright 2013-2022 Xia Jun(3979434@qq.com). * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cim-boot-server/src/main/java/com/farsunset/cim/component/event/MessageEvent.java b/cim-boot-server/src/main/java/com/farsunset/cim/component/event/MessageEvent.java new file mode 100644 index 0000000..7107f89 --- /dev/null +++ b/cim-boot-server/src/main/java/com/farsunset/cim/component/event/MessageEvent.java @@ -0,0 +1,37 @@ +/* + * Copyright 2013-2022 Xia Jun(3979434@qq.com). + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + *************************************************************************************** + * * + * Website : http://www.farsunset.com * + * * + *************************************************************************************** + */ +package com.farsunset.cim.component.event; + +import com.farsunset.cim.model.Message; +import org.springframework.context.ApplicationEvent; + +public class MessageEvent extends ApplicationEvent { + public MessageEvent(Message message) { + super(message); + } + + @Override + public Message getSource() { + return (Message) source; + } + +} diff --git a/cim-boot-server/src/main/java/com/farsunset/cim/component/event/SessionEvent.java b/cim-boot-server/src/main/java/com/farsunset/cim/component/event/SessionEvent.java new file mode 100644 index 0000000..e59eb69 --- /dev/null +++ b/cim-boot-server/src/main/java/com/farsunset/cim/component/event/SessionEvent.java @@ -0,0 +1,37 @@ +/* + * Copyright 2013-2022 Xia Jun(3979434@qq.com). + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + *************************************************************************************** + * * + * Website : http://www.farsunset.com * + * * + *************************************************************************************** + */ +package com.farsunset.cim.component.event; + +import com.farsunset.cim.entity.Session; +import org.springframework.context.ApplicationEvent; + +public class SessionEvent extends ApplicationEvent { + public SessionEvent(Session session) { + super(session); + } + + @Override + public Session getSource() { + return (Session) source; + } + +} diff --git a/cim-boot-server/src/main/java/com/farsunset/cim/component/handler/BindHandler.java b/cim-boot-server/src/main/java/com/farsunset/cim/component/handler/BindHandler.java index 9dd5b4c..b11ed40 100644 --- a/cim-boot-server/src/main/java/com/farsunset/cim/component/handler/BindHandler.java +++ b/cim-boot-server/src/main/java/com/farsunset/cim/component/handler/BindHandler.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2019 Xia Jun(3979434@qq.com). + * Copyright 2013-2022 Xia Jun(3979434@qq.com). * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -23,8 +23,8 @@ package com.farsunset.cim.component.handler; import com.farsunset.cim.component.handler.annotation.CIMHandler; import com.farsunset.cim.component.redis.SignalRedisTemplate; -import com.farsunset.cim.entity.Session; import com.farsunset.cim.constant.ChannelAttr; +import com.farsunset.cim.entity.Session; import com.farsunset.cim.group.SessionGroup; import com.farsunset.cim.handler.CIMRequestHandler; import com.farsunset.cim.model.ReplyBody; diff --git a/cim-boot-server/src/main/java/com/farsunset/cim/component/handler/ClosedHandler.java b/cim-boot-server/src/main/java/com/farsunset/cim/component/handler/ClosedHandler.java index 94100ff..5eda934 100644 --- a/cim-boot-server/src/main/java/com/farsunset/cim/component/handler/ClosedHandler.java +++ b/cim-boot-server/src/main/java/com/farsunset/cim/component/handler/ClosedHandler.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2019 Xia Jun(3979434@qq.com). + * Copyright 2013-2022 Xia Jun(3979434@qq.com). * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -22,8 +22,8 @@ package com.farsunset.cim.component.handler; import com.farsunset.cim.component.handler.annotation.CIMHandler; -import com.farsunset.cim.entity.Session; import com.farsunset.cim.constant.ChannelAttr; +import com.farsunset.cim.entity.Session; import com.farsunset.cim.group.SessionGroup; import com.farsunset.cim.handler.CIMRequestHandler; import com.farsunset.cim.model.SentBody; diff --git a/cim-boot-server/src/main/java/com/farsunset/cim/component/handler/annotation/CIMHandler.java b/cim-boot-server/src/main/java/com/farsunset/cim/component/handler/annotation/CIMHandler.java index e4227fc..d816259 100644 --- a/cim-boot-server/src/main/java/com/farsunset/cim/component/handler/annotation/CIMHandler.java +++ b/cim-boot-server/src/main/java/com/farsunset/cim/component/handler/annotation/CIMHandler.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2019 Xia Jun(3979434@qq.com). + * Copyright 2013-2022 Xia Jun(3979434@qq.com). * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cim-boot-server/src/main/java/com/farsunset/cim/component/message/BindMessageListener.java b/cim-boot-server/src/main/java/com/farsunset/cim/component/message/BindMessageListener.java index 2807edc..9b6818a 100644 --- a/cim-boot-server/src/main/java/com/farsunset/cim/component/message/BindMessageListener.java +++ b/cim-boot-server/src/main/java/com/farsunset/cim/component/message/BindMessageListener.java @@ -1,11 +1,34 @@ +/* + * Copyright 2013-2022 Xia Jun(3979434@qq.com). + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + *************************************************************************************** + * * + * Website : http://www.farsunset.com * + * * + *************************************************************************************** + */ package com.farsunset.cim.component.message; -import com.farsunset.cim.entity.Session; +import com.farsunset.cim.component.event.SessionEvent; import com.farsunset.cim.constant.ChannelAttr; +import com.farsunset.cim.entity.Session; import com.farsunset.cim.group.SessionGroup; import com.farsunset.cim.model.Message; import com.farsunset.cim.util.JSONUtils; import io.netty.channel.Channel; +import org.springframework.context.event.EventListener; import org.springframework.data.redis.connection.MessageListener; import org.springframework.stereotype.Component; @@ -43,10 +66,21 @@ public class BindMessageListener implements MessageListener { conflictMap.put(Session.CHANNEL_MAC,new String[]{Session.CHANNEL_WINDOWS,Session.CHANNEL_WEB,Session.CHANNEL_MAC}); } + @EventListener + public void onMessage(SessionEvent event) { + this.handle(event.getSource()); + } + @Override public void onMessage(org.springframework.data.redis.connection.Message redisMessage, byte[] bytes) { Session session = JSONUtils.fromJson(redisMessage.getBody(), Session.class); + + this.handle(session); + } + + private void handle(Session session) { + String uid = session.getUid(); String[] conflictChannels = conflictMap.get(session.getChannel()); diff --git a/cim-boot-server/src/main/java/com/farsunset/cim/component/message/PushMessageListener.java b/cim-boot-server/src/main/java/com/farsunset/cim/component/message/PushMessageListener.java index b036ad5..674d9e6 100644 --- a/cim-boot-server/src/main/java/com/farsunset/cim/component/message/PushMessageListener.java +++ b/cim-boot-server/src/main/java/com/farsunset/cim/component/message/PushMessageListener.java @@ -1,8 +1,31 @@ +/* + * Copyright 2013-2022 Xia Jun(3979434@qq.com). + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + *************************************************************************************** + * * + * Website : http://www.farsunset.com * + * * + *************************************************************************************** + */ package com.farsunset.cim.component.message; +import com.farsunset.cim.component.event.MessageEvent; import com.farsunset.cim.group.SessionGroup; import com.farsunset.cim.model.Message; import com.farsunset.cim.util.JSONUtils; +import org.springframework.context.event.EventListener; import org.springframework.data.redis.connection.MessageListener; import org.springframework.stereotype.Component; @@ -24,9 +47,19 @@ public class PushMessageListener implements MessageListener { Message message = JSONUtils.fromJson(redisMessage.getBody(), Message.class); + this.onMessage(message); + + } + + @EventListener + public void onMessage(MessageEvent event) { + this.onMessage(event.getSource()); + } + + public void onMessage(Message message) { + String uid = message.getReceiver(); sessionGroup.write(uid,message); - } } diff --git a/cim-boot-server/src/main/java/com/farsunset/cim/component/predicate/HandshakePredicate.java b/cim-boot-server/src/main/java/com/farsunset/cim/component/predicate/HandshakePredicate.java index 92b5563..f04e5d2 100644 --- a/cim-boot-server/src/main/java/com/farsunset/cim/component/predicate/HandshakePredicate.java +++ b/cim-boot-server/src/main/java/com/farsunset/cim/component/predicate/HandshakePredicate.java @@ -1,3 +1,24 @@ +/* + * Copyright 2013-2022 Xia Jun(3979434@qq.com). + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + *************************************************************************************** + * * + * Website : http://www.farsunset.com * + * * + *************************************************************************************** + */ package com.farsunset.cim.component.predicate; import com.farsunset.cim.handshake.HandshakeEvent; diff --git a/cim-boot-server/src/main/java/com/farsunset/cim/component/push/CIMMessagePusher.java b/cim-boot-server/src/main/java/com/farsunset/cim/component/push/CIMMessagePusher.java index 0355829..a5f558a 100644 --- a/cim-boot-server/src/main/java/com/farsunset/cim/component/push/CIMMessagePusher.java +++ b/cim-boot-server/src/main/java/com/farsunset/cim/component/push/CIMMessagePusher.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2019 Xia Jun(3979434@qq.com). + * Copyright 2013-2022 Xia Jun(3979434@qq.com). * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cim-boot-server/src/main/java/com/farsunset/cim/component/push/DefaultMessagePusher.java b/cim-boot-server/src/main/java/com/farsunset/cim/component/push/DefaultMessagePusher.java index 79281a6..84f2cd2 100644 --- a/cim-boot-server/src/main/java/com/farsunset/cim/component/push/DefaultMessagePusher.java +++ b/cim-boot-server/src/main/java/com/farsunset/cim/component/push/DefaultMessagePusher.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2019 Xia Jun(3979434@qq.com). + * Copyright 2013-2022 Xia Jun(3979434@qq.com). * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cim-boot-server/src/main/java/com/farsunset/cim/component/redis/KeyValueRedisTemplate.java b/cim-boot-server/src/main/java/com/farsunset/cim/component/redis/KeyValueRedisTemplate.java index 777e3e2..ea85be2 100644 --- a/cim-boot-server/src/main/java/com/farsunset/cim/component/redis/KeyValueRedisTemplate.java +++ b/cim-boot-server/src/main/java/com/farsunset/cim/component/redis/KeyValueRedisTemplate.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2019 Xia Jun(3979434@qq.com). + * Copyright 2013-2022 Xia Jun(3979434@qq.com). * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cim-boot-server/src/main/java/com/farsunset/cim/component/redis/SignalRedisTemplate.java b/cim-boot-server/src/main/java/com/farsunset/cim/component/redis/SignalRedisTemplate.java index e2d2db3..9eae26f 100644 --- a/cim-boot-server/src/main/java/com/farsunset/cim/component/redis/SignalRedisTemplate.java +++ b/cim-boot-server/src/main/java/com/farsunset/cim/component/redis/SignalRedisTemplate.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2019 Xia Jun(3979434@qq.com). + * Copyright 2013-2022 Xia Jun(3979434@qq.com). * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,17 +21,31 @@ */ package com.farsunset.cim.component.redis; +import com.farsunset.cim.component.event.MessageEvent; +import com.farsunset.cim.component.event.SessionEvent; import com.farsunset.cim.constants.Constants; import com.farsunset.cim.entity.Session; import com.farsunset.cim.model.Message; import com.farsunset.cim.util.JSONUtils; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.context.ApplicationContext; import org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory; import org.springframework.data.redis.core.StringRedisTemplate; import org.springframework.stereotype.Component; +import javax.annotation.Resource; +import java.util.Objects; + @Component public class SignalRedisTemplate extends StringRedisTemplate { + @Value("${spring.profiles.active}") + private String env; + + @Resource + private ApplicationContext applicationContext; + + public SignalRedisTemplate(LettuceConnectionFactory connectionFactory) { super(connectionFactory); connectionFactory.setValidateConnection(true); @@ -42,6 +56,10 @@ public class SignalRedisTemplate extends StringRedisTemplate { * @param message */ public void push(Message message) { + if (isDev()){ + applicationContext.publishEvent(new MessageEvent(message)); + return; + } super.convertAndSend(Constants.PUSH_MESSAGE_INNER_QUEUE, JSONUtils.toJSONString(message)); } @@ -50,6 +68,19 @@ public class SignalRedisTemplate extends StringRedisTemplate { * @param session */ public void bind(Session session) { + if (isDev()){ + applicationContext.publishEvent(new SessionEvent(session)); + return; + } super.convertAndSend(Constants.BIND_MESSAGE_INNER_QUEUE, JSONUtils.toJSONString(session)); } + + /** + * 本地调试环境下不走redis,避免lettuce 经常command timeout。 + * @return + */ + private boolean isDev(){ + return Objects.equals(env,"dev"); + } + } diff --git a/cim-boot-server/src/main/java/com/farsunset/cim/config/CIMConfig.java b/cim-boot-server/src/main/java/com/farsunset/cim/config/CIMConfig.java index bb05762..1901820 100644 --- a/cim-boot-server/src/main/java/com/farsunset/cim/config/CIMConfig.java +++ b/cim-boot-server/src/main/java/com/farsunset/cim/config/CIMConfig.java @@ -1,3 +1,24 @@ +/* + * Copyright 2013-2022 Xia Jun(3979434@qq.com). + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + *************************************************************************************** + * * + * Website : http://www.farsunset.com * + * * + *************************************************************************************** + */ package com.farsunset.cim.config; import com.farsunset.cim.acceptor.AppSocketAcceptor; diff --git a/cim-boot-server/src/main/java/com/farsunset/cim/config/RedisConfig.java b/cim-boot-server/src/main/java/com/farsunset/cim/config/RedisConfig.java index cd790a7..db2dd69 100644 --- a/cim-boot-server/src/main/java/com/farsunset/cim/config/RedisConfig.java +++ b/cim-boot-server/src/main/java/com/farsunset/cim/config/RedisConfig.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2019 Xia Jun(3979434@qq.com). + * Copyright 2013-2022 Xia Jun(3979434@qq.com). * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cim-boot-server/src/main/java/com/farsunset/cim/config/SwaggerConfig.java b/cim-boot-server/src/main/java/com/farsunset/cim/config/SwaggerConfig.java index 3dc7eab..ef5dbd4 100644 --- a/cim-boot-server/src/main/java/com/farsunset/cim/config/SwaggerConfig.java +++ b/cim-boot-server/src/main/java/com/farsunset/cim/config/SwaggerConfig.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2019 Xia Jun(3979434@qq.com). + * Copyright 2013-2022 Xia Jun(3979434@qq.com). * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cim-boot-server/src/main/java/com/farsunset/cim/config/properties/APNsProperties.java b/cim-boot-server/src/main/java/com/farsunset/cim/config/properties/APNsProperties.java index c7bdeac..4a4a9be 100644 --- a/cim-boot-server/src/main/java/com/farsunset/cim/config/properties/APNsProperties.java +++ b/cim-boot-server/src/main/java/com/farsunset/cim/config/properties/APNsProperties.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2019 Xia Jun(3979434@qq.com). + * Copyright 2013-2022 Xia Jun(3979434@qq.com). * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cim-boot-server/src/main/java/com/farsunset/cim/config/properties/CIMAppSocketProperties.java b/cim-boot-server/src/main/java/com/farsunset/cim/config/properties/CIMAppSocketProperties.java index cd5cede..0b2227c 100644 --- a/cim-boot-server/src/main/java/com/farsunset/cim/config/properties/CIMAppSocketProperties.java +++ b/cim-boot-server/src/main/java/com/farsunset/cim/config/properties/CIMAppSocketProperties.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2019 Xia Jun(3979434@qq.com). + * Copyright 2013-2022 Xia Jun(3979434@qq.com). * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cim-boot-server/src/main/java/com/farsunset/cim/config/properties/CIMWebsocketProperties.java b/cim-boot-server/src/main/java/com/farsunset/cim/config/properties/CIMWebsocketProperties.java index 36f2c54..4f4d2ae 100644 --- a/cim-boot-server/src/main/java/com/farsunset/cim/config/properties/CIMWebsocketProperties.java +++ b/cim-boot-server/src/main/java/com/farsunset/cim/config/properties/CIMWebsocketProperties.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2019 Xia Jun(3979434@qq.com). + * Copyright 2013-2022 Xia Jun(3979434@qq.com). * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cim-boot-server/src/main/java/com/farsunset/cim/constants/Constants.java b/cim-boot-server/src/main/java/com/farsunset/cim/constants/Constants.java index 9d4b120..fd48eec 100644 --- a/cim-boot-server/src/main/java/com/farsunset/cim/constants/Constants.java +++ b/cim-boot-server/src/main/java/com/farsunset/cim/constants/Constants.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2019 Xia Jun(3979434@qq.com). + * Copyright 2013-2022 Xia Jun(3979434@qq.com). * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cim-boot-server/src/main/java/com/farsunset/cim/entity/Session.java b/cim-boot-server/src/main/java/com/farsunset/cim/entity/Session.java index ed09032..8cee6d1 100644 --- a/cim-boot-server/src/main/java/com/farsunset/cim/entity/Session.java +++ b/cim-boot-server/src/main/java/com/farsunset/cim/entity/Session.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2019 Xia Jun(3979434@qq.com). + * Copyright 2013-2022 Xia Jun(3979434@qq.com). * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -23,22 +23,20 @@ package com.farsunset.cim.entity; import javax.persistence.*; -import java.io.Serializable; @Entity @Table(name = "t_hoxin_session") -public class Session implements Serializable { +public class Session{ - private static final transient long serialVersionUID = 1L; - public static final transient int STATE_ACTIVE = 0; - public static final transient int STATE_APNS = 1; - public static final transient int STATE_INACTIVE = 2; + public static final int STATE_ACTIVE = 0; + public static final int STATE_APNS = 1; + public static final int STATE_INACTIVE = 2; - public static final transient String CHANNEL_IOS = "ios"; - public static final transient String CHANNEL_ANDROID = "android"; - public static final transient String CHANNEL_WINDOWS = "windows"; - public static final transient String CHANNEL_MAC = "mac"; - public static final transient String CHANNEL_WEB = "web"; + public static final String CHANNEL_IOS = "ios"; + public static final String CHANNEL_ANDROID = "android"; + public static final String CHANNEL_WINDOWS = "windows"; + public static final String CHANNEL_MAC = "mac"; + public static final String CHANNEL_WEB = "web"; /** * 数据库主键ID diff --git a/cim-boot-server/src/main/java/com/farsunset/cim/mvc/controller/admin/NavigationController.java b/cim-boot-server/src/main/java/com/farsunset/cim/mvc/controller/admin/NavigationController.java index b530c8e..b776617 100644 --- a/cim-boot-server/src/main/java/com/farsunset/cim/mvc/controller/admin/NavigationController.java +++ b/cim-boot-server/src/main/java/com/farsunset/cim/mvc/controller/admin/NavigationController.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2019 Xia Jun(3979434@qq.com). + * Copyright 2013-2022 Xia Jun(3979434@qq.com). * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -23,8 +23,6 @@ package com.farsunset.cim.mvc.controller.admin; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.servlet.ModelAndView; @Controller diff --git a/cim-boot-server/src/main/java/com/farsunset/cim/mvc/controller/admin/SessionController.java b/cim-boot-server/src/main/java/com/farsunset/cim/mvc/controller/admin/SessionController.java index e1b356b..780e919 100644 --- a/cim-boot-server/src/main/java/com/farsunset/cim/mvc/controller/admin/SessionController.java +++ b/cim-boot-server/src/main/java/com/farsunset/cim/mvc/controller/admin/SessionController.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2019 Xia Jun(3979434@qq.com). + * Copyright 2013-2022 Xia Jun(3979434@qq.com). * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cim-boot-server/src/main/java/com/farsunset/cim/mvc/controller/api/APNsController.java b/cim-boot-server/src/main/java/com/farsunset/cim/mvc/controller/api/APNsController.java index 66de2da..cf4cc18 100644 --- a/cim-boot-server/src/main/java/com/farsunset/cim/mvc/controller/api/APNsController.java +++ b/cim-boot-server/src/main/java/com/farsunset/cim/mvc/controller/api/APNsController.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2019 Xia Jun(3979434@qq.com). + * Copyright 2013-2022 Xia Jun(3979434@qq.com). * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cim-boot-server/src/main/java/com/farsunset/cim/mvc/controller/api/MessageController.java b/cim-boot-server/src/main/java/com/farsunset/cim/mvc/controller/api/MessageController.java index c646472..6c9a0ea 100644 --- a/cim-boot-server/src/main/java/com/farsunset/cim/mvc/controller/api/MessageController.java +++ b/cim-boot-server/src/main/java/com/farsunset/cim/mvc/controller/api/MessageController.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2019 Xia Jun(3979434@qq.com). + * Copyright 2013-2022 Xia Jun(3979434@qq.com). * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cim-boot-server/src/main/java/com/farsunset/cim/repository/SessionRepository.java b/cim-boot-server/src/main/java/com/farsunset/cim/repository/SessionRepository.java index c76de8d..71b43f8 100644 --- a/cim-boot-server/src/main/java/com/farsunset/cim/repository/SessionRepository.java +++ b/cim-boot-server/src/main/java/com/farsunset/cim/repository/SessionRepository.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2019 Xia Jun(3979434@qq.com). + * Copyright 2013-2022 Xia Jun(3979434@qq.com). * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cim-boot-server/src/main/java/com/farsunset/cim/service/APNsService.java b/cim-boot-server/src/main/java/com/farsunset/cim/service/APNsService.java index c16ce55..7c3b9a2 100644 --- a/cim-boot-server/src/main/java/com/farsunset/cim/service/APNsService.java +++ b/cim-boot-server/src/main/java/com/farsunset/cim/service/APNsService.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2019 Xia Jun(3979434@qq.com). + * Copyright 2013-2022 Xia Jun(3979434@qq.com). * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cim-boot-server/src/main/java/com/farsunset/cim/service/SessionService.java b/cim-boot-server/src/main/java/com/farsunset/cim/service/SessionService.java index 7e74231..44d484d 100644 --- a/cim-boot-server/src/main/java/com/farsunset/cim/service/SessionService.java +++ b/cim-boot-server/src/main/java/com/farsunset/cim/service/SessionService.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2019 Xia Jun(3979434@qq.com). + * Copyright 2013-2022 Xia Jun(3979434@qq.com). * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cim-boot-server/src/main/java/com/farsunset/cim/service/impl/APNsServiceImpl.java b/cim-boot-server/src/main/java/com/farsunset/cim/service/impl/APNsServiceImpl.java index b7888d3..69298bb 100644 --- a/cim-boot-server/src/main/java/com/farsunset/cim/service/impl/APNsServiceImpl.java +++ b/cim-boot-server/src/main/java/com/farsunset/cim/service/impl/APNsServiceImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2019 Xia Jun(3979434@qq.com). + * Copyright 2013-2022 Xia Jun(3979434@qq.com). * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cim-boot-server/src/main/java/com/farsunset/cim/service/impl/SessionServiceImpl.java b/cim-boot-server/src/main/java/com/farsunset/cim/service/impl/SessionServiceImpl.java index 3ddf8da..d9190e7 100644 --- a/cim-boot-server/src/main/java/com/farsunset/cim/service/impl/SessionServiceImpl.java +++ b/cim-boot-server/src/main/java/com/farsunset/cim/service/impl/SessionServiceImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2019 Xia Jun(3979434@qq.com). + * Copyright 2013-2022 Xia Jun(3979434@qq.com). * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cim-boot-server/src/main/java/com/farsunset/cim/util/JSONUtils.java b/cim-boot-server/src/main/java/com/farsunset/cim/util/JSONUtils.java index e53a101..2274065 100644 --- a/cim-boot-server/src/main/java/com/farsunset/cim/util/JSONUtils.java +++ b/cim-boot-server/src/main/java/com/farsunset/cim/util/JSONUtils.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2019 Xia Jun(3979434@qq.com). + * Copyright 2013-2022 Xia Jun(3979434@qq.com). * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/cim-boot-server/src/main/resources/application.properties b/cim-boot-server/src/main/resources/application.properties index 2dc9e9c..b1a3ef4 100644 --- a/cim-boot-server/src/main/resources/application.properties +++ b/cim-boot-server/src/main/resources/application.properties @@ -1,6 +1,10 @@ server.port=8080 + +#单台服务器可设置为dev,广播消息走本地消息事件(参见SignalRedisTemplate.java) +#多台服务器集群环境设置为prd,广播消息走三方消息队列 spring.profiles.active=dev + ################################################################## # JDBC Config # ##################################################################