We are having a setup where we are using spring-amqp transacted channels to push our messages to RabbitMq. During a testing we found that messages were not even getting published from spring-amqp to rabbitmq;
we suspect metricsCollector.basicPublish(this)
in com.rabbitmq.client.impl.ChannelN
failure(no exception is thrown).
because we can see that RabbitUtils.commitIfNecessary(channel)
in org.springframework.amqp.rabbit.core.RabbitTemplate
is not getting called when there is an issue executing metricsCollector.basicPublish(this)
for the same code flow.
We have taken TCP dumps and could see that message were written to stream/socket on rabbitmq, but since commit didn't happen due to an a probable amqp api failure the messages were not delivered to corresponding queues.
Jars Version Being used in the setup:-
- spring-amqp-2.2.1.RELEASE.jar,
- spring-rabbit-2.2.1.RELEASE.jar
- amqp-client-5.7.3.jar,
- metrics-core-3.0.2.jar
Is anyone facing the similar issue?
Can someone please help.
---edit 1
(Setup) :- We are using same connection Factory for flows with parent transaction and flows not running with parent transactions
On further analyzing the issue , we found that isChannelLocallyTransacted
is sometimes showing in-consistent behavior because ConnectionFactoryUtils.isChannelTransactional(channel, getConnectionFactory()
is sometimes having a reference to transacted channel (returns true hence expression isChannelLocallyTransacted
evaluates to false) due to which tx.commit never happens; so message gets lost before getting committed to RabbitMQ.
question from:
https://stackoverflow.com/questions/65883353/message-loss-message-sent-to-spring-amqp-doesnt-get-published-to-rabbitmq 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…