See 'Outbox Pattern' in Distributed Systems. Uses a local transaction to ensure event reliability.
Writing the event to a SQL table in the same transaction as the business entity.
class TransactionalOutboxPattern:\n def __init__(self):\n pass\n\n def execute(self):\n print('Executing Transactional Outbox Pattern')