How to change the db:statement to continue to execute the following statement when errors occur?

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

How to change the db:statement to continue to execute the following statement when errors occur?

Kriss Lu

Hi All,

 

I am writing a program with Smooks:  Read in CSV file Then do some database operation on these data.

               

Here is my Smooks configuration file:

 

<?xml version="1.0"?>

<smooks-resource-list xmlns="http://www.milyn.org/xsd/smooks-1.1.xsd"

                xmlns:csv="http://www.milyn.org/xsd/smooks/csv-1.2.xsd" xmlns:core="http://www.milyn.org/xsd/smooks/smooks-core-1.3.xsd"

                xmlns:jb="http://www.milyn.org/xsd/smooks/javabean-1.4.xsd" xmlns:db="http://www.milyn.org/xsd/smooks/db-routing-1.1.xsd">

 

                <csv:reader fields = "sourceid, startdate, scheduleid...">

                </csv:reader>

  

    <db:executor executeOnElement="csv-record" datasource="DBExtractTransformLoadDS" executeBefore="false">

        <db:statement>SQL Statement A

       </db:statement>

    </db:executor>

 

    <db:executor executeOnElement="csv-record" datasource="DBExtractTransformLoadDS" executeBefore="false">

        <db:statement>SQL Statement B

       </db:statement>

    </db:executor>

 

    <db:executor executeOnElement="csv-record" datasource="DBExtractTransformLoadDS" executeBefore="false">

        <db:statement>SQL Statement C

       </db:statement>

    </db:executor>

 

</smooks-resource-list>

 

 

What I expect is when a db:statement fail, it can report an error then continue the following statements, rather than exit the entire Smooks processing. How to do that?

 

Thanks in advance!

Reply | Threaded
Open this post in threaded view
|

Re: How to change the db:statement to continue to execute the following statement when errors occur?

Tom Fennelly
Hi.

There's a core setting for terminating on failure.  It's default setting is true.  You can try setting that to false.  See the core configs in the docs.

T.

On 02/08/2013 07:15, Kriss Lu wrote:

Hi All,

 

I am writing a program with Smooks:  Read in CSV file Then do some database operation on these data.

               

Here is my Smooks configuration file:

 

<?xml version="1.0"?>

<smooks-resource-list xmlns="http://www.milyn.org/xsd/smooks-1.1.xsd"

                xmlns:csv="http://www.milyn.org/xsd/smooks/csv-1.2.xsd" xmlns:core="http://www.milyn.org/xsd/smooks/smooks-core-1.3.xsd"

                xmlns:jb="http://www.milyn.org/xsd/smooks/javabean-1.4.xsd" xmlns:db="http://www.milyn.org/xsd/smooks/db-routing-1.1.xsd">

 

                <csv:reader fields = "sourceid, startdate, scheduleid...">

                </csv:reader>

  

    <db:executor executeOnElement="csv-record" datasource="DBExtractTransformLoadDS" executeBefore="false">

        <db:statement>SQL Statement A

       </db:statement>

    </db:executor>

 

    <db:executor executeOnElement="csv-record" datasource="DBExtractTransformLoadDS" executeBefore="false">

        <db:statement>SQL Statement B

       </db:statement>

    </db:executor>

 

    <db:executor executeOnElement="csv-record" datasource="DBExtractTransformLoadDS" executeBefore="false">

        <db:statement>SQL Statement C

       </db:statement>

    </db:executor>

 

</smooks-resource-list>

 

 

What I expect is when a db:statement fail, it can report an error then continue the following statements, rather than exit the entire Smooks processing. How to do that?

 

Thanks in advance!


Reply | Threaded
Open this post in threaded view
|

RE: How to change the db:statement to continue to execute the following statement when errors occur?

Kriss Lu

Thanks Tom. I find this configuration after reading the code.

 

From: Tom Fennelly [mailto:[hidden email]]
Sent: Tuesday, August 06, 2013 5:34 AM
To: [hidden email]
Subject: Re: [milyn-user] How to change the db:statement to continue to execute the following statement when errors occur?

 

Hi.

