Multiple services run immediately

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|

Multiple services run immediately

iwolf
Hi everybody,

I want to run two or more services immediately after another service has finished.

For example printing creating/printing the invoice and starting the pick process should be done immediately after orderchange  Invoicing and picking are two different processes that should be initiated at the same time. Picking should not wait until the invoice process is finished.

Right no I have:

<eca service="changeOrderStatus" event="commit"  run-on-error="false">
       <condition field-name="orderTypeId" operator="equals" value="SALES_ORDER"/>
        <condition field-name="statusId" operator="equals" value="ORDER_APPROVED"/>
        <condition-field field-name="statusId" operator="not-equals" to-field-name="oldStatusId"/>
        <action service="createInvoiceBeforeShipment" mode="async"  persist="true"/>
        <action service="sendOutputRequest" mode="async" persist="true"/>
</eca>

The problem with that is, that if there are other tasks in the queue (solr product update, ...) it may come to unwanted delays.

Would runSyncIgnore work?

It would be great if I could use th eca service definitions to to it.

Best regards
Ingo
Reply | Threaded
Open this post in threaded view
|

Re: Multiple services run immediately

Suraj Khurana-2
Hello Ingo,

Hope you are doing good.

I am not sure about the environment you are currently trying to achieve
this. IMO, there are two ways:

- For improving performance, we can set up multiple OFBiz servers in
parallel. Yes, we can set up two OFBiz servers, one calling sync service
and another dedicated for async services only.
Here [1] is a reference blog for more details.

- You can increase jobs count in service engine [2], so that your OFBiz
server will be picking more jobs to complete at a time, be careful various
factors are responsible with this approach, like CPU core, deployed OFBiz
memory allocation, maximum DB threads enabled etc.

[1]
https://www.hotwaxsystems.com/ofbiz/ofbiz-tutorials/apache-ofbiz-performance/
[2] framework/service/config/serviceengine.xml

HTH.
--
Best Regards,
Suraj Khurana
Senior Techincal Consultant


On Fri, Apr 24, 2020 at 11:01 PM Ingo Wolfmayr <[hidden email]>
wrote:

> Hi everybody,
>
> I want to run two or more services immediately after another service has
> finished.
>
> For example printing creating/printing the invoice and starting the pick
> process should be done immediately after orderchange  Invoicing and picking
> are two different processes that should be initiated at the same time.
> Picking should not wait until the invoice process is finished.
>
> Right no I have:
>
> <eca service="changeOrderStatus" event="commit"  run-on-error="false">
>        <condition field-name="orderTypeId" operator="equals"
> value="SALES_ORDER"/>
>         <condition field-name="statusId" operator="equals"
> value="ORDER_APPROVED"/>
>         <condition-field field-name="statusId" operator="not-equals"
> to-field-name="oldStatusId"/>
>         <action service="createInvoiceBeforeShipment" mode="async"
> persist="true"/>
>         <action service="sendOutputRequest" mode="async" persist="true"/>
> </eca>
>
> The problem with that is, that if there are other tasks in the queue (solr
> product update, ...) it may come to unwanted delays.
>
> Would runSyncIgnore work?
>
> It would be great if I could use th eca service definitions to to it.
>
> Best regards
> Ingo
>
Reply | Threaded
Open this post in threaded view
|

Re: Multiple services run immediately

Pawan Verma-2
Hi Ingo,

I hope you are well!

Have you tried with mode="sync" instead of mode="async"? It should run both
services simultaneously.

runSyncIgnore is noting but calling service in sync mode without expecting
the output of the service.

If you wanna call services inline you can even try addCommitService.

HTH!

--
Thanks & Regards
Pawan Verma
ofbiz.apache.org


On Sat, Apr 25, 2020 at 11:36 AM Suraj Khurana <[hidden email]>
wrote:

> Hello Ingo,
>
> Hope you are doing good.
>
> I am not sure about the environment you are currently trying to achieve
> this. IMO, there are two ways:
>
> - For improving performance, we can set up multiple OFBiz servers in
> parallel. Yes, we can set up two OFBiz servers, one calling sync service
> and another dedicated for async services only.
> Here [1] is a reference blog for more details.
>
> - You can increase jobs count in service engine [2], so that your OFBiz
> server will be picking more jobs to complete at a time, be careful various
> factors are responsible with this approach, like CPU core, deployed OFBiz
> memory allocation, maximum DB threads enabled etc.
>
> [1]
>
> https://www.hotwaxsystems.com/ofbiz/ofbiz-tutorials/apache-ofbiz-performance/
> [2] framework/service/config/serviceengine.xml
>
> HTH.
> --
> Best Regards,
> Suraj Khurana
> Senior Techincal Consultant
>
>
> On Fri, Apr 24, 2020 at 11:01 PM Ingo Wolfmayr <[hidden email]>
> wrote:
>
> > Hi everybody,
> >
> > I want to run two or more services immediately after another service has
> > finished.
> >
> > For example printing creating/printing the invoice and starting the pick
> > process should be done immediately after orderchange  Invoicing and
> picking
> > are two different processes that should be initiated at the same time.
> > Picking should not wait until the invoice process is finished.
> >
> > Right no I have:
> >
> > <eca service="changeOrderStatus" event="commit"  run-on-error="false">
> >        <condition field-name="orderTypeId" operator="equals"
> > value="SALES_ORDER"/>
> >         <condition field-name="statusId" operator="equals"
> > value="ORDER_APPROVED"/>
> >         <condition-field field-name="statusId" operator="not-equals"
> > to-field-name="oldStatusId"/>
> >         <action service="createInvoiceBeforeShipment" mode="async"
> > persist="true"/>
> >         <action service="sendOutputRequest" mode="async" persist="true"/>
> > </eca>
> >
> > The problem with that is, that if there are other tasks in the queue
> (solr
> > product update, ...) it may come to unwanted delays.
> >
> > Would runSyncIgnore work?
> >
> > It would be great if I could use th eca service definitions to to it.
> >
> > Best regards
> > Ingo
> >
>
Reply | Threaded
Open this post in threaded view
|

Re: Multiple services run immediately

Nameet Jain-2
In reply to this post by iwolf
Hi Ingo,

To execute two or more independent processes immediately without waiting
for each other to finish, use async mode. The example you shared will do
the thing for you. Here JobPoller takes care of the services in "action".
So if you add one more async service, it will execute independently.

the runSyncIgnore will just ignore the result of service.

Thanks

--
Regards
Nameet Jain


On Fri, Apr 24, 2020 at 11:01 PM Ingo Wolfmayr <[hidden email]>
wrote:

> Hi everybody,
>
> I want to run two or more services immediately after another service has
> finished.
>
> For example printing creating/printing the invoice and starting the pick
> process should be done immediately after orderchange  Invoicing and picking
> are two different processes that should be initiated at the same time.
> Picking should not wait until the invoice process is finished.
>
> Right no I have:
>
> <eca service="changeOrderStatus" event="commit"  run-on-error="false">
>        <condition field-name="orderTypeId" operator="equals"
> value="SALES_ORDER"/>
>         <condition field-name="statusId" operator="equals"
> value="ORDER_APPROVED"/>
>         <condition-field field-name="statusId" operator="not-equals"
> to-field-name="oldStatusId"/>
>         <action service="createInvoiceBeforeShipment" mode="async"
> persist="true"/>
>         <action service="sendOutputRequest" mode="async" persist="true"/>
> </eca>
>
> The problem with that is, that if there are other tasks in the queue (solr
> product update, ...) it may come to unwanted delays.
>
> Would runSyncIgnore work?
>
> It would be great if I could use th eca service definitions to to it.
>
> Best regards
> Ingo
>
Reply | Threaded
Open this post in threaded view
|

AW: Multiple services run immediately

iwolf
In reply to this post by Suraj Khurana-2
Hello Suraj, hello Pawan, Hello Nameet

thanks for the fast responses.

I have read the blog article aready + adjusting the service settings is one of those things I try to improve before launching a new ofbiz installation in production. So I guess I can check this of :) Adding an additional server would be my last resort, but always taken into account.

When it comes to async an sync services with the example below - I just want to make sure I am not folling a wrong idea:

1) async services would run independenly, but depend on the interval services are polled. Default 30 seconds. So I will have to change this to 5 seconds in order to have thoses services started "right away".
<action service="createInvoiceBeforeShipment" mode="async" persist="true"/>
<action service="sendOutputRequest" mode="async" persist="true"/> </eca>

2) sync services - the second service would wait for the first service + it is possible to use the result of service one.
<action service="createInvoiceBeforeShipment" mode="sync" />
<action service="sendOutputRequest" mode="sync" /> </eca>

@Pawan: "Have you tried with mode="sync" instead of mode="async"? It should run both services simultaneously." Do you mean that in my example (one eca - two sync action services) the second service would be started without waiting for the first to return the result?

With case 1 - would it make a difference if I create a single eca service definition for each service to be called? Would they be called independently?

Thanks a lot.
Ingo



-----Ursprüngliche Nachricht-----
Von: Suraj Khurana <[hidden email]>
Gesendet: Samstag, 25. April 2020 08:05
An: ofbizuser <[hidden email]>
Betreff: Re: Multiple services run immediately

Hello Ingo,

Hope you are doing good.

I am not sure about the environment you are currently trying to achieve this. IMO, there are two ways:

- For improving performance, we can set up multiple OFBiz servers in parallel. Yes, we can set up two OFBiz servers, one calling sync service and another dedicated for async services only.
Here [1] is a reference blog for more details.

- You can increase jobs count in service engine [2], so that your OFBiz server will be picking more jobs to complete at a time, be careful various factors are responsible with this approach, like CPU core, deployed OFBiz memory allocation, maximum DB threads enabled etc.

[1]
https://www.hotwaxsystems.com/ofbiz/ofbiz-tutorials/apache-ofbiz-performance/
[2] framework/service/config/serviceengine.xml

HTH.
--
Best Regards,
Suraj Khurana
Senior Techincal Consultant


On Fri, Apr 24, 2020 at 11:01 PM Ingo Wolfmayr <[hidden email]>
wrote:

