Managing very lengthy Java operations

In fact, I have the following thread:

  • The user clicks the "huge operation" button;
  • It calls the RESTful service;
  • The rest of the service calls HugeOpServiceBean, which is an EJB;
  • This EJB will report JMS queues to do HugeOperation;
  • This HugeOperation can have two or more implementations, so every MDBean that listens for it will work (which means it can be in another .earear)

I would love to hear how you guys are doing or suggesting that I get me to get the “status” of these MDBeans.

Basically, every MDBean will run some method in the list of some type of object, therefore, calculating the percentage done should be easy, I just don’t know how and what better architectural solution I could do to make this available in some RESTful services .

Thanks in advance.

+7
source share
2 answers

Since the consumption and treatment of MDB is broadcast, all of this or nothing. Mapping progress will be complex and require the sub-transaction to update progress. I would suggest decomposing the work into several JMS messages in the EJB and monitoring the progress of the JMS messages that were successfully used later. See Corporate Integration Templates

+2
source

RESTful way to do this:

  • Returns an HTTP 202 Accepted status code to the client after the first call to indicate that the request was successful, but additional processing is required. You can also provide a response URI that the client can use to request job status
  • Implement an endpoint that a client can call to request job status.
  • When the operation is completed, the endpoint from 2) above will issue a constant redirect to the actual URI of the main object created by the operation.
+6
source

All Articles