Skip to content

Add DelayedQueueSpecification for Tanzu delayed queues#92

Merged
Gsantomaggio merged 7 commits intomainfrom
feature/delayed-queue-specification
Mar 23, 2026
Merged

Add DelayedQueueSpecification for Tanzu delayed queues#92
Gsantomaggio merged 7 commits intomainfrom
feature/delayed-queue-specification

Conversation

@Gsantomaggio
Copy link
Copy Markdown
Member

@Gsantomaggio Gsantomaggio commented Mar 23, 2026

Introduce the delayed queue type and specification (standard queue args plus optional automatic shovel fields with documented defaults). Extend topology recovery and unit tests, add an integration test that rejects declaration on non-Tanzu brokers, document the feature in AGENTS.md, and add a docs/examples/delayed_queue sample with README entry.

part of #90

Introduce the delayed queue type and specification (standard queue args plus optional automatic shovel fields with documented defaults). Extend topology recovery and unit tests, add an integration test that rejects declaration on non-Tanzu brokers, document the feature in AGENTS.md, and add a docs/examples/delayed_queue sample with README entry.

Made-with: Cursor
@Gsantomaggio Gsantomaggio added this to the 1.0.0 milestone Mar 23, 2026
@Gsantomaggio Gsantomaggio self-assigned this Mar 23, 2026
@Gsantomaggio Gsantomaggio marked this pull request as ready for review March 23, 2026 12:58
Signed-off-by: Gabriele Santomaggio <G.santomaggio@gmail.com>
Signed-off-by: Gabriele Santomaggio <G.santomaggio@gmail.com>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds support for Tanzu-specific delayed queues to the Go AMQP 1.0 client by introducing a new queue type/spec and wiring it into topology recovery, tests, and documentation/examples.

Changes:

  • Add Delayed queue type and DelayedQueueSpecification (including optional automatic-shovel arguments and defaults).
  • Extend topology recovery to reconstruct delayed queue specs, plus unit/integration tests around argument mapping and non-Tanzu rejection.
  • Add a new docs/examples/delayed_queue sample and update docs/AGENTS documentation to reference the new spec.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
pkg/rabbitmqamqp/entities.go Introduces Delayed queue type, delayed queue spec, argument building, and server capability validation.
pkg/rabbitmqamqp/entities_test.go Adds unit tests for delayed queue argument mapping and shovel defaults.
pkg/rabbitmqamqp/amqp_queue_test.go Adds integration test ensuring delayed queue declaration is rejected on non-Tanzu brokers.
pkg/rabbitmqamqp/amqp_connection_recovery.go Adds delayed queue handling when converting recovery records back to queue specs.
pkg/rabbitmqamqp/amqp_connection_recovery_test.go Updates recovery table tests to cover delayed queue reconstruction.
docs/examples/README.md Documents the new delayed queue example (and updates JMS wording).
docs/examples/delayed_queue/main.go New runnable example demonstrating delayed queue declaration and delayed delivery via annotations.
AGENTS.md Documents the new queue type and queue specification.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +712 to +717
func (d *DelayedQueueSpecification) validate(f *featuresAvailable) error {
if f.isTanzu {
return nil
}
return fmt.Errorf("DelayedQueueSpecification is only supported on Tanzu RabbitMQ 4.3 or later")
}
Copy link

Copilot AI Mar 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DelayedQueueSpecification.validate currently checks only f.isTanzu but the error message (and PR description/docs) state the feature requires Tanzu RabbitMQ 4.3+. This means older Tanzu versions would be treated as supported. Consider aligning this with JMSQueueSpecification by also checking the server version flag (e.g., f.is43rMore) or updating the message/docs if 4.3+ is not actually required.

Copilot uses AI. Check for mistakes.
Comment thread pkg/rabbitmqamqp/amqp_connection_recovery.go Outdated
Comment thread docs/examples/README.md Outdated
Comment thread docs/examples/README.md
- [Getting Started](getting_started) - A simple example to get you started.
- [JMS queue](jms_queue) - Same flow as getting started, using `JmsQueueSpecification` (Tanzu RabbitMQ 4.x).
- [JMS queue](jms_queue) - Same flow as getting started, using `JmsQueueSpecification` (Tanzu RabbitMQ 4.3+).
- [Delayed queue](delayed_queue) - Same flow as getting started, using `DelayedQueueSpecification` (Tanzu RabbitMQ 4.x).
Copy link

