Spring Batch

  • Batch processing means processing of a batch without any external interference or any manual interaction.
  • Batch contains same types of objects
  • Processing of data without any interaction or interruption is called as batch possessing.
  • Use case
    • Generation of batch statements
    • ETL processing-Transferring of data
    • Processing big data
    • Research and analysis
  • Spring batch is a lightweight, comprehensive batch framework designed to enable the development of robust batch applications vital for daily operations of enterprise systems.
  • Advantages of spring batch are
    • Restartability
    • Start, restart, skip, reentry capabilities
    • Different readers and writers-support of JMS, JDBC, CSV, FILE, HIBERNATE, AND MORE
    • Chunk processing
    • Transaction management-Roll back, skip capabilities
    • Parallel processing
  • Hierarchy in spring batch
    • Job
    • Steps
    • Items
      • Reader
      • Processor
      • Writer
        • Writer Chunks
    • Chunks
  • We create a job which has steps in steps we have items and in items we have chunks.
  • A job is a sequence of steps. Each step can be configured with.
    • Next-Next step to execute
    • Tasklet-Task or chunk to execute(Item reader, item, writer, item processor)
    • Decision-Decide which steps need to execute.
  • We can execute spring batch using XML or programmatically.
  • Who is split a job using flow.
  • Task executor, executes task, in parallel.
  • A job launcher can be used to execute spring batch job. It can also be launched/scheduled In a Web container as well.
  • Spring batch does not use any schedulers by design.
  • Each execution of a job is called as a job instance. Each job instance is provided with an execution ID, which can be used to restart the job.
  • Job can be configured with terms which can be passed to it from the job launcher.
  • Scaling batch processing
    • Multithreaded steps
    • Parallel steps
    • Remote chunking
    • Remote partitioning-It follows master slave flow.
  • Job deposit to store the state of a job
  • Partitioning in spring batch
    • We create partition of data and in each partition chunks are created.
    • We use master slave model for this.
    • It helps in scaling the application.
  • Example

No comments:

Post a Comment

Spring Boot

What is circular/cyclic dependency in spring boot? When two services are interdependent on each other, that is to start one service, we requ...