| 252 | |
| 253 | @classmethod |
| 254 | def delete(cls, model_object, publish=True, dispatch_trigger=True): |
| 255 | persisted_object = cls._get_impl().delete(model_object) |
| 256 | |
| 257 | # Publish internal event on the message bus |
| 258 | if publish: |
| 259 | try: |
| 260 | cls.publish_delete(model_object) |
| 261 | except Exception: |
| 262 | LOG.exception("Publish failed.") |
| 263 | |
| 264 | # Dispatch trigger |
| 265 | if dispatch_trigger: |
| 266 | try: |
| 267 | cls.dispatch_delete_trigger(model_object) |
| 268 | except Exception: |
| 269 | LOG.exception("Trigger dispatch failed.") |
| 270 | |
| 271 | return persisted_object |
| 272 | |
| 273 | #################################################### |
| 274 | # Internal event bus message publish related methods |