diff --git a/dj_cqrs/transport/mixins.py b/dj_cqrs/transport/mixins.py index 8c76c07..fa34157 100644 --- a/dj_cqrs/transport/mixins.py +++ b/dj_cqrs/transport/mixins.py @@ -28,7 +28,7 @@ def log_consumed_denied(payload): :param dj_cqrs.dataclasses.TransportPayload payload: Transport payload from master model. """ if payload.pk: - logger.info('CQRS is denied: pk = {} ({}).'.format(payload.pk, payload.cqrs_id)) + logger.warning('CQRS is denied: pk = {} ({}).'.format(payload.pk, payload.cqrs_id)) @staticmethod def log_produced(payload): diff --git a/dj_cqrs/transport/rabbit_mq.py b/dj_cqrs/transport/rabbit_mq.py index 7249df5..7d19c68 100644 --- a/dj_cqrs/transport/rabbit_mq.py +++ b/dj_cqrs/transport/rabbit_mq.py @@ -99,7 +99,7 @@ def _consume_message(cls, ch, method, properties, body): ch.basic_ack(delivery_tag=method.delivery_tag) cls.log_consumed_accepted(payload) else: - ch.basic_nack(delivery_tag=method.delivery_tag, requeue=False) + ch.basic_nack(delivery_tag=method.delivery_tag) cls.log_consumed_denied(payload) @classmethod @@ -111,7 +111,11 @@ def _produce_message(cls, channel, exchange, payload): routing_key=routing_key, body=ujson.dumps(payload.to_dict()), mandatory=True, - properties=BasicProperties(content_type='text/plain', delivery_mode=2) + properties=BasicProperties( + content_type='text/plain', + delivery_mode=2, # make message persistent + expiration='60000', # milliseconds + ) ) @staticmethod