Skip to content

Instantly share code, notes, and snippets.

@kjnilsson
Created April 16, 2017 09:53
Show Gist options
  • Save kjnilsson/c00291358caf4f18e6be8d575927c7e4 to your computer and use it in GitHub Desktop.
Save kjnilsson/c00291358caf4f18e6be8d575927c7e4 to your computer and use it in GitHub Desktop.
RabbitMQ fsharp helpers
let consume (m: IModel) queue f =
let consumer =
{ new DefaultBasicConsumer(m) with
member x.HandleBasicDeliver(consumerTag,
deliveryTag,
redelivered,
exchange,
routingKey,
props,
body) =
f deliveryTag props body }
let consumerTag = m.BasicConsume(queue, false, consumer)
{ new System.IDisposable with
member __.Dispose () =
m.BasicCancel(consumerTag) }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment