File tree Expand file tree Collapse file tree 2 files changed +36
-14
lines changed Expand file tree Collapse file tree 2 files changed +36
-14
lines changed Original file line number Diff line number Diff line change @@ -20,17 +20,39 @@ func main() {
20
20
// true to ACK, false to NACK
21
21
return true
22
22
},
23
- "my_queue5 " ,
24
- []string {"routing_key_7 " },
23
+ "my_queue7 " ,
24
+ []string {"publisher-key-1 " },
25
25
rabbitmq .WithConsumeOptionsConcurrency (10 ),
26
26
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
+ }
34
56
},
35
57
)
36
58
if err != nil {
Original file line number Diff line number Diff line change @@ -21,7 +21,7 @@ func do() {
21
21
func (options * rabbitmq.PublisherOptions ) {
22
22
options .BindingExchange = rabbitmq.BindingExchangeOptions {
23
23
DoBinding : true ,
24
- Name : "beautifulExchange5 " ,
24
+ Name : "pubexch " ,
25
25
Kind : "topic" ,
26
26
Durable : true ,
27
27
AutoDelete : false ,
@@ -32,12 +32,12 @@ func do() {
32
32
}
33
33
34
34
options .RoutingKeys = []string {
35
- "routing_key5 " ,
35
+ "publisher-key-1 " ,
36
36
}
37
37
38
38
options .QueueDeclare = rabbitmq.QueueDeclareOptions {
39
39
DoDeclare : true ,
40
- QueueName : "my_queue5 " ,
40
+ QueueName : "pub_queue " ,
41
41
QueueDurable : true ,
42
42
QueueAutoDelete : false ,
43
43
QueueExclusive : false ,
@@ -69,11 +69,11 @@ func do() {
69
69
for {
70
70
err = publisher .Publish (
71
71
[]byte (fmt .Sprintf ("AAA %d" , idx )),
72
- []string {"routing_key5 " },
72
+ []string {"publisher-key-1 " },
73
73
rabbitmq .WithPublishOptionsContentType ("application/json" ),
74
74
rabbitmq .WithPublishOptionsMandatory ,
75
75
rabbitmq .WithPublishOptionsPersistentDelivery ,
76
- rabbitmq .WithPublishOptionsExchange ("beautifulExchange5 " ),
76
+ rabbitmq .WithPublishOptionsExchange ("pubexch " ),
77
77
)
78
78
if err != nil {
79
79
log .Fatal (err )
You can’t perform that action at this time.
0 commit comments