Ubik Batch Server FAQ

From UbikWiki

(Difference between revisions)
(Development)
(Development)

Line 92:

Line 92:

== Development ==
== Development ==
 +
=== How to modify SQL Query parameters depending on business conditions ===
 +
Sometimes Sql parameters change depending on some conditions that cannot be computed before execution,
 +
to enable this, Ubik Batch server offers a way to do it:
 +
# Use SqlParameter in DaoSqlBatchStart or SqlBatchStart
 +
# In Traitement#initialize() or BaseBatch#executeBeforeData, modify the parameters using:
 +
<source lang="java">
 +
getBatchExecutionContext().setSqlBatchStartParameters(new SqlParameter[]{...});
 +
</source>
 +
=== How to pass data safely between initialize/exec/finalizeBatch ===
=== How to pass data safely between initialize/exec/finalizeBatch ===
You can use BatchExecutionContext object:
You can use BatchExecutionContext object:

Revision as of 18:19, 18 November 2007

Contents

Administration

How do I setup logging parameters

Log4j is used as logging framework for the Batch Server, see:

What are the available parameters for Database Pool declarations

Ubik Batch Server used commons-dbcp implementation, see:

How do I set a JDBC connection property

Use the Ubik Web Controler or open <INSTALL_DIR>/config/datasource.xml and add or modify for your pool the parameter connectionProperties(Format of the string must be [propertyName=property;]*:

<parameter>
      <name>connectionProperties</name>
      <value>currentSchema=TEST</value>
</parameter>

How do I change the retention period for Batches History in Database

Open the file <INSTALL_DIR>/config/config.properties and change:

# Cleanup delay in days for tables BATCH_HEAD and BATCH_TRT
CLEANUP_DELAY=30

How do I setup my mail server parameters

Open the file <INSTALL_DIR>/config/mail.xml and change:

<?xml version="1.0" encoding="UTF-8"?>
<!-- #Release @VERSION@ at @DATE@ -->
<mail>
	<mailHost>smtp.ubik-ingenierie.com</mailHost>
	<mailer>UbikBatch</mailer>
	<mailPort>25</mailPort>
</mail>

How do I declare my custom plugin

Open the file <INSTALL_DIR>/config/plugin-manager.xml and add:

<plug-in className="com.ubikingenierie.console.monitoring.plugin.HealthMonitorPlugin"  
        id="com.ubikingenierie.console.monitoring.plugin.HealthMonitorPlugin">
          <set-property property="propertyOfClass" value="valueToSet"></set-property>
...
          <set-property property="otherValue" value="3000000"></set-property>
</plug-in>

How do I declare my custom extension

Open the file <INSTALL_DIR>/config/extension-manager.xml and add:

<extension className="com.ubikingenierie.console.si3si.extension.SI3SIExtension" >
  </extension>

I get the following message on deployment of a big BAR

java.lang.OutOfMemoryError: PermGen space

Ensure you use the last JDK 5 available version Open <INSTALL_DIR>/bin/setEnv.bat or <INSTALL_DIR>/bin/setenv.cfg and set correctly the PermGen space using JAVA_OPTS:

-XX:MaxPermSize=128M

My database type is not correctly detected

Open <INSTALL_DIR>/config/config.properties and set HIBERNATE_CONFIGURED_DIALECT:

# Force a dialect for Hibernate to override auto detection
# For DB2 : com.ubikingenierie.console.persistance.hibernate.DB2ExtendedDialect(*) 
HIBERNATE_CONFIGURED_DIALECT=org.hibernate.dialect.MySQL5InnoDBDialect

(*) : see DB2Dialect.getCurrentTimestampSQLFunctionName() uses Oracle syntax

After a while, Oracle throws this exception: too many open cursors for pool jdbc/console

The Oracle JDBC driver doesn't much like to have its prepared statements cached with Hibernate (see [http://www.hibernate.org/120.html#A10 Hibernate Platform Specific Issues).

Disable PreparedStatement caching for the connection pool. Use Web Controler JDBC Administration page or open <INSTALL_DIR>config/datasource.xml, goto jdbc/console declaration and modifiy parameter poolPreparedStatements:

<parameter>
      <name>poolPreparedStatements</name>
      <value>false</value>
</parameter>

I have the following messages in the logs

11:49:27,464 WARN LoadContexts? fail-safe cleanup (collections)... org.hibernate.engine.loading.CollectionLoadContext@cd7045<rs=org.hsqldb.jdbc.jdbcResultSet@192e6b6>

Nothing's wrong, it's a small issue that will be resolved in future versions of Hibernate, since it's indirectly a logging issue. You can hide those messages by adding to <INSTALL_DIR>/config/log.properties:

log4j.category.org.hibernate.engine.loading.LoadContexts=ERROR

Development

How to modify SQL Query parameters depending on business conditions

Sometimes Sql parameters change depending on some conditions that cannot be computed before execution, to enable this, Ubik Batch server offers a way to do it:

  1. Use SqlParameter in DaoSqlBatchStart or SqlBatchStart
  2. In Traitement#initialize() or BaseBatch#executeBeforeData, modify the parameters using:
getBatchExecutionContext().setSqlBatchStartParameters(new SqlParameter[]{...});

How to pass data safely between initialize/exec/finalizeBatch

You can use BatchExecutionContext object:

getBatchExecutionContext().setAttribute(...);
getBatchExecutionContext().getAttribute(...);

How to veto a batch

You can veto a batch (stop the execution) in the initialize method invoking method vetoExecution. For example if some conditions for execution are not met.

vetoExecution("NOT A BUG! The treatment has been stopped by batch, functional flag is disabled");

If you want to stop a batch once you are in the exec method, you will have to manage by an applicative way.

How to check if your batch encountered a problem

You can check in the finalizeBatch method if there was a problem in your treatment.

if (!getBatchExecutionContext().getExceptions().isEmpty())
{
    // do something
}

Authors

  • Philippe Mouawad

History

  • Page created by Pmouawad, 18 November 2007: New page: === Authors === * Philippe Mouawad === History ===
  • Last modified by Pmouawad, 10 January 2014: /* What is the difference between SUPER ADMIN and ADMIN in Mail notifications ? */
Personal tools