Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
MaxKey单点登录官方(MaxKeyTop)
MaxKey
提交
090f4c9c
MaxKey
项目概览
MaxKey单点登录官方(MaxKeyTop)
/
MaxKey
大约 1 年 前同步成功
通知
76
Star
3
Fork
1
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
MaxKey
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
090f4c9c
编写于
2月 23, 2022
作者:
M
MaxKey
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
message queue support none, Kafka ,RocketMQ
none, Kafka ,RocketMQ
上级
c9317e4a
变更
18
展开全部
隐藏空白更改
内联
并排
Showing
18 changed file
with
1121 addition
and
962 deletion
+1121
-962
build.gradle
build.gradle
+222
-211
config/build_docker.gradle
config/build_docker.gradle
+220
-209
config/build_jar.gradle
config/build_jar.gradle
+220
-209
config/build_standard.gradle
config/build_standard.gradle
+220
-209
gradle.properties
gradle.properties
+3
-0
maxkey-core/src/main/java/org/maxkey/configuration/ApplicationConfig.java
...main/java/org/maxkey/configuration/ApplicationConfig.java
+19
-11
maxkey-persistence/src/main/java/org/maxkey/persistence/mq/MqIdentityAction.java
...main/java/org/maxkey/persistence/mq/MqIdentityAction.java
+2
-2
maxkey-persistence/src/main/java/org/maxkey/persistence/mq/MqIdentityTopic.java
.../main/java/org/maxkey/persistence/mq/MqIdentityTopic.java
+2
-2
maxkey-persistence/src/main/java/org/maxkey/persistence/mq/MqMessage.java
...ce/src/main/java/org/maxkey/persistence/mq/MqMessage.java
+13
-13
maxkey-persistence/src/main/java/org/maxkey/persistence/mq/MqPersistService.java
...main/java/org/maxkey/persistence/mq/MqPersistService.java
+25
-43
maxkey-persistence/src/main/java/org/maxkey/persistence/mq/thread/KafkaProvisioningThread.java
...maxkey/persistence/mq/thread/KafkaProvisioningThread.java
+52
-0
maxkey-persistence/src/main/java/org/maxkey/persistence/mq/thread/RocketMQProvisioningThread.java
...key/persistence/mq/thread/RocketMQProvisioningThread.java
+54
-0
maxkey-persistence/src/main/java/org/maxkey/persistence/service/AccountsService.java
.../java/org/maxkey/persistence/service/AccountsService.java
+16
-16
maxkey-persistence/src/main/java/org/maxkey/persistence/service/OrganizationsService.java
.../org/maxkey/persistence/service/OrganizationsService.java
+10
-10
maxkey-persistence/src/main/java/org/maxkey/persistence/service/UserInfoService.java
.../java/org/maxkey/persistence/service/UserInfoService.java
+19
-19
maxkey-webs/maxkey-web-maxkey/src/main/resources/application-http.properties
...web-maxkey/src/main/resources/application-http.properties
+8
-3
maxkey-webs/maxkey-web-maxkey/src/main/resources/application-https.properties
...eb-maxkey/src/main/resources/application-https.properties
+8
-3
maxkey-webs/maxkey-web-mgt/src/main/resources/application-http.properties
...ey-web-mgt/src/main/resources/application-http.properties
+8
-2
未找到文件。
build.gradle
浏览文件 @
090f4c9c
此差异已折叠。
点击以展开。
config/build_docker.gradle
浏览文件 @
090f4c9c
此差异已折叠。
点击以展开。
config/build_jar.gradle
浏览文件 @
090f4c9c
此差异已折叠。
点击以展开。
config/build_standard.gradle
浏览文件 @
090f4c9c
此差异已折叠。
点击以展开。
gradle.properties
浏览文件 @
090f4c9c
...
...
@@ -30,6 +30,7 @@ commonspool2Version =2.11.1
commonshttpclientVersion
=
3.1
commonsfileuploadVersion
=
1.4
commonsemailVersion
=
1.5
commonsvalidatorVersion
=
1.7
httpcomponentsVersion
=
4.5.13
httpcoreVersion
=
4.4.14
httpasyncclientVersion
=
4.1.4
...
...
@@ -40,6 +41,8 @@ xmlbeansVersion =5.0.2
commonscompressVersion
=
1.20
log4jVersion
=
2.17.1
kafkaclientsVersion
=
2.8.1
rocketmqclientVersion
=
4.9.2
rocketmqspringbootVersion
=
2.2.1
poiVersion
=
5.1.0
tomcatVersion
=
9.0.58
tomcatembedloggingjuliVersion
=
8.5.2
...
...
maxkey-core/src/main/java/org/maxkey/configuration/ApplicationConfig.java
浏览文件 @
090f4c9c
...
...
@@ -17,6 +17,7 @@
package
org.maxkey.configuration
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.context.annotation.Configuration
;
...
...
@@ -72,8 +73,8 @@ public class ApplicationConfig {
@Value
(
"${server.servlet.session.timeout:1800}"
)
private
int
sessionTimeout
;
@Value
(
"${maxkey.server.
kafka.support:fals
e}"
)
private
boolean
kafkaSupport
;
@Value
(
"${maxkey.server.
message.queue:non
e}"
)
private
String
messageQueue
;
@Value
(
"${maxkey.notices.visible:false}"
)
private
boolean
noticesVisible
;
...
...
@@ -178,15 +179,22 @@ public class ApplicationConfig {
this
.
defaultUri
=
defaultUri
;
}
public
boolean
isKafkaSupport
()
{
return
kafkaSupport
;
}
public
void
setKafkaSupport
(
boolean
kafkaSupport
)
{
this
.
kafkaSupport
=
kafkaSupport
;
}
public
String
getMessageQueue
()
{
return
messageQueue
;
}
public
boolean
isMessageQueueSupport
()
{
if
(
StringUtils
.
isBlank
(
messageQueue
)||
messageQueue
.
equalsIgnoreCase
(
"none"
))
{
return
false
;
}
return
true
;
}
public
void
setMessageQueue
(
String
messageQueue
)
{
this
.
messageQueue
=
messageQueue
;
}
public
String
getMgtUri
()
{
public
String
getMgtUri
()
{
return
mgtUri
;
}
...
...
@@ -242,7 +250,7 @@ public class ApplicationConfig {
builder
.
append
(
", port="
);
builder
.
append
(
port
);
builder
.
append
(
", kafkaSupport="
);
builder
.
append
(
kafkaSupport
);
builder
.
append
(
messageQueue
);
builder
.
append
(
", maxKeyUri="
);
builder
.
append
(
authzUri
);
builder
.
append
(
"]"
);
...
...
maxkey-persistence/src/main/java/org/maxkey/persistence/
kafka/Kafka
IdentityAction.java
→
maxkey-persistence/src/main/java/org/maxkey/persistence/
mq/Mq
IdentityAction.java
浏览文件 @
090f4c9c
...
...
@@ -15,9 +15,9 @@
*/
package
org.maxkey.persistence.
kafka
;
package
org.maxkey.persistence.
mq
;
public
class
Kafka
IdentityAction
{
public
class
Mq
IdentityAction
{
public
static
String
CREATE_ACTION
=
"CREATE_ACTION"
;
...
...
maxkey-persistence/src/main/java/org/maxkey/persistence/
kafka/Kafka
IdentityTopic.java
→
maxkey-persistence/src/main/java/org/maxkey/persistence/
mq/Mq
IdentityTopic.java
浏览文件 @
090f4c9c
...
...
@@ -15,9 +15,9 @@
*/
package
org.maxkey.persistence.
kafka
;
package
org.maxkey.persistence.
mq
;
public
class
Kafka
IdentityTopic
{
public
class
Mq
IdentityTopic
{
public
final
static
String
USERINFO_TOPIC
=
"MXK_IDENTITY_USERINFO_TOPIC"
;
...
...
maxkey-persistence/src/main/java/org/maxkey/persistence/
kafka/Kafka
Message.java
→
maxkey-persistence/src/main/java/org/maxkey/persistence/
mq/Mq
Message.java
浏览文件 @
090f4c9c
...
...
@@ -15,14 +15,14 @@
*/
package
org.maxkey.persistence.
kafka
;
package
org.maxkey.persistence.
mq
;
public
class
Kafka
Message
{
public
class
Mq
Message
{
String
id
;
String
topic
;
String
actionType
;
String
sendTime
;
String
msgId
;
Object
content
;
public
String
getTopic
()
{
...
...
@@ -49,15 +49,15 @@ public class KafkaMessage {
this
.
sendTime
=
sendTime
;
}
public
String
get
Msg
Id
()
{
return
msgI
d
;
}
public
String
getId
()
{
return
i
d
;
}
public
void
setMsgId
(
String
msgI
d
)
{
this
.
msgId
=
msgI
d
;
}
public
void
setId
(
String
i
d
)
{
this
.
id
=
i
d
;
}
public
Object
getContent
()
{
public
Object
getContent
()
{
return
content
;
}
...
...
@@ -65,15 +65,15 @@ public class KafkaMessage {
this
.
content
=
content
;
}
public
Kafka
Message
()
{
public
Mq
Message
()
{
}
public
KafkaMessage
(
String
topic
,
String
actionType
,
String
sendTime
,
String
msgId
,
Object
content
)
{
public
MqMessage
(
String
id
,
String
topic
,
String
actionType
,
String
sendTime
,
Object
content
)
{
super
();
this
.
id
=
id
;
this
.
topic
=
topic
;
this
.
actionType
=
actionType
;
this
.
sendTime
=
sendTime
;
this
.
msgId
=
msgId
;
this
.
content
=
content
;
}
...
...
maxkey-persistence/src/main/java/org/maxkey/persistence/
kafka/Kafka
PersistService.java
→
maxkey-persistence/src/main/java/org/maxkey/persistence/
mq/Mq
PersistService.java
浏览文件 @
090f4c9c
...
...
@@ -15,12 +15,14 @@
*/
package
org.maxkey.persistence.
kafka
;
package
org.maxkey.persistence.
mq
;
import
java.util.UUID
;
import
org.apache.rocketmq.spring.core.RocketMQTemplate
;
import
org.maxkey.configuration.ApplicationConfig
;
import
org.maxkey.pretty.PrettyFactory
;
import
org.maxkey.persistence.mq.thread.KafkaProvisioningThread
;
import
org.maxkey.persistence.mq.thread.RocketMQProvisioningThread
;
import
org.maxkey.util.DateUtils
;
import
org.maxkey.util.JsonUtils
;
import
org.slf4j.Logger
;
...
...
@@ -30,14 +32,17 @@ import org.springframework.kafka.core.KafkaTemplate;
import
org.springframework.stereotype.Component
;
@Component
public
class
Kafka
PersistService
{
private
static
final
Logger
_logger
=
LoggerFactory
.
getLogger
(
Kafka
PersistService
.
class
);
public
class
Mq
PersistService
{
private
static
final
Logger
_logger
=
LoggerFactory
.
getLogger
(
Mq
PersistService
.
class
);
@Autowired
protected
ApplicationConfig
applicationConfig
;
@Autowired
protected
KafkaTemplate
<
String
,
String
>
kafkaTemplate
;
@Autowired
private
RocketMQTemplate
rocketMQTemplate
;
public
void
setApplicationConfig
(
ApplicationConfig
applicationConfig
)
{
this
.
applicationConfig
=
applicationConfig
;
...
...
@@ -58,50 +63,27 @@ public class KafkaPersistService {
* @param actionType CREATE UPDATE DELETE
*/
public
void
send
(
String
topic
,
Object
content
,
String
actionType
)
{
//maxkey.server.kafka.support , if true
if
(
applicationConfig
.
isKafkaSupport
())
{
KafkaMessage
message
=
new
KafkaMessage
(
topic
,
//kafka TOPIC
actionType
,
//action of content
DateUtils
.
getCurrentDateTimeAsString
(),
//send to kafka time
//maxkey.server.message.queue , if not none , Kafka , RocketMQ
if
(
applicationConfig
.
isMessageQueueSupport
())
{
MqMessage
message
=
new
MqMessage
(
UUID
.
randomUUID
().
toString
(),
//message id as uuid
topic
,
//TOPIC
actionType
,
//action of content
DateUtils
.
getCurrentDateTimeAsString
(),
//send time
content
//content Object to json message content
);
String
msg
=
JsonUtils
.
gson2Json
(
message
);
//sand msg to Kafka topic
KafkaProvisioningThread
thread
=
new
KafkaProvisioningThread
(
kafkaTemplate
,
topic
,
msg
);
//sand msg to MQ topic
Thread
thread
=
null
;
if
(
applicationConfig
.
getMessageQueue
().
equalsIgnoreCase
(
"Kafka"
))
{
_logger
.
trace
(
"Kafka message..."
);
thread
=
new
KafkaProvisioningThread
(
kafkaTemplate
,
topic
,
msg
);
}
else
if
(
applicationConfig
.
getMessageQueue
().
equalsIgnoreCase
(
"RocketMQ"
))
{
_logger
.
trace
(
"RocketMQ message..."
);
thread
=
new
RocketMQProvisioningThread
(
rocketMQTemplate
,
topic
,
msg
);
}
thread
.
start
();
}
}
/**
* KafkaProvisioningThread for send message
*
*/
class
KafkaProvisioningThread
extends
Thread
{
KafkaTemplate
<
String
,
String
>
kafkaTemplate
;
String
topic
;
String
msg
;
public
KafkaProvisioningThread
(
KafkaTemplate
<
String
,
String
>
kafkaTemplate
,
String
topic
,
String
msg
)
{
this
.
kafkaTemplate
=
kafkaTemplate
;
this
.
topic
=
topic
;
this
.
msg
=
msg
;
}
@Override
public
void
run
()
{
_logger
.
debug
(
"send message \n{}"
,
PrettyFactory
.
getJsonPretty
().
format
(
msg
));
kafkaTemplate
.
send
(
topic
,
msg
);
_logger
.
debug
(
"send to Message Queue finished ."
);
}
}
}
maxkey-persistence/src/main/java/org/maxkey/persistence/mq/thread/KafkaProvisioningThread.java
0 → 100644
浏览文件 @
090f4c9c
/*
* Copyright [2022] [MaxKey of copyright http://www.maxkey.top]
*
* 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.
*/
package
org.maxkey.persistence.mq.thread
;
import
org.maxkey.pretty.PrettyFactory
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.kafka.core.KafkaTemplate
;
/**
* Kafka Provisioning Thread for send message
*
*/
public
class
KafkaProvisioningThread
extends
Thread
{
private
static
final
Logger
_logger
=
LoggerFactory
.
getLogger
(
KafkaProvisioningThread
.
class
);
KafkaTemplate
<
String
,
String
>
kafkaTemplate
;
String
topic
;
String
msg
;
public
KafkaProvisioningThread
(
KafkaTemplate
<
String
,
String
>
kafkaTemplate
,
String
topic
,
String
msg
)
{
this
.
kafkaTemplate
=
kafkaTemplate
;
this
.
topic
=
topic
;
this
.
msg
=
msg
;
}
@Override
public
void
run
()
{
_logger
.
debug
(
"send message \n{}"
,
PrettyFactory
.
getJsonPretty
().
format
(
msg
));
kafkaTemplate
.
send
(
topic
,
msg
);
_logger
.
debug
(
"send to Message Queue finished ."
);
}
}
maxkey-persistence/src/main/java/org/maxkey/persistence/mq/thread/RocketMQProvisioningThread.java
0 → 100644
浏览文件 @
090f4c9c
/*
* Copyright [2022] [MaxKey of copyright http://www.maxkey.top]
*
* 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.
*/
package
org.maxkey.persistence.mq.thread
;
import
org.apache.rocketmq.spring.core.RocketMQTemplate
;
import
org.maxkey.pretty.PrettyFactory
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.messaging.support.MessageBuilder
;
/**
* RocketMQ Provisioning Thread for send message
*
*/
public
class
RocketMQProvisioningThread
extends
Thread
{
private
static
final
Logger
_logger
=
LoggerFactory
.
getLogger
(
RocketMQProvisioningThread
.
class
);
RocketMQTemplate
rocketMQTemplate
;
String
topic
;
String
msg
;
public
RocketMQProvisioningThread
(
RocketMQTemplate
rocketMQTemplate
,
String
topic
,
String
msg
)
{
this
.
rocketMQTemplate
=
rocketMQTemplate
;
this
.
topic
=
topic
;
this
.
msg
=
msg
;
}
@Override
public
void
run
()
{
_logger
.
debug
(
"send message \n{}"
,
PrettyFactory
.
getJsonPretty
().
format
(
msg
));
rocketMQTemplate
.
syncSend
(
topic
,
MessageBuilder
.
withPayload
(
msg
).
build
());
_logger
.
debug
(
"send to Message Queue finished ."
);
}
}
\ No newline at end of file
maxkey-persistence/src/main/java/org/maxkey/persistence/service/AccountsService.java
浏览文件 @
090f4c9c
...
...
@@ -26,10 +26,10 @@ import org.maxkey.entity.Accounts;
import
org.maxkey.entity.AccountsStrategy
;
import
org.maxkey.entity.OrganizationsCast
;
import
org.maxkey.entity.UserInfo
;
import
org.maxkey.persistence.kafka.KafkaIdentityAction
;
import
org.maxkey.persistence.kafka.KafkaIdentityTopic
;
import
org.maxkey.persistence.kafka.KafkaPersistService
;
import
org.maxkey.persistence.mapper.AccountsMapper
;
import
org.maxkey.persistence.mq.MqIdentityAction
;
import
org.maxkey.persistence.mq.MqIdentityTopic
;
import
org.maxkey.persistence.mq.MqPersistService
;
import
org.maxkey.util.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Repository
;
...
...
@@ -45,7 +45,7 @@ import net.sourceforge.pinyin4j.format.exception.BadHanyuPinyinOutputFormatCombi
public
class
AccountsService
extends
JpaBaseService
<
Accounts
>{
@Autowired
KafkaPersistService
kafka
PersistService
;
MqPersistService
mq
PersistService
;
@Autowired
UserInfoService
userInfoService
;
...
...
@@ -71,17 +71,17 @@ public class AccountsService extends JpaBaseService<Accounts>{
public
boolean
insert
(
Accounts
account
)
{
if
(
super
.
insert
(
account
))
{
if
(
kafkaPersistService
.
getApplicationConfig
().
isKafka
Support
())
{
if
(
mqPersistService
.
getApplicationConfig
().
isMessageQueue
Support
())
{
UserInfo
loadUserInfo
=
userInfoService
.
findUserRelated
(
account
.
getUserId
());
account
.
setUserInfo
(
loadUserInfo
);
OrganizationsCast
cast
=
new
OrganizationsCast
();
cast
.
setProvider
(
account
.
getAppId
());
cast
.
setOrgId
(
loadUserInfo
.
getDepartmentId
());
account
.
setOrgCast
(
organizationsCastService
.
query
(
cast
));
kafka
PersistService
.
send
(
Kafka
IdentityTopic
.
ACCOUNT_TOPIC
,
mq
PersistService
.
send
(
Mq
IdentityTopic
.
ACCOUNT_TOPIC
,
account
,
Kafka
IdentityAction
.
CREATE_ACTION
);
Mq
IdentityAction
.
CREATE_ACTION
);
}
return
true
;
...
...
@@ -91,17 +91,17 @@ public class AccountsService extends JpaBaseService<Accounts>{
public
boolean
update
(
Accounts
account
)
{
if
(
super
.
update
(
account
))
{
if
(
kafkaPersistService
.
getApplicationConfig
().
isKafka
Support
())
{
if
(
mqPersistService
.
getApplicationConfig
().
isMessageQueue
Support
())
{
UserInfo
loadUserInfo
=
userInfoService
.
findUserRelated
(
account
.
getUserId
());
account
.
setUserInfo
(
loadUserInfo
);
OrganizationsCast
cast
=
new
OrganizationsCast
();
cast
.
setProvider
(
account
.
getAppId
());
cast
.
setOrgId
(
loadUserInfo
.
getDepartmentId
());
account
.
setOrgCast
(
organizationsCastService
.
query
(
cast
));
kafka
PersistService
.
send
(
Kafka
IdentityTopic
.
ACCOUNT_TOPIC
,
mq
PersistService
.
send
(
Mq
IdentityTopic
.
ACCOUNT_TOPIC
,
account
,
Kafka
IdentityAction
.
UPDATE_ACTION
);
Mq
IdentityAction
.
UPDATE_ACTION
);
}
return
true
;
...
...
@@ -113,13 +113,13 @@ public class AccountsService extends JpaBaseService<Accounts>{
Accounts
account
=
this
.
get
(
id
);
if
(
super
.
remove
(
id
))
{
UserInfo
loadUserInfo
=
null
;
if
(
kafkaPersistService
.
getApplicationConfig
().
isKafka
Support
())
{
if
(
mqPersistService
.
getApplicationConfig
().
isMessageQueue
Support
())
{
loadUserInfo
=
userInfoService
.
findUserRelated
(
account
.
getUserId
());
account
.
setUserInfo
(
loadUserInfo
);
kafka
PersistService
.
send
(
Kafka
IdentityTopic
.
ACCOUNT_TOPIC
,
mq
PersistService
.
send
(
Mq
IdentityTopic
.
ACCOUNT_TOPIC
,
account
,
Kafka
IdentityAction
.
DELETE_ACTION
);
Mq
IdentityAction
.
DELETE_ACTION
);
}
return
true
;
...
...
maxkey-persistence/src/main/java/org/maxkey/persistence/service/OrganizationsService.java
浏览文件 @
090f4c9c
...
...
@@ -23,10 +23,10 @@ import org.apache.mybatis.jpa.persistence.JpaBaseService;
import
org.apache.poi.ss.usermodel.Cell
;
import
org.apache.poi.ss.usermodel.CellType
;
import
org.maxkey.entity.Organizations
;
import
org.maxkey.persistence.kafka.KafkaIdentityAction
;
import
org.maxkey.persistence.kafka.KafkaIdentityTopic
;
import
org.maxkey.persistence.kafka.KafkaPersistService
;
import
org.maxkey.persistence.mapper.OrganizationsMapper
;
import
org.maxkey.persistence.mq.MqIdentityAction
;
import
org.maxkey.persistence.mq.MqIdentityTopic
;
import
org.maxkey.persistence.mq.MqPersistService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Repository
;
...
...
@@ -35,7 +35,7 @@ import org.springframework.stereotype.Repository;
public
class
OrganizationsService
extends
JpaBaseService
<
Organizations
>{
@Autowired
KafkaPersistService
kafka
PersistService
;
MqPersistService
mq
PersistService
;
public
OrganizationsService
()
{
super
(
OrganizationsMapper
.
class
);
...
...
@@ -51,8 +51,8 @@ public class OrganizationsService extends JpaBaseService<Organizations>{
public
boolean
insert
(
Organizations
organization
)
{
if
(
super
.
insert
(
organization
)){
kafka
PersistService
.
send
(
KafkaIdentityTopic
.
ORG_TOPIC
,
organization
,
Kafka
IdentityAction
.
CREATE_ACTION
);
mq
PersistService
.
send
(
MqIdentityTopic
.
ORG_TOPIC
,
organization
,
Mq
IdentityAction
.
CREATE_ACTION
);
return
true
;
}
return
false
;
...
...
@@ -60,8 +60,8 @@ public class OrganizationsService extends JpaBaseService<Organizations>{
public
boolean
update
(
Organizations
organization
)
{
if
(
super
.
update
(
organization
)){
kafka
PersistService
.
send
(
KafkaIdentityTopic
.
ORG_TOPIC
,
organization
,
Kafka
IdentityAction
.
UPDATE_ACTION
);
mq
PersistService
.
send
(
MqIdentityTopic
.
ORG_TOPIC
,
organization
,
Mq
IdentityAction
.
UPDATE_ACTION
);
return
true
;
}
return
false
;
...
...
@@ -82,8 +82,8 @@ public class OrganizationsService extends JpaBaseService<Organizations>{
public
boolean
delete
(
Organizations
organization
)
{
if
(
super
.
delete
(
organization
)){
kafka
PersistService
.
send
(
KafkaIdentityTopic
.
ORG_TOPIC
,
organization
,
Kafka
IdentityAction
.
DELETE_ACTION
);
mq
PersistService
.
send
(
MqIdentityTopic
.
ORG_TOPIC
,
organization
,
Mq
IdentityAction
.
DELETE_ACTION
);
return
true
;
}
return
false
;
...
...
maxkey-persistence/src/main/java/org/maxkey/persistence/service/UserInfoService.java
浏览文件 @
090f4c9c
...
...
@@ -26,10 +26,10 @@ import org.maxkey.crypto.password.PasswordReciprocal;
import
org.maxkey.entity.Accounts
;
import
org.maxkey.entity.ChangePassword
;
import
org.maxkey.entity.UserInfo
;
import
org.maxkey.persistence.kafka.KafkaIdentityAction
;
import
org.maxkey.persistence.kafka.KafkaIdentityTopic
;
import
org.maxkey.persistence.kafka.KafkaPersistService
;
import
org.maxkey.persistence.mapper.UserInfoMapper
;
import
org.maxkey.persistence.mq.MqIdentityAction
;
import
org.maxkey.persistence.mq.MqIdentityTopic
;
import
org.maxkey.persistence.mq.MqPersistService
;
import
org.maxkey.persistence.repository.PasswordPolicyValidator
;
import
org.maxkey.util.DateUtils
;
import
org.maxkey.util.StringUtils
;
...
...
@@ -57,7 +57,7 @@ public class UserInfoService extends JpaBaseService<UserInfo> {
PasswordPolicyValidator
passwordPolicyValidator
;
@Autowired
KafkaPersistService
kafka
PersistService
;
MqPersistService
mq
PersistService
;
@Autowired
protected
JdbcTemplate
jdbcTemplate
;
...
...
@@ -79,12 +79,12 @@ public class UserInfoService extends JpaBaseService<UserInfo> {
public
boolean
insert
(
UserInfo
userInfo
)
{
userInfo
=
passwordEncoder
(
userInfo
);
if
(
super
.
insert
(
userInfo
))
{
if
(
kafkaPersistService
.
getApplicationConfig
().
isKafka
Support
())
{
if
(
mqPersistService
.
getApplicationConfig
().
isMessageQueue
Support
())
{
UserInfo
loadUserInfo
=
findUserRelated
(
userInfo
.
getId
());
kafka
PersistService
.
send
(
Kafka
IdentityTopic
.
USERINFO_TOPIC
,
mq
PersistService
.
send
(
Mq
IdentityTopic
.
USERINFO_TOPIC
,
loadUserInfo
,
Kafka
IdentityAction
.
CREATE_ACTION
);
Mq
IdentityAction
.
CREATE_ACTION
);
}
return
true
;
...
...
@@ -96,13 +96,13 @@ public class UserInfoService extends JpaBaseService<UserInfo> {
public
boolean
update
(
UserInfo
userInfo
)
{
userInfo
=
passwordEncoder
(
userInfo
);
if
(
super
.
update
(
userInfo
))
{
if
(
kafkaPersistService
.
getApplicationConfig
().
isKafka
Support
())
{
if
(
mqPersistService
.
getApplicationConfig
().
isMessageQueue
Support
())
{
UserInfo
loadUserInfo
=
findUserRelated
(
userInfo
.
getId
());
accountUpdate
(
loadUserInfo
);
kafka
PersistService
.
send
(
Kafka
IdentityTopic
.
USERINFO_TOPIC
,
mq
PersistService
.
send
(
Mq
IdentityTopic
.
USERINFO_TOPIC
,
loadUserInfo
,
Kafka
IdentityAction
.
UPDATE_ACTION
);
Mq
IdentityAction
.
UPDATE_ACTION
);
}
changePasswordProvisioning
(
userInfo
);
...
...
@@ -113,15 +113,15 @@ public class UserInfoService extends JpaBaseService<UserInfo> {
public
boolean
delete
(
UserInfo
userInfo
)
{
UserInfo
loadUserInfo
=
null
;
if
(
kafkaPersistService
.
getApplicationConfig
().
isKafka
Support
())
{
if
(
mqPersistService
.
getApplicationConfig
().
isMessageQueue
Support
())
{
loadUserInfo
=
findUserRelated
(
userInfo
.
getId
());
}
if
(
super
.
delete
(
userInfo
)){
kafka
PersistService
.
send
(
Kafka
IdentityTopic
.
USERINFO_TOPIC
,
mq
PersistService
.
send
(
Mq
IdentityTopic
.
USERINFO_TOPIC
,
loadUserInfo
,
Kafka
IdentityAction
.
DELETE_ACTION
);
Mq
IdentityAction
.
DELETE_ACTION
);
accountUpdate
(
loadUserInfo
);
return
true
;
}
...
...
@@ -326,10 +326,10 @@ public class UserInfoService extends JpaBaseService<UserInfo> {
changePassword
.
setDecipherable
(
loadUserInfo
.
getDecipherable
());
changePassword
.
setPassword
(
loadUserInfo
.
getPassword
());
changePassword
.
setInstId
(
loadUserInfo
.
getInstId
());
kafka
PersistService
.
send
(
Kafka
IdentityTopic
.
PASSWORD_TOPIC
,
mq
PersistService
.
send
(
Mq
IdentityTopic
.
PASSWORD_TOPIC
,
changePassword
,
Kafka
IdentityAction
.
PASSWORD_ACTION
);
Mq
IdentityAction
.
PASSWORD_ACTION
);
}
}
...
...
maxkey-webs/maxkey-web-maxkey/src/main/resources/application-http.properties
浏览文件 @
090f4c9c
...
...
@@ -41,8 +41,8 @@ maxkey.server.mgt.uri =${maxkey.server.name}:9527/maxk
maxkey.server.authz.uri
=
${maxkey.server.name}:${server.port}${server.servlet.context-path}
#InMemory 0 , Redis 2
maxkey.server.persistence
=
${SERVER_PERSISTENCE:0}
#identity
maxkey.server.
kafka.support
=
${SERVER_KAFKA_SUPPORT:fals
e}
#identity
none, Kafka ,RocketMQ
maxkey.server.
message.queue
=
${SERVER_MESSAGE_QUEUE:non
e}
#issuer name
maxkey.app.issuer
=
CN=ConSec,CN=COM,CN=SH
############################################################################
...
...
@@ -175,7 +175,12 @@ spring.kafka.producer.key-serializer =org.apache.kafka.common.seriali
spring.kafka.producer.value-serializer
=
org.apache.kafka.common.serialization.StringSerializer
# partitioner
#spring.kafka.producer.properties.partitioner.class=com.felix.kafka.producer.CustomizePartitioner
############################################################################
#RocketMQ for connectors configuration #
############################################################################
rocketmq.name-server
=
${ROCKETMQ_SERVERS:localhost:9876}
rocketmq.producer.enable
=
true
rocketmq.producer.group
=
maxkey_identity
############################################################################
#Time-based One-Time Password configuration #
############################################################################
...
...
maxkey-webs/maxkey-web-maxkey/src/main/resources/application-https.properties
浏览文件 @
090f4c9c
...
...
@@ -41,8 +41,8 @@ maxkey.server.mgt.uri =${maxkey.server.name}:9527/maxk
maxkey.server.authz.uri
=
${maxkey.server.name}${server.servlet.context-path}
#InMemory 0 , Redis 2
maxkey.server.persistence
=
${SERVER_PERSISTENCE:0}
#identity
maxkey.server.
kafka.support
=
${SERVER_KAFKA_SUPPORT:fals
e}
#identity
none, Kafka ,RocketMQ
maxkey.server.
message.queue
=
${SERVER_MESSAGE_QUEUE:non
e}
#issuer name
maxkey.app.issuer
=
CN=ConSec,CN=COM,CN=SH
...
...
@@ -177,7 +177,12 @@ spring.kafka.producer.key-serializer =org.apache.kafka.common.seriali
spring.kafka.producer.value-serializer
=
org.apache.kafka.common.serialization.StringSerializer
# partitioner
#spring.kafka.producer.properties.partitioner.class=com.felix.kafka.producer.CustomizePartitioner
############################################################################
#RocketMQ for connectors configuration #
############################################################################
rocketmq.name-server
=
${ROCKETMQ_SERVERS:localhost:9876}
rocketmq.producer.enable
=
true
rocketmq.producer.group
=
maxkey_identity
############################################################################
#Time-based One-Time Password configuration #
############################################################################
...
...
maxkey-webs/maxkey-web-mgt/src/main/resources/application-http.properties
浏览文件 @
090f4c9c
...
...
@@ -37,8 +37,8 @@ maxkey.server.mgt.uri =${maxkey.server.uri}
maxkey.server.authz.uri
=
https://${maxkey.server.domain}/maxkey
#InMemory 0 , Redis 2
maxkey.server.persistence
=
0
#identity
maxkey.server.
kafka.support
=
${SERVER_KAFKA_SUPPORT:fals
e}
#identity
none, Kafka ,RocketMQ
maxkey.server.
message.queue
=
${SERVER_MESSAGE_QUEUE:non
e}
############################################################################
#Login configuration #
...
...
@@ -160,6 +160,12 @@ spring.kafka.producer.key-serializer =org.apache.kafka.common.seriali
spring.kafka.producer.value-serializer
=
org.apache.kafka.common.serialization.StringSerializer
# partitioner
#spring.kafka.producer.properties.partitioner.class=com.felix.kafka.producer.CustomizePartitioner
############################################################################
#RocketMQ for connectors configuration #
############################################################################
rocketmq.name-server
=
${ROCKETMQ_SERVERS:localhost:9876}
rocketmq.producer.enable
=
true
rocketmq.producer.group
=
maxkey_identity
############################################################################
#Time-based One-Time Password configuration #
############################################################################
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录