juntossomosmais / django-outbox-pattern

A django application to make it easier to use the transactional outbox pattern
MIT License
50 stars 7 forks source link

feat: add stop param to method save #43

Open hugobrilhante opened 7 months ago

hugobrilhante commented 7 months ago

Sometimes you need to update an instance of a model decorated with @publish, but you don't want a new message to be published on the broker.

An example, which may serve as a guideline to understand the motivation behind this new feature, would be updating the status of an order when it reaches its final stage:

order = Order.objects.get(order_id=order_id)
order.status = 'Confirmed'
order.save(stop=True)

In this example, by using stop=True when calling the save method, the message publication on the broker is halted, allowing the update of the order status without triggering a new publication message.

This pull request also incorporates the changes from the fix in pull request PR #42