-
Notifications
You must be signed in to change notification settings - Fork 629
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
RabbitTemplate.send throw java.lang.ClassCastException: com.rabbitmq.client.impl.AMQImpl$Channel$OpenOk cannot be cast to com.rabbitmq.client.impl.AMQImpl$Confirm$SelectOk #1337
Comments
Can you show, please, more stack trace to see what Spring AMQP code is involved in the problem? |
Also, 2.1.x is at end of life; consider upgrading to 2.2.16.RELEASE or 2.3.6. |
this is my code
with config
cause :
|
Appears to be a a problem in the amqp-client; the openOk is returned for the open request and it is somehow coming as a reply to the Have you tried upgrading to a supported Spring AMQP version? They use newer clients. |
OK, I have tried the new version and this problem does not appear. I'm going to ask rabbitmq-users. I'm just curious about the cause of the problem. My previous guess is that if a connection exceeds the cache size, it will be physically closed, and there is a possibility to get the same Channel (one closed and one unclosed) while sending messages using the same connection. CachingConnectionFactory doesn't seem to have this problem. |
I have a detailed look at the code and found still have this problem. In 'CachingConnectionFactory.doCreateBareChannel' |
It's not clear what you mean; Please explain further. |
@CrackerGit 请问下你后面怎么解决的,是不是这个配置也有问题,如果在多线程环境下运行 |
To avoid this problem, I use the 'connectionLimit' property of CachingConnectionFactory to make it the same as 'connectionCacheSize' But I think it needs to be fixed |
It is still not clear to me how two threads can get the same channel - I must be missing something - can you elaborate? |
spring-rabbit 2.1.13
Question
I use RabbitTemplate to send messages where the caching mode is Connection and the number of cached connections is less than the maximum number of connections.
At this time I used 50 concurrent pressure test abnormal
The text was updated successfully, but these errors were encountered: