Skip to content

Commit

Permalink
Merge pull request #205 from rabbitmq/zerpet/issue-199
Browse files Browse the repository at this point in the history
Add a constant for CQ v2 queue argument
  • Loading branch information
Zerpet authored Jun 20, 2023
2 parents 0ee6e88 + 901a76c commit e834fc5
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
16 changes: 16 additions & 0 deletions examples_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -539,3 +539,19 @@ func ExampleChannel_QueueDeclare_stream() {
)
log.Printf("Declared queue: %s", q.Name)
}

func ExampleChannel_QueueDeclare_classicQueueV2() {
conn, _ := amqp.Dial("amqp://localhost")
ch, _ := conn.Channel()
q, _ := ch.QueueDeclare(
"my-classic-queue-v2", // queue name
true, // durable
false, // auto-delete
false, // exclusive
false, // noWait
amqp.Table{
amqp.QueueVersionArg: 2,
},
)
log.Printf("Declared Classic Queue v2: %s", q.Name)
}
2 changes: 2 additions & 0 deletions types.go
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,8 @@ const (
QueueTTLArg = "x-expires"
StreamMaxAgeArg = "x-max-age"
StreamMaxSegmentSizeBytesArg = "x-stream-max-segment-size-bytes"
// QueueVersionArg declares the Classic Queue version to use. Expects an integer, either 1 or 2.
QueueVersionArg = "x-queue-version"
)

// Values for queue arguments. Use as values for queue arguments during queue declaration.
Expand Down

0 comments on commit e834fc5

Please sign in to comment.