Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

negativeAcknowledge #254

Open
colinbes opened this issue Dec 11, 2020 · 1 comment
Open

negativeAcknowledge #254

colinbes opened this issue Dec 11, 2020 · 1 comment

Comments

@colinbes
Copy link

If on consumer.receive we get a failed Try does one need to call consumer.negativeAcknowledge?

If so then how does one do this as we would only have the exception and not the consumer method?
For example. with code below what would we reference in consumer.negativeAcknowledge(??) as msg is Try[CosumerMessage[String]]

    val msg = consumer.receive

    msg match {
      case Success(value) =>
        println(s"${consumer.subscription} Success, $label ${value.valueTry}")
        consumer.acknowledge(value)
      case Failure(exception) =>
        println(s"Failed: ${exception.getMessage}")
        consumer.negativeAcknowledge(??)
    }
@gmethvin
Copy link
Collaborator

gmethvin commented Dec 29, 2020

Are you encountering a situation where failures lead to unacknowledged messages? If so that's likely a bug.

If you don't receive a message back that typically means there was an error receiving the message for some reason (e.g. the client is disconnected or closed). It's not your responsibility to acknowledge anything. The correct way to recover really depends on the type of error, but one possible strategy is to restart the consumer with an exponential backoff, then fail after some amount of time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants