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

reactive #290

Open
ByteByteBrew opened this issue Mar 29, 2024 · 3 comments
Open

reactive #290

ByteByteBrew opened this issue Mar 29, 2024 · 3 comments

Comments

@ByteByteBrew
Copy link

I'm considering exploring the reactive mode. I've also come across a concern regarding Axon, suggesting that it might take a considerable amount of time before it fully supports Quarkus. Would you happen to have any insights or advice on this matter? I'd greatly appreciate your input.

@JohT
Copy link
Owner

JohT commented Mar 29, 2024

Hi @ByteByteBrew 👋,

what exactly do you mean by "reactive mode"?

@ByteByteBrew
Copy link
Author

Hi @ByteByteBrew 👋,

what exactly do you mean by "reactive mode"?

By "reactive mode," I'm referring to the programming style enabled by Quarkus that uses a non-blocking development model. It leverages the SmallRye implementation of the MicroProfile Reactive Streams Operators and Mutiny libraries for reactive programming support.

@JohT
Copy link
Owner

JohT commented Apr 1, 2024

I've never used Reactive Programming in a professional context. So please take my thought with a grain of salt.

Where can I find something "Reactive" in the showcase?

  • NicknameEventStreamResource shows how to implement a HTTP endpoint that uses Server-sent events to push updates to query results. The user interface doesn't need to poll for new results, they will be pushed when they are available.
  • The basis for that is a so called Subscription Query provided by AxonFramework. It is wired up in the QuerySubmitterAdapter.
  • In the implementation of the QuerySubmitterAdapter you will see that AxonFramework uses Flux from project-reactor which is well known in the Spring community. It is based on the Reactive Streams specification which "provides a standard for asynchronous stream processing".
  • The In the implementation of the QuerySubmitterAdapter uses the Flux from project-reactor to return a CompletableFuture that is provided by Java itself to reduce dependencies to Frameworks as much as possible if they aren't needed.
  • In the showcase I tried out an extreme approach regarding reducing dependencies and putting everything behind a Boundary. This even applies to AxonFramework. In practice you most probably won't go that way that also introduces a lot of complexity. So decide as a team or within the company, which Frameworks you intentionally want to depend on to reduce complexity with higher probability that major updates of those Frameworks might be more effort.

Reactive Programming with AxonFramework

  • If you are mainly concerned about blocking Threads, then have a look at Support for Virtual Threads - JDK21. Virtual Threads were released with Java 21.
  • Reactive for Axon Framework 5 is a discussion you might find interesting
  • If you are passionate about Reactive programming despite its higher complexity then it should be possible to at least use the already existing interfaces (see above) of AxonFramework.
  • I never used Mutiny and am therefore not aware of how good it integrates with Reactive Streams. At least on the website they claim that they are based on it. - What I personally didn't like about Mutiny is how they are using the word "Event". What would be considered a "Command" is also an event there. But this might also have changed since I had a look at it more than a year ago.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants