项目作者: faiza-aslam

项目描述 :
JavaEE 7 Batch Processing API
高级语言: Java
项目地址: git://github.com/faiza-aslam/batch-job-processor.git
创建时间: 2017-12-25T09:12:50Z
项目社区:https://github.com/faiza-aslam/batch-job-processor

开源协议:

下载


batch-job-processor

This project demonstrates the features of JavaEE 7 batch processing API.
The use case is to send SMS/Email notification on daily basis to some particular group of users.

Technology Stack

  • JavaEE 7
  • EJBs
  • CDI
  • WildFly 10
  • MySQL

Project Setup

  • Download/clone the project.
  • Execute the attached scripts
  • Create datasource in standalone.xml of WildFly server as follows:

    1. <datasource jndi-name="java:jboss/jdbc/batch-ds" pool-name="BatchDatasource">
    2. <connection-url>jdbc:mysql://localhost:3306/batch?useSSL=false</connection-url>
    3. <driver>mysql</driver>
    4. <pool>
    5. <min-pool-size>10</min-pool-size>
    6. <max-pool-size>20</max-pool-size>
    7. <prefill>true</prefill>
    8. </pool>
    9. <security>
    10. <user-name>root</user-name>
    11. <password>root</password>
    12. </security>
    13. </datasource>
  • To make job repository persistent, replace the jberet subsystem with the following:

    1. <subsystem xmlns="urn:jboss:domain:batch-jberet:1.0">
    2. <default-job-repository name="jdbc"></default-job-repository>
    3. <default-thread-pool name="batch"></default-thread-pool>
    4. <job-repository name="in-memory">
    5. <in-memory></in-memory>
    6. </job-repository>
    7. <job-repository name="jdbc">
    8. <jdbc data-source="BatchDatasource"></jdbc>
    9. </job-repository>
    10. <thread-pool name="batch">
    11. <max-threads count="10"></max-threads>
    12. <keepalive-time time="30" unit="seconds"></keepalive-time>
    13. </thread-pool>
    14. </subsystem>

Build the project using:

  1. $ mvn clean install

Deploy the war in wildfly and start the server using:

  1. $ standalone.bat (or standalone.sh)

Open browser and go to URL:

http://localhost:8080/batch

This will open up index.jsp page. Click on the link to start the job.