> Hi everybody,
>
> I want to run two or more services immediately after another service
> has finished.
>
> For example printing creating/printing the invoice and starting the
> pick process should be done immediately after orderchange  Invoicing
> and picking are two different processes that should be initiated at the same time.
> Picking should not wait until the invoice process is finished.
>
> Right no I have:
>
> <eca service="changeOrderStatus" event="commit"  run-on-error="false">
>        <condition field-name="orderTypeId" operator="equals"
> value="SALES_ORDER"/>
>         <condition field-name="statusId" operator="equals"
> value="ORDER_APPROVED"/>
>         <condition-field field-name="statusId" operator="not-equals"
> to-field-name="oldStatusId"/>
>         <action service="createInvoiceBeforeShipment" mode="async"
> persist="true"/>
>         <action service="sendOutputRequest" mode="async"
> persist="true"/> </eca>
>
> The problem with that is, that if there are other tasks in the queue
> (solr product update, ...) it may come to unwanted delays.
>
> Would runSyncIgnore work?
>
> It would be great if I could use th eca service definitions to to it.
>
> Best regards
> Ingo
>
Reply | Threaded
Open this post in threaded view
|

Re: Multiple services run immediately

Ankush Upadhyay-2
Hello Ingo,

Answer for question
@Pawan: "Have you tried with mode="sync" instead of mode="async"? It should
run both services simultaneously." Do you mean that in my example (one eca
- two sync action services) the second service would be started without
waiting for the first to return the result?

No, with sync mode, all actions of particular service eca would execute one
by one, If you want to go dipper to know how it works, you can review
ServiceEcaRule.java and ServiceEcaAction.


Kind Regards,
Ankush Upadhyay
Senior Technical Consultant

*HotWax Systems*
*Enterprise open source experts*
cell: +91-8109201285
office: 0731-409-3684
http://www.hotwaxsystems.com


On Sun, Apr 26, 2020 at 1:27 PM Ingo Wolfmayr <[hidden email]>
wrote:

> Hello Suraj, hello Pawan, Hello Nameet
>
> thanks for the fast responses.
>
> I have read the blog article aready + adjusting the service settings is
> one of those things I try to improve before launching a new ofbiz
> installation in production. So I guess I can check this of :) Adding an
> additional server would be my last resort, but always taken into account.
>
> When it comes to async an sync services with the example below - I just
> want to make sure I am not folling a wrong idea:
>
> 1) async services would run independenly, but depend on the interval
> services are polled. Default 30 seconds. So I will have to change this to 5
> seconds in order to have thoses services started "right away".
> <action service="createInvoiceBeforeShipment" mode="async" persist="true"/>
> <action service="sendOutputRequest" mode="async" persist="true"/> </eca>
>
> 2) sync services - the second service would wait for the first service +
> it is possible to use the result of service one.
> <action service="createInvoiceBeforeShipment" mode="sync" />
> <action service="sendOutputRequest" mode="sync" /> </eca>
>
> @Pawan: "Have you tried with mode="sync" instead of mode="async"? It
> should run both services simultaneously." Do you mean that in my example
> (one eca - two sync action services) the second service would be started
> without waiting for the first to return the result?
>
> With case 1 - would it make a difference if I create a single eca service
> definition for each service to be called? Would they be called
> independently?
>
> Thanks a lot.
> Ingo
>
>
>
> -----Ursprüngliche Nachricht-----
> Von: Suraj Khurana <[hidden email]>
> Gesendet: Samstag, 25. April 2020 08:05
> An: ofbizuser <[hidden email]>
> Betreff: Re: Multiple services run immediately
>
> Hello Ingo,
>
> Hope you are doing good.
>
> I am not sure about the environment you are currently trying to achieve
> this. IMO, there are two ways:
>
> - For improving performance, we can set up multiple OFBiz servers in
> parallel. Yes, we can set up two OFBiz servers, one calling sync service
> and another dedicated for async services only.
> Here [1] is a reference blog for more details.
>
> - You can increase jobs count in service engine [2], so that your OFBiz
> server will be picking more jobs to complete at a time, be careful various
> factors are responsible with this approach, like CPU core, deployed OFBiz
> memory allocation, maximum DB threads enabled etc.
>
> [1]
>
> https://www.hotwaxsystems.com/ofbiz/ofbiz-tutorials/apache-ofbiz-performance/
> [2] framework/service/config/serviceengine.xml
>
> HTH.
> --
> Best Regards,
> Suraj Khurana
> Senior Techincal Consultant
>
>
> On Fri, Apr 24, 2020 at 11:01 PM Ingo Wolfmayr <[hidden email]>
> wrote:
>
> > Hi everybody,
> >
> > I want to run two or more services immediately after another service
> > has finished.
> >
> > For example printing creating/printing the invoice and starting the
> > pick process should be done immediately after orderchange  Invoicing
> > and picking are two different processes that should be initiated at the
> same time.
> > Picking should not wait until the invoice process is finished.
> >
> > Right no I have:
> >
> > <eca service="changeOrderStatus" event="commit"  run-on-error="false">
> >        <condition field-name="orderTypeId" operator="equals"
> > value="SALES_ORDER"/>
> >         <condition field-name="statusId" operator="equals"
> > value="ORDER_APPROVED"/>
> >         <condition-field field-name="statusId" operator="not-equals"
> > to-field-name="oldStatusId"/>
> >         <action service="createInvoiceBeforeShipment" mode="async"
> > persist="true"/>
> >         <action service="sendOutputRequest" mode="async"
> > persist="true"/> </eca>
> >
> > The problem with that is, that if there are other tasks in the queue
> > (solr product update, ...) it may come to unwanted delays.
> >
> > Would runSyncIgnore work?
> >
> > It would be great if I could use th eca service definitions to to it.
> >
> > Best regards
> > Ingo
> >
>
Reply | Threaded
Open this post in threaded view
|

