Skip to content
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

[5.3] Create NotificationFailed event #14874

Merged
merged 1 commit into from
Aug 18, 2016
Merged

[5.3] Create NotificationFailed event #14874

merged 1 commit into from
Aug 18, 2016

Conversation

barryvdh
Copy link
Contributor

In the case of a failure, which shouldn't be retried, it currently is possible to handle this, right?

I propose we add an event for when a Notification fails, eg. for push notifications when a token is invalid. We would like to respond by removing the push token from the user model (or log/notify/do something else).

Throwing an exception would break the flow (eg. when the 1st of 2 notification channels throws an exception).

@themsaid
Copy link
Member

themsaid commented Aug 18, 2016

If we catch exceptions while sending to a specific channel and fire an event that'll help not to break the flow, but from inside the listener we need to be able to retry for x times depends on the nature of the exception thrown. I'm not sure but maybe having a way to send a notification to only a single channel can solve this issue.

@barryvdh
Copy link
Contributor Author

@themsaid I think that is more relevant to issue #14785
This is more for when it's not supposed to retry, but instead a sort of soft-fail, which needs to handling.

Actual example here: https://github.com/fruitcake/laravel-gcm-notification-channel/blob/dd2acc1c22ecab6c5db81b2d39cfbaf27126fdcd/src/GcmChannel.php#L55-L80

  1. When it fails because of connection problem etc, it throws an Exception.
  2. When the service responds there is something wrong with the token (in this case), it should do some action.

(And yes, this is currently solved by our own Event, but perhaps a Event would be better)

@themsaid
Copy link
Member

I like how you handled failure in your channel, and yes there are conditions where a retry won't solve anything, in that case firing an event is a good solution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants