v3.4.0
Version 3.4.0 - Minor Release
A consolidated release that lands twenty features from the roadmap across
retry/DLQ, delayed/typed/schema messaging, production infrastructure,
workflows/testing, and scale/interop -- all fully backwards-compatible and
verified on PHP 7.3 through 8.5.
No migration required. Every new feature is opt-in; existing publish/consume
code, handler signatures, and config layouts continue to work unchanged.
Compatibility
- PHP: 7.3 through 8.5
- Laravel: 8.x through 13.x (Lumen 8.x+)
- PHPUnit:
^9.6on PHP 7.3/7.4;^10.5|^11.5|^12.0on PHP 8.0+ - New
scripts/check-php73-compat.php(curated) and
scripts/check-php73-compat-all-src.php(entiresrc/) using
nikic/php-parser— every file undersrc/parses as PHP 7.3.
Retry, Delayed, Typed & Schema Messaging
-
Advanced retry & dead-letter abstractions
Bschmitt\Amqp\Support\RetryPolicyvalue object with
fixed()/exponential()/immediate()/none()factories and
configurablemaxDelayMscap +jitterMs.DeadLetterTopologybuilder generates property bags for the work
queue, DLQ, and per-delay retry queues ({queue}.retry.{ms}).RetryHandlerdecorator wraps any callable with the full
republish-or-reject pipeline (tracksx-retry-attempt,
x-first-failed-at, andx-last-errorheaders).Amqp::declareRetryTopology(),retryHandler(),
consumeWithRetry(),topology().amqp:workgains--retry,--retry-backoff,--retry-delay,
--retry-multiplier,--retry-max-delay,--retry-jitter,
--dlq, and--declare-topology.
-
Delayed messaging & publisher backoff
Bschmitt\Amqp\Support\DelayedPublisherwith two strategies:
ttl(default, TTL+DLX per-delay queue — works on stock RabbitMQ)
andplugin(rabbitmq-delayed-message-exchange).Amqp::publishLater(),publishTypedLater(),
delayedPublisher().PublishBackoffwraps any publish closure with aRetryPolicy,
exposed viaAmqp::withPublishBackoff().amqp:publishgains--delay-msand--delay-strategy=ttl|plugin.
-
Typed message contracts & DTO serialization
Bschmitt\Amqp\Contracts\MessageContractInterfaceand the
optionalTypedMessagebase class (reflection-driven defaults plus
routingKey(),exchange(),schema()hooks).MessageSerializerInterfacestrategy; default is
JsonMessageSerializer(JSON_THROW_ON_ERROR, unicode/slash-safe).Amqp::publishTyped(),publishTypedLater(),consumeTyped(),
setSerializer(),getSerializer().amqp:work --contract=deserializes inbound bodies and passes the
DTO as a third handler argument (the existing two-argument signature
keeps working — the new arg defaults tonull).
-
JSON Schema validation for messages
- Zero-dependency
Bschmitt\Amqp\Support\SchemaValidator
implementing a Draft 7 subset (types,required,properties,
additionalProperties, string/number/array constraints,enum,
const,oneOf/anyOf/allOf/not, commonformats). SchemaValidationExceptioncarrieserrors()with JSON-pointer
paths.- Schema validation runs automatically on publish/consume whenever a
contract exposes a non-nullschema(). amqp:work --validate-schemaenforces in long-running workers.
- Zero-dependency
Production Infrastructure
-
Exchange & topology builders
ExchangeTopologyfluent builder for exchange + multi-queue bindings.Amqp::declareExchangeTopology(),exchangeTopology()shortcut.
-
Quorum & priority queue profiles
QueueProfilepresets:classic(),quorum(),priority(),
quorumWithPriority()withmergeInto()for property bags.
-
Auto reconnect & heartbeat monitoring
ResilientConnectionManagerdecorator with connect retries and
heartbeat staleness detection.Amqp::resilientConnection()factory helper.
-
Connection pooling & persistent channels
ConnectionPoolsingleton viaAmqp::connectionPool()with
persistent key support and optional resilient wrapping.
-
Distributed tracing (W3C, OTel-ready)
TraceContext,TracePropagatorInterface,W3cTracePropagator,
NullTracePropagator,CallbackTracePropagatorfor APM bridges.propagate_traceflag on publish/consume;Amqp::setTracePropagator().
-
Correlation ID propagation
CorrelationContextwithpropagate_correlationintegration on
publish andconsumeWithLifecycle().
-
Consumer lifecycle management
ConsumerLifecyclehooks (starting/stopping/message/error), signal
handlers, andAmqp::consumeWithLifecycle().
Workflows, Events, Middleware & Testing
-
SAGA workflow helpers
Sagabuilder withstep($name, $action, $compensation)and
reverse-order compensations on failure.SagaResultreports succeeded/failed status, per-step results, the
failing step, exception, and which steps were compensated.Amqp::saga($name)shortcut.
-
Laravel events
- New events under
Bschmitt\Amqp\Events\:MessagePublishing,
MessagePublished,MessageReceived,MessageHandled,
MessageFailed. - Dispatched via
Illuminate\Support\Facades\Eventwhen available;
fallback singletonEventDispatcherfor non-Laravel contexts.
- New events under
-
Consume middleware pipeline
ConsumeMiddlewareInterfaceandConsumePipeline.Amqp::consumeWithMiddleware($queue, $handler, $middlewares, $properties).
-
Fake AMQP test driver
Bschmitt\Amqp\Testing\FakeAmqpextendsAmqpwith null
publisher/consumer/factory stubs.- Laravel-style assertions:
assertPublished(),assertNotPublished(),
assertNothingPublished(),assertPublishedCount(). Amqp::fake()swaps the bound singleton (or returns a standalone fake
when no Laravel app is active).
-
Publisher confirms & async publishing
AsyncPublisherwith persistent channel,confirm_select,
onAck()/onNack()callbacks, andflush()/stats().Amqp::asyncPublisher($properties)shortcut.- Leverages existing
Publisherconfirms (publisher_confirms,
wait_for_confirms,waitForConfirms()).
Scale & Interop
-
RPC abstraction helpers
RpcClient+RpcCallResultwith JSON mode and configurable
timeouts.RpcServerauto-reply consumer wrapper.Amqp::rpcClient(),rpcServer().
-
Cross-service / polyglot messaging
InteropEnvelope/InteropMessagewith standard headers
(x-message-type,x-schema-version,x-source-service).Amqp::publishInterop(),consumeInterop().
-
Enhanced observability & queue metrics
MetricsCollectorwithAmqp::metrics()(auto-increment on
publish / consume).QueueMetricsnormalized view of Management API stats.Amqp::queueMetrics(),getQueueStats()alias.
-
High-performance worker optimizations
WorkerOptionspresets (throughput,lowLatency).HighPerformanceWorker,Amqp::consumeOptimized().amqp:work --optimized(prefetch=50 when not overridden).
Tests
- ~130 new unit tests; total 395 unit tests (906 assertions).
- Full suite passes on PHP 8.3 and 8.4; deprecation warnings on 8.4 come
exclusively from the vendored Mockery library and predate this release.
New & Updated Documentation
- New pages:
docs/content/delayed-messaging.mddocs/content/typed-messaging.mddocs/content/schema-validation.mddocs/content/production-features.mddocs/content/workflow-events-testing.mddocs/content/scale-and-interop.md
- Updated
docs/content/advanced.md,publishing.md,consuming.md,
artisan-commands.md,best-practices.md,faq.md,
getting-started.md,guide.md,USER_MANUAL.md,README.md. - New sidebar entries and feature cards in
docs/index.html; new
"Typed Messages" quick-start tab on the home page.
Migration
No migration required. All new features are opt-in:
- Existing handlers keep their two-argument signature; the typed third
argument defaults tonullwhen--contractis not used. MessageHandlerInterface::handle()gains an optional$typed = null
parameter; implementations written against the old signature continue
to work because the new argument has a default value.- The default
MessageSerializerInterfaceis lazily resolved as
JsonMessageSerializer— existing publish/consume calls that send raw
bodies are unaffected.