Dominik Dominik - 16 days ago 6
Java Question

jberet, one wildfly instance, multiple datasources: can I use more than one job-repository?

We currently have a set of services each running in their respective wildfly 9.0 instance. Some of them have batch jobs implemented using jberet 1.2.0.

Each wildfly instance has one datasource (jdbc, oracle) for the service and one job-repository for jberet defined. Currently the jberet tables are put into the database of the single datasoure of this wildfly instance.

Now we are moving all the batch jobs into a separate wildfly instance to take the load generated by the batches away from the other wildfly instances.

So now we have one standalone.xml with x datasources (one per service).

What's the best practice to define the job-repository/-ies?


Answer

If you only have one single war-file deployed: Currently you can only have one job repository.

If you have multiple war-files deployed in one Wildfly instance: If you can use WildFly 10 for the batch applications you could use the jboss-all.xml deployment descriptor to define different job repositories for each deployment.

If you do want them all added to the same database there is an APPLICATIONNAME field in the JOB_INSTANCE field if you want to be able to see which app they come from. The name is resolved from the java:app/AppName. That may help you filter out which applications jobs you're viewing.