diff --git a/README.md b/README.md index 83217a6..410ca0b 100644 --- a/README.md +++ b/README.md @@ -126,6 +126,28 @@ You may want to disable monitoring for certain messages. There are several ways - App\Message\MyMessage ``` +#### Disable Input Monitoring + +You may want to disable monitoring for certain messages (example: emails with attachments). There are two ways to do this: + +1. When dispatching the message, add the `DisableInputStoreStamp`: + ```php + use Zenstruck\Messenger\Monitor\Stamp\DisableInputStoreStamp; + + /** @var \Symfony\Component\Messenger\MessageBusInterface $bus */ + + $bus->dispatch(new MyMessage(), [new DisableInputStoreStamp()]) + ``` +2. Add the `DisableInputStoreStamp` as a class attribute to your message: + ```php + use Zenstruck\Messenger\Monitor\Stamp\DisableInputStoreStamp; + + #[DisableInputStoreStamp] + class MyMessage + { + } + ``` + #### Description The stored `ProcessedMessage` has a description property. This is helpful to differentiate between diff --git a/src/Stamp/DisableInputStoreStamp.php b/src/Stamp/DisableInputStoreStamp.php new file mode 100644 index 0000000..45971c4 --- /dev/null +++ b/src/Stamp/DisableInputStoreStamp.php @@ -0,0 +1,19 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Zenstruck\Messenger\Monitor\Stamp; + +use Symfony\Component\Messenger\Stamp\StampInterface; + +#[\Attribute(\Attribute::TARGET_CLASS)] +final class DisableInputStoreStamp implements StampInterface +{ +}