IngressMount:subscribe
methodIngressMount:subscribe(opts: IngressMount.SubscribeOptions) -> SubscriptionSubscribe to the channel behind this handle. The callback fires with each authenticated record. Returns a subscription; call :unsubscribe() to stop it. Records that are not authenticated for the channel, or that fail decryption, are dropped silently. Delivery starts once the subscription has joined the channel, usually within a second; a record pushed before that may not arrive.
local sub = orders:subscribe({
callback = function(record)
local order = record.payload:json()
print(record.channel, order.id)
end,
})opts IngressMount.SubscribeOptions options 2 keys
| Key | Type | Default | Description |
|---|---|---|---|
| channel | string | the mount's default channel | Sub-channel selector, when the mount carries several streams. |
| callback required | fun(event: IngressEvent) | no default | Invoked with each authenticated record. Duplicates (by the source's idempotency key) are collapsed before delivery. |