Created
April 22, 2016 05:05
-
-
Save WilliamBerryiii/132d7dc6c0571b5907ea0a9f6ad6949b to your computer and use it in GitHub Desktop.
Simple example of consuming an EasyNetQ Advanced Bus from F#
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let messageHandlers () = | |
new Action<byte[], MessageProperties, MessageReceivedInfo>(fun message props receivedInfo -> | |
let envelope = message |> Encoding.UTF8.GetString |> Envelope.Parse | |
match Model.TryParse(envelope.Topic) with | |
| Some x -> | |
subject.OnNext ( pushToQueue x ) | |
| None -> () | |
) | |
let queue = bus.Advanced.QueueDeclare(rabbitConfig.Queue, passive = true) | |
async { | |
let q = queue | |
bus.Advanced.Consume(queue = q, onMessage = messageHandlers ()) |> ignore | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment