RpcClient not thread safe #754
karlnicholas
started this conversation in
General
Replies: 2 comments 3 replies
-
Given that most clients, including this one, explicitly do not allow sharing channels across threads, I'm not sure You are welcome to look into it or simply roll your own. This "RPC client" was developed years ago primarily as an example. |
Beta Was this translation helpful? Give feedback.
1 reply
-
Another issue you will run into is a shared response queue. So you probably want a separate channel per thread (avoiding creating a new one of the fly every time as much as possible) and Direct reply to. |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
RabbitMQ version:
<groupId>com.rabbitmq</groupId>
<artifactId>amqp-client</artifactId>
<version>5.13.1</version>
A runnable code sample, terminal transcript or detailed set of
instructions that can be used to reproduce the issue:
Make two threads in com.rabbitmq.client.test.RpcTest.java
e.g. RabbitMQRpcClient
Operating system, version, and patch level:
Java 11: Windows 11
Errors reported in the JavaScript console (if any):
My use case is that I am calling RpcClient from a REST service. When two clients hit the REST endpoint "at the same time" then RpcClient gives the above exception.
Beta Was this translation helpful? Give feedback.
All reactions