Skip to content

Commit f95e4c9

Browse files
committed
fix test
1 parent 782c36a commit f95e4c9

File tree

2 files changed

+36
-14
lines changed

2 files changed

+36
-14
lines changed

examples/consumer/main.go

Lines changed: 31 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,39 @@ func main() {
2020
// true to ACK, false to NACK
2121
return true
2222
},
23-
"my_queue5",
24-
[]string{"routing_key_7"},
23+
"my_queue7",
24+
[]string{"publisher-key-1"},
2525
rabbitmq.WithConsumeOptionsConcurrency(10),
2626
func(options *rabbitmq.ConsumeOptions) {
27-
rabbitmq.WithQueueDeclare(&options.QueueDeclare)
28-
rabbitmq.WithQueueDeclareOptionsDurable(&options.QueueDeclare)
29-
rabbitmq.WithQueueDeclareOptionsQuorum(&options.QueueDeclare)
30-
rabbitmq.WithBindingExchangeOptionsExchangeName("events", &options.BindingExchange)
31-
rabbitmq.WithBindingExchangeOptionsExchangeKind("topic", &options.BindingExchange)
32-
rabbitmq.WithBindingExchangeOptionsExchangeDurable(&options.BindingExchange)
33-
options.Qos.QOSPrefetchCount = 1
27+
options.BindingExchange = rabbitmq.BindingExchangeOptions{
28+
DoBinding: true,
29+
Name: "pubexch",
30+
Kind: "topic",
31+
Durable: true,
32+
AutoDelete: false,
33+
Internal: false,
34+
NoWait: true,
35+
ExchangeArgs: nil,
36+
BindingNoWait: false,
37+
}
38+
39+
options.QueueDeclare = rabbitmq.QueueDeclareOptions{
40+
DoDeclare: true,
41+
QueueName: "my_queue7",
42+
QueueDurable: true,
43+
QueueAutoDelete: false,
44+
QueueExclusive: false,
45+
QueueNoWait: false,
46+
QueueArgs: rabbitmq.Table{},
47+
}
48+
49+
options.QueueDeclare.QueueArgs["x-queue-type"] = "quorum"
50+
51+
options.Qos = rabbitmq.QosOptions{
52+
QOSPrefetchCount: 1,
53+
QOSPrefetchSize: 0,
54+
QOSGlobal: false,
55+
}
3456
},
3557
)
3658
if err != nil {

examples/publisher/main.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ func do() {
2121
func(options *rabbitmq.PublisherOptions) {
2222
options.BindingExchange = rabbitmq.BindingExchangeOptions{
2323
DoBinding: true,
24-
Name: "beautifulExchange5",
24+
Name: "pubexch",
2525
Kind: "topic",
2626
Durable: true,
2727
AutoDelete: false,
@@ -32,12 +32,12 @@ func do() {
3232
}
3333

3434
options.RoutingKeys = []string{
35-
"routing_key5",
35+
"publisher-key-1",
3636
}
3737

3838
options.QueueDeclare = rabbitmq.QueueDeclareOptions{
3939
DoDeclare: true,
40-
QueueName: "my_queue5",
40+
QueueName: "pub_queue",
4141
QueueDurable: true,
4242
QueueAutoDelete: false,
4343
QueueExclusive: false,
@@ -69,11 +69,11 @@ func do() {
6969
for {
7070
err = publisher.Publish(
7171
[]byte(fmt.Sprintf("AAA %d", idx)),
72-
[]string{"routing_key5"},
72+
[]string{"publisher-key-1"},
7373
rabbitmq.WithPublishOptionsContentType("application/json"),
7474
rabbitmq.WithPublishOptionsMandatory,
7575
rabbitmq.WithPublishOptionsPersistentDelivery,
76-
rabbitmq.WithPublishOptionsExchange("beautifulExchange5"),
76+
rabbitmq.WithPublishOptionsExchange("pubexch"),
7777
)
7878
if err != nil {
7979
log.Fatal(err)

0 commit comments

Comments
 (0)