Setting a timeout in Resteasy, JAX-RS

I have HTTP requests that are very durable and I need results.

How to extend server latency for these types of calls. Note this is not Session-Timeoutas defined in web.xmlfor the server.

I noticed that JAX-RS has a notation @Timeout, but I don’t know how to use it, or if it even works with this type of configuration.

My calls are configured like this:

@Path("/path/")
public class BulkCreate {
    @Path("/path")
    @Produces(MediaType.APPLICATION_JSON)
    @Consumes(MediaType.APPLICATION_JSON)
    public Response query(@QueryParam("token") String token,
            BulkCreateObject[] objects) {
          ....
        }
}

I cannot use @ Suspend or make them completely asynchronous.

I did not start setting up this project, so I don’t know what other elements are needed to enable these interfaces, except that they work, but I can’t figure out where to set the long timeout.

- , ( , ) "Timeout Exception" ~ 2-3

- .

+4

Source: https://habr.com/ru/post/1540598/


All Articles