<?xml version="1.0" encoding='utf-8'?>
<?xml-stylesheet type="text/xsl" href="https://nozaki.me/roller/roller-ui/styles/atom.xsl" media="screen"?><feed xmlns="http://www.w3.org/2005/Atom">
    <title type="html">Kohei Nozaki&apos;s blog</title>
    <subtitle type="html">Notes of my experiments</subtitle>
    <id>https://nozaki.me/roller/kyle/feed/entries/atom</id>
            <link rel="self" type="application/atom+xml" href="https://nozaki.me/roller/kyle/feed/entries/atom?cat=jberetweb" />
        <link rel="alternate" type="text/html" href="https://nozaki.me/roller/kyle/" />
        <updated>2024-05-01T08:28:13+00:00</updated>
    <generator uri="http://roller.apache.org" version="5.2.0">Apache Roller</generator>
        <entry>
        <id>https://nozaki.me/roller/kyle/entry/multiple-deployment-use-mode-is</id>
        <title type="html">Multiple deployment use mode is implemented to jberetweb</title>
        <author><name>Kohei Nozaki</name></author>
        <link rel="alternate" type="text/html" href="https://nozaki.me/roller/kyle/entry/multiple-deployment-use-mode-is"/>
        <published>2015-01-15T12:06:17+00:00</published>
        <updated>2015-02-03T02:59:18+00:00</updated> 
        <category term="jberetweb" label="jberetweb" />
        <category term="jbatch" scheme="http://roller.apache.org/ns/tags/" />
        <category term="jberet" scheme="http://roller.apache.org/ns/tags/" />
        <category term="wildfly" scheme="http://roller.apache.org/ns/tags/" />
        <content type="html">&lt;div class=&quot;paragraph&quot;&gt;