Re: Multiple services run immediately

Rohit Koushal
Hey Ingo,

>> With case 1 - would it make a difference if I create a single eca
service definition for each service to be called? Would they be called
independently?

It won't make any difference until we are utilizing async mode and same eca
configuration. Additionally, they do call independently because when we are
calling any service in async mode, it implies that system treats it as an
independent thread and they are allowed to execute when system permits.

If you would like to go in more details check ServiceDispatcher
and ServiceEcaRule

------------
Kind Regards
*Rohit Koushal*

On Sun, Apr 26, 2020 at 6:21 PM Ankush Upadhyay <
[hidden email]> wrote:

> Hello Ingo,
>
> Answer for question
> @Pawan: "Have you tried with mode="sync" instead of mode="async"? It should
> run both services simultaneously." Do you mean that in my example (one eca
> - two sync action services) the second service would be started without
> waiting for the first to return the result?
>
> No, with sync mode, all actions of particular service eca would execute one
> by one, If you want to go dipper to know how it works, you can review
> ServiceEcaRule.java and ServiceEcaAction.
>
>
> Kind Regards,
> Ankush Upadhyay
> Senior Technical Consultant
>
> *HotWax Systems*
> *Enterprise open source experts*
> cell: +91-8109201285
> office: 0731-409-3684
> http://www.hotwaxsystems.com
>
>
> On Sun, Apr 26, 2020 at 1:27 PM Ingo Wolfmayr <[hidden email]>
> wrote:
>
> > Hello Suraj, hello Pawan, Hello Nameet
> >
> > thanks for the fast responses.
> >
> > I have read the blog article aready + adjusting the service settings is
> > one of those things I try to improve before launching a new ofbiz
> > installation in production. So I guess I can check this of :) Adding an
> > additional server would be my last resort, but always taken into account.
> >
> > When it comes to async an sync services with the example below - I just
> > want to make sure I am not folling a wrong idea:
> >
> > 1) async services would run independenly, but depend on the interval
> > services are polled. Default 30 seconds. So I will have to change this
> to 5
> > seconds in order to have thoses services started "right away".
> > <action service="createInvoiceBeforeShipment" mode="async"
> persist="true"/>
> > <action service="sendOutputRequest" mode="async" persist="true"/> </eca>
> >
> > 2) sync services - the second service would wait for the first service +
> > it is possible to use the result of service one.
> > <action service="createInvoiceBeforeShipment" mode="sync" />
> > <action service="sendOutputRequest" mode="sync" /> </eca>
> >
> > @Pawan: "Have you tried with mode="sync" instead of mode="async"? It
> > should run both services simultaneously." Do you mean that in my example
> > (one eca - two sync action services) the second service would be started
> > without waiting for the first to return the result?
> >
> > With case 1 - would it make a difference if I create a single eca service
> > definition for each service to be called? Would they be called
> > independently?
> >
> > Thanks a lot.
> > Ingo
> >
> >
> >
> > -----Ursprüngliche Nachricht-----
> > Von: Suraj Khurana <[hidden email]>
> > Gesendet: Samstag, 25. April 2020 08:05
> > An: ofbizuser <[hidden email]>
> > Betreff: Re: Multiple services run immediately
> >
> > Hello Ingo,
> >
> > Hope you are doing good.
> >
> > I am not sure about the environment you are currently trying to achieve
> > this. IMO, there are two ways:
> >
> > - For improving performance, we can set up multiple OFBiz servers in
> > parallel. Yes, we can set up two OFBiz servers, one calling sync service
> > and another dedicated for async services only.
> > Here [1] is a reference blog for more details.
> >
> > - You can increase jobs count in service engine [2], so that your OFBiz
> > server will be picking more jobs to complete at a time, be careful
> various
> > factors are responsible with this approach, like CPU core, deployed OFBiz
> > memory allocation, maximum DB threads enabled etc.
> >
> > [1]
> >
> >
> https://www.hotwaxsystems.com/ofbiz/ofbiz-tutorials/apache-ofbiz-performance/
> > [2] framework/service/config/serviceengine.xml
> >
> > HTH.
> > --
> > Best Regards,
> > Suraj Khurana
> > Senior Techincal Consultant
> >
> >
> > On Fri, Apr 24, 2020 at 11:01 PM Ingo Wolfmayr <[hidden email]>
> > wrote:
> >
> > > Hi everybody,
> > >
> > > I want to run two or more services immediately after another service
> > > has finished.
> > >
> > > For example printing creating/printing the invoice and starting the
> > > pick process should be done immediately after orderchange  Invoicing
> > > and picking are two different processes that should be initiated at the
> > same time.
> > > Picking should not wait until the invoice process is finished.
> > >
> > > Right no I have:
> > >
> > > <eca service="changeOrderStatus" event="commit"  run-on-error="false">
> > >        <condition field-name="orderTypeId" operator="equals"
> > > value="SALES_ORDER"/>
> > >         <condition field-name="statusId" operator="equals"
> > > value="ORDER_APPROVED"/>
> > >         <condition-field field-name="statusId" operator="not-equals"
> > > to-field-name="oldStatusId"/>
> > >         <action service="createInvoiceBeforeShipment" mode="async"
> > > persist="true"/>
> > >         <action service="sendOutputRequest" mode="async"
> > > persist="true"/> </eca>
> > >
> > > The problem with that is, that if there are other tasks in the queue
> > > (solr product update, ...) it may come to unwanted delays.
> > >
> > > Would runSyncIgnore work?
> > >
> > > It would be great if I could use th eca service definitions to to it.
> > >
> > > Best regards
> > > Ingo
> > >
> >
>
Reply | Threaded
Open this post in threaded view
|

Re: Multiple services run immediately

Rishi Solanki
In reply to this post by Ankush Upadhyay-2
Ingo,
What exactly you want to achieve, you want to run two independent services
on ECA trigger and should run independently without waiting for each other
then it would be possible. Add two ECA rules and use Sync in action.

And if you want two services run one by one on success or so then that also
possible. Add one ECA rule and two action with sync in sequence you want to
execute. The exact requirement would help to answer better.


Best Regards,
--
Rishi Solanki
*CTO, Mindpath Technology*
Intelligent Solutions
cell: +91-98932-87847
http://www.mindpathtech.com
LinkedIn <https://www.linkedin.com/in/rishi-solanki-62271b7/>


On Sun, Apr 26, 2020 at 6:21 PM Ankush Upadhyay <
[hidden email]> wrote:

> Hello Ingo,
>
> Answer for question
> @Pawan: "Have you tried with mode="sync" instead of mode="async"? It should
> run both services simultaneously." Do you mean that in my example (one eca
> - two sync action services) the second service would be started without
> waiting for the first to return the result?
>
> No, with sync mode, all actions of particular service eca would execute one
> by one, If you want to go dipper to know how it works, you can review
> ServiceEcaRule.java and ServiceEcaAction.
>
>
> Kind Regards,
> Ankush Upadhyay
> Senior Technical Consultant
>
> *HotWax Systems*
> *Enterprise open source experts*
> cell: +91-8109201285
> office: 0731-409-3684
> http://www.hotwaxsystems.com
>
>
> On Sun, Apr 26, 2020 at 1:27 PM Ingo Wolfmayr <[hidden email]>
> wrote:
>
> > Hello Suraj, hello Pawan, Hello Nameet
> >
> > thanks for the fast responses.
> >
> > I have read the blog article aready + adjusting the service settings is
> > one of those things I try to improve before launching a new ofbiz
> > installation in production. So I guess I can check this of :) Adding an
> > additional server would be my last resort, but always taken into account.
> >
> > When it comes to async an sync services with the example below - I just
> > want to make sure I am not folling a wrong idea:
> >
> > 1) async services would run independenly, but depend on the interval
> > services are polled. Default 30 seconds. So I will have to change this
> to 5
> > seconds in order to have thoses services started "right away".
> > <action service="createInvoiceBeforeShipment" mode="async"
> persist="true"/>
> > <action service="sendOutputRequest" mode="async" persist="true"/> </eca>
> >
> > 2) sync services - the second service would wait for the first service +
> > it is possible to use the result of service one.
> > <action service="createInvoiceBeforeShipment" mode="sync" />
> > <action service="sendOutputRequest" mode="sync" /> </eca>
> >
> > @Pawan: "Have you tried with mode="sync" instead of mode="async"? It
> > should run both services simultaneously." Do you mean that in my example
> > (one eca - two sync action services) the second service would be started
> > without waiting for the first to return the result?
> >
> > With case 1 - would it make a difference if I create a single eca service
> > definition for each service to be called? Would they be called
> > independently?
> >
> > Thanks a lot.
> > Ingo
> >
> >
> >
> > -----Ursprüngliche Nachricht-----
> > Von: Suraj Khurana <[hidden email]>
> > Gesendet: Samstag, 25. April 2020 08:05
> > An: ofbizuser <[hidden email]>
> > Betreff: Re: Multiple services run immediately
> >
> > Hello Ingo,
> >
> > Hope you are doing good.
> >
> > I am not sure about the environment you are currently trying to achieve
> > this. IMO, there are two ways:
> >
> > - For improving performance, we can set up multiple OFBiz servers in
> > parallel. Yes, we can set up two OFBiz servers, one calling sync service
> > and another dedicated for async services only.
> > Here [1] is a reference blog for more details.
> >
> > - You can increase jobs count in service engine [2], so that your OFBiz
> > server will be picking more jobs to complete at a time, be careful
> various
> > factors are responsible with this approach, like CPU core, deployed OFBiz
> > memory allocation, maximum DB threads enabled etc.
> >
> > [1]
> >
> >
> https://www.hotwaxsystems.com/ofbiz/ofbiz-tutorials/apache-ofbiz-performance/
> > [2] framework/service/config/serviceengine.xml
> >
> > HTH.
> > --
> > Best Regards,
> > Suraj Khurana
> > Senior Techincal Consultant
> >
> >
> > On Fri, Apr 24, 2020 at 11:01 PM Ingo Wolfmayr <[hidden email]>
> > wrote:
> >
> > > Hi everybody,
> > >
> > > I want to run two or more services immediately after another service
> > > has finished.
> > >
> > > For example printing creating/printing the invoice and starting the
> > > pick process should be done immediately after orderchange  Invoicing
> > > and picking are two different processes that should be initiated at the
> > same time.
> > > Picking should not wait until the invoice process is finished.
> > >
> > > Right no I have:
> > >
> > > <eca service="changeOrderStatus" event="commit"  run-on-error="false">
> > >        <condition field-name="orderTypeId" operator="equals"
> > > value="SALES_ORDER"/>
> > >         <condition field-name="statusId" operator="equals"
> > > value="ORDER_APPROVED"/>
> > >         <condition-field field-name="statusId" operator="not-equals"
> > > to-field-name="oldStatusId"/>
> > >         <action service="createInvoiceBeforeShipment" mode="async"
> > > persist="true"/>
> > >         <action service="sendOutputRequest" mode="async"
> > > persist="true"/> </eca>
> > >
> > > The problem with that is, that if there are other tasks in the queue
> > > (solr product update, ...) it may come to unwanted delays.
> > >
> > > Would runSyncIgnore work?
> > >
> > > It would be great if I could use th eca service definitions to to it.
> > >
> > > Best regards
> > > Ingo
> > >
> >
>
Reply | Threaded
Open this post in threaded view
|

