Skip to content

Commit

Permalink
Merge branch 'fix_not_connected_error' into test_stomp
Browse files Browse the repository at this point in the history
  • Loading branch information
kamil-certat committed Nov 14, 2023
2 parents 8a81068 + 1cd6eec commit f62c76b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ CHANGELOG
of necessary file(s)).
- Add `stomp.py` version check (raise `MissingDependencyError` if not `>=4.1.12`).
- Minor fixes/improvements and some refactoring (see also above: *Core*...).
- `intelmq.bots.outputs.stomp.output` (PR#2423 by Kamil Mankowski):
- Try to reconnect on `NotConnectedException`.

### Documentation
- Add a readthedocs configuration file to fix the build fail (PR#2403 by Sebastian Wagner).
Expand Down
8 changes: 6 additions & 2 deletions intelmq/bots/outputs/stomp/output.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,12 @@ def process(self):

body = self.export_event(event)

self._conn.send(body=body,
destination=self.exchange)
try:
self._conn.send(body=body, destination=self.exchange)
except stomp.exception.NotConnectedException:
self.logger.warning("Detected connection error, trying to reestablish it.")
self.connect()
raise # Fallback to default retry
self.acknowledge_message()

@classmethod
Expand Down

0 comments on commit f62c76b

Please sign in to comment.