&lt;p&gt;Now jberetweb can operate (start, stop, etc) distributed batches in multiple deployment. to enable multiple deployment use mode, suppress &lt;code&gt;-DjobOperator.jndi&lt;/code&gt; and specify &lt;code&gt;-DjobOperator.name=${facade-class-name}&lt;/code&gt; (e.g. &lt;code&gt;JobOperatorFacade&lt;/code&gt;) in mvn option when you build it.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;paragraph&quot;&gt;
&lt;p&gt;In multiple deployment use mode, &quot;App Name&quot; column will be added for grasp where is deployment of each job comprehensively. actions such as restart, stop will be executed through lookup of appropriate remote EJB interface in according to &quot;App Name&quot;.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;imageblock&quot;&gt;
&lt;div class=&quot;content&quot;&gt;
&lt;img src=&quot;/roller/kyle/mediaresource/8eb794ca-c389-4590-bc0a-643507e66c3a&quot; alt=&quot;8eb794ca c389 4590 bc0a 643507e66c3a&quot; width=&quot;600&quot;&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;paragraph&quot;&gt;
&lt;p&gt;Also in Start Job window, &quot;App Name&quot; can be specified. this will lookup appropriate remote interface accordingly too.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;imageblock&quot;&gt;
&lt;div class=&quot;content&quot;&gt;
&lt;img src=&quot;/roller/kyle/mediaresource/905367a9-1944-4025-bf2c-0623571313b0&quot; alt=&quot;905367a9 1944 4025 bf2c 0623571313b0&quot; width=&quot;600&quot;&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;paragraph&quot;&gt;
&lt;p&gt;&lt;a href=&quot;https://github.com/lbtc-xxx/jberetweb&quot;&gt;Please refer README.md for more information&lt;/a&gt;.&lt;/p&gt;
&lt;/div&gt;</content>
    </entry>
    <entry>
        <id>https://nozaki.me/roller/kyle/entry/restarting-a-stopped-job-with</id>
        <title type="html">Restarting a stopped job with jberetweb</title>
        <author><name>Kohei Nozaki</name></author>
        <link rel="alternate" type="text/html" href="https://nozaki.me/roller/kyle/entry/restarting-a-stopped-job-with"/>
        <published>2015-01-09T12:30:49+00:00</published>
        <updated>2015-02-03T03:14:59+00:00</updated> 
        <category term="jberetweb" label="jberetweb" />
        <category term="jbatch" scheme="http://roller.apache.org/ns/tags/" />
        <content type="html">&lt;p&gt;Assume that there is a job execution which is STOPPED on the Job Executions table like following. let&apos;s see a drop-down list at right end of the row. you can take some actions for each job executions with this &lt;em&gt;&amp;quot;Action&amp;quot;&lt;/em&gt; drop-down list.&lt;/p&gt; 
  &lt;p&gt;&lt;a href=&quot;http://www.nailedtothex.org/roller/kyle/mediaresource/a02f776f-6d2c-4b65-af23-765e200f535b&quot;&gt;&lt;img src=&quot;http://www.nailedtothex.org/roller/kyle/mediaresource/a02f776f-6d2c-4b65-af23-765e200f535b&quot; alt=&quot;スクリーンショット 2015-01-09 19.58.29.png&quot; /&gt;&lt;/a&gt;&lt;/p&gt; 
  &lt;p&gt;This drop-down list contains some actions like following (for STOPPED one).&lt;a href=&quot;http://www.nailedtothex.org/roller/kyle/mediaresource/a02f776f-6d2c-4b65-af23-765e200f535b&quot;&gt; &lt;/a&gt;&lt;/p&gt;&lt;a href=&quot;http://www.nailedtothex.org/roller/kyle/mediaresource/eb23d39e-fc07-402f-9df1-6d0a7573065f&quot;&gt;&lt;img src=&quot;http://www.nailedtothex.org/roller/kyle/mediaresource/eb23d39e-fc07-402f-9df1-6d0a7573065f&quot; alt=&quot;スクリーンショット 2015-01-09 19.59.00.png&quot;/&gt;&lt;/a&gt; 
  &lt;p&gt;There are 3 actions available. &lt;em&gt;&amp;quot;Restart&amp;quot;&lt;/em&gt; means restarting this execution as a new execution but inherit job instance from previous one. &lt;em&gt;&amp;quot;Abandon&amp;quot;&lt;/em&gt; means abandoning this execution as won&apos;t be used again. after abandoning, restarting will be impossible. &lt;em&gt;&amp;quot;Re-execute as new instance&amp;quot;&lt;/em&gt; means opening &amp;quot;Start Job&amp;quot; window with inheriting both of job name and job parameters of selected instance. also &lt;em&gt;&amp;quot;Stop&amp;quot;&lt;/em&gt;&amp;nbsp;is available for running executions.&lt;/p&gt; 
  &lt;p&gt;After selection of Restart, pop-up window will be appeared like following.&lt;/p&gt; 
  &lt;p&gt;&lt;a href=&quot;http://www.nailedtothex.org/roller/kyle/mediaresource/e072d391-8bc8-4430-a180-1ac2170b0144&quot;&gt;&lt;img src=&quot;http://www.nailedtothex.org/roller/kyle/mediaresource/b7fd65ca-fdc6-450f-b7e7-948427949223&quot; alt=&quot;スクリーンショット 2015-01-09 20.02.51.png&quot;/&gt;&lt;/a&gt;&lt;/p&gt; 
  &lt;p&gt;This window looks similar to &amp;quot;Start Job&amp;quot; window, but Job Name editing is prohibited because this is about to restarting of previous execution. you can edit Job Parameters as well as regular job execution but initial value of them will be inherited if they exists in previous execution.&lt;/p&gt;&lt;a href=&quot;http://www.nailedtothex.org/roller/kyle/mediaresource/e072d391-8bc8-4430-a180-1ac2170b0144&quot;&gt; 
    &lt;p&gt; &lt;/p&gt;&lt;/a&gt;</content>
    </entry>
    <entry>
        <id>https://nozaki.me/roller/kyle/entry/how-to-make-jberetweb-to</id>
        <title type="html">How to make jberetweb to invoke BatchRuntime.getJobOperator() directly</title>
        <author><name>Kohei Nozaki</name></author>
        <link rel="alternate" type="text/html" href="https://nozaki.me/roller/kyle/entry/how-to-make-jberetweb-to"/>
        <published>2015-01-07T10:32:52+00:00</published>
        <updated>2015-02-03T03:02:51+00:00</updated> 
        <category term="jberetweb" label="jberetweb" />
        <category term="jbatch" scheme="http://roller.apache.org/ns/tags/" />
        <content type="html">&lt;p&gt;
