JasperFx 0.9.14


Next

Store and Forward Messaging

Previous

TCP Transport

Local Loopback Transport Edit on GitHub


Note! The loopback transport is used underneath the covers by Jasper for retrying locally enqueued messages or scheduled messages that may have initially failed.

The "loopback" transport is a local, in memory transport that allows you to queue messages directly to the internal worker queues. This transport is enabled by default, and the Uri structure is loopback://queuename, where "queuename" is the name of a worker queue. Here are some examples of how it is configured:


public class LoopbackTransportApp : JasperRegistry
{
    public LoopbackTransportApp()
    {
        Handlers.Worker("important")
            .IsDurable()
            .MaximumParallelization(10);

        // Publish the message Message2 the important queue
        Publish.Message<Message2>().To("loopback://important");
    }
}

While you can use explicit publishing rules by message type to route messages locally to the loopback transport, it's probably easier to just use the explicit methods on IMessageContext shown below:


public static async Task enqueue_locally(IMessageContext bus)
{
    // Enqueue a message to the local, loopback transport
    // using the default worker queue & durability rules
    // for the message type
    await bus.Enqueue(new Message1());

    // Enqueue a message locally non-durably
    await bus.EnqueueLightweight(new Message1());

    // Enqueue a message locally & durably
    await bus.EnqueueDurably(new Message1());
}

See Worker Queues and Message Priority and Store and Forward Messaging for more information.