AW: Multiple services run immediately

iwolf
Hello Rishi,

I think I have all I need. Two ECA rules with one action in sync mode handle my requirements without the need of customization.

The usecase: Customers order via a terminal in the local shop. They pay on the terminal and get the invoice right away (terminal printer). In the "same" moment the order picking will be started (automated warehouse). The customer goes to the good issue and receives the order. If there is a problem in the warehouse it should not affect the invoice. The customer should get the invoice in the moment. So the timing is important.

So thanks to everyone.

Best regards,
Ingo

-----Ursprüngliche Nachricht-----
Von: Rishi Solanki <[hidden email]>
Gesendet: Montag, 27. April 2020 23:06
An: ofbizuser <[hidden email]>
Betreff: Re: Multiple services run immediately

Ingo,
What exactly you want to achieve, you want to run two independent services on ECA trigger and should run independently without waiting for each other then it would be possible. Add two ECA rules and use Sync in action.

And if you want two services run one by one on success or so then that also possible. Add one ECA rule and two action with sync in sequence you want to execute. The exact requirement would help to answer better.


Best Regards,
--
Rishi Solanki
*CTO, Mindpath Technology*
Intelligent Solutions
cell: +91-98932-87847
http://www.mindpathtech.com
LinkedIn <https://www.linkedin.com/in/rishi-solanki-62271b7/>


On Sun, Apr 26, 2020 at 6:21 PM Ankush Upadhyay < [hidden email]> wrote:

> Hello Ingo,
>
> Answer for question
> @Pawan: "Have you tried with mode="sync" instead of mode="async"? It
> should run both services simultaneously." Do you mean that in my
> example (one eca
> - two sync action services) the second service would be started
> without waiting for the first to return the result?
>
> No, with sync mode, all actions of particular service eca would
> execute one by one, If you want to go dipper to know how it works, you
> can review ServiceEcaRule.java and ServiceEcaAction.
>
>
> Kind Regards,
> Ankush Upadhyay
> Senior Technical Consultant
>
> *HotWax Systems*
> *Enterprise open source experts*
> cell: +91-8109201285
> office: 0731-409-3684
> http://www.hotwaxsystems.com
>
>
> On Sun, Apr 26, 2020 at 1:27 PM Ingo Wolfmayr
> <[hidden email]>
> wrote:
>
> > Hello Suraj, hello Pawan, Hello Nameet
> >
> > thanks for the fast responses.
> >
> > I have read the blog article aready + adjusting the service settings
> > is one of those things I try to improve before launching a new ofbiz
> > installation in production. So I guess I can check this of :) Adding
> > an additional server would be my last resort, but always taken into account.
> >
> > When it comes to async an sync services with the example below - I
> > just want to make sure I am not folling a wrong idea:
> >
> > 1) async services would run independenly, but depend on the interval
> > services are polled. Default 30 seconds. So I will have to change
> > this
> to 5
> > seconds in order to have thoses services started "right away".
> > <action service="createInvoiceBeforeShipment" mode="async"
> persist="true"/>
> > <action service="sendOutputRequest" mode="async" persist="true"/>
> > </eca>
> >
> > 2) sync services - the second service would wait for the first
> > service + it is possible to use the result of service one.
> > <action service="createInvoiceBeforeShipment" mode="sync" /> <action
> > service="sendOutputRequest" mode="sync" /> </eca>
> >
> > @Pawan: "Have you tried with mode="sync" instead of mode="async"? It
> > should run both services simultaneously." Do you mean that in my
> > example (one eca - two sync action services) the second service
> > would be started without waiting for the first to return the result?
> >
> > With case 1 - would it make a difference if I create a single eca
> > service definition for each service to be called? Would they be
> > called independently?
> >
> > Thanks a lot.
> > Ingo
> >
> >
> >
> > -----Ursprüngliche Nachricht-----
> > Von: Suraj Khurana <[hidden email]>
> > Gesendet: Samstag, 25. April 2020 08:05
> > An: ofbizuser <[hidden email]>
> > Betreff: Re: Multiple services run immediately
> >
> > Hello Ingo,
> >
> > Hope you are doing good.
> >
> > I am not sure about the environment you are currently trying to
> > achieve this. IMO, there are two ways:
> >
> > - For improving performance, we can set up multiple OFBiz servers in
> > parallel. Yes, we can set up two OFBiz servers, one calling sync
> > service and another dedicated for async services only.
> > Here [1] is a reference blog for more details.
> >
> > - You can increase jobs count in service engine [2], so that your
> > OFBiz server will be picking more jobs to complete at a time, be
> > careful
> various
> > factors are responsible with this approach, like CPU core, deployed
> > OFBiz memory allocation, maximum DB threads enabled etc.
> >
> > [1]
> >
> >
> https://www.hotwaxsystems.com/ofbiz/ofbiz-tutorials/apache-ofbiz-perfo
> rmance/
> > [2] framework/service/config/serviceengine.xml
> >
> > HTH.
> > --
> > Best Regards,
> > Suraj Khurana
> > Senior Techincal Consultant
> >
> >
> > On Fri, Apr 24, 2020 at 11:01 PM Ingo Wolfmayr
> > <[hidden email]>
> > wrote:
> >
> > > Hi everybody,
> > >
> > > I want to run two or more services immediately after another
> > > service has finished.
> > >
> > > For example printing creating/printing the invoice and starting
> > > the pick process should be done immediately after orderchange  
> > > Invoicing and picking are two different processes that should be
> > > initiated at the
> > same time.
> > > Picking should not wait until the invoice process is finished.
> > >
> > > Right no I have:
> > >
> > > <eca service="changeOrderStatus" event="commit"  run-on-error="false">
> > >        <condition field-name="orderTypeId" operator="equals"
> > > value="SALES_ORDER"/>
> > >         <condition field-name="statusId" operator="equals"
> > > value="ORDER_APPROVED"/>
> > >         <condition-field field-name="statusId" operator="not-equals"
> > > to-field-name="oldStatusId"/>
> > >         <action service="createInvoiceBeforeShipment" mode="async"
> > > persist="true"/>
> > >         <action service="sendOutputRequest" mode="async"
> > > persist="true"/> </eca>
> > >
> > > The problem with that is, that if there are other tasks in the
> > > queue (solr product update, ...) it may come to unwanted delays.
> > >
> > > Would runSyncIgnore work?
> > >
> > > It would be great if I could use th eca service definitions to to it.
> > >
> > > Best regards
> > > Ingo
> > >
> >
>
Reply | Threaded
Open this post in threaded view
|

Re: Multiple services run immediately

Rohit Koushal
In reply to this post by Rishi Solanki
Thanks Rishi for adding up details.

Just wanted to share, In Sync mode, a single thread is responsible for
executing a complete task(means it child services and ECA rules). So if we
have we have multiple ECA associated over a single service in sync mode
then ECA will be run running in the order in which they get stacked during
server startup. In addition, other ECA's needs to hold up until the current
gets finished successfully. So in case, if there is any error during ECA
execution at that point framework immediately stops subsequent ECA's to get
trigger except for rules having run-on-failure/run-on-error is set to true.

Unlike in Async mode, multiple independent threads are involved which allow
executions of multiple ECA simultaneously over a common service.

----------------
Thanks & Regards
Rohit Koushal


On Tue, Apr 28, 2020 at 2:36 AM Rishi Solanki <[hidden email]>
wrote:

