Events get published in running transaction

Events are published inside the running transaction, this leads to false notifications if transaction is rolled back.