Thursday, March 12, 2015

Patterns for list-based pub/sub with wcf and msmq

The topic of using queues came up today. The debate we had was between contract based topics and content based topics. In WCF, a pub/sub service can use msmq to receive and relay messages to subscribers. We are only considering the list-based subscriber model and perhaps transient subscribers as a potential case. Broadcasts and other patterns were out of scope of the conversation.

The debate was about whether to have an explicit event operation on the service contract to describe the topic or to have a data based description of the topic. In other words, would an event be published as follows:

IEmailSentEventPublisher publisherProxy =
  new factory.GetProxy();

or in a data controlled way as follows:

IEventPublisher publisherProxy =
  new factory.GetProxy();
publisherProxy.PublishEvent(event, data);

where event contains meta data about the event such as the topic ("email","success", etc) and data is the contextual data such as the id of the email in the database.

or perhaps a variation of the former:

IEventPublisher publisherProxy =
  new factory.GetProxy(event);

where the factory sets up the proxy to send meta data in the header.

1 comment:

  1. I can't read articles online all the time, however I'm happy I did today.
    Bar em porto alegre