Solving a special asynchronous scenario

Hello All,

i have a special asynchronous web service scenario.

The webservice is converting a file to a pdf which can take some time. So I have two different operations in that service:

  • putDocument - sends a file to the converter
  • retrieveDocument - try to retrieve the converted file using an id

The second service returns null if the document is not processed yet. So I might need to poll for the result several times.

My requirements are that I do not wait synchronously for the result because this might block a thread for a long time. We would rather like to wait asynchronously without blocking a thread.

  1. Put Document
  2. Poll every 5s for the document
    3 if document is not converted after 60s return an error

Any ideas on how to solve this in Integration server?



How long does the conversion typically take? How many calls might be going at any given moment?

If the conversion is just a few minutes, and the number of calls is relatively few, I would just implement this synchronously. Holding onto a thread is not that big of a deal. Since you indicate that you’ll give up after 1 minute, waiting shouldn’t be a problem. But you’ll want a timeout of some sort even when you’re synchronous, so be sure to do that.

Thanks for your reply.

Initially we do not expect a lot of load on that service but it might increase in future.

From an architecture point of view I think it is always a bad thing to call something that is asynchronous in a synchronous way. It might lead to a congestion of the system. I have seen such cases in a production system. Would you agree?

Apart from this architecture discussion i am still interested if it is possible to solve such a scenario in an asynchronous way in Integration server. I have two ideas:

  • Publish a broker document with a delay - This would work if i could publish a broker document and tell the broker to process the document with a certain delay - is that possible?
  • Use pub.scheduler:addOneTimeTask to schedule the next poll for the converted file. What do you think about that?

Any ideas are appreciated.