I am using Spring Boot application which has API controller to generate reports . The actual service function is wrapped around @Async annotation and function makes DB calls and generates the csv reports . I am also using Hikari CP for connection pool management and JPA + QueryDSL for forming select queries .…
Tag: asynchronous
Run task asynchronously: ManagedExcecutorService vs Microprofile fault tolerance @Asynchronous
I want to run an asynchronous task in a JavaEE openliberty environment. Ideally the task has to run at startup, but I don’t want that it blocks the startup of the WAR module itself. Also, I don’t want that on failure it prevents the whole application from starting up. So I guess that the solution …
How to send multiple of asynchronous requests from client to server
I’ve built simple client-server model using sockets. The server receives 1 type of request: 2 numbers from client, sums them, waits for 5 seconds and sends the response back to the client. I’m trying to send 20 asynchronous request from the client without waiting for response. The client should su…
Does Spring AMQP CorrelationData getFuture wait indefinitely without timeout?
In the context of Publisher confirms, when waiting for the CorrelationData’s future (SettableListenableFuture#get()) – does it wait indefinitely or is there a timeout configured under the water? Answer It does wait indefinitely. There is just no any opinion and everything is delegated directly to …
Make order of responses match order of requests in Netty
Context I am writing a Netty application (Netty 4) in which the processing of each message might take some time. As an example of what I mean I have created an EchoHandler that responds with the original message, though sometimes after a short delay: Problem Using this code, the order of the responses is not …
Asynchronous execution/operation with CompletableFuture in Java 8+
In Java, is calling get() method while looping on CompletableFuture instances as good as doing synchronous operations although CompletableFuture is used for async calls? Answer ‘get()’ waits until the future is completed. If that’s what you want, it’s what you use. There’s no gen…
Asynchronous inserts to cassandra with save order of inserts per key
I have an ordered set of incoming events and I need to insert them into Cassandra. I want to take advantage of the speed of asynchronous inserts, but my incoming events may have duplicates by key of target table. If I understand correctly, then asynchronous insertions can’t guarantee data consistency in…
How to have an asynchronous and non-concurrent scheduler in Spring?
I have in the main class that starts the app: and a scheduler I want to prevent the scheduler from being launched again if the internal process takes more than 15 minutes to start the task again. I can’t find the way. I have tried implementing @DisallowConcurrentExecution with the quartz library but it …
Is there a way to calculate the time required to complete every completableFuture?
Before I jump into the specifics of the question, I want to give the context of the problem. Basically, my code looks like Now what i want to do is run doSomething() as a completableFuture and get the responseTime as mentioned above. But since doing something like this would be totally incorrect — since…
How to manage a RestEndpoint with Spring Application Events?
I´m developing a spring boot microservice and I´m raising application events to execute my services and do my business stuff. It works well when I listen from Kafka, but also I want to implement an endpoint that returns a response. I raise my application event in the restController but what I don´t know is ho…