MCPcopy Create free account
hub / github.com/dataddo/pgq / parseMetadata

Function parseMetadata

consumer.go:688–700  ·  view source on GitHub ↗
(pgMsg pgMessage)

Source from the content-addressed store, hash-verified

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
697func 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 }

Callers 1

finishParsingMethod · 0.85

Calls 1

isJSONObjectFunction · 0.85

Tested by

no test coverage detected