首页 文章

Grails status更新长时间运行的任务

提问于
浏览
3

我有一个长时间运行的任务(> 1.5分钟),我希望能够通过ajax提供用户完成状态 . 这里's what I'目前在做:我使用ajax处理上传(使用ajax上传插件),并在任务运行时显示忙标签 . I want to be able to display percentage completed (Not percentage of upload - I already provide updates for that.) i.e After my excel file is done uploading and I start processing the rows, I want to be able to provide status updates to the user.

以下是我的研究/个人知识引导我:1 . 使用线程2.使用JMS或某种消息3.使用grails事件 . (不知道这将如何工作)

有人知道实现这个的最佳方法是什么?

2 回答

  • 2

    我们在Grails应用程序中使用Spring Batch作为长期运行的任务(=批处理作业) . 它是Spring产品系列的框架部分,旨在构建批处理作业 .

    SpringSource / GoPivotal的工作人员在整体架构和提供的模式中真正考虑了很多 . 如果您的应用程序中有多个批处理作业,我会考虑查看它 .

    对于您的特定进度要求,Spring Batch在运行时提供了诸如 JobOperatorJobExplorer 之类的组件,可用于查找当前批处理作业状态 . 如果你喜欢这个作为起点,那就有一个单独的SO question about monitoring progress in Spring Batch .

  • 1

    当我在过去做过这个时,我使用了以下方法:

    如果要显示%完成,jQuery UI progress bar非常容易使用 .

相关问题