zatosource/zato — Issue #3: Class-level service attributes read from the key/value DB
Author: dsuch
Created: 2011-11-10 01:09:35+00:00
State: open

The idea is to enrich each of the services with class-level attributes read from the key/value DB when the service is being (re-)deployed.

For instance, if there's a service my.Foo living in a Python class my.awesome.Foo then if there's a Redis key along the lines of 'zato:service:attrs:my.Foo' and it contains a dictionary of {'bar':'BAR', 'baz':'BAZ'} then the class will be given this dictionary's items so in the runtime it will look as though it had always attributes like below from the very beginning:

# skip imports

class Foo(Service):
bar = 'BAR'
baz = 'BAZ'

The purpose of it is to make users not hardcode these values directly in the service's code as changing it would otherwise require a redeployment. This way a service may be running just fine and its configuration be updated externally if need be.