Browse Source

declare exchange before binding

pull/8/head
Miguel Bautista 5 years ago
parent
commit
ba7b786e63
2 changed files with 9 additions and 17 deletions
  1. +8
    -16
      consume.go
  2. +1
    -1
      examples/consumer/main.go

+ 8
- 16
consume.go View File

@ -189,31 +189,23 @@ func WithConsumeOptionsBindingExchangeKind(kind string) func(*ConsumeOptions) {
} }
// WithConsumeOptionsBindingExchangeDurable returns a function that sets the binding exchange durable flag // WithConsumeOptionsBindingExchangeDurable returns a function that sets the binding exchange durable flag
func WithConsumeOptionsBindingExchangeDurable() func(*ConsumeOptions) {
return func(options *ConsumeOptions) {
getBindingExchangeOptionsOrSetDefault(options).Durable = true
}
func WithConsumeOptionsBindingExchangeDurable(options *ConsumeOptions) {
getBindingExchangeOptionsOrSetDefault(options).Durable = true
} }
// WithConsumeOptionsBindingExchangeAutoDelete returns a function that sets the binding exchange autoDelete flag // WithConsumeOptionsBindingExchangeAutoDelete returns a function that sets the binding exchange autoDelete flag
func WithConsumeOptionsBindingExchangeAutoDelete() func(*ConsumeOptions) {
return func(options *ConsumeOptions) {
getBindingExchangeOptionsOrSetDefault(options).AutoDelete = true
}
func WithConsumeOptionsBindingExchangeAutoDelete(options *ConsumeOptions) {
getBindingExchangeOptionsOrSetDefault(options).AutoDelete = true
} }
// WithConsumeOptionsBindingExchangeInternal returns a function that sets the binding exchange internal flag // WithConsumeOptionsBindingExchangeInternal returns a function that sets the binding exchange internal flag
func WithConsumeOptionsBindingExchangeInternal() func(*ConsumeOptions) {
return func(options *ConsumeOptions) {
getBindingExchangeOptionsOrSetDefault(options).Internal = true
}
func WithConsumeOptionsBindingExchangeInternal(options *ConsumeOptions) {
getBindingExchangeOptionsOrSetDefault(options).Internal = true
} }
// WithConsumeOptionsBindingExchangeNoWait returns a function that sets the binding exchange noWait flag // WithConsumeOptionsBindingExchangeNoWait returns a function that sets the binding exchange noWait flag
func WithConsumeOptionsBindingExchangeNoWait() func(*ConsumeOptions) {
return func(options *ConsumeOptions) {
getBindingExchangeOptionsOrSetDefault(options).NoWait = true
}
func WithConsumeOptionsBindingExchangeNoWait(options *ConsumeOptions) {
getBindingExchangeOptionsOrSetDefault(options).NoWait = true
} }
// WithConsumeOptionsBindingExchangeArgs returns a function that sets the binding exchange arguments that are specific to the server's implementation of the exchange // WithConsumeOptionsBindingExchangeArgs returns a function that sets the binding exchange arguments that are specific to the server's implementation of the exchange


+ 1
- 1
examples/consumer/main.go View File

@ -27,7 +27,7 @@ func main() {
rabbitmq.WithConsumeOptionsQuorum, rabbitmq.WithConsumeOptionsQuorum,
rabbitmq.WithConsumeOptionsBindingExchangeName("events"), rabbitmq.WithConsumeOptionsBindingExchangeName("events"),
rabbitmq.WithConsumeOptionsBindingExchangeKind("topic"), rabbitmq.WithConsumeOptionsBindingExchangeKind("topic"),
rabbitmq.WithConsumeOptionsBindingExchangeDurable(true),
rabbitmq.WithConsumeOptionsBindingExchangeDurable,
) )
if err != nil { if err != nil {
log.Fatal(err) log.Fatal(err)


Loading…
Cancel
Save