我有一些逻辑,它使用JMS队列线程池。它通常看起来是什么样子:
[request thread] -> jms -> JMS listener [thread pool] -> reactive web client现在我收到了重复的消息(例如-错误)
ERROR [DefaultMessageListenerContainer-5 @coroutine#2]
ERROR [DefaultMessageListenerContainer-4 @coroutine#4]
ERROR [DefaultMessageListenerContainer-1 @coroutine#1]
ERROR [DefaultMessageListenerContainer-3 @coroutine#3]这样的协程是由runBlocking发起的。
@JmsListener(destination = ...)
fun someHandleFunction(...) = runBlocking {
someWebClientService.createRequest(...)
}
// SomeWebClientService class
suspend fun createRequest(...) = try {
val response = webClient
.post()
.uri { ... }
...
.exchange()
.awaitFirst()
// Check response status here
} catch (e: Exception) {
// Some error handling here
}是的,我知道在runBlockin协程的情况下可以behave in such way...但是为什么协程线程与新的线程相关联呢?
这样的重复有什么问题?
发布于 2020-11-12 15:40:13
问题与JMS配置相关。
由于某些原因,如果没有这个配置,单独的JMS线程只能处理一个任务
spring:
artemis.embedded:
persistent: true
data-directory: ./target/some-queue-storage
queues: ...https://stackoverflow.com/questions/64788133
复制相似问题