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

channel is already closed when applying recovery strategy on a failed stream #121

Open
TrustNoOne opened this issue Aug 5, 2017 · 3 comments

Comments

@TrustNoOne
Copy link

The following code never nacks a "fail' message, every time it's restarted it reads it again.

It fails here with an AlreadyClosedException.

The documentation says RecoveryStrategy does not work with streams: why do I have to specify one then? Maybe It should be hardcoded to "none" if not supported?

 implicit val recoveryStrategy = RecoveryStrategy.nack(requeue = false)
    val src = RabbitSource(
      rabbitControl,
      channel(qos = 3),
      consume(queue(
        "hello",
        durable    = false,
        exclusive  = false,
        autoDelete = false
      )),
      body(as[String])
    )

    val res = src
      .runForeach { msg 
        if (msg == "fail") throw new Exception("errorrr")
        println(msg)
      }

    Await.result(res, Duration.Inf)
@timcharper
Copy link
Member

timcharper commented Oct 3, 2017

I don't remember writing anywhere in the documentation that recovery strategy doesn't work with streams... where did you read this?

I just pushed up a test change, too, which does show that this behavior works: a51d408

@timcharper
Copy link
Member

Ah... I see what is happening.

The stream is closing because you did not set a resuming decider. Then, there is a race condition. The channel closes when the stream closes, but this is happening before the recoveryStrategy has a chance to apply.

@timcharper
Copy link
Member

Not sure how to best solve this; any ideas?

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