There's a core setting for terminating on failure.  It's default setting is true.  You can try setting that to false.  See the core configs in the docs.

T.

On 02/08/2013 07:15, Kriss Lu wrote:

Hi All,

 

I am writing a program with Smooks:  Read in CSV file Then do some database operation on these data.

               

Here is my Smooks configuration file:

 

<?xml version="1.0"?>

<smooks-resource-list xmlns="http://www.milyn.org/xsd/smooks-1.1.xsd"

                xmlns:csv="http://www.milyn.org/xsd/smooks/csv-1.2.xsd" xmlns:core="http://www.milyn.org/xsd/smooks/smooks-core-1.3.xsd"

                xmlns:jb="http://www.milyn.org/xsd/smooks/javabean-1.4.xsd" xmlns:db="http://www.milyn.org/xsd/smooks/db-routing-1.1.xsd">

 

                <csv:reader fields = "sourceid, startdate, scheduleid...">

                </csv:reader>

  

    <db:executor executeOnElement="csv-record" datasource="DBExtractTransformLoadDS" executeBefore="false">

        <db:statement>SQL Statement A

       </db:statement>

    </db:executor>

 

    <db:executor executeOnElement="csv-record" datasource="DBExtractTransformLoadDS" executeBefore="false">

        <db:statement>SQL Statement B

       </db:statement>

    </db:executor>

 

    <db:executor executeOnElement="csv-record" datasource="DBExtractTransformLoadDS" executeBefore="false">

        <db:statement>SQL Statement C

       </db:statement>

    </db:executor>

 

</smooks-resource-list>

 

 

What I expect is when a db:statement fail, it can report an error then continue the following statements, rather than exit the entire Smooks processing. How to do that?

 

Thanks in advance!

 

Reply | Threaded
Open this post in threaded view
|

Re: How to change the db:statement to continue to execute the following statement when errors occur?

Tom Fennelly
Doc'd in the user guide: http://www.smooks.org/mediawiki/index.php?title=V1.5:Smooks_v1.5_User_Guide#Filter_Settings

See " terminateOnException"

On 09/08/2013 02:40, Kriss Lu wrote:

Thanks Tom. I find this configuration after reading the code.

 

From: Tom Fennelly [[hidden email]]
Sent: Tuesday, August 06, 2013 5:34 AM
To: [hidden email]
Subject: Re: [milyn-user] How to change the db:statement to continue to execute the following statement when errors occur?

 

Hi.

There's a core setting for terminating on failure.  It's default setting is true.  You can try setting that to false.  See the core configs in the docs.

T.

On 02/08/2013 07:15, Kriss Lu wrote:

Hi All,

 

I am writing a program with Smooks:  Read in CSV file Then do some database operation on these data.

               

Here is my Smooks configuration file:

 

<?xml version="1.0"?>

<smooks-resource-list xmlns="http://www.milyn.org/xsd/smooks-1.1.xsd"

                xmlns:csv="http://www.milyn.org/xsd/smooks/csv-1.2.xsd" xmlns:core="http://www.milyn.org/xsd/smooks/smooks-core-1.3.xsd"

                xmlns:jb="http://www.milyn.org/xsd/smooks/javabean-1.4.xsd" xmlns:db="http://www.milyn.org/xsd/smooks/db-routing-1.1.xsd">

 

                <csv:reader fields = "sourceid, startdate, scheduleid...">

                </csv:reader>

  

    <db:executor executeOnElement="csv-record" datasource="DBExtractTransformLoadDS" executeBefore="false">

        <db:statement>SQL Statement A

       </db:statement>

    </db:executor>

 

    <db:executor executeOnElement="csv-record" datasource="DBExtractTransformLoadDS" executeBefore="false">

        <db:statement>SQL Statement B

       </db:statement>

    </db:executor>

 

    <db:executor executeOnElement="csv-record" datasource="DBExtractTransformLoadDS" executeBefore="false">

        <db:statement>SQL Statement C

       </db:statement>

    </db:executor>

 

</smooks-resource-list>

 

 

What I expect is when a db:statement fail, it can report an error then continue the following statements, rather than exit the entire Smooks processing. How to do that?

 

Thanks in advance!