Topic
  • 3 replies
  • Latest Post - ‏2013-07-09T13:05:31Z by Tchu
Tchu
Tchu
8 Posts

Pinned topic Email not sent when ECApplicationException Thrown

‏2013-07-04T15:54:26Z |

Hi all,

Using Websphere commerce 7 fep5, we are having a problem, in a controller command when we send an email with SendMsgCmd and just after an ECApplicationException is thrown from the command containing the SendMsgCmd the email is not sent.

Is there any way that help us with separating the transaction of SendMsgCmd and the controller command that contains the sending ?

Updated on 2013-07-04T17:22:17Z at 2013-07-04T17:22:17Z by Tchu
  • Raj.S
    Raj.S
    533 Posts
    ACCEPTED ANSWER

    Re: Email not sent when ECApplicationException Thrown

    ‏2013-07-09T07:34:11Z  
    • Tchu
    • ‏2013-07-08T13:50:14Z

    Hi,

    In others world, imagine have two commands cmd1 and cmd2 : cmd2 is called inside cmd1, so I want a way to be able to tell when there's error in cmd1 and there's transaction rollback, please don't rollback cmd2.

    This is the default behavior of the inner commands. cmd2 runs in the same transaction of the parent command cmd1 and hence it gets rolledback as well.

    To not to rollback the cmd2, you can explicitly do the transaction handling

    Eg:

    public void perforExecute () {

    TransactionHandle txHandle = TransactionManager.begin ();

    // cmd2 execution

    TransactionManager.commit (txHandle);

    TransactionManager.begin ();

    }

    If the cmd2 is only for sending email, why dont you think of a way where in cmd2 is executed first and then redirected to cmd1 -- if possible**

     

    Rgds, Raj.

  • Tchu
    Tchu
    8 Posts

    Re: Email not sent when ECApplicationException Thrown

    ‏2013-07-08T13:50:14Z  

    Hi,

    In others world, imagine have two commands cmd1 and cmd2 : cmd2 is called inside cmd1, so I want a way to be able to tell when there's error in cmd1 and there's transaction rollback, please don't rollback cmd2.

  • Raj.S
    Raj.S
    533 Posts

    Re: Email not sent when ECApplicationException Thrown

    ‏2013-07-09T07:34:11Z  
    • Tchu
    • ‏2013-07-08T13:50:14Z

    Hi,

    In others world, imagine have two commands cmd1 and cmd2 : cmd2 is called inside cmd1, so I want a way to be able to tell when there's error in cmd1 and there's transaction rollback, please don't rollback cmd2.

    This is the default behavior of the inner commands. cmd2 runs in the same transaction of the parent command cmd1 and hence it gets rolledback as well.

    To not to rollback the cmd2, you can explicitly do the transaction handling

    Eg:

    public void perforExecute () {

    TransactionHandle txHandle = TransactionManager.begin ();

    // cmd2 execution

    TransactionManager.commit (txHandle);

    TransactionManager.begin ();

    }

    If the cmd2 is only for sending email, why dont you think of a way where in cmd2 is executed first and then redirected to cmd1 -- if possible**

     

    Rgds, Raj.

  • Tchu
    Tchu
    8 Posts

    Re: Email not sent when ECApplicationException Thrown

    ‏2013-07-09T13:05:31Z  
    • Raj.S
    • ‏2013-07-09T07:34:11Z

    This is the default behavior of the inner commands. cmd2 runs in the same transaction of the parent command cmd1 and hence it gets rolledback as well.

    To not to rollback the cmd2, you can explicitly do the transaction handling

    Eg:

    public void perforExecute () {

    TransactionHandle txHandle = TransactionManager.begin ();

    // cmd2 execution

    TransactionManager.commit (txHandle);

    TransactionManager.begin ();

    }

    If the cmd2 is only for sending email, why dont you think of a way where in cmd2 is executed first and then redirected to cmd1 -- if possible**

     

    Rgds, Raj.

    Thanks for your response, I didn't want to use any other solution because I didn't believe that there was that much restriction about managing transaction, I was hoping that there will be just a parameter that will tell to second command to begin an isolated transaction,