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

Metadata enricher #157

Closed
wants to merge 1 commit into from
Closed

Conversation

MattKetmo
Copy link
Member

Hello,

Here is a small plugin I wrote for a project to easily add custom metadata to all events. The code is inspired from event-store-bus-bridge/src/TransactionManager.php#L54.

In my case I use it to add information about the user who caused the events.

The PR is missing the tests and some phpdoc but I prefer to ask before, to know if you want the feature in this package or prefer having it elsewhere (or maybe you don't want it).

I also consider to configure it in the Container via something like:

return [
    'prooph' => [
        'event_store' => [
            'metadata_enrichers' => [
                UserMetadataEnricher::class,
                OtherMetadataEnricher::class,
            ],
    // ...

(Btw this is also something Broadway brings natively ;))


use Prooph\Common\Messaging\Message;

final class MetadataEnricherAggregation implements MetadataEnricher
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i would suggest the name MetadataEnricherAggregate

@prolic
Copy link
Member

prolic commented Feb 26, 2016

I like it. Let's add some phpdoc and test-coverage back to 100% :-)
@codeliner additional thoughts?

@codeliner
Copy link
Member

I like it, too. It reminds me on refactoring the TransactionManager so that causation_id and causation_name are no longer added by the TransactionManager. If the MetadataEnricherPlugin is available we can change the behavior of TransactionManager with the next major release.

@prolic
Copy link
Member

prolic commented Feb 26, 2016

@MattKetmo can you submit the pr to the develop branch, please?

@MattKetmo
Copy link
Member Author

ok, I will do it tomorrow

@MattKetmo
Copy link
Member Author

PR submitted in develop branch with tests and phpdoc #162.

@MattKetmo MattKetmo closed this Feb 27, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants