Modern Java-based batching in WebSphere application Server (i)

Source: Internet
Author: User
Tags pack versions websphere application server

Introduction to modern Batch and computational-intensive programming models

Brief introduction

A batch process is a traditional and indispensable component of any enterprise IT domain. The current batch development trend is to apply internal Java skills to online programs and batch programs to ensure that:

Maximize the reuse of implementations.

Easier development and maintenance because the same toolset is used.

Consistency in the implementation of enterprise standards and service quality.

IBM developed solutions provide a cohesive batch process management model. Modern Batch features of IBM WebSphere Application Server (available for WebSphere Application Server V8, WebSphere Application Server V7.0 F Eature Pack for modern Batch and IBM WebSphere Extended deployment Compute Grid V8.0) provides a batch middleware framework that provides:

Container-managed batch job execution: provides the structure and support capabilities required by Java batch applications to help you avoid custom middleware traps.

Job Control Interface: An XML file that describes the steps that are contained in a Java class file and a batch job that is used in a batch step.

Job Checkpoint and reboot feature: the ability to create checkpoints on a record quantity or time basis. This supports restarting a job from a known checkpoint.

Universal Batch Data stream (BDS): A feature that abstracts data into an easily accessible record format, allowing batch programming to focus on business functions rather than basic code for reading and writing data.

Having such a framework provides a good alternative to developing custom batch middleware, allowing developers to focus on achieving core business goals. With modern Batch, you can streamline the development of batch applications to write business logic for the job. Separation of concerns between this business logic and the "Piping" code is an important advantage of the batch processing framework. It enables a more efficient modularity of batch functions, which supports more efficient reuse and the ability to expose batches as modular services.

Modern Batch supports two types of batch programming modes:

Compute-intensive: simple jobs that perform compute-intensive work without requiring a reboot.

Transaction Batch: Applies to checkpoints that require a container management and a job that restarts the mechanism. If interrupted because of a planned or unplanned power outage, this enables the batch job to reboot from the last checkpoint.

This article analyzes the compute-intensive model and provides an example implementation that uses the new functionality provided in the IBM Rational application Developer V8.

Computational-intensive programming models

Computational-intensive programming contains the following elements:

Controller Bean: A stateless session bean that supports the job of the runtime environment to control the application. The implementation of this stateless session bean (Cicontrollerbean) is provided by the application server.

Job step implementation class: The job step represents the business logic that the job will execute. It is represented by an instance of a class that implements the Com.ibm.websphere.ci.CIWork interface. The Ciwork interface contains the following methods:

The run () method executes when the CI job is run.

The GetProperties () and SetProperties () methods are used to get the input values from the properties from the client.

The release () method is invoked when a job is required to break through the client during execution.

If the work is long-term, not short-term, then the Isdaemon () method returns "true".

XJCL file: An xml-based configuration file that is submitted to the job scheduler to run. The job scheduler uses the information in this file to determine where and when the job runs, its input, and its output. The XJCL definition of a job is not part of a batch application.

Figure 1 shows the computational-intensive programming model. (This is a simplified version of the actual programming model, and the actual model will be discussed in detail in part 2nd.) )

Figure 1. Computational-intensive programming model

To develop compute-intensive jobs, you need:

Defines the XJCL file.

Create a Java class that implements the Ciwork interface, including the business logic that will be executed for each job step.

Ciwork is appropriately packaged as an implementation class using a stateless session bean pointing to Com.ibm.ws.ci.CIControllerBean.

Before building a sample compute-intensive job, it is important to understand the behavior of compute-intensive applications during run-time. In short, what happens is that the application server uses the XJCL file to find and invoke the controller bean. The bean reads the XJCL file, and for each job step in XJCL, the Bean performs the following actions:

Instantiates the application Ciwork object (specified by the class name element in the XJCL of the job step) using the Ciwork constructor of the class.

Call the Ciwork object's SetProperties () method to pass any of the properties defined in the XJCL of the job step.

Find the work manager defined in the deployment descriptor of the Enterprise Bean module, using it to invoke the Ciwork object's run () method asynchronously.

With this understanding of the programming model, let's take a look at the steps in developing a compute-intensive application.

Sample Business Scenario

Related products and versions

The examples provided here are developed and deployed on the WebSphere application Server V8.0 using the Rational application Developer V8.0. The Rational Software Architect for WebSphere V8 and newer versions also provides tool support for developing batch programs. The WebSphere application Server V7.0.0.11 and newer versions provide run-time support for modern Batch through the modern Batch feature Pack, modern Batch in the form of an integrated component in V8.

The enterprise in this sample scenario is a financial organization that has many branches in different states. The organization's customers submit applications to the branch office for appropriate processing. The compute-intensive application sample generates a report summarizing the number of applications from each state, as well as other metrics for the organization.

To develop this application, follow these steps:

In Rational application Developer, navigate to File > New > Batch Project to create a new batch project named Dwsamplebatch. Click Finish after you complete this action (see Figure 2). This also creates an EJB project that has a stateless session bean and an EAR project.

Figure 2. Create a new batch project

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.