Skip to content
Snippets Groups Projects
Commit 488c9ab5 authored by Jorrit Schaap's avatar Jorrit Schaap
Browse files

SW-957: by default, expire message after 5 days

parent 5a773150
No related branches found
No related tags found
No related merge requests found
...@@ -59,7 +59,7 @@ class LofarMessage: ...@@ -59,7 +59,7 @@ class LofarMessage:
self.content = content self.content = content
self.subject = subject self.subject = subject
self.priority = priority self.priority = priority
self.ttl = ttl if ttl is not None else 5*24*60*60 # by default, expire message after 5 days. self.ttl = ttl if ttl is not None else 5*24*60*60 # by default, expire message after 5 days.
self.id = uuid.uuid4() if id is None else uuid.UUID(id) self.id = uuid.uuid4() if id is None else uuid.UUID(id)
def as_kombu_publish_kwargs(self): def as_kombu_publish_kwargs(self):
...@@ -75,7 +75,9 @@ class LofarMessage: ...@@ -75,7 +75,9 @@ class LofarMessage:
} }
if self.ttl: if self.ttl:
publish_kwargs['expiration'] = self.ttl # https://www.rabbitmq.com/ttl.html#per-message-ttl-in-publishers
# Since the expiration field must be a string, the broker will (only) accept the string representation of the number.
publish_kwargs['expiration'] = str(self.ttl)
return publish_kwargs return publish_kwargs
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment