Spring Batch Concepts Chapter
Spring Batch Concepts Chapter
The below figure shows two kinds of Spring Batch components:infrastructure components and application components. The infrastructure componentsare the job repository and the job launcher. Spring Batch provides implementations for both – and you do need to configure these components – but there’slittle chance you’ll have to create your own implementations.
The main Spring Batch components. The framework provides ajob repository to store job metadata and a job launcher to launch jobs, and theapplication developer configures and implements jobs. The infrastructure components– provide by Spring Batch – are in gray, and application components –implemented by the developer – are in white.
Table ‘The main components of a Spring Batch application’
|
Component |
Description |
|
Job repository |
An infrastructure component that persists job execution metadata |
|
Job launcher |
An infrastructure component that starts job executions |
|
Job |
An application component that represents a batch process |
|
Step |
A phase in a job; a job is a sequence of steps |
|
Tasklet |
A transactional, potentially repeatable process occurring in a step |
|
Item |
A record read from or written to a data source |
|
Chunk |
A list of items of a given size |
|
Item reader |
A component responsible for reading items from a data source |
|
Item processor |
A component responsible for processing(transforming, validating, or filtering) a read item before it’s written |
|
Item writer |
A component responsible for writing a chunk to a data source |
How Spring Batch interacts with the outside world
A job starts in response to an event. You’ll always use theJobLauncher interface and JobParameters class, but the event can come fromanywhere; a system scheduler like cron that runs periodically, a script thatlauncher a Spring Batch process, an HTTP request to a web container thatlaunches the job, and so on.
Batch jobs are about processing data, and that’s why belowfigure shows Spring Batch communicating with data sources. These data sourcescan be of any kind, the file system and a database being the most common, but a job can read and write messages to Java Message Service(JMS) queues as well.
Jobs can communicate with data sources, but so does the job repository. In fact, the job repository stores job execution metadata in a databaseto provide Spring Batch reliable monitoring and restart features.
Spring Batch can run anywhere the Spring Framework can run:in its own Java process, in a web container, in an application, or even in anOpen Services Gateway initiative(OSGi) container. The container depends on your requirements, and Spring batch is flexible in this regard.
Spring Batch infrastructure need to deal mainly with two components: the job launcher and the job repository. These concepts match two straightforwardjava interfaces: JobLauncher and JobRepository.
The JobLauncher interface have run function, which acceptstwo parameters: Job, which is typically a Spring bean configured in Spring BatchXML, and Jobparameters, which is usually created on the fly by the launchingmechanism.
Who calls the job launcher? Your own java program can usethe job launcher to launch a job, but so can command-line programs orschedulers(like cron or the Java-based Quartz scheduler).
The job launcher encapsulates launching strategies such asexecuting a job synchronously or asynchronously. Spring Batch provides oneimplementation of the JobLauncher interface: SimpleJobLauncher.
The job repository maintains all metadata related to jobexecutions.
The JobRepository interface provides all the services tomanage the batch job lifecycle: creation,update, and so on.
What constitutes runtime metadata? It includes the list ofexecuted steps: how many items Spring Batch read, wrote, or skipped; theduration of each step: and so forth.
Spring Batch provides two implementations of theJobRepositorty interface: one stores metadata in memory, which is useful fortesting or when you don’t want monitoring or restart capabilities; the otherstores metadata in a relational database.
Spring Batch Concepts Chapter的更多相关文章
- spring batch(一):基础部分
spring batch(一):基础部分 博客分类: Spring java spring batch 官网: http://www.springsource.org/spring-batch 下 ...
- Spring Batch Framework– introduction chapter(下)
Extract,Transform, and load(ETL) Briefly stated, ETL is a process in the database anddata-warehousin ...
- spring batch(二):核心部分(1):配置Spring batch
spring batch(二):核心部分(1):配置Spring batch 博客分类: Spring 经验 java chapter 3.Batch configuration 1.spring ...
- Spring Batch在大型企业中的最佳实践
在大型企业中,由于业务复杂.数据量大.数据格式不同.数据交互格式繁杂,并非所有的操作都能通过交互界面进行处理.而有一些操作需要定期读取大批量的数据,然后进行一系列的后续处理.这样的过程就是" ...
- spring batch资料收集
spring batch官网 Spring Batch在大型企业中的最佳实践 一篇文章全面解析大数据批处理框架Spring Batch Spring Batch系列总括
- Spring Batch学习笔记三:JobRepository
此系列博客皆为学习Spring Batch时的一些笔记: Spring Batch Job在运行时有很多元数据,这些元数据一般会被保存在内存或者数据库中,由于Spring Batch在默认配置是使用H ...
- Spring Batch学习笔记二
此系列博客皆为学习Spring Batch时的一些笔记: Spring Batch的架构 一个Batch Job是指一系列有序的Step的集合,它们作为预定义流程的一部分而被执行: Step代表一个自 ...
- 初探Spring Batch
此系列博客皆为学习Spring Batch时的一些笔记: 为什么我们需要批处理? 我们不会总是想要立即得到需要的信息,批处理允许我们在请求处理之前就一个既定的流程开始搜集信息:比如说一个银行对账单,我 ...
- Spring Batch 中文参考文档 V3.0.6 - 1 Spring Batch介绍
1 Spring Batch介绍 企业领域中许多应用系统需要采用批处理的方式在特定环境中运行业务操作任务.这种业务作业包括自动化,大量信息的复杂操作,他们不需要人工干预,并能高效运行.这些典型作业包括 ...
随机推荐
- 页面多个Jquery版本共存的冲突问题,解决方法!
示例如下: <script type="text/javascript" src="jquery.js"></script> <s ...
- 原创: 做一款属于自己风格的音乐播放器 (HTML5的Audio新特性)
灵感的由来是前些天看到了博: http://www.cnblogs.com/li-cheng 的首页有一个很漂亮的播放器,感觉很不错,是用Flex做的Flash播放器. 于是我也便想到了,自己也来来弄 ...
- Java [Leetcode 232]Implement Queue using Stacks
题目描述: Implement the following operations of a queue using stacks. push(x) -- Push element x to the b ...
- Dataguard三种保护模式
Oracle Data Guard 提供三种高水平的数据保护模式来平衡成本.可用性.性能和事务保护.可以使用任意可用管理界面来轻松地设置这些模式.要确定适当的数据保护模式,企业需要根据用户对系统响应时 ...
- delphi实现ado的高级功能
ADO是Microsoft存取通用数据源的标准引擎.ADO通过封装OLE DB而能够存取不同类型的数据,让应用程序能很方便地通过统一的接口处理各种数据库.ADO由一组COM对象组成,每一个不同的原生A ...
- 嵌入式 hi3518c平台网卡模式MII与RMII模式在Uboot和kernel中切换小结
由于公司项目的需要,我们需要在原有的MII的基础上,修改为RMII模式,针对hi3518c平台,我的网卡是LAN8701需要修改的地方有如下几个: 首先我的uboot中env是: bootargs=m ...
- hadoop2.0中无法启动datanode的问题
问题描述:在启动datanode进程时,能成功的启动:但用jps查看进程时,发现进程不存在,下面是在datanode日记文件的错误信息 如下图的截屏所示: 主要原因:发生错误的原因:由于把data放在 ...
- leveldb源码笔记
关于KV数据库leveldb的介绍,网上已经太多了,这里只是自己再学习源码过程中,整理的笔记,磁盘存储和内存存储的结构用了伪代码表示出来了,首先是内存中存储结构,然后是log文件存储结构和磁盘数据ss ...
- HDU-4861 Couple doubi
http://acm.hdu.edu.cn/showproblem.php?pid=4861 Couple doubi Time Limit: 2000/1000 MS (Java/Others) ...
- 《Python核心编程》 第四章 Python对象- 课后习题
练习 4-1. Python对象.与所有Python对象有关的三个属性是什么?请简单的描述一下. 答:身份.类型和值: 身份:每一个对象都有一个唯一的身份标识自己,可以用id()得到. 类型:对象的 ...