MCPcopy Create free account
hub / github.com/Mnexa-AI/e2a / Process

Method Process

internal/delivery/consumer.go:71–104  ·  view source on GitHub ↗

Process applies one normalized SES event. Unknown/uncorrelated messages and event kinds with no recipient outcomes are no-ops (returns nil) — an SNS notification e2a can't act on must still be ACKed so SES stops retrying.

(ctx context.Context, ev *Event)

Source from the content-addressed store, hash-verified

69// event kinds with no recipient outcomes are no-ops (returns nil) — an SNS
70// notification e2a can't act on must still be ACKed so SES stops retrying.
71func (c *Consumer) Process(ctx context.Context, ev *Event) error {
72 if ev == nil || len(ev.Recipients) == 0 {
73 return nil
74 }
75 messageID, userID, agentID, found, err := c.store.CorrelateBySESMessageID(ctx, ev.SESMessageID)
76 if err != nil {
77 return err
78 }
79 if !found {
80 log.Printf("[delivery] SES %s for unknown message id=%s (expired/foreign); acking", ev.Kind, ev.SESMessageID)
81 return nil
82 }
83
84 for _, r := range ev.Recipients {
85 if r.Address == "" || !r.Status.Valid() {
86 continue
87 }
88 if err := c.store.RecordDeliveryOutcome(ctx, messageID, r.Address, r.Status, r.Detail); err != nil {
89 return err
90 }
91 if evType := pushEventFor(r.Status); evType != "" && c.fire != nil {
92 c.fire(ctx, userID, agentID, evType, map[string]any{
93 "message_id": messageID,
94 "recipient": r.Address,
95 "status": string(r.Status),
96 "detail": r.Detail,
97 }, evType+"|"+messageID+"|"+r.Address)
98 }
99 if r.Suppress {
100 c.suppress(ctx, userID, messageID, r)
101 }
102 }
103 return nil
104}
105
106func (c *Consumer) suppress(ctx context.Context, userID, messageID string, r RecipientOutcome) {
107 source := suppressionSourceBounce

Calls 6

suppressMethod · 0.95
pushEventForFunction · 0.85
fireMethod · 0.80
RecordDeliveryOutcomeMethod · 0.65
ValidMethod · 0.45