04-13-2021 01:00 PM
I'm looking to implement the reactive fastmap pattern by having a vpn service request a vpn id. I understand the high level concept of writing and reading operational data and having a CDB subscriber to re-deploy the service once the id has been allocated. What I'm struggling with is wrapping my head around how to actually implement the CDB subscriber to do this as the documentation seem to lack any clear information, or I'm not looking in the right place.
I've mainly looked at the example opercdbsub.py in getting-started/1-dcb-py but the code is difficult to read and understand. Comments refer to a Java project and most methods have variables with no information about what they mean and what I can expect from them (for example "kp", "op", "state" among others). The diff iteration seems to be a core part of the subscriber but I have no clue when or how it's being called, what's passed to it and what I'm supposed to do within it.
The Python API docs for OperSubscriber and Subscriber is rather thin on information as well. Constructor parameters aren't explained at all (for example "app", "name" and "subtype") and the docstrings for methods like "run" and "register" simply words the method name differently while not providing much additional information. Is one of them where I would implement the code to allocate my vpn id?
I don't have very deep knowledge with low level CDB and how it operates, is this necessary to create a CDB subscriber?
Is there a more simple and explanatory example of a CDB subscriber or some other guide on how to build one in python available?
Thanks
Solved! Go to Solution.
04-14-2021 12:21 PM
ncs-make-package can actually add an example python subscriber to your code
ncs-make-package --help
Usage: ncs-make-package [options] package-name
ncs-make-package --service-skeleton TYPE package-name
where TYPE is one of:
python Python based service
python-and-template Python service with template
PYTHON specific options:
--subscriber-example
04-14-2021 12:21 PM
ncs-make-package can actually add an example python subscriber to your code
ncs-make-package --help
Usage: ncs-make-package [options] package-name
ncs-make-package --service-skeleton TYPE package-name
where TYPE is one of:
python Python based service
python-and-template Python service with template
PYTHON specific options:
--subscriber-example
04-14-2021 12:23 PM
But a shameless plug (written by me), there is an simple example package on the developer hub that you can use or at least get some ideas from
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide