Skip to content

Commit

Permalink
Add stamp to ignore input saving
Browse files Browse the repository at this point in the history
  • Loading branch information
SpartakusMd authored and Adrian Borza committed Nov 25, 2024
1 parent 5b9435f commit cc9cde9
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 0 deletions.
22 changes: 22 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
19 changes: 19 additions & 0 deletions src/Stamp/DisableInputStoreStamp.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php

/*
* This file is part of the zenstruck/messenger-monitor-bundle package.
*
* (c) Kevin Bond <[email protected]>
*
* 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
{
}

0 comments on commit cc9cde9

Please sign in to comment.