Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
MaxKey单点登录官方(MaxKeyTop)
MaxKey
提交
98c11661
MaxKey
项目概览
MaxKey单点登录官方(MaxKeyTop)
/
MaxKey
10 个月 前同步成功
通知
75
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,体验更适合开发者的 AI 搜索 >>
提交
98c11661
编写于
2月 19, 2022
作者:
M
MaxKey
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
kafka message optimize
上级
1e73605b
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
30 addition
and
28 deletion
+30
-28
maxkey-core/src/main/java/org/maxkey/autoconfigure/ApplicationAutoConfiguration.java
...rg/maxkey/autoconfigure/ApplicationAutoConfiguration.java
+3
-3
maxkey-persistence/src/main/java/org/maxkey/persistence/kafka/KafkaMessage.java
.../main/java/org/maxkey/persistence/kafka/KafkaMessage.java
+13
-2
maxkey-persistence/src/main/java/org/maxkey/persistence/kafka/KafkaPersistService.java
...ava/org/maxkey/persistence/kafka/KafkaPersistService.java
+13
-22
maxkey-webs/maxkey-web-maxkey/src/main/resources/templates/views/safe/setting.ftl
...axkey/src/main/resources/templates/views/safe/setting.ftl
+1
-1
未找到文件。
maxkey-core/src/main/java/org/maxkey/autoconfigure/ApplicationAutoConfiguration.java
浏览文件 @
98c11661
...
...
@@ -105,10 +105,10 @@ public class ApplicationAutoConfiguration implements InitializingBean {
PasswordEncoder
passwordEncoder
=
new
DelegatingPasswordEncoder
(
idForEncode
,
encoders
);
if
(
_logger
.
is
Debug
Enabled
())
{
_logger
.
debug
(
"Password Encoders :"
);
if
(
_logger
.
is
Trace
Enabled
())
{
_logger
.
trace
(
"Password Encoders :"
);
for
(
String
key
:
encoders
.
keySet
())
{
_logger
.
debug
(
"{}= {}"
,
String
.
format
(
"%-10s"
,
key
),
encoders
.
get
(
key
).
getClass
().
getName
());
_logger
.
trace
(
"{}= {}"
,
String
.
format
(
"%-10s"
,
key
),
encoders
.
get
(
key
).
getClass
().
getName
());
}
}
_logger
.
debug
(
"{} is default encoder"
,
idForEncode
);
...
...
maxkey-persistence/src/main/java/org/maxkey/persistence/kafka/KafkaMessage.java
浏览文件 @
98c11661
...
...
@@ -23,7 +23,7 @@ public class KafkaMessage {
String
actionType
;
String
sendTime
;
String
msgId
;
String
content
;
Object
content
;
public
String
getTopic
()
{
return
topic
;
...
...
@@ -61,10 +61,21 @@ public class KafkaMessage {
return
content
;
}
public
void
setContent
(
String
content
)
{
public
void
setContent
(
Object
content
)
{
this
.
content
=
content
;
}
public
KafkaMessage
()
{
}
public
KafkaMessage
(
String
topic
,
String
actionType
,
String
sendTime
,
String
msgId
,
Object
content
)
{
super
();
this
.
topic
=
topic
;
this
.
actionType
=
actionType
;
this
.
sendTime
=
sendTime
;
this
.
msgId
=
msgId
;
this
.
content
=
content
;
}
}
maxkey-persistence/src/main/java/org/maxkey/persistence/kafka/KafkaPersistService.java
浏览文件 @
98c11661
...
...
@@ -20,6 +20,7 @@ package org.maxkey.persistence.kafka;
import
java.util.UUID
;
import
org.maxkey.configuration.ApplicationConfig
;
import
org.maxkey.pretty.PrettyFactory
;
import
org.maxkey.util.DateUtils
;
import
org.maxkey.util.JsonUtils
;
import
org.slf4j.Logger
;
...
...
@@ -30,7 +31,6 @@ import org.springframework.stereotype.Component;
@Component
public
class
KafkaPersistService
{
private
static
final
Logger
_logger
=
LoggerFactory
.
getLogger
(
KafkaPersistService
.
class
);
@Autowired
...
...
@@ -58,29 +58,24 @@ public class KafkaPersistService {
* @param actionType CREATE UPDATE DELETE
*/
public
void
send
(
String
topic
,
Object
content
,
String
actionType
)
{
//
config.identity.kafka
support , if true
//
maxkey.server.kafka.
support , if true
if
(
applicationConfig
.
isKafkaSupport
())
{
KafkaMessage
message
=
new
KafkaMessage
();
//message id is uuid
message
.
setMsgId
(
UUID
.
randomUUID
().
toString
());
message
.
setActionType
(
actionType
);
message
.
setTopic
(
topic
);
//send to kafka time
message
.
setSendTime
(
DateUtils
.
getCurrentDateTimeAsString
());
//content Object to json message content
message
.
setContent
(
JsonUtils
.
gson2Json
(
content
));
KafkaMessage
message
=
new
KafkaMessage
(
topic
,
//kafka TOPIC
actionType
,
//action of content
DateUtils
.
getCurrentDateTimeAsString
(),
//send to kafka time
UUID
.
randomUUID
().
toString
(),
//message id as uuid
content
//content Object to json message content
);
String
msg
=
JsonUtils
.
gson2Json
(
message
);
_logger
.
debug
(
"send message = {}"
,
msg
);
//通过线程发送Kafka消息
//sand msg to Kafka topic
KafkaProvisioningThread
thread
=
new
KafkaProvisioningThread
(
kafkaTemplate
,
topic
,
msg
);
thread
.
start
();
}
}
/**
* KafkaProvisioningThread for send message
*
...
...
@@ -97,20 +92,16 @@ public class KafkaPersistService {
KafkaTemplate
<
String
,
String
>
kafkaTemplate
,
String
topic
,
String
msg
)
{
this
.
kafkaTemplate
=
kafkaTemplate
;
this
.
topic
=
topic
;
this
.
msg
=
msg
;
}
@Override
public
void
run
()
{
_logger
.
trace
(
"send to Message Queue ..."
);
_logger
.
debug
(
"send message \n{}"
,
PrettyFactory
.
getJsonPretty
().
format
(
msg
)
);
kafkaTemplate
.
send
(
topic
,
msg
);
_logger
.
trace
(
"send to Message Queue finished ."
);
_logger
.
debug
(
"send to Message Queue finished ."
);
}
}
}
maxkey-webs/maxkey-web-maxkey/src/main/resources/templates/views/safe/setting.ftl
浏览文件 @
98c11661
...
...
@@ -35,7 +35,7 @@
<th><
@
locale
code=
"userinfo.authnType"
/></th>
<td
nowrap
>
<select
class=
"form-control form-select"
name=
"authnType"
id=
"authnType"
>
<option
value=
"
1
"
<
#if
0==
model.authnType
>
selected
</
#
if>
>
<
@
locale
code=
"button.text.select"
/></option>
<option
value=
"
0
"
<
#if
0==
model.authnType
>
selected
</
#
if>
>
<
@
locale
code=
"button.text.select"
/></option>
<option
value=
"1"
<
#if
1==
model.authnType
>
selected
</
#
if>
>
<
@
locale
code=
"userinfo.authnType.authnType.1"
/></option>
<!--
<option value="2" <#if 2==model.authnType >selected</#if> ><@locale code="userinfo.authnType.authnType.2" /></option>
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录