mirai-core发送消息是否是线程安全的 #874
Answered
by
Him188
applearound
asked this question in
Q&A
-
while (true) {
val records = kafkaConsumer.poll(Duration.ofMillis(100))
records.forEach {
if (it.topic() == topic) {
executorService.submit {
runBlocking {
val msg = it.value().getString("msg")
Bot.botInstances[123].groups[456].sendMessage(msg)
}
}
}
}
kafkaConsumer.commitSync()
} 比如我的消息是从消息队列中获取的,我想以线程执行器多线程的方式发送,Bot对象和与其相关的方法是否会有线程安全问题。 |
Beta Was this translation helpful? Give feedback.
Answered by
Him188
Jan 18, 2021
Replies: 2 comments
-
算了不懂kt.jpg 让别人回答下吧( |
Beta Was this translation helpful? Give feedback.
0 replies
-
mirai 的所有公开 API 都是安全的 |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
Him188
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
mirai 的所有公开 API 都是安全的