aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVijay Venkatesh Kumar <vv770d@att.com>2022-10-19 15:25:42 +0000
committerVijay Venkatesh Kumar <vv770d@att.com>2022-11-09 15:48:16 +0000
commit5ff6313aa7fc5c087ee8cd922e6c23b55d8b8213 (patch)
tree4aee6630c4d06e279b42c91f76378df405c3a9c4
parentbe9bed4d80105e87cf2209c2cf945b5f84442485 (diff)
Handle MR connection error
Change-Id: I8defdd65093d19d4255427a8c7961cf5249007b8 Signed-off-by: Vijay Venkatesh Kumar <vv770d@att.com> Issue-ID: DCAEGEN2-2952 Signed-off-by: Vijay Venkatesh Kumar <vv770d@att.com> (cherry picked from commit 462cee04e5d952f544a8300dc5a0d1e297482e3f)
-rw-r--r--Changelog.md3
-rw-r--r--miss_htbt_service/htbtworker.py11
-rw-r--r--pom.xml2
-rw-r--r--setup.py2
-rw-r--r--version.properties4
5 files changed, 15 insertions, 7 deletions
diff --git a/Changelog.md b/Changelog.md
index f58fc8c..4631560 100644
--- a/Changelog.md
+++ b/Changelog.md
@@ -4,6 +4,9 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).
+## [2.5.0] - 2022/10/19
+- [DCAEGEN2-2952] Handle exception when MR is unavailable
+
## [2.4.1] - 2022/09/23
- [DCAEGEN2-2837] Heartbeat ms: remove unnecessary parenthesis, use lowercase variable name
- [DCAEGEN2-3268] Fix cryptography version to 37.0.4
diff --git a/miss_htbt_service/htbtworker.py b/miss_htbt_service/htbtworker.py
index ac7a0d9..0d43533 100644
--- a/miss_htbt_service/htbtworker.py
+++ b/miss_htbt_service/htbtworker.py
@@ -98,9 +98,14 @@ def process_msg(jsfile, user_name, password, ip_address, port_num, db_name):
i = 0
break
else:
- res = requests.get(get_url)
- msg = "HBT:", res.text
- _logger.info(msg)
+ try:
+ res = requests.get(get_url)
+ except Exception as e:
+ # message-router may be down temporarily. continue polling loop to try again
+ _logger.error('HBT: Failed to fetch messages from DMaaP. get_url=%s', get_url, exc_info=e)
+ time.sleep(1)
+ continue
+ _logger.info("HBT: %s", res.text)
input_string = res.text
# If mrstatus in message body indicates some information, not json msg.
if "mrstatus" in input_string:
diff --git a/pom.xml b/pom.xml
index 2f6390e..fbf5c20 100644
--- a/pom.xml
+++ b/pom.xml
@@ -37,7 +37,7 @@ limitations under the License.
<groupId>org.onap.dcaegen2.services</groupId>
<artifactId>heartbeat</artifactId>
<name>dcaegen2-services-heartbeat</name>
- <version>2.4.1</version>
+ <version>2.5.0</version>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<sonar.sources>.</sonar.sources>
diff --git a/setup.py b/setup.py
index 2fada3f..2104015 100644
--- a/setup.py
+++ b/setup.py
@@ -20,7 +20,7 @@ from setuptools import setup, find_packages
setup(
name="miss_htbt_service",
description="Missing heartbeat microservice to communicate with policy-engine",
- version="2.4.1",
+ version="2.5.0",
# packages=find_packages(exclude=["tests.*", "tests"]),
packages=find_packages(),
install_requires=[
diff --git a/version.properties b/version.properties
index a88b650..6c69733 100644
--- a/version.properties
+++ b/version.properties
@@ -1,6 +1,6 @@
major=2
-minor=4
-patch=1
+minor=5
+patch=0
base_version=${major}.${minor}.${patch}
release_version=${base_version}
snapshot_version=${base_version}-SNAPSHOT