Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Channel Closing #1074

gustavohfelixs started this conversation in General
Discussion options

Describe the bug

Hello Guys.
I'm using Apache Camel and RabbitMq on a project to make an update in some itens status, if the item doesn't exists in database i need to purge the message. After pass and return by Router of Apache when channel.basicAck() is called throws an exception,. Follow the snippets

 public void readMessage(@Payload final String payload, Channel channel, @Header(AmqpHeaders.DELIVERY_TAG) long tag
 ) throws IOException {
 try {
 final var myObject = objectMapper.readValue(payload, myObject.class);
 log.info("Object received : {}", myObject );
 service.paymentObject(myObject);
 channel.basicAck(tag, false);

Exception: org.springframework.amqp.AmqpApplicationContextClosedException: The ApplicationContext is closed and the ConnectionFactory can no longer create connections.

How can I fix that?

Specs:
Spring: 2.2.0
JDK 11 - Oracle OpenJDK version 11.0.6
Camel: 3.0.1

Reproduction steps

  1. Receive the message in Listener
  2. Go to Router (Apache Camel), try to verify if value exists in other components
  3. If the value doens't exists purge the message of queue (Now its throwing exception)
    ...

Expected behavior

To Handle the exception and purge the invalid messages of queue

Additional context

No response

You must be logged in to vote

Replies: 1 comment

Comment options

We cannot suggest much without server logs. I'm afraid our team won't be setting up Apache Camel to reproduce and troubleshoot this. You can put together an executable example in a repo but logs and a traffic will likely be enough.

My best guess right now is that you try to ack on a channel that's different from the channel on which you have received the delivery. That results in a channel exception. Whether that can result in an "application context closure" in Spring AMQP, I don't know, but doing so will result in a channel exception that renders the channel unusable.

Double acking or acking when the consumer was set up to use automatic acknowledgement would have the same effect.

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Converted from issue

This discussion was converted from issue #1074 on July 17, 2023 19:11.

AltStyle によって変換されたページ (->オリジナル) /