You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ofbiz.apache.org by Jacques Le Roux <ja...@les7arts.com> on 2016/08/18 10:33:47 UTC

Re: Why create transaction in Event?

Hi \u53f6\u53cc\u660e,

One thing we could do is introduce a parameter in the event handler to have or not a transaction. By default we would have one. This seems simple 
enough to implement.

Please open a Jira and I'll take care of it, the same way we did for the metric attribute of the event element. This would work also for the 
firstvisit, preprocessor, postprocessor, after-login, and before-logout event types.

Thanks

Jacques


Le 26/07/2016 � 09:02, \u53f6\u53cc\u660e a �crit :
> Hi all:
>
> After update ofbiz to 13.07.03, our system was Unstable. At last, I found
> the cause was The transaction created in Event, introduced in revision
> 1,740,632.
> And found https://issues.apache.org/jira/browse/OFBIZ-6808.
> But I doubt whether it is good to do this.
>
> In my opinion:
>
> 1. It would make more long-running transaction.
>      For example, there was a event which call three services, the three
> services has their own transaction before the change, but now there is one
> big transaction for the event and three services, of course the transaction
> would run longer time.
>
> 2. It would make a lots of transaction run longer time.
>      Almost all event would do something else after call service, for
> example, convert the result from service to JSON format, but the conversion
> not need transaction!
>
> 3. It makes it difficult to manage transactions between services and events.
>      For example, there was a event:
>
>      public String createOrder() {
>
>          //some business process here... and define serviceCtx
>
>          def results = dispatcher.runSync("createOrder", serviceCtx)
>
>          //some business process here... and return success or error at last
>
>      }
>
>      after call createOrder service success, i want to fire a jms
> service(call it jmsIndexOrder) to index the order in Elasticsearch\u3002
>      I use secas before the change, everything work well.
>
>      <eca service=\u201ccreateOrder\u201d event="return">
>          <action service="jmsIndexOrder" mode="sync"/>
>      </eca>
>
>
>      but now i don't know where ant how to call jmsIndexOrder. :(
>
>