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

Support Synthetic Flows/Tests #2950

Open
vab2048 opened this issue Dec 22, 2023 · 1 comment
Open

Support Synthetic Flows/Tests #2950

vab2048 opened this issue Dec 22, 2023 · 1 comment
Labels
Priority 4: Would Lowest priority. Would-be-nice to include issues when time allows it. Type: Feature Use to signal an issue is completely new to the project.

Comments

@vab2048
Copy link

vab2048 commented Dec 22, 2023

Feature Description

  • A synthetic test is the running of a business flow in production with synthetic data (fake users/entities/etc).
  • The idea is to be able to, at-any-time, on-demand, run a real invocation of a business flow.
  • This is useful for monitoring, performance testing, regression testing, health checks, etc.
  • Essentially you can proactively see if something is wrong with your system, rather than waiting for a real user interaction which highlights the problem.

Current Behaviour

There is no first class support for synthetic tests but you can probably work around this to have them run in an Axon app.

Wanted Behaviour

Support in Axon would mean:

  • The framework would be aware of whether the command/event/query is for a synthetic test flow or a real one.
    • The framework already does something similar - it knows if an event is being "replayed" or not. Granted it does it in its own way (a replay token) but I wanted to highlight something like this already kind of exists for an alternative use case.
  • Axon would have a standardised representation of synthetic events (e.g. the event payload would be the same, but the metadata would include a standardised way of representing that it was synthetic (along with any other synthetic test metadata the user wants)).
  • Axon would somehow allow for the definition of behaviour to be different when handling a synthetic command/event/query.
    • Most of the time the behaviour will be the same but you may want to customise it for specific synthetic flows so that alternative actions can be taken if need be e.g. we do not want to trigger a payment for a synthetic test run, or we want an email which is to be sent out to be sent to a different email address, etc.
    • Either we programatically can call "isSynthetic" (or something) or declaratively have an annotation over another event handler to bifurcate the behaviour.
    • Again, Axon already does something similar for events which are replaying - you can programatically/declaratively change behaviour based on whether a replay is occurring.
  • Axon would have an easy way to cleanup the events.
    • Since they are marked as "synthetic" this should make things a lot easier.
    • These types of events are not really needed after a fixed time period.

This is really a low priority feature request but I thought I would get it in there since I know you guys are working on Axon 5.

@vab2048 vab2048 added the Type: Feature Use to signal an issue is completely new to the project. label Dec 22, 2023
@smcvb smcvb added the Priority 4: Would Lowest priority. Would-be-nice to include issues when time allows it. label Dec 27, 2023
@smcvb
Copy link
Member

smcvb commented Dec 27, 2023

Although awesome, I agree with your point to make this low priority (sadly enough, of course).
To that end, I've marked it as a priority 4.

Concerning the approach, I guess there are two main pillars we'd want for this:

  1. A way to mark an entire message flow to be synthetic and
  2. selective ephemeral events within a context/store

Point one should be pretty straightforward to construct already by using the MetaData of a Message.
By adding the (e.g.) isSynthetic boolean to the MetaData and wiring this value through the @MetaDataValue("isSynthetic") annotation with Axon's parameter resolving logic, each message handlers (command, event, or query), would be able to switch between regular handling and synthetic handling.
Combining the field and handler changes with a CorrelationDataProvider that hauls the field from one message to another would set you up just fine I believe.

From there, you could even go so far as to make dedicated annotations to separate the behavior from normal and synthetic flow by adding a HandlerEnhancerDefinition.

However, point two is the blocker, as Axon Framework currently has no way to selectively mark events to be ephemeral.
Although we do want to provide support for it, that will indeed become an Axon Framework 5.x feature.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Priority 4: Would Lowest priority. Would-be-nice to include issues when time allows it. Type: Feature Use to signal an issue is completely new to the project.
Projects
None yet
Development

No branches or pull requests

2 participants