Skip to content
Dashboard
Theme
Theme

Ordering and setup status

How to process directory events in order using the sequence number, and the setup status of a directory, which may be configured before SSO is active.

View Markdown

Maintain a durable cursor per environment for the Events API and an applied sequence per directory for directory events. They solve different problems: the event cursor traverses the dispatch stream; sequence orders one directory’s changes.

For each directory, apply an unseen event only after its expected predecessor. Store its effects, event ID and sequence in the same application transaction. Ignore duplicates whose effects are already committed. Do not advance the sequence for an event you failed to apply.

If a later sequence arrives first, hold it and catch up from the Events API. Webhook retries can reorder delivery. For a new consumer, reconcile current directory users and groups and establish a durable processing checkpoint using your application’s reconciliation strategy. Do not interpret the first sequence you happen to receive as proof that no earlier events exist.

The Events API lists oldest first by dispatch position and uses the last event ID as its forward cursor. Use that cursor rather than sorting IDs or timestamps yourself.

A directory can receive SCIM requests before an SSO connection is active. First request, directory activation and connection activation are separate facts. The portal context lists steps such as create_directory, first_scim_request, test_sign_in and activate_connection; use those statuses rather than treating directory traffic as proof of SSO readiness.