Skip to content

ADR 0015 — Azure Service Bus subscription triggers

Status: Accepted (option C implemented)
Date: 2026-08-14
Related: #127, ADR 0013, Egress Azure Service Bus, Egress RabbitMQ


Context

Azure Logic Apps and BizTalk often start a flow when a Service Bus subscription delivers a message (peek-lock), then complete that message later in the graph.

MeshFlows already had:

Path What exists
Mid-flow egress.azure.servicebus.subscription.receive (peek-lock) + .complete / .abandon / .dead_letter as service_call steps
Platform bus RabbitMQ AMQP triggers (rabbitmq-trigger-subscriber) with subscriber-owned ACK after a synchronous Orchestrator invoke (ADR 0013)

Peek-lock tokens for mid-flow complete are held in-process on egress-azure-servicebus (replicas: 1). That is acceptable for step-level receive/complete; it is not a substitute for a trigger subscriber.


Decision

Option C: dedicated trigger subscriber, same image as egress-azure-servicebus, mirroring rabbitmq-trigger-subscriber.

AMQP Azure Service Bus (this ADR)
Image egress-rabbitmq egress-azure-servicebus
Deployment rabbitmq-trigger-subscriber azure-servicebus-trigger-subscriber
Enable env RABBITMQ_TRIGGER_ENABLED SERVICEBUS_TRIGGER_ENABLED
Invoke POST /invoke/amqp POST /invoke/azure-servicebus
Dispatch POST /invoke/amqp/dispatch POST /invoke/azure-servicebus/dispatch
Start contract invocation.type: amqp invocation.type: azure_servicebus
Settle ACK after 2xx, NACK on error Peek-lock complete on 2xx, abandon on failure, dead-letter after N

Orchestrator does not import the Azure SDK. The subscriber owns settle on the trigger path (ADR 0013). Mid-flow .complete stays for Logic Apps-style graphs that receive inside the workflow.

Rejected:

  • A — polling loop inside the egress HTTP process (mixes short service_call with a long receiver).
  • B — Event Grid / Function → HTTP (not peek-lock).
  • D — Orchestrator pull loop (vendor SDK in orchestrator; forbidden by the capability-provider contract).

Implementation

  • Deployment: engine/deploy/k8s/azure-servicebus-trigger-subscriber-deployment.yaml
  • Same image as egress via kustomize replacements + align_trigger_subscriber: azure-servicebus-trigger-subscriber
  • Env: SERVICEBUS_TRIGGER_TOPIC, SERVICEBUS_TRIGGER_SUBSCRIPTION, optional SERVICEBUS_TRIGGER_WORKFLOW (empty → dispatch)
  • Idle until topic + subscription and SAS connection string or workload identity FQNS are set
  • Demo: flows/triggers/azure-servicebus-topic-trigger.yaml → azure_servicebus_topic_trigger_demo (no mid-flow complete)

Queues, sessions, and deferred messages remain out of scope. Service Bus MSI is ADR 0012.


Consequences

  • Two settle models, as ADR 0013 already sketched:
  • Trigger path: subscriber completes/abandons after sync invoke (no complete step in the workflow).
  • Mid-flow path: workflow calls subscription.receive then later subscription.complete (lock token on the egress replica).
  • Native SB is a connector, not a replacement for meshflows.events.
  • egress-azure-servicebus stays replicas: 1 while mid-flow lock tokens are in-process. Trigger workers do not share that store.
  • Logic Apps import can map peek-lock triggers to invocation.type: azure_servicebus once that converter slice is built.