3
votes

I was looking at using spring 3.1 for publishing events and using listeners to consume these events. however I have read that these events are synchronous, is it possible to make them asynchronous, maybe use the @async annotation?

Im really looking at creating an event driven architecture in Java/Spring - publishing and consuming events, would you think Spring/Java would suffice?

2
possible duplicate of Spring Framework Events - laffuste

2 Answers

3
votes

In this case it will be perfect to use Spring integration. which gives a different kinds of messaging solutions.

Here is a little explanation about Event-Driven Consumer:

And here is an example in Spring integration that is relevant to your needs:

  1. Messaging Endpoints
  2. some more examples

Good luck!

1
votes

Have you looked into the Spring Reactor project?

Here's an excerpt:

What is Reactor good for?

While you can make Reactor do a lot of things because of its inherent flexibility, it’s really designed to be a foundational framework for applications that need high throughput when performing reasonably small chunks of stateless, asynchronous processing. The sheer volume of non-human-generated data in modern applications can easily overtake a traditional single-threaded, blocking design model. From mobile applications that generate streams of location information to computerized manufacturing machines that send out vast amounts of geometric data to big data applications mining real-time logs to generate business metrics: modern data-driven applications demand better resource utilization and higher throughput than a traditional imperative, blocking application can usually provide.