Copilot AI Mar 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Delayed queue entry says Tanzu RabbitMQ 4.x, while other documentation in this PR (AGENTS.md and the runtime validation error) says 4.3+. Please make the version requirement consistent across docs and code so users don’t get conflicting guidance.

Suggested change
- [Delayed queue](delayed_queue) - Same flow as getting started, using `DelayedQueueSpecification` (Tanzu RabbitMQ 4.x).
- [Delayed queue](delayed_queue) - Same flow as getting started, using `DelayedQueueSpecification` (Tanzu RabbitMQ 4.3+).

Copilot uses AI. Check for mistakes.
Comment on lines +4 to +5
// (RabbitMQ queue type "delayed"). Delayed queues are available on Tanzu RabbitMQ 4.x+; see:
// https://techdocs.broadcom.com/us/en/vmware-tanzu/data-solutions/tanzu-rabbitmq-on-kubernetes/4-2/tanzu-rabbitmq-kubernetes/delayed-queues.html
Copy link

Copilot AI Mar 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This example header says delayed queues are available on Tanzu RabbitMQ 4.x+ and links to the 4-2 docs, but the client validation/error message says 4.3+. Please align the stated minimum version and the linked docs version with the actual requirement enforced by DelayedQueueSpecification.validate.

Suggested change
// (RabbitMQ queue type "delayed"). Delayed queues are available on Tanzu RabbitMQ 4.x+; see:
// https://techdocs.broadcom.com/us/en/vmware-tanzu/data-solutions/tanzu-rabbitmq-on-kubernetes/4-2/tanzu-rabbitmq-kubernetes/delayed-queues.html
// (RabbitMQ queue type "delayed"). Delayed queues are available on Tanzu RabbitMQ 4.3+; see:
// https://techdocs.broadcom.com/us/en/vmware-tanzu/data-solutions/tanzu-rabbitmq-on-kubernetes/4-3/tanzu-rabbitmq-kubernetes/delayed-queues.html

Copilot uses AI. Check for mistakes.
Comment thread pkg/rabbitmqamqp/amqp_queue_test.go Outdated
Comment on lines +259 to +265
It("should fail if declare a Delayed queue in the open source RabbitMQ", func() {
queueName := generateName("should fail if declare a Delayed queue in the open source RabbitMQ")
_, err := management.DeclareQueue(context.TODO(), &DelayedQueueSpecification{
Name: queueName,
})
Expect(err).NotTo(BeNil())
Expect(err.Error()).To(ContainSubstring("DelayedQueueSpecification is only supported on Tanzu RabbitMQ 4.3 or later"))
Copy link

Copilot AI Mar 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test name grammar: "should fail if declare a Delayed queue..." reads awkwardly. Consider rewording to "should fail when declaring a delayed queue on open-source RabbitMQ" (also keeps the queue type consistently lowercased in prose).

Copilot uses AI. Check for mistakes.
Comment on lines 225 to +233
Entry("Classic queue", Classic, true, true, map[string]any{}),
Entry("Stream queue", Stream, false, false, map[string]any{}),
//Entry("JMS queue", Jms, false, false, map[string]any{}),
//Entry("Delayed queue", Delayed, false, false, map[string]any{}),
Entry("Quorum queue with arguments", Quorum, false, false, map[string]any{"x-max-length-bytes": 1000}),
Entry("Classic queue with arguments", Classic, true, true, map[string]any{"x-max-length-bytes": 1000}),
Entry("Stream queue with arguments", Stream, false, false, map[string]any{"x-max-length-bytes": 1000}),
//Entry("JMS queue with arguments", Jms, false, false, map[string]any{"x-max-length-bytes": 1000}),
Entry("Delayed queue with arguments", Delayed, false, false, map[string]any{"x-max-length-bytes": 1000}),
Copy link

Copilot AI Mar 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The topology recovery table adds a Delayed queue entry with arguments but leaves the no-arguments Delayed entry commented out. Re-enabling the basic Delayed case would keep coverage consistent with the other queue types and ensure recovery works when arguments are empty.

Copilot uses AI. Check for mistakes.
Gsantomaggio and others added 4 commits March 23, 2026 14:11
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Gabriele Santomaggio <G.santomaggio@gmail.com>
Signed-off-by: Gabriele Santomaggio <G.santomaggio@gmail.com>
@Gsantomaggio Gsantomaggio merged commit 5ae63ba into main Mar 23, 2026
2 checks passed
@Gsantomaggio Gsantomaggio deleted the feature/delayed-queue-specification branch March 23, 2026 13:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants