Usage Patterns

Oct 6, 2007 at 6:46 AM
Assuming the following usage pattern:
  • Loose coupling (no knowledge between brokers and subscribers)
  • Transient subscription
  • Content Routing
What is the best pattern for using WSP, or is this just not the way it works? The key here is having the subscription to events being data driven - the content or an event defines the subscriber list.

I'm struggling with the use of GUIDs - are there ways to classify GUIDs? What's the best way of ensuring that a Subscriber knows which GUIDs, and therefore events, to subscribe to?
Coordinator
Oct 6, 2007 at 5:34 PM
The intent is that events are .Net objects and therefore there is a class definition of the object. The class is compiled into a dll. When you define the event class, you inherit from the base event class and assign a unique guid to the new event class. The publisher and subscriber both use that dll.

The publisher can listen to subscription events and only begin publishing when someone has subscribed to its event type.

The WSP event system does not support content-based routing. The main reason I didn't do this was because of overhead and complexity. Moving events around is relatively low overhead. It seems efficient have the subscriber do the filtering in most cases.

If you really want to do content-based routing, one alternative is to have the publisher do the filtering and routing. In this case, you would have an event defined where you pass your criteria and provide the event type you want the content-based events sent as. The publisher would have subscribed to the definition events. The publisher would do the filtering and send out events that meet the criteria with the event type provided. The subscriber would have subscribed to the new event type and it then begins receiving the events which only meet its criteria.

The ping-pong sample follows this style.

A subscriber can subscribe to all events by using a "*" and it can enumerate through the properties. If it didn't have the corresponding .Net object, it wouldn't be able to deserialize back to the original object.



DynamicalSystem wrote:
Assuming the following usage pattern:
  • Loose coupling (no knowledge between brokers and subscribers)
  • Transient subscription
  • Content Routing
What is the best pattern for using WSP, or is this just not the way it works? The key here is having the subscription to events being data driven - the content or an event defines the subscriber list.

I'm struggling with the use of GUIDs - are there ways to classify GUIDs? What's the best way of ensuring that a Subscriber knows which GUIDs, and therefore events, to subscribe to?

Oct 7, 2007 at 9:14 AM
OK - I get it now - it makes sense.

Thanks for answering silly questions.