0

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). enter image description here

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:-

  1. spring-amqp-2.2.1.RELEASE.jar,
  2. spring-rabbit-2.2.1.RELEASE.jar
  3. amqp-client-5.7.3.jar,
  4. 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.

enter image description here

Ankit
  • 609
  • 2
  • 10
  • 26
  • Please post a complete, simple, example that exhibits this behavior so we can take a look. Spring has no knowledge on whether a metrics collector is configured so I don't see how or why the commit would not be called. – Gary Russell Jan 25 '21 at 15:33
  • Hi Gary, I have updated my question to include more details on setup and point of failure. – Ankit Jan 26 '21 at 14:46
  • I don't see how that's possible; as I said I need a complete example that exhibits the behavior. This code has been in place for over a decade. – Gary Russell Jan 26 '21 at 15:17

0 Answers0