Long running webservice architecture

后端 未结 2 436
迷失自我
迷失自我 2021-01-14 21:31

We use axis2 for building our webservices and a Jboss server to run the logic of all of our applications. We were asked to build a webservice that talks to a bean that could

2条回答
  •  温柔的废话
    2021-01-14 22:20

    Another approach you could take is to make use of JMS and a DB.

    The process would be

    1. In web service call, put a message on a JMS Queue
    2. Insert a record into a DB table, and return a unique id for that record to the client
    3. In an MDB that listens to the Queue, call the bean
    4. When the bean returns, update the DB record with a "Done" status
    5. When the client calls for status, read the DB record, return "Not Done" or "Done" depending on the record.
    6. When the client calls and the record indicates "Done", return "Done" and delete the record

    This process is a bit heavier on resource usage, but has some advantages

    • A Durable JMS Queue will redeliver if your bean method throws an Exception
    • A Durable JMS Queue will redeliver if your server restarts
    • By using a DB table instead of some static data, you can support a clustered or load balanced environment

提交回复
热议问题