基于内容的路由和 java 批处理 JSR 352(jBeret,Spring 批处理)?

Content based routing and java batch JSR 352 (jBeret, Spring Batch)?

基于内容的路由和 java 批处理 JSR 352jBeretSpring Batch)?

已尝试实施一些简单的 "real world" 批处理作业,因为 "hello world" 看起来很有前途。 似乎我的概念不正确 - 但实际的释放接缝对于 "real world" 个示例来说毫无用处。

- read 5mio lines (ItemReader works fine)
- write to three different filed/resources based on the content of the line read

"intuitive" 方法是:

使用 Java 批处理 JSR 352 执行此操作的正确方法是什么? 欢迎任何提示。

您需要在单个 ItemWriter 中实现逻辑。 specification-defined 框架在这里帮不了你。 SpringBatch 有一个 CompositeItemWriter 可以帮助处理这种用例,尽管它特定于 SpringBatch,并且不能与其他 JSR 352 实现一起使用,例如 Liberty(或者,据我所知,JBeret)。

在规范中不包含 "child writers" 的一个理由是,就像您的情况一样,有 app-specific 逻辑来决定写入(或不写入)children。但这是一个 JSR 352 可以使用更多示例并可能增强规范本身的领域。

这不是一个很好的答案,但我不想在没有答案的情况下离开这个问题。