如何使用 WebServices 显示进度指示?
我有一个每日启动的多线程加载服务。我想跟踪加载程序的进度百分比。我想在数据库表上有一个更新列来写入 %Progress 会很好。然而,我了解到这可能不是一个好主意,因为会有很大的开销(每分钟 5k 更新)。
我被告知进度指示最好作为网络服务公开。
有人可以向我解释一下如何实现这个吗? Web 服务将输出什么 - XML 数据,例如“21.5% Complete”或其他?客户端应用程序如何确定进度 - 我假设 Web 服务应该公开客户端应用程序将实现并侦听更新的某种通知事件?
I have a daily launched multi-threaded loading service. I would like to keep tack of the percentage progress of the loader. I was thinking that it would be good to have an update column on a database table that writes the %Progress. However, I have learned that this may not be a good idea as there will there be a large overhead(5k updates per minute).
I have been informed that the progress indication is best exposed as a webservice.
Can someone please explain to me how I could implement this? What will the webservice output - XML data such as '21.5% Complete' or otherwise? How would a client appication determine the progress - I assume the webservice should expose some sort of notification event that a client application would implement and listen to update?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我们有 aysnc Web 服务,它运行长时间运行的作业,我们在 Web 服务上使用辅助方法来查询数据库并将值返回到 UI,因此我们可以运行多个作业并返回值。
不优雅但有效。
干杯
伊恩
we have aysnc webservice, that runs the long running job, we use a secondary method on the webservice to query the database and return the value to the UI, so we could have multiple jobs running and return the value.
Not elegant but it works.
Cheers
Iain
保持简单。
使用 updateProgress 和 getProgress 两个方法创建一个 Web 服务。所有 Web 服务都必须将进度存储在静态变量中。
您的加载服务只是发布更新,您的客户端会轮询进度以及您认为可接受的速率。
Keep it simple.
Create a web service with 2 methods, updateProgress and getProgress. all the web service has to do store the the Progress in a static variable.
Your loading service just posts the updates and your client polls for progress and whatever rate you consider acceptable.