Spring Batch Integration

编程入门 行业动态 更新时间:2024-10-26 03:24:09
本文介绍了Spring Batch Integration - 传递数据黑白集成和批处理的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我正在使用 Spring Batch Integration,因为在调用批处理之前我必须执行某些工作.

I am using Spring Batch Integration as I have to perform certain works before invoking the batch.

我已经使用 Spring Integration 完成了这项工作,并使用 job-launching-gateway 调用了批处理,它的工作原理非常棒.现在的问题是如何将数据从 Spring Integration 传递到 Batch?

I have done the work using Spring Integration and invoke the batch using job-launching-gateway and it works like a charm. Now the question is how to pass the data from Spring Integration to Batch?

请提出建议.

推荐答案

发送到 JobLaunchingGateway 的消息有一个 JobLaunchRequest 负载.

The message sent to the JobLaunchingGateway has a JobLaunchRequest payload.

在 Spring Integration 流程中构建请求时,您可以添加 JobParameters,然后在批处理作业中使用.

When you build the request in your Spring Integration flow, you can add JobParameters which are then used within the batch job.

编辑

对于自定义对象,您必须间接进行.例如通过 Map.

For custom objects you would have to do it indirectly. For example via a Map.

如果您使用的是 XML 配置,则可以使用:

If you are using XML configuration, you can use a:

... </...>

将您的对象填充到某个键下的映射中,将键作为 JobParameter、@Autowire 传递到您的批处理作业中,然后使用键.

Stuff your object into the map under some key, pass the key as a JobParameter, @Autowire the map into your batch job and retrieve/remove the object using the key.

更多推荐

Spring Batch Integration

本文发布于:2023-08-01 20:15:27,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1271361.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:Spring   Batch   Integration

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!