Comments (3)
Any updates on this topic?
from ninja.
Docu is not yet there, but the integration test has a class that can serve as an example:
https://github.com/ninjaframework/ninja/blob/develop/ninja-servlet-integration-test/src/main/java/controllers/AsyncController.java
Please feel free to add any documentation. Ninja is a community project and all help is well appreciated :)
from ninja.
I just did some testing with async for the first time in ninja and noticed the following:
I need to call context.handleAsync()
before returning Results.async();
for it to work, otherwise the client gets an empty http reply immediately (before I called returnResultAsync
).
Is this the expected behavior? I saw that handleAsync()
is called internally as well when calling retrunResultAsync
so I'm not sure if this is the correct usage.
Update:
I'm also getting some IllegalStateException: s=IDLE i=true a=NOT_ASYNC
when processing some requests although the client is still waiting for a reply (tcp connection not closed).
A bit of background information: For some endpoints I need to limit the number of parallel executions without blocking the threads. My idea was to put the requests into a queue and return Results.async()
. A single worker thread then processes the queue and returns the result with context.returnResultAsync
.
This seems to work for 70% of the requests, but for the others I get the exception mentioned above when calling returnResultAsync
.
Any idea?
from ninja.
Related Issues (20)
- NPE in Ninja when trying to render error message HOT 2
- SuperDevMode issue on VirtualBox "Shared Folder"
- How to return HttpServletResponse
- Is Ninja-Framework safe regarding "Critical New 0-day Vulnerability in Popular Log4j Library"? HOT 4
- Is it still active? / Looking for maintainers? HOT 2
- Problem using Validation & DTO (v6.8.1) HOT 1
- Issue with deployed WAR : Application seems run twice HOT 1
- Websockets are not initialised error HOT 3
- dependency scope setting issues
- Retrieve url path from template
- Ninja 6.9.0 : Configure Jetty ThreadPool HOT 1
- Code optimization suggestions
- Does anyone use it to build microservices
- Test Smell: it is not a good practice to write return statement in test case
- X-Forwarded-For does an insecure internal DNS lookups for user-provided hosts
- How to integrate socket into ninja and start it with ninja program, not websocket
- Some flaky tests
- Exclude field from depths (nested relation) on create_schema function
- org.hibernate.HibernateException: HHH000142: Javassist Enhancement failed: models.Article
- Insecure Cookie Encryption due to usage of insecure mode of operation when doing AES cipher
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ninja.