Skip to content

Commit

Permalink
adding failure check IsUndelivered for cloudevent
Browse files Browse the repository at this point in the history
Signed-off-by: Jalander Ramagiri <[email protected]>
  • Loading branch information
Jalander Ramagiri committed Aug 15, 2024
1 parent 89be5f9 commit 0612407
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions pkg/cdevents/helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,11 +94,11 @@ func SendCDEvent(event string, messageBrokerURL string) error {
log.Printf("failed to create client, %v", err)
return err
}
if result := c.Send(ctx, *ce); cloudevents.IsNACK(result) {
if result := c.Send(ctx, *ce); cloudevents.IsNACK(result) || cloudevents.IsUndelivered(result) {
log.Printf("Failed to send CDEvent, %v", result)
return errors.New("failed to send CDEvent")
return errors.New("failed to send CDEvent to target message-broker URL: " + messageBrokerURL)
} else {
log.Println("Sent CDEvent to target message-broker URL")
log.Printf("Sent CDEvent to target message-broker URL: %s", messageBrokerURL)
}
return nil
}

0 comments on commit 0612407

Please sign in to comment.