Ack delivery if it is unparseable in amqp_consumer input (#5286)
This commit is contained in:
parent
42184fd1c8
commit
193aba8673
|
@ -430,6 +430,14 @@ func (a *AMQPConsumer) process(ctx context.Context, msgs <-chan amqp.Delivery, a
|
|||
func (a *AMQPConsumer) onMessage(acc telegraf.TrackingAccumulator, d amqp.Delivery) error {
|
||||
metrics, err := a.parser.Parse(d.Body)
|
||||
if err != nil {
|
||||
// Discard the message from the queue; will never be able to process
|
||||
// this message.
|
||||
rejErr := d.Ack(false)
|
||||
if rejErr != nil {
|
||||
log.Printf("E! [inputs.amqp_consumer] Unable to reject message: %d: %v",
|
||||
d.DeliveryTag, rejErr)
|
||||
a.conn.Close()
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue