Add AuditEvents::Streaming::EnqueueService producer seam

What does this MR do and why?

Add AuditEvents::Streaming::EnqueueService producer seam

Route audit event streaming through a single EnqueueService instead of calling AuditEventStreamingWorker.perform_async directly.

  • Publishes to NATS JetStream (partitioned subject) when Gitlab::Nats is enabled and the audit_event_streaming_via_nats flag is on for the root group; any publish failure falls back to the existing Sidekiq path, preserving at-least-once delivery.
  • Generates a stable stream_id once at enqueue time (carried in the payload) so every destination and transport observes the same ID.
  • Carries namespace-ancestor fields in the payload so the consumer can evaluate namespace filters without a Postgres lookup.

The NATS consumer and batched dispatch that read these messages are added in later changes; until then the Sidekiq fallback is the only live path.

Part of epic - &17582

Related to - #604452 (closed)

References

Screenshots or screen recordings

Before After

How to set up and validate locally

MR acceptance checklist

Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Merge request reports

Loading