-
Notifications
You must be signed in to change notification settings - Fork 224
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Pass message to RecordReceivedMalformedEvent when validation fails #964
Comments
Quick question: since cc/ @duglin for thoughts |
I like the idea of a DLQ that isn't tied to the ObservabilityService. |
I agree with the idea. My plan is to use custom error handler in ObservabilityService that will handle the error as we intended. So the DLQ logic will not live in ObservabilityService.
What I understand is, the |
The message is also passed as Line 75 in 70abff6
|
So you don't know what the |
No I don't know |
Shouldn't that be the responsibility of the producer/sender though? If they send a malformed event and you return an error, i.e., no |
What I understand is, the sender sends and forget, and consumer try to process message and upon failure, send the message to DLQ. |
With fire-and-forget, the sender is basically in Question: while not the full event/payload, do we log some metadata in the observability service for correlation purposes at all? |
Just logging error message at the moment in observability service. I don't think I have access to any other info from the actual payload to log? Would be good to have some more info about payload as consumer is unaware the event/payload. Looking at another open issue, someone has encountered similar situation |
Correct, we don't log any message detail.
Agree, IMHO this is something we should improve. From that point, your PR sounds good to me (not the DLQ approach). However, I'm not an expert on the observability part and their could be issues with logging large, or malicious, payloads (which would be true today I guess since we record a successfully transformed event to observability service - yet, it's a risk). This is the code in e, eventErr := binding.ToEvent(ctx, m)
switch {
case eventErr != nil && r.fn.hasEventIn:
r.observabilityService.RecordReceivedMalformedEvent(ctx, eventErr)
return respFn(ctx, nil, protocol.NewReceipt(r.ackMalformedEvent, "failed to convert Message to Event: %w", eventErr))
case r.fn != nil:
// Check if event is valid before invoking the receiver function
if e != nil {
if validationErr := e.Validate(); validationErr != nil {
r.observabilityService.RecordReceivedMalformedEvent(ctx, validationErr)
return respFn(ctx, nil, protocol.NewReceipt(r.ackMalformedEvent, "validation error in incoming event: %w", validationErr))
}
} |
@embano1 You are absolutely right about this block of code. If you ignore my DLQ approach, the PR will still make this block of code useful. I would suggest to even pass
|
We have encountered a scenario where we want to send all messages (that failed validation) to dead letter topic to be reviewed later. Currently I can't find a way to get the message if it fails validation. I think it will be useful if we pass
binding.Message
to ObservabilityService method RecordReceivedMalformedEvent which will enable us to log or send message to dead letter topic.sdk-go/v2/client/invoker.go
Line 68 in 70abff6
and
sdk-go/v2/client/invoker.go
Line 74 in 70abff6
The text was updated successfully, but these errors were encountered: