diff options
author | Jack Lucas <jflucas@research.att.com> | 2019-07-19 09:10:01 -0400 |
---|---|---|
committer | Jack Lucas <jflucas@research.att.com> | 2019-07-19 15:26:46 -0400 |
commit | 556b233513db587f5d3982628dbca200fd3a9e2a (patch) | |
tree | 29aa301c39b7ce51bbbad972482db3b9ab730dee /dmaap/dmaapplugin/mr_lifecycle.py | |
parent | 2aa97d09d9fc97a1562a3e3ac966bd48130086a4 (diff) |
DMaaP add support for useExisting
Issue-ID: DCAEGEN2-1670
Signed-off-by: Jack Lucas <jflucas@research.att.com>
Change-Id: I0a945117b7f4084191245ea56af2712b2cd20d4c
Diffstat (limited to 'dmaap/dmaapplugin/mr_lifecycle.py')
-rw-r--r-- | dmaap/dmaapplugin/mr_lifecycle.py | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/dmaap/dmaapplugin/mr_lifecycle.py b/dmaap/dmaapplugin/mr_lifecycle.py index a4f04ec..ec674de 100644 --- a/dmaap/dmaapplugin/mr_lifecycle.py +++ b/dmaap/dmaapplugin/mr_lifecycle.py @@ -28,12 +28,14 @@ from dmaapcontrollerif.dmaap_requests import DMaaPControllerHandle def create_topic(**kwargs): ''' Creates a message router topic. - Allows 'topic_name', 'topic_description', 'txenable', 'replication_case', - and 'global_mr_url' as optional node properties. If 'topic_name' is not set, + Allows 'topic_name', 'topic_description', 'txenable', 'replication_case', 'global_mr_url', + and 'useExisting' as optional node properties. If 'topic_name' is not set, generates a random one. Sets 'fqtn' in the instance runtime_properties. Note that 'txenable' is a Message Router flag indicating whether transactions are enabled on the topic. + Note that 'useExisting' is a flag indicating whether DBCL will use existing topic if + the topic already exists. ''' try: # Make sure there's a topic_name @@ -66,11 +68,15 @@ def create_topic(**kwargs): else: global_mr_url = None + if "useExisting" in ctx.node.properties: + useExisting = ctx.node.properties["useExisting"] + else: + useExisting = False # Make the request to the controller dmc = DMaaPControllerHandle(DMAAP_API_URL, DMAAP_USER, DMAAP_PASS, ctx.logger) ctx.logger.info("Attempting to create topic name {0}".format(topic_name)) - t = dmc.create_topic(topic_name, topic_description, txenable, DMAAP_OWNER, replication_case, global_mr_url) + t = dmc.create_topic(topic_name, topic_description, txenable, DMAAP_OWNER, replication_case, global_mr_url, useExisting) t.raise_for_status() # Capture important properties from the result |