This is simple demo how to use NServiceBus from F-Sharp (F#) programming language.

(Ensure first that you have NServiceBus and F# installed...)

FSharp is a multi-paradigm programming language, targeting the .NET Framework.

NServiceBus is service bus for .NET (based on MSMQ and RavenDB).

Description of the solution:
Events.fs - Events, currently only one, MyEvent that is sent to message bus. Has one parameter.
MyEventHandler.fs - Example of listener/processor who handles the event (and usually would send a new one(s) after done). This could be a state machine state.
NServiceBusInstaller.fs - Castle Windsor IoC container registration
Program.fs - Small infra to launch the first event
App.config - NServiceBus, Castle & MSMQ settings
packages.config - Nuget package management settings

This solution uses NuGet, but there seems to be some problems with NuGet and VS2012 automation still...
This could be enough for the package management console: Install-Package NServiceBus.CastleWindsor 3.3.3
as the NServiceBus.CastleWindsor will have dependency to NServiceBus and Castle Windsor.

Why to use NServiceBus from F# when we have MailboxProcessors?
- Usually I won't but... How about communication with already existing C# SOA architecture...
- By default F# MailboxProcessor can't do recovery (from e.g. some kind of hardware failure)
- Actor/Agents-model and message based communication are very similar!

Last edited Jan 29, 2014 at 10:08 PM by Thorium, version 2