On 18/02/15 00:42, Nicolas Cadou wrote:
Hi Nicolas,
So my question is: any of you has pointers to some useful info on the
subject?
First thing is - try to get around it by not sharing environments. This
is the easiest thing and will save the most time. Just have multiple
environments. If needed, each can be sharing information using
publish/subscribe:
https://zato.io/docs/pubsub/index.html
Next, if you are sure you want to keep it all shared, you need to have
versioning on both major layers:
- Services need to be versioned
- Same thing with the data model
On top of it, you can consider making use of two new features in 2.0:
- Invocation targets
- Request filtering
https://zato.io/docs/admin/guide/install-config/config-server.html#invoke-target-patterns-allowed
https://zato.io/docs/progguide/service-dev.html#progguide-write-service-accept
The idea with invocation targets is that you can use self.invoke and
self.invoke_async as usual and along with the basic parameters you can
give it a list of targets (servers) to invoke the service on.
Let’s say you have three servers:
Moon1 and Moon2 have the ‘moon’ target assigned while Jupter1 does not.
Now doing something like:
self.invoke_async(‘myservice@moon’, My Request’)
Will make the request go to one of Moon1 or Moon2. It’s guaranteed
myservice1 on Jupiter1 won’t see it.
Request filtering lets you discard a message before ‘def handle’ is called.
For instance:
class MyService(Service):
def accept(self):
if some_condition:
return False
it
def handle(self):
# We reach here only if self.accept didn’t return False
That all said, why is there a requirement to share the environment(s)?
If I picture it correctly, each actual client, each branch, will connect
to servers in their own branch so why cannot they simply have their own
environments?
The environments wouldn’t have to be completely separated, various
business data would still be shared from a central DB, if applicable.
It would be good if we could go through a couple of use-cases - I’m
still not 100% sure I understand why it needs to be shared if there is
already a question how to make them not share things.
thanks,