Skip to content

Commit

Permalink
Merge pull request #2423 from kamil-certat/fix_not_connected_error
Browse files Browse the repository at this point in the history
Fix not connected error in STOMP output
  • Loading branch information
sebix authored Nov 29, 2023
2 parents ed79116 + 67699b7 commit 552d7ce
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 @@ -84,6 +84,8 @@
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 552d7ce

Please sign in to comment.