Models API

This module contains the database models used by Django Dispatch.

OutboxEvent

class django_broadcaster.models.OutboxEvent(*args, **kwargs)[source]

Bases: Model

Stores events to be published following the outbox pattern. Compatible with CloudEvents specification.

__init__(*args, **kwargs)
__str__()[source]

Return str(self).

to_cloud_event() Dict[str, Any][source]

Convert to CloudEvents format

mark_as_published()[source]

Mark event as successfully published

mark_as_failed(error_message: str)[source]

Mark event as failed with error details

increment_retry(error_message: str = '')[source]

Increment retry count and handle retry logic

exception DoesNotExist

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: MultipleObjectsReturned

created_at

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

data

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

data_content_type

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

data_schema

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

event_type

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

get_next_by_created_at(*, field=<django.db.models.fields.DateTimeField: created_at>, is_next=True, **kwargs)
get_next_by_scheduled_at(*, field=<django.db.models.fields.DateTimeField: scheduled_at>, is_next=True, **kwargs)
get_next_by_updated_at(*, field=<django.db.models.fields.DateTimeField: updated_at>, is_next=True, **kwargs)
get_previous_by_created_at(*, field=<django.db.models.fields.DateTimeField: created_at>, is_next=False, **kwargs)
get_previous_by_scheduled_at(*, field=<django.db.models.fields.DateTimeField: scheduled_at>, is_next=False, **kwargs)
get_previous_by_updated_at(*, field=<django.db.models.fields.DateTimeField: updated_at>, is_next=False, **kwargs)
get_status_display(*, field=<django.db.models.fields.CharField: status>)
id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

increment_retry(error_message: str = '')[source]

Increment retry count and handle retry logic

last_error

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

mark_as_failed(error_message: str)[source]

Mark event as failed with error details

mark_as_published()[source]

Mark event as successfully published

max_retries

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

objects = <django.db.models.manager.Manager object>
published_at

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

publisher_backend

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

publisher_config

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

retry_count

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

scheduled_at

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

source

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

spec_version

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

status

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

subject

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

to_cloud_event() Dict[str, Any][source]

Convert to CloudEvents format

updated_at

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

OutboxEventStatus

class django_broadcaster.models.OutboxEventStatus(value)[source]

Bases: TextChoices

FAILED = 'failed'
PENDING = 'pending'
PROCESSING = 'processing'
PUBLISHED = 'published'
RETRY = 'retry'