如何轮询目录以及目录中复制的任何XLSX文件,请致电REST API加载feed
我有一个用例,我想对目录进行轮询。 我找不到自己的方式,请提出某种方法来做到这一点。
I have a use case, i want to poll a directory, if the any .*xlsx file get pasted in that directory, i want to call a post rest API that will load the data.
I'm not able to find the my way, please suggest some way to do this.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我相信您正在寻找完全工作的样本,我怀疑这将是一个,因为您的业务任务可能与其他人所做的不一样。
尽管我们不介意您是否贡献了这样的样本: https:// github。 com/spring-projects/spring-integration-samples 。
因此,要构建逻辑,我们需要提供
IntegrationFlow
: https://docs.spring.io/spring-integration/docs/current/current/referent/referent/referent/html/dsl.html.html#java-dsl-dsl-dsl-dsl 。< /p>要从DIR读取文件,我们需要使用
files.inboundadapter()
与各自的轮询策略。您可以对轮询文件内容进行一些转换(
.transform()
)。通过
http.outboundgateway()
致电休息服务
类似的事情:(
我不知道您的XSLT内容是什么以及如何调用其剩余服务
。 //github.com/spring-projects/spring-integration-samples/tree/main/main/applications/file-split-ftp“ rel =” nofollow noreferrer“> https://github.com/spring-proing-projects/spring-integration-integration-integration-integration-integration-integration-integration -samples/tree/main/applications/file-split-ftp
I believe that you are looking for fully working sample and I doubt that is going to be one since your business task might not be the same what other people are doing.
Although we won't mind if you contribute back such a sample: https://github.com/spring-projects/spring-integration-samples.
So, to build a logic we need to provide an
IntegrationFlow
: https://docs.spring.io/spring-integration/docs/current/reference/html/dsl.html#java-dsl.To read files from a dir we need to use a
Files.inboundAdapter()
with respective polling policy.You may do some transformation (
.transform()
) about polled file content or so.Call the REST service via
Http.outboundGateway()
Do the post-process.
Something like this:
(Haven't checked as working since I don't know what is your XSLT content and how you call the REST service.)
This sample does something with files reading to gather some ideas: https://github.com/spring-projects/spring-integration-samples/tree/main/applications/file-split-ftp
我们有一个系统(几乎)相同(仅XML而不是XLSX),并且我们使用Apache Camel https:// https:// camel.apache.org/
春季启动的集成很好。您只需要从(“ file:////// path; path”).to(“ http:&lt; host&gt;:port/&lt; path;)您可能需要的
是要划到的代码线以进行过滤,并增加了一些转换,但这是一个不错的软件。
We have a system that does (almost) the same (just xml instead of xlsx) and we use Apache Camel https://camel.apache.org/
Integration is good with Spring Boot. You just need to define your route
from("file:///<path").to("http:<host>:port/<path>)
and it will do probably what you need.Might need to tweek the line of code to get filtering and maybe add some transformation but it is a nice peace of software.