Browse Source

use defaults in consumer

pull/53/head
wagslane 4 years ago
parent
commit
fca30bb394
3 changed files with 3 additions and 5 deletions
  1. +1
    -1
      channel.go
  2. +1
    -4
      consume.go
  3. +1
    -0
      examples/consumer/.gitignore

+ 1
- 1
channel.go View File

@ -46,7 +46,7 @@ func getNewChannel(url string, conf amqp.Config) (*amqp.Connection, *amqp.Channe
if err != nil {
return nil, nil, err
}
return amqpConn, ch, err
return amqpConn, ch, nil
}
// startNotifyCancelOrClosed listens on the channel's cancelled and closed


+ 1
- 4
consume.go View File

@ -90,13 +90,10 @@ func (consumer Consumer) StartConsuming(
optionFuncs ...func(*ConsumeOptions),
) error {
defaultOptions := getDefaultConsumeOptions()
options := &ConsumeOptions{}
options := &defaultOptions
for _, optionFunc := range optionFuncs {
optionFunc(options)
}
if options.Concurrency < 1 {
options.Concurrency = defaultOptions.Concurrency
}
err := consumer.startGoroutines(
handler,


+ 1
- 0
examples/consumer/.gitignore View File

@ -0,0 +1 @@
consumer

Loading…
Cancel
Save