Project Description
PubSubLite is a lightweight library for publish/subscribe within a single application. It supports pub/sub, message topics, commands, logging.

What does it do?

  • Publish/Subscribe
  • Publish/Subscribe messages with topics/categories.
  • Publish a command, with a callback.
  • Support for logging by implementing one or more loggers using the IBusLogger interface.
  • PubSubLite works with or without IOC (any IOC container can be used, see Documentation page).

What does it NOT do?

  • It does not support applications on multiple servers or processes.
  • It does not support longrunning transactions
  • It does not persists messages.

Code example

using PubSubLite;

class TestMessage
{
      public string Value{ get; set; }
}

class TestSubscriber : ISubscriber<TestMessage>
{
      void ISubscriber<TestMessage>.HandleMessage(IMessage<TestMessage> message)
      {
            Console.WriteLine("TestMessage Received. MessageID: " + message.MessageID.ToString());
            Console.WriteLine("Value: " + message.Data.Value);
      }
}

static void Main(string[] args)
{
      var subscriber = new TestSubscriber();
      PubSubLite.Bus.Subscribe<TestMessage>(subscriber);
      PubSubLite.Bus.Publish(new TestMessage());
      // ... or if you are using IOC, resolve PubSubLite.IBus interface using the implementing class PubSubLite.Bus
      IBus bus = myIOCContainer.Resolve<IBus>();
      bus.Subscribe<TestMessage>(subscriber);
      bus.Publish(new TestMessage);
}

See the documentation section for more details

Feedback

Any feedback is greatly appreciated!

Last edited Nov 15, 2010 at 1:29 PM by swmal, version 21