|
As you might guess, for
pmnc.the_system.execute(...)
to work, module the_system.py must exist somewhere within the cage. It
indeed should be present in modules/the_system.py. The contents of the
module is predetermined and you need not to modify it. But to bring the
module to existence you must. This is the first thing you do to set up
a connection to another external system - copy _static/connection_template.py
to modules/the_system.py
Once the module is in place, the reference to its execute method becomes
resolvable, but what external system does it refer to ? No way to tell unless
you configure it. And this therefore is the second and the last step to create
a new connection - edit the config/config_connections.py to include the new
connection. Excerpt from config/config_connections.py (see the file for real
samples):
from foo_connection import FooConnection
def config_dynamic(config):
config.set("the_system.connection", FooConnection)
config.set("the_system.connection.0.first_argument", "aaa")
config.set("the_system.connection.1.second_argument", "bbb")
...
config.set("the_system.timeout", 30.0)
config.set("the_system.pool_size", 4)
This way you specify the class for the connection adapter, a set of arguments
passed to its constructor and the timeout and the pool size.
Once you do this, the connection pool is ready to use.
One other thing to mention is that the configuration file config_connections.py
is reloadable (just like all the other configuration files), but what happens if
you modify and save the settings for an external system connection ? Upon the
next call to execute the change is detected, all the existing connections are
disconnected, one is reconnected with the new settings and the execute call
proceeds with the new settings. There appears to be a noticeable hiccup when
this happens, but no calls are lost or failed in transition.
|
Features Download Documentation Tutorial |