> Ingo,
> What exactly you want to achieve, you want to run two independent services
> on ECA trigger and should run independently without waiting for each other
> then it would be possible. Add two ECA rules and use Sync in action.
>
> And if you want two services run one by one on success or so then that also
> possible. Add one ECA rule and two action with sync in sequence you want to
> execute. The exact requirement would help to answer better.
>
>
> Best Regards,
> --
> Rishi Solanki
> *CTO, Mindpath Technology*
> Intelligent Solutions
> cell: +91-98932-87847
> http://www.mindpathtech.com
> LinkedIn <https://www.linkedin.com/in/rishi-solanki-62271b7/>
>
>
> On Sun, Apr 26, 2020 at 6:21 PM Ankush Upadhyay <
> [hidden email]> wrote:
>
> > Hello Ingo,
> >
> > Answer for question
> > @Pawan: "Have you tried with mode="sync" instead of mode="async"? It
> should
> > run both services simultaneously." Do you mean that in my example (one
> eca
> > - two sync action services) the second service would be started without
> > waiting for the first to return the result?
> >
> > No, with sync mode, all actions of particular service eca would execute
> one
> > by one, If you want to go dipper to know how it works, you can review
> > ServiceEcaRule.java and ServiceEcaAction.
> >
> >
> > Kind Regards,
> > Ankush Upadhyay
> > Senior Technical Consultant
> >
> > *HotWax Systems*
> > *Enterprise open source experts*
> > cell: +91-8109201285
> > office: 0731-409-3684
> > http://www.hotwaxsystems.com
> >
> >
> > On Sun, Apr 26, 2020 at 1:27 PM Ingo Wolfmayr <[hidden email]>
> > wrote:
> >
> > > Hello Suraj, hello Pawan, Hello Nameet
> > >
> > > thanks for the fast responses.
> > >
> > > I have read the blog article aready + adjusting the service settings is
> > > one of those things I try to improve before launching a new ofbiz
> > > installation in production. So I guess I can check this of :) Adding an
> > > additional server would be my last resort, but always taken into
> account.
> > >
> > > When it comes to async an sync services with the example below - I just
> > > want to make sure I am not folling a wrong idea:
> > >
> > > 1) async services would run independenly, but depend on the interval
> > > services are polled. Default 30 seconds. So I will have to change this
> > to 5
> > > seconds in order to have thoses services started "right away".
> > > <action service="createInvoiceBeforeShipment" mode="async"
> > persist="true"/>
> > > <action service="sendOutputRequest" mode="async" persist="true"/>
> </eca>
> > >
> > > 2) sync services - the second service would wait for the first service
> +
> > > it is possible to use the result of service one.
> > > <action service="createInvoiceBeforeShipment" mode="sync" />
> > > <action service="sendOutputRequest" mode="sync" /> </eca>
> > >
> > > @Pawan: "Have you tried with mode="sync" instead of mode="async"? It
> > > should run both services simultaneously." Do you mean that in my
> example
> > > (one eca - two sync action services) the second service would be
> started
> > > without waiting for the first to return the result?
> > >
> > > With case 1 - would it make a difference if I create a single eca
> service
> > > definition for each service to be called? Would they be called
> > > independently?
> > >
> > > Thanks a lot.
> > > Ingo
> > >
> > >
> > >
> > > -----Ursprüngliche Nachricht-----
> > > Von: Suraj Khurana <[hidden email]>
> > > Gesendet: Samstag, 25. April 2020 08:05
> > > An: ofbizuser <[hidden email]>
> > > Betreff: Re: Multiple services run immediately
> > >
> > > Hello Ingo,
> > >
> > > Hope you are doing good.
> > >
> > > I am not sure about the environment you are currently trying to achieve
> > > this. IMO, there are two ways:
> > >
> > > - For improving performance, we can set up multiple OFBiz servers in
> > > parallel. Yes, we can set up two OFBiz servers, one calling sync
> service
> > > and another dedicated for async services only.
> > > Here [1] is a reference blog for more details.
> > >
> > > - You can increase jobs count in service engine [2], so that your OFBiz
> > > server will be picking more jobs to complete at a time, be careful
> > various
> > > factors are responsible with this approach, like CPU core, deployed
> OFBiz
> > > memory allocation, maximum DB threads enabled etc.
> > >
> > > [1]
> > >
> > >
> >
> https://www.hotwaxsystems.com/ofbiz/ofbiz-tutorials/apache-ofbiz-performance/
> > > [2] framework/service/config/serviceengine.xml
> > >
> > > HTH.
> > > --
> > > Best Regards,
> > > Suraj Khurana
> > > Senior Techincal Consultant
> > >
> > >
> > > On Fri, Apr 24, 2020 at 11:01 PM Ingo Wolfmayr <
> [hidden email]>
> > > wrote:
> > >
> > > > Hi everybody,
> > > >
> > > > I want to run two or more services immediately after another service
> > > > has finished.
> > > >
> > > > For example printing creating/printing the invoice and starting the
> > > > pick process should be done immediately after orderchange  Invoicing
> > > > and picking are two different processes that should be initiated at
> the
> > > same time.
> > > > Picking should not wait until the invoice process is finished.
> > > >
> > > > Right no I have:
> > > >
> > > > <eca service="changeOrderStatus" event="commit"
> run-on-error="false">
> > > >        <condition field-name="orderTypeId" operator="equals"
> > > > value="SALES_ORDER"/>
> > > >         <condition field-name="statusId" operator="equals"
> > > > value="ORDER_APPROVED"/>
> > > >         <condition-field field-name="statusId" operator="not-equals"
> > > > to-field-name="oldStatusId"/>
> > > >         <action service="createInvoiceBeforeShipment" mode="async"
> > > > persist="true"/>
> > > >         <action service="sendOutputRequest" mode="async"
> > > > persist="true"/> </eca>
> > > >
> > > > The problem with that is, that if there are other tasks in the queue
> > > > (solr product update, ...) it may come to unwanted delays.
> > > >
> > > > Would runSyncIgnore work?
> > > >
> > > > It would be great if I could use th eca service definitions to to it.
> > > >
> > > > Best regards
> > > > Ingo
> > > >
> > >
> >
>


--
Kind Regards,
*Rohit Koushal* | Senior Technical Consultant
HotWax Systems <http://www.hotwaxsystems.com/>
Plot no. 80, Scheme no. 78 Part 2, Near Brilliant Convention Center, Indore,
M.P 452010
Mobile: 9098461867