Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
rsnullptr committed Jul 2, 2021
1 parent 782c36a commit f95e4c9
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 14 deletions.
40 changes: 31 additions & 9 deletions examples/consumer/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,39 @@ func main() {
// true to ACK, false to NACK
return true
},
"my_queue5",
[]string{"routing_key_7"},
"my_queue7",
[]string{"publisher-key-1"},
rabbitmq.WithConsumeOptionsConcurrency(10),
func(options *rabbitmq.ConsumeOptions) {
rabbitmq.WithQueueDeclare(&options.QueueDeclare)
rabbitmq.WithQueueDeclareOptionsDurable(&options.QueueDeclare)
rabbitmq.WithQueueDeclareOptionsQuorum(&options.QueueDeclare)
rabbitmq.WithBindingExchangeOptionsExchangeName("events", &options.BindingExchange)
rabbitmq.WithBindingExchangeOptionsExchangeKind("topic", &options.BindingExchange)
rabbitmq.WithBindingExchangeOptionsExchangeDurable(&options.BindingExchange)
options.Qos.QOSPrefetchCount = 1
options.BindingExchange = rabbitmq.BindingExchangeOptions{
DoBinding: true,
Name: "pubexch",
Kind: "topic",
Durable: true,
AutoDelete: false,
Internal: false,
NoWait: true,
ExchangeArgs: nil,
BindingNoWait: false,
}

options.QueueDeclare = rabbitmq.QueueDeclareOptions{
DoDeclare: true,
QueueName: "my_queue7",
QueueDurable: true,
QueueAutoDelete: false,
QueueExclusive: false,
QueueNoWait: false,
QueueArgs: rabbitmq.Table{},
}

options.QueueDeclare.QueueArgs["x-queue-type"] = "quorum"

options.Qos = rabbitmq.QosOptions{
QOSPrefetchCount: 1,
QOSPrefetchSize: 0,
QOSGlobal: false,
}
},
)
if err != nil {
Expand Down
10 changes: 5 additions & 5 deletions examples/publisher/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ func do() {
func(options *rabbitmq.PublisherOptions) {
options.BindingExchange = rabbitmq.BindingExchangeOptions{
DoBinding: true,
Name: "beautifulExchange5",
Name: "pubexch",
Kind: "topic",
Durable: true,
AutoDelete: false,
Expand All @@ -32,12 +32,12 @@ func do() {
}

options.RoutingKeys = []string{
"routing_key5",
"publisher-key-1",
}

options.QueueDeclare = rabbitmq.QueueDeclareOptions{
DoDeclare: true,
QueueName: "my_queue5",
QueueName: "pub_queue",
QueueDurable: true,
QueueAutoDelete: false,
QueueExclusive: false,
Expand Down Expand Up @@ -69,11 +69,11 @@ func do() {
for {
err = publisher.Publish(
[]byte(fmt.Sprintf("AAA %d", idx)),
[]string{"routing_key5"},
[]string{"publisher-key-1"},
rabbitmq.WithPublishOptionsContentType("application/json"),
rabbitmq.WithPublishOptionsMandatory,
rabbitmq.WithPublishOptionsPersistentDelivery,
rabbitmq.WithPublishOptionsExchange("beautifulExchange5"),
rabbitmq.WithPublishOptionsExchange("pubexch"),
)
if err != nil {
log.Fatal(err)
Expand Down

0 comments on commit f95e4c9

Please sign in to comment.