(pgMsg pgMessage)
| 686 | } |
| 687 | msg.Metadata, err = parseMetadata(pgMsg) |
| 688 | if err != nil { |
| 689 | return msg, errors.Wrap(err, "parsing metadata") |
| 690 | } |
| 691 | msg.Attempt = int(pgMsg.Attempt.Int32) |
| 692 | msg.maxConsumedCount = c.cfg.MaxConsumeCount |
| 693 | msg.Deadline = pgMsg.LockedUntil.Time.Add(-c.cfg.AckTimeout).Add(-c.cfg.MessageProcessingReserveDuration) |
| 694 | return msg, nil |
| 695 | } |
| 696 | |
| 697 | func parsePayload(pgMsg pgMessage) (json.RawMessage, error) { |
| 698 | if pgMsg.Payload == nil { |
| 699 | return nil, errors.New("missing message payload") |
| 700 | } |
| 701 | if !isJSONObject(pgMsg.Payload) { |
| 702 | return nil, errors.New("payload is invalid JSON object") |
| 703 | } |
no test coverage detected