Spring Batch Integration - 传递数据黑白集成和批处理 [英] Spring Batch Integration - pass data b/w integration and batch

查看:33
本文介绍了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 - 传递数据黑白集成和批处理的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