While I prefer to deploy both of jberetweb.war and your batch application archive independently and invoke JobOperator through remote EJB invocation, there is an another option which make jberetweb to invoke BatchRuntime.getJobOperator() directly instead of remote EJB lookup.
&lt;p&gt;
Just suppress mvn parameter &quot;-DjobOperator.jndi&quot; when you build your jberetweb WAR (please refer &lt;a href=&quot;https://github.com/lbtc-xxx/jberetweb&quot;&gt;README.md&lt;/a&gt;), then jberetweb starts invoke BatchRuntime directly instead of using remote interface. of course, then you have to embed or merge your batch application archive and jberetweb into one WAR or EAR.
&lt;p&gt;
I don&apos;t recommend this way because this makes deployment time of your application longer due to JSF and JPA initializing. and you have to care about consistency for both of JSF and JPA configuration between your application and jberetweb. but it might be a solution where remote EJB invocation is not allowed by some security reasons (EJBAccessException might be occured when jberetweb tries to lookup remote JobOperator interface on such environment).</content>
    </entry>
    <entry>
        <id>https://nozaki.me/roller/kyle/entry/index-needed-on-jobexecutionid-column</id>
        <title type="html">Index needed on jobexecutionid column in step_execution table</title>
        <author><name>Kohei Nozaki</name></author>
        <link rel="alternate" type="text/html" href="https://nozaki.me/roller/kyle/entry/index-needed-on-jobexecutionid-column"/>
        <published>2015-01-05T12:56:03+00:00</published>
        <updated>2015-02-03T03:01:09+00:00</updated> 
        <category term="jberetweb" label="jberetweb" />
        <category term="jbatch" scheme="http://roller.apache.org/ns/tags/" />
        <category term="jberet" scheme="http://roller.apache.org/ns/tags/" />
        <category term="wildfly" scheme="http://roller.apache.org/ns/tags/" />
        <content type="html">Today I deployed new jberetweb to my production system which have 1 million rows in step_execution table, and felt jberetweb slow. I looked it and found the cause is sequential scan.

&lt;pre&gt;
jbatch=# explain analyze select * from step_execution where jobexecutionid = 384846;
                                                    QUERY PLAN                                                    
------------------------------------------------------------------------------------------------------------------
 Seq Scan on step_execution  (cost=0.00..36817.53 rows=4 width=626) (actual time=101.046..101.047 rows=2 loops=1)
   Filter: (jobexecutionid = 384846)
   Rows Removed by Filter: 1102459
 Total runtime: 101.074 ms
&lt;/pre&gt;

So I created an index on jobexecutionid column in step_execution table, then jberetweb starts running fast.

&lt;pre&gt;
jbatch=# create index step_execution_jobexecutionid_idx on step_execution (jobexecutionid);
CREATE INDEX
jbatch=# explain analyze select * from step_execution where jobexecutionid = 384846;
                                                                     QUERY PLAN                                                                     
----------------------------------------------------------------------------------------------------------------------------------------------------
 Index Scan using step_execution_jobexecutionid_idx on step_execution  (cost=0.43..8.50 rows=4 width=626) (actual time=0.054..0.056 rows=2 loops=1)
   Index Cond: (jobexecutionid = 384846)
 Total runtime: 0.113 ms
&lt;/pre&gt;

Maybe more indexes are needed for default JBeret schema if I implement some filtering function to jberetweb.
</content>
    </entry>
    <entry>
        <id>https://nozaki.me/roller/kyle/entry/jberetweb-todos</id>
        <title type="html">jberetweb TODOs</title>
        <author><name>Kohei Nozaki</name></author>
        <link rel="alternate" type="text/html" href="https://nozaki.me/roller/kyle/entry/jberetweb-todos"/>
        <published>2015-01-04T13:37:56+00:00</published>
        <updated>2015-02-22T02:03:57+00:00</updated> 
        <category term="jberetweb" label="jberetweb" />
        <category term="jbatch" scheme="http://roller.apache.org/ns/tags/" />
        <content type="html">Just for memo. I think this list could be moved to GitHub&apos;s issue tracker.

&lt;ul&gt;

&lt;li&gt;&lt;strike&gt;Operation support for various application archive / remote interface&lt;/strike&gt;
&lt;li&gt;Save preferences such as visible columns to cookie
&lt;li&gt;Change some of Integer id columns to Long
&lt;li&gt;Refreshing of execution detail part
&lt;li&gt;Variable / closable table area
&lt;li&gt;In-cell editing of a value of job parameter table
&lt;li&gt;Add clear button to job parameter table
&lt;li&gt;Improve pagination for larger data set
&lt;ul&gt;
&lt;li&gt;Jump to specified execution id or page number directly&lt;/li&gt;
&lt;li&gt;Clickable page numbers (1 2 3 4 5...)&lt;/li&gt;
&lt;li&gt;Selection of number of rows in single page&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;

&lt;li&gt;Job schedule managing (like cron) with EJB programmatic timer

&lt;li&gt;Job name completion (with JobOperator#getJobNames() ?)

&lt;li&gt;Filtering / Sorting
&lt;ul&gt;
&lt;li&gt;Show BatchStatus=FAILED only etc&lt;/li&gt;
&lt;li&gt;Sorting in ascending order&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;

&lt;li&gt;Covering omitted information
&lt;ul&gt;
&lt;li&gt;job_execution.exitstatus, job_execution.restartposition etc
&lt;li&gt;Checkpointinfo would be useful. just pass it to String.valueOf() after deserialize
&lt;/ul&gt;
&lt;/li&gt;

&lt;li&gt;Testing against MySQL, Derby, H2, newer WildFly etc

&lt;li&gt;Row highlighting/coloring for various statuses (STARTING/STARTED/STOPPING/STOPPED/ABANDONED). currently cares COMPLETED/FAILED only.

&lt;li&gt;Refactoring (especially I think current CSS/HTML design is terrible due to my bad in client side web technology)
&lt;li&gt;Use of REST API (would following spec of &lt;a href=&quot;http://batchee.incubator.apache.org&quot;&gt;BatchEE&lt;/a&gt; be good?)
&lt;/ul&gt;</content>
    </entry>
    <entry>
        <id>https://nozaki.me/roller/kyle/entry/job-operation-features-are-implemented</id>
        <title type="html">Job operation features are implemented to jberetweb</title>
        <author><name>Kohei Nozaki</name></author>
        <link rel="alternate" type="text/html" href="https://nozaki.me/roller/kyle/entry/job-operation-features-are-implemented"/>
        <published>2015-01-04T12:26:41+00:00</published>
        <updated>2015-02-03T06:48:18+00:00</updated> 
        <category term="jberetweb" label="jberetweb" />
        <category term="jbatch" scheme="http://roller.apache.org/ns/tags/" />
        <category term="jberet" scheme="http://roller.apache.org/ns/tags/" />
        <category term="wildfly" scheme="http://roller.apache.org/ns/tags/" />
        <content type="html">Now jberetweb is able to operate JobOperator interface through remote EJB invocation, so finally jberetweb can start batch jobs. the Start Job window popups when &quot;Start Job&quot; anchor is clicked on the upper right corner. here&apos;s a screenshot:
&lt;p&gt;
&lt;a href=&quot;https://www.flickr.com/photos/106080983@N07/16191930191&quot; title=&quot;スクリーンショット 2015-01-04 20.53.13, on Flickr&quot;&gt;&lt;img src=&quot;https://farm9.staticflickr.com/8659/16191930191_3688d8039c.jpg&quot;  alt=&quot;スクリーンショット 2015-01-04 20.53.13&quot;&gt;&lt;/a&gt;
&lt;p&gt;
To use this feature, some preparation are needed. first, you have to expose a remote EJB interface of javax.batch.operations.JobOperator from your batch application archive. &lt;a href=&quot;https://github.com/lbtc-xxx/jbatchtest/blob/master/src/main/java/jbatchtest/JobOperatorFacade.java&quot;&gt;an example of simplest one is available here.&lt;/a&gt; &lt;a href=&quot;https://github.com/lbtc-xxx/jbatchtest&quot;&gt;also entire of the project is here.&lt;/a&gt;
&lt;p&gt;
You can just put this class to any package in your batch application archive. after that, you can see some notification of JNDI names in your WildFly console at every deployment like this:

&lt;pre&gt;
21:06:45,501 INFO  [org.jboss.as.ejb3.deployment.processors.EjbJndiBindingsDeploymentUnitProcessor] (MSC service thread 1-10) JNDI bindings for session bean named JobOperatorFacade in deployment unit deployment &quot;jbatchtest-1.0-SNAPSHOT.war&quot; are as follows:

java:global/jbatchtest-1.0-SNAPSHOT/JobOperatorFacade!javax.batch.operations.JobOperator
java:app/jbatchtest-1.0-SNAPSHOT/JobOperatorFacade!javax.batch.operations.JobOperator
java:module/JobOperatorFacade!javax.batch.operations.JobOperator
java:jboss/exported/jbatchtest-1.0-SNAPSHOT/JobOperatorFacade!javax.batch.operations.JobOperator
java:global/jbatchtest-1.0-SNAPSHOT/JobOperatorFacade
java:app/jbatchtest-1.0-SNAPSHOT/JobOperatorFacade
java:module/JobOperatorFacade
&lt;/pre&gt;

&lt;p&gt;Then save first one of yours (&quot;java:global/jbatchtest-1.0-SNAPSHOT/JobOperatorFacade!javax.batch.operations.JobOperator&quot; for example), then put that string to a build parameter of jberetweb (after &quot;-DjobOperator.jndi=&quot;). &lt;a href=&quot;https://github.com/lbtc-xxx/jberetweb&quot;&gt;please refer &quot;How to use&quot; section of README.md for build instruction.&lt;/a&gt;

&lt;p&gt;Other operations such as restart, stop, abandon are implemented too so I will write more about it later. &lt;a href=&quot;https://github.com/lbtc-xxx/jberetweb&quot;&gt;jberetweb can be obtained from GitHub.&lt;/a&gt;
</content>
    </entry>
    <entry>
        <id>https://nozaki.me/roller/kyle/entry/jberetweb-jberet-job-repository-viewer</id>
        <title type="html">jberetweb, JBeret job repository viewer</title>
        <author><name>Kohei Nozaki</name></author>
        <link rel="alternate" type="text/html" href="https://nozaki.me/roller/kyle/entry/jberetweb-jberet-job-repository-viewer"/>
        <published>2015-01-01T16:01:50+00:00</published>
        <updated>2019-02-20T10:54:17+00:00</updated> 
        <category term="jberetweb" label="jberetweb" />
        <category term="jbatch" scheme="http://roller.apache.org/ns/tags/" />
        <category term="jberet" scheme="http://roller.apache.org/ns/tags/" />
        <category term="wildfly" scheme="http://roller.apache.org/ns/tags/" />
        <content type="html">&lt;h4&gt;What are JBeret and jberetweb?&lt;/h4&gt;

&lt;p&gt;&lt;a href=&quot;https://github.com/jberet&quot;&gt;JBeret&lt;/a&gt; is the out-of-the-box JSR352 JBatch implementation of the WildFly application server. It manages its statuses of jobs and steps in several types of data storage, like RDBMS, which is called repository. But it has no management console or even a standardized way to see it efficiently (I&apos;ve been watching the repository through SQL!). So, I have created jberetweb as a small web application which shows the JDBC job repository of JBeret.

&lt;p&gt;&lt;a href=&quot;https://github.com/lbtc-xxx/jberetweb&quot;&gt;jberetweb can be obtained at GitHub.&lt;/a&gt;

&lt;p&gt;
&lt;a href=&quot;https://www.flickr.com/photos/106080983@N07/15977476160&quot; title=&quot;スクリーンショット 2015-01-01 23.31.18, on Flickr&quot;&gt;&lt;img src=&quot;https://farm8.staticflickr.com/7465/15977476160_eb7cc8f411.jpg&quot;   alt=&quot;スクリーンショット 2015-01-01 23.31.18&quot;&gt;&lt;/a&gt;

&lt;h4&gt;What can be done with jberetweb?&lt;/h4&gt;

&lt;p&gt;It shows recent job executions with their names, the start/end time and the batch status on the table in the upper half of the page. These rows are clickable. Additional information, like job parameters and step executions, will be shown when any row of the job executions table is clicked. Execution exception data will be shown if the step has failed because an exception occurred. Any problematic rows, such as a failed execution or step, are highlighted.   Thanks to JSF&apos;s partial rendering and Ajax, paging and operations are fast.

&lt;h4&gt;How do I install it?&lt;/h4&gt;

&lt;p&gt;As &lt;a href=&quot;https://github.com/lbtc-xxx/jberetweb&quot;&gt;I described at README.md in GitHub repository of it&lt;/a&gt;, you have to clone and build it with mvn yourself, and some configuration is needed for WildFly before deploying the WAR.

&lt;ul&gt;
&lt;li&gt;Create a database on PostgreSQL (jberetweb should run on any other RDBMS, but I haven&apos;t tested yet)
&lt;li&gt;Register a XA data source for the job repository
&lt;li&gt;Register JNDI name of the JDBC job repository
&lt;li&gt;Set the job repository type as JDBC
&lt;li&gt;Define JSF project stage to JNDI
&lt;/ul&gt;

Configuration procedures with jboss-cli should be like this:

&lt;pre&gt;
batch
xa-data-source add \
      --name=JBatchDS \
      --driver-name=postgresql \
      --jndi-name=java:jboss/jdbc/JBatchDS \
      --user-name=postgres \
      --password=***
/subsystem=datasources/xa-data-source=&quot;JBatchDS&quot;/xa-datasource-properties=ServerName:add(value=&quot;localhost&quot;)
/subsystem=datasources/xa-data-source=&quot;JBatchDS&quot;/xa-datasource-properties=PortNumber:add(value=&quot;5432&quot;)
/subsystem=datasources/xa-data-source=&quot;JBatchDS&quot;/xa-datasource-properties=DatabaseName:add(value=&quot;jbatch&quot;)
run-batch
/subsystem=batch/job-repository=jdbc:write-attribute(name=jndi-name, value=java:jboss/jdbc/JBatchDS)
/subsystem=batch:write-attribute(name=job-repository-type, value=jdbc)
/subsystem=naming/binding=java\:\/env\/jsf\/ProjectStage:add(binding-type=simple,value=Development,class=java.lang.String)
&lt;/pre&gt;

&lt;p&gt;NOTE:

&lt;ul&gt;
&lt;li&gt;JBeret creates the schema automatically if any tables aren&apos;t found, so make sure the database user can execute DDLs.
&lt;li&gt;Use XA datasource for both the job repository and your application database.
&lt;/ul&gt;
&lt;p&gt;

&lt;p&gt;Here&apos;s some related pointers:

&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://issues.jboss.org/browse/WFLY-3174&quot;&gt;[WFLY-3174] Add view of batch jobs with ability to view, restart and stop - JBoss Issue Tracker&lt;/a&gt;
&lt;li&gt;&lt;a href=&quot;https://developer.jboss.org/thread/238573&quot;&gt;JSR 352 - Viewing batch jobs in admin console | JBoss Developer&lt;/a&gt;
&lt;/ul&gt;

&lt;p&gt;I would be grateful for your feedback because it&apos;s my first software which is public on GitHub.</content>
    </entry>
</feed>

