简体   繁体   English

如何使用两个不同的API取消异步Spring方法

[英]How to cancel Async spring method using two different apis

I have got two APIs 我有两个API
/books/generatreport and /books/cancelreport / books / generatreport/ books / cancelreport
what I am doing is when the user hits the first rest API books/generatereport it starts an async spring method which returns AsyncResult. 我正在做的是,当用户点击第一本其余的API书籍/ generatereport时,它将启动一个异步spring方法,该方法返回AsyncResult。
I am looking for is when the user hits books/cancelreport then it should cancel the task which was started by generatereport API. 我正在寻找的是当用户点击书籍/取消报告时,它应该取消由generatereport API启动的任务。
How can I share the AsyncResult between two rest APIs? 如何在两个其他API之间共享AsyncResult?

使用servlet上下文解决了我的问题,因为在servlet上下文中添加内容是应用程序级别的,因此可以将其用于在两个Restful服务之间共享信息。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM