Skip to content

Instantly share code, notes, and snippets.

@AlexCuse
Created June 30, 2011 01:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AlexCuse/1055416 to your computer and use it in GitHub Desktop.
Save AlexCuse/1055416 to your computer and use it in GitHub Desktop.
rabbitmq subscription?
//I think this is more or less how it'd work
public IEnumerable<T> Stuffs () {
bool noAck = false;
using (var connection = connectionFactory.CreateConnection ())
using (var channel = SetupChannel (connection)) {
var sub = new Subscription (channel, queueName, noAck);
while (true) {
var result = sub.Next ();
if (result != null) {
var output = serializer.Deserialize (result.Body);
yield return output;
sub.Ack (result);
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment