Skip to content

Commit 552d7ce

Browse files
authored
Merge pull request #2423 from kamil-certat/fix_not_connected_error
Fix not connected error in STOMP output
2 parents ed79116 + 67699b7 commit 552d7ce

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,8 @@
8484
of necessary file(s)).
8585
- Add `stomp.py` version check (raise `MissingDependencyError` if not `>=4.1.12`).
8686
- Minor fixes/improvements and some refactoring (see also above: *Core*...).
87+
- `intelmq.bots.outputs.stomp.output` (PR#2423 by Kamil Mankowski):
88+
- Try to reconnect on `NotConnectedException`.
8789

8890
### Documentation
8991
- Add a readthedocs configuration file to fix the build fail (PR#2403 by Sebastian Wagner).

intelmq/bots/outputs/stomp/output.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,12 @@ def process(self):
7676

7777
body = self.export_event(event)
7878

79-
self._conn.send(body=body,
80-
destination=self.exchange)
79+
try:
80+
self._conn.send(body=body, destination=self.exchange)
81+
except stomp.exception.NotConnectedException:
82+
self.logger.warning("Detected connection error, trying to reestablish it.")
83+
self.connect()
84+
raise # Fallback to default retry
8185
self.acknowledge_message()
8286

8387
@classmethod

0 commit comments

Comments
 (0)