liveapicreator-admin-cli
Version:
The NodeJS command line utility for 'CA Live API Creator' DevOps Administration from CA Technologies
22 lines • 2.53 kB
JSON
[
{
"name": "Startup",
"description": "Listener provider for server startup - each listener is executed once when the Live API Creator war starts up. Note that, in a cluster, each cluster node will execute its own instance.",
"is_active": true,
"must_have_connection": false,
"startup_code": "out.println(\"Server Startup listener provider now starting\");\n",
"shutdown_code": "",
"test_connection_code": "",
"start_connection_code": "",
"stop_connection_code": "",
"start_listener_code": "out.println(\"Executing startup listener: \" + listener.name);\nlistener.executor.execute(allVars);\nreturn {};\n",
"stop_listener_code": "",
"publish_message_code": "",
"listener_documentation": "<h3>Startup Listeners</h3>A <em>startup listener</em> is a piece of code that gets executed any time a Live API Creator\nserver starts up.\n<p/>\nMore technically, it gets executed any time the WAR file for Live API Creator is started\nor restarted.\n<p/>\nYou can create a startup listener and have it execute any JavaScript code. Typical\nexamples might be:\n<ul>\n<li>retrieving configuration parameters from an outside source, such as a file or a\nservice such as Consul.\n<li>notifying an outside service that this Live API Creator server is starting\n<li>starting a background thread to monitor a directory for new files\n</ul>\nIf you define a startup listener, you may consider defining a corresponding shutdown\nlistener if you need to clean up any resources when Live API Creator shuts down.\n<p/>\nA listener's code will have access to the following pre-defined variables:\n<ul>\n<li><code>env</code>: the environment for the listener.\n</ul>\n",
"connection_documentation": "",
"code_completion_code": "return {\n};\n",
"code_example_code": "return {\n examples: [\n {\n name: \"Registering with an external service\",\n code: \"<div id='ExampleDiv'><h3>Calling an external registration</h3>A startup listener can be used for a variety of purposes, but a common one is to register the newly-up server with some sort of external registry, perhaps something like Consul.<p/>\\n<pre>// This is only a very generic example\\nvar json = listenerUtil.restPost(\\n 'https://consul.rocks/v1/agent/members',\\n {},\\n {headers:\\n {\\\"X-Consul-Token\\\": \\\"abcd1234\\\"}\\n },\\n {name: listenerUtil.getHostName()}\\n);</pre></div>\"\n }\n ]\n};\n",
"ConnectionParameterTypes": [],
"ListenerParameterTypes": []
}
]