This project is read-only.

Filtering messages on categories/topics

When a message is published you can set a category/topic on that message. A category could be any string.

Subscribers can apply a filter to their subscribtion in order to only receive messages that matches the filter.

// subscribe to message published with a category that starts with "TestCategory"
PubSubLite.Bus.Subscribe(new Subscriber()).ApplyFilter(message => message.Category.StartsWith("TestCategory"));

// The subscriber will receive this message
PubSubLite.Bus.Publish(new TestMessage1(3), "TestCategory.More.Text");

// ...but not this
PubSubLite.Bus.Publish(new TestMessage1(2), "Another.Category");

Last edited Nov 8, 2010 at 9:44 AM by swmal, version 4


No comments yet.