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

Adding support for outbound EventMessage filtering #2933

Open
wants to merge 1 commit into
base: axon-4.5.x
Choose a base branch
from

Conversation

bsanders1979
Copy link

These are the changes I made to support my use-case of not wanting to publish certain events to AxonServerEventStore to alleviate possible quota issues. I don't anticipate this feature being used outside of the context of migrating to this kind of event store. But, anything is possible I imagine. I was getting errors in DefaultConfigurer and back ported the 4.6 version of code, so you can ignore that bit. I had to check that filteredEvents wasn't empty before passing the value along because it was causing a timeout in my code.

This is how my Spring (non-Boot) config looks now...

public Configuration serverConfiguration(AxonServerConfiguration axonServerConfiguration) {
    return DefaultConfigurer.defaultConfiguration()
        ...
        .configureEventStore(this::buildEventStore)
        ...
        .start();
}

private AxonServerEventStore buildEventStore(Configuration c) {
    return AxonServerEventStore.builder()
       .configuration(c.getComponent(AxonServerConfiguration.class))
       .platformConnectionManager(c.getComponent(AxonServerConnectionManager.class))
       .messageMonitor(c.messageMonitor(AxonServerEventStore.class, "eventStore"))
       .snapshotSerializer(c.serializer())
       .eventSerializer(c.eventSerializer())
       .snapshotFilter(c.snapshotFilter())
       .upcasterChain(c.upcasterChain())
       .eventMessageFilter(event -> event.getPayloadType().getName().startsWith("com.acme.api"))
       .build();
}

@CLAassistant
Copy link

CLAassistant commented Dec 6, 2023

CLA assistant check
All committers have signed the CLA.

@smcvb smcvb added Type: Feature Use to signal an issue is completely new to the project. Priority 3: Could Low priority. Issues that are nice to have but have a straightforward workaround. Status: Under Discussion Use to signal that the issue in question is being discussed. labels Dec 12, 2023
@smcvb smcvb self-requested a review December 12, 2023 10:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Priority 3: Could Low priority. Issues that are nice to have but have a straightforward workaround. Status: Under Discussion Use to signal that the issue in question is being discussed. Type: Feature Use to signal an issue is completely new to the project.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants