Application Server – Pubsub Workign

I haven’t really worked on my latest personal project in a few weeks. The application server is up and running, and is completely command driven, and the commands can be specified declaratively. 

I started to implement the new SEMANTIC LOGGING BLOCK from P&P, and created a custom sync that sent the log items to MSMQ. That worked, but I want to be able to process the messages multiple times. IE: put them in a database, and also monitoring tools and the website. So, I needed pubsub.

Since that realization, I haven’t worked on it too much. I’ve spent a few minutes here and there, but tonight was the first time I put some serious time into it while watching “MASK OF ZORRO”.

The plan is to have 2 implementations out-of-the-box

– MSMQ – the best choice, when available

– NETTCP – a less reliable backup for when MSMQ isn’t available.

The nice thing is that both implementations can use the same contracts. The only thing that will change is the bindings. Yay for WCF! But, I have been focusing on MSMQ.

As of tonight, it’s working, but there’s still a lot more to do. The client is pretty configurable, but the server isn’t yet. There’s a few hard coded things in there that have to go. All of this can be driven by the WCF configuration files, and that will be an option, but I want it to just work without people having to mess with anything. I have some work to do on that end.

There are two WCF services running on the app server: 1 to handle subscribes, and 1 to handle publishes. A lot of the work I did previously payed off nicely here. I created my WCF contracts and a MSMQPubsubFeature. I put two attributes on the feature, one per service, and now the services automatically start… just as they were supposed to. (It defaults to NETTCP, so I added WCF configuration to the app.config to switch it to MSMQ.)

The publish service:

public class PublishService : IServerPublishService

The subscribe service:

public class SubscribeService : IServerSubscribeService

The feature class:

public class MsmqPubSubFeature : Feature, IPubSubFeature

Each service has a name. The feature has a name. When the feature starts, it starts the two WCF services by name.

I setup a simple test application that uses the pubsubclient (a stand-alone assembly) to exercise it, and it’s working as expected.

Progress made.



Leave a Reply

Please log in using one of these methods to post your comment: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: