`\Drupal\pusher_api\Service\PusherService::trigger()` is declared as returning
`void` and wraps the inner Pusher SDK call in
`try { ... } catch (\Throwable $e) { $this->loggerChannel->error(...); }`.

This means a caller has no way to know if the Pusher publish actually succeeded —
Soketi/Pusher being down, an HTTP timeout, invalid credentials, channel limits
exceeded etc. are all swallowed and turn into a silent log entry.

This breaks the contract for any caller that needs to make decisions based on
delivery result. Concrete example: writing a `MessageNotifier` plugin for
`message_notify`, where the contract is:

public function deliver(array $output = []): bool;

Returning `TRUE` is supposed to mean "delivered". With the current API the
notifier can only return `TRUE` optimistically and `MessageNotifierBase::postSend()`'s
`save on fail` configuration becomes useless.

The same situation applies to any code that wants to fall back to a different
transport (queue for retry, fall through to email) on Pusher failure.

### Steps to reproduce

1. Configure `pusher_api` with a host that doesn't respond (or stop Soketi).
2. Call `\Drupal::service(PusherService::class)->trigger(...)`.
only a `dblog` entry.

### Proposed resolution

Change `PusherService::trigger()` to return `bool`:
- `TRUE` on successful publish
- `FALSE` after catching `\Throwable` (still log the error)

Backwards compatibility: callers that currently call `trigger(...)` and ignore
the return value are unaffected. Callers that want to react to failure can now
check the return.

Alternative considered: a separate `triggerOrFail()` method that rethrows.
Useful but extra surface area; just changing the return type is simpler and a
strict superset.

Issue fork pusher_api-3591837

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

immoreel created an issue. See original summary.

immoreel’s picture

Status: Active » Needs review
fabianderijk’s picture

Assigned: Unassigned » fabianderijk
fabianderijk’s picture

Status: Needs review » Fixed

MR is now merged. Thanks!

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.