2 Replies Latest reply on Sep 28, 2017 3:36 PM by satrapu

    How to prevent Wildfly timeout while running long backend process.

    jboss234

      I am using wildfly10 which calls backend batch process from front end. If BatchProcess processes large number of records then after sometime browser times out with page cannot be display.

       

      How to prevent this timeout with configuration / programmatically.

       

      Thanks,

        • 1. Re: How to prevent Wildfly timeout while running long backend process.
          walkerca

          Hi,

           

          I put this annotation on an EJB method for long-running operations.

           

          @TransactionTimeout(value=4,unit= TimeUnit.HOURS)

          public void longOp() ...

           

          It's not a standard JavaEE annotation but I don't have to modify standalone*.xml.

           

          -Carl

          • 2. Re: How to prevent Wildfly timeout while running long backend process.
            satrapu

            Hi,

             

            You could use a fire-and-forget approach, where you call an async EJB method to initiate the batch processing; this will no longer result in browser timeout.

            The downside of this approach is that you will not be able to see the processing outcome, as the server will return control to the client immediately.

             

            A more user-friendly approach, though more complex, is to call the same async EJB method,

            but when the batch operation completes, send a notification to the client side by resorting to web sockets.

            Then, the UI should display a popup informing the user about the long-running process outcome.

             

            References from Java EE 7 Tutorial:

             

            Cheers,

            Bogdan