Finished up the Cache Data Service for Ticker Plant

Ringmaster

Today was a great day for making progress on publishing the cache through the data service. In fact, I got it all done. It's pretty slick and should fit into the other data services of the broker nicely.

I create a subclass of the MMDServiceHandler which is spawned off of the MMDService for each call to bind() that the MMDService receives. It's a classic controller/worker breakdown where I've put a lot of the smarts of the workers in the abstract base class - MMDServiceHandler, and then create subclasses for the 'basic' data handler and the 'cache' handler. I'd tackled the first one earlier, so today it was time to hit the latter.

The cache is a lockless single-producer, multiple-consumer cache of the last tick message the feed has produced for that message type and a particular conflation key to make sure we keep "unique" values, but not duplicates of those "unique" values. It's standard stuff for a ticker plant, the point is that we need to scan the cache - no two ways about it.

So I created the different query schemes and then implemented them - realizing that we don't have to worry as much about performance here as this is going through the Broker, and because of that it's meant for the slower data consumers. In that our big concern is not to slow down the feed by locking anything. Good enough.

I found out that I needed to return the data in two ways: objects and a map of ivar names/values for the cross-platform crowd. To accomplish this, I had to add a getMapData() method to all the messages and build it up from the bottom. It just took a little time, but in the end it's a solid way of allowing easier access to the Java and Python clients as they all have maps and I don't have to worry about making real objects of the messages. (Note: I am making them in Java, but it's nice not to have to mess with the Python client)

The last thing I had to do was to glue this service into the Ticker Plant such that the feed exposed it's cache so the service could bind() it to the Broker. Not bad at all, and very slick. Really nice day today.