Skip to content

test: add per-event retry/backoff examples for framework#1529 - #138

Merged
hwbrzzl merged 3 commits into
masterfrom
bowen/test-pr-1529-broadcast-retry
Aug 3, 2026
Merged

test: add per-event retry/backoff examples for framework#1529#138
hwbrzzl merged 3 commits into
masterfrom
bowen/test-pr-1529-broadcast-retry

Conversation

@goravel-coder

@goravel-coder goravel-coder commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Queued broadcasts can declare a per-event retry policy: BroadcastTries() sets the max attempts and BroadcastBackoff() sets the delay before each retry, overriding the queue worker's global tries
  • Public, private, and presence dispatch now accept the same queue options — queue name, queue connection, delay, timeout, tries/backoff — wired through the demo pages and forwarded to the dispatched event
  • dispatchPublic now honors should_fire instead of always dispatching, and feature tests pin queue-option forwarding for public/presence channels plus the should_fire=false skip path

Why

This example PR covers goravel/framework#1529, which lets each queued broadcast event opt into its own queue policy instead of inheriting the queue worker's globals. TeamPresenceBroadcast now implements all seven optional broadcast interfaces (BroadcastQueue, BroadcastConnections, BroadcastQueueConnection, BroadcastDelay, BroadcastTimeout, BroadcastTries, BroadcastBackoff), and the dispatch controller shares a single queueOptions() helper so public and presence dispatches forward the same options the private path already did. The demo pages no longer restrict tries/backoff to the private channel, so every channel type can be configured from the UI.

Previously dispatchPublic hardcoded ShouldFire: true and only the private path forwarded queue options, so public/presence broadcasts couldn't be skipped or tuned per event. dispatchPublic now honors should_fire (with a negative-path test asserting nothing is queued), and the feature tests assert dispatch-time serialization for the new forwarding:

// app/http/controllers/broadcast_controller.go
// dispatchPublic now honors should_fire and forwards the same queue
// options as the private path.
err := facades.Broadcast().Dispatch(context.Background(), &events.OrderShippedBroadcast{
	ChannelType:        "public",
	OrderData:          req.OrderData,
	ShouldFire:         req.ShouldFire,
	QueueName:          req.QueueName,
	Conns:              req.Conns,
	QueueConn:          req.QueueConn,
	DelayedAt:          delayedAt,
	Timeout:            timeout,
	Tries:              tries,
	Backoff:            backoff,
	ShouldBroadcastNow: req.BroadcastNow,
	ChannelName:        req.Channel,
})

Note on dependencies: the framework is pinned to the PR-head pseudo-version v1.18.1-0.20260802085640-2aa82fd133a7 (resolves refs/pull/1529/head), since per-event retry/backoff is only available on the unreleased framework PR head. This should be swapped for a tagged release once goravel/framework#1529 merges; it also brings transitive bumps (grpc 1.82.1, mimetype 1.4.15, go-runewidth 0.0.27, golang.org/x/exp pseudo-version).

@goravel-coder
goravel-coder requested a review from a team as a code owner August 2, 2026 10:34
@hwbrzzl
hwbrzzl merged commit ed487aa into master Aug 3, 2026
9 checks passed
@hwbrzzl
hwbrzzl deleted the bowen/test-pr-1529-broadcast-retry branch August 3, 2026 07:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants