v4.27.4: Publishes queue on transaction commit
Ensures background queue messages are only published to the broker when the outermost database transaction commits successfully. This is achieved by tracking the transaction nesting level and publishing the queue only when the level returns to zero.