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

Release Consume thread when Consumer disposed #97

Open
ksavelev opened this issue Jul 21, 2016 · 0 comments
Open

Release Consume thread when Consumer disposed #97

ksavelev opened this issue Jul 21, 2016 · 0 comments

Comments

@ksavelev
Copy link

Running code below;

var consumer = new Consumer(...); // initialize consumer
Task.Factory.StartNew(() =>
{
    Console.WriteLine("Consumer started");
    foreach (var m in bc.Consume()) Console.WriteLine(Encoding.UTF8.GetString(m.Value));
    Console.WriteLine("Consumer finished");
});
// wait a sec;
consumer.Dispose();

will never print Consumer finished even though consumer is in unusable state and bc.Consume() will never yield any result anymore.

Is it possible to change behavior of Consumer on Dispose so it will release the thread that runs the .Consume() method?

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

1 participant