The primary transport for FubuMVC is based off of LightningQueues (LQ). LightningQueues is a persistent, store and forward queuing library for .Net applications. The latest version of LQ uses LightningDB for persistence instead of the slower, more problematic Esent storage in previous versions. The huge advantage of LightningQueues is that it's completely xcopy. No installation or configuration is necessary other than having the right binaries and a Uri designating queue names and IP ports.
The only thing you need to do to enable the LQ transport in FubuMVC is to install the FubuMVC.LightningQueues in your application, typically via Nuget.
To opt into LightningQueues in a service bus application, use a Uri that follows this pattern:
lq.tcp://[machine name]:[port]/[queue name]
lq.tcp is just the Uri scheme that designates an LQ endpoint. The machine name can be either a remote server, an IP address, or "localhost" for local only development.
Here's an example of configuring a service bus application with LightningQueues backed channels:
public class LqAppSettings
{
public Uri Incoming { get; set; }
= new Uri("lq.tcp://localhost:2200/incoming");
public Uri Control { get; set; }
= new Uri("lq.tcp://localhost:2201/control");
public Uri Other { get; set; }
= new Uri("lq.tcp://localhost:2202/messages");
}
public class LqApp : FubuTransportRegistry<LqAppSettings>
{
public LqApp()
{
// You need at least one incoming channel if you
// are going to use LightningQueues as a transport
Channel(x => x.Incoming).ReadIncoming();
// Designate a control channel and
// mark it as non-persistent
Channel(x => x.Control)
.UseAsControlChannel()
.DeliveryFastWithoutGuarantee();
Channel(x => x.Other)
.AcceptsMessage<PingMessage>();
}
}
A couple things to note about the sample above:
- When FubuMVC constructs channels at application bootstrapping time, it matches the Uri scheme name ("lq.tcp" in this case) to the transport and asks that transport to build a channel for that Uri.
- The
DeliveryFastWithoutGuarantee()
mode directs LQ to not try to persist messages before attempting to send them to a remote location. This is an appropriate mode when performance is paramount or messages are quickly obsolete. This is somewhat comparable to ZeroMQ. - Behind the scenes, LQ makes all queues at a single port be either all persistent or not persistent. FubuMVC will throw exceptions at runtime if you try to run two queues to the same port with different persistence profiles.