diff --git a/LCS/Messaging/python/messaging/messages.py b/LCS/Messaging/python/messaging/messages.py index 99b8a1e8b41a22deb590fddb42bb94839730f8bd..50bbf9e23d809323796d4ea3d1f9db5f950bd4e6 100644 --- a/LCS/Messaging/python/messaging/messages.py +++ b/LCS/Messaging/python/messaging/messages.py @@ -59,7 +59,7 @@ class LofarMessage: self.content = content self.subject = subject 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) def as_kombu_publish_kwargs(self): @@ -75,7 +75,9 @@ class LofarMessage: } 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