在 RESTful 架构中实现批处理操作的最佳方式?

发布于 2024-08-26 06:58:07 字数 202 浏览 4 评论 0原文

我们的产品主要采用 RESTful 架构。这使我们能够很好地实现几乎所有所需的功能,除了这个新的要求。

我需要实现一个页面,让用户可以同步进行大规模数据库操作。如果他们意识到自己犯了一个错误,他们可以在中间停止操作(而不是等待它完成并执行撤消操作)

我想知道是否有人可以给出一些指示,说明实现此类操作的最佳方法是什么一个功能?

干杯! 尼拉夫

We have a predominantly RESTful architecture for our product. This enables us to nicely implement almost all of the required functionality, except this new requirement thats come in.

I need to implement a page which lets the user to large scale DB operations synchronously. They can stop the operation in between, if they realized they made a mistake (rather than waiting for it to complete and doing an undo operation)

I was wondering if some one could give some pointers as to what would be the best way to implement such a functionality?

Cheers!
Nirav

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

与他有关 2024-09-02 06:58:08

我会在一个单独的线程中启动大型操作。向用户显示不断更新的线程状态以及取消按钮。如果用户单击“取消”按钮,则会终止线程。

这就是我过去实施类似事情的方式。

这个想法是立即将控制权交还给他们,但在线程完成之前不要让他们做任何其他事情,除了取消。

一般来说,您需要一个“作业队列”和一种管理队列的方法。

I would kick off the large operation in a separate thread. Show the user a constantly updated status of the thread, along with a Cancel button. If the user clicks the Cancel button, you kill thread.

This is the way I've implemented similar things in the past.

The idea is to give them their control back immediately, but don't let them do anything else until the thread is complete except cancel.

In generic terms, you need a "job queue" and a way to manage the queue.

北陌 2024-09-02 06:58:08

您需要集成批处理管理器,或实现您自己的。有多种产品可以为您提供帮助。作为示例,请阅读这篇文章
http://www.ibm.com/developerworks/websphere/techjournal/ 0801_vignola/0801_vignola.html

You need to integrate a batch manager, or implement your own. There are several products that can help you. As an example, read this article
http://www.ibm.com/developerworks/websphere/techjournal/0801_vignola/0801_vignola.html

樱娆 2024-09-02 06:58:07

封装一组批处理操作的资源怎么样?创建资源意味着开始操作(指示操作应执行的操作的数据通过 POST 提交)。更新资源允许在处理时停止或修改它。

How about a resource that encapsulates a set of batch operations? Creating the resource means kicking off the operations (data to indicate what the operations should do is submitted via POST). Updating the resource allows stopping it or modifying it while processing.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文