harwind

harwind

Event handling in java

I’m developing a web-based application that uses Java servlets to make RPC calls.
I’m searching for a solid technique to dispatch and handle server events. With a PHP application, I’m used to using Symfony’s EventDispatcher class to add event listeners and dispatch events, but I’m having trouble finding something analogous in Java because much of what I can find is about dealing with UI events, and I want to listen for and fire events on the server.

I’d also like the actual event handling to happen asynchronously on a separate thread or something, so that an API call to handle adding a payment can do what’s necessary, fire an event, and return immediately, even if the event triggers some more time-consuming stuff like sending emails or contacting a partner to inform them of the new balance.

Is it better to just write my own event interfaces, ExecutorService/Runnable, and Observer or Publish/Subscribe patterns? Or are there existing libraries (or built-in features I’m not aware of) that can handle some of this for me?
Thanks!

Popular General Dev topics Top

justinjunodev
Figured this would be a cool topic and maybe provide some inspiration for those who are just starting to work from home. Feel free to sha...
New
Devtalk
Our jobs section is for full-time paid positions and for companies to post their own jobs (no consultancies or agencies, sorry!) - simply...
New
AstonJ
There’s a whole world of custom keycaps out there that I didn’t know existed! Check out all of our Keycaps threads here: https://forum....
New
foxtrottwist
Here’s our thread for the Keyboardio Atreus. It is a mechanical keyboard based on and a slight update of the original Atreus (Keyboardio ...
New
Margaret
Hello content creators! Happy new year. What tech topics do you think will be the focus of 2021? My vote for one topic is ethics in tech...
New
DevotionGeo
The version of Java installed with Android Studio on my Mac is the following (when I run java -version) openjdk version "1.8.0_242-relea...
New
First poster: OvermindDL1
Using Zig to Build Native Lua Scripts. Using Zig to Cross compile a Lua script for multiple arches
New
First poster: bot
API Gateway Trends behind Features: Apache APISIX 3.0 vs. Kong 3.0 - API7.ai. By comparing the open-source API Gateway Apache APISIX and...
New
First poster: bot
zig/http.zig at 7cf2cbb33ef34c1d211135f56d30fe23b6cacd42 · ziglang/zig. General-purpose programming language and toolchain for maintaini...
New
harwind
I’m working on a Spring Boot project and I have a controller where I want to map multiple request paths to a single method. Let’s say I h...
New

Other popular topics Top

Rainer
My first contact with Erlang was about 2 years ago when I used RabbitMQ, which is written in Erlang, for my job. This made me curious and...
New
AstonJ
There’s a whole world of custom keycaps out there that I didn’t know existed! Check out all of our Keycaps threads here: https://forum....
New
dimitarvp
Small essay with thoughts on macOS vs. Linux: I know @Exadra37 is just waiting around the corner to scream at me “I TOLD YOU SO!!!” but I...
New
Exadra37
Oh just spent so much time on this to discover now that RancherOS is in end of life but Rancher is refusing to mark the Github repo as su...
New
New
OvermindDL1
Woooooooo! This is such a huge release for it, and 2 years incoming! In short, the library is now using an updated hyper backend (not j...
New
Maartz
Hi folks, I don’t know if I saw this here but, here’s a new programming language, called Roc Reminds me a bit of Elm and thus Haskell. ...
New
New
CommunityNews
A Brief Review of the Minisforum V3 AMD Tablet. Update: I have created an awesome-minisforum-v3 GitHub repository to list information fo...
New
AstonJ
This is a very quick guide, you just need to: Download LM Studio: https://lmstudio.ai/ Click on search Type DeepSeek, then select the o...
New