Re: Multiple services run immediately

2020-04-28 Thread Rohit Koushal
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 
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 <
> ankush.upadh...@hotwaxsystems.com> 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 
> > 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".
> > >  > persist="true"/>
> > > 
> 
> > >
> > > 2) sync services - the second service would wait for the first service
> +
> > > it is possible to use the result of service one.
> > > 
> > >  
> > >
> > > @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 
> > > Gesendet: Samstag, 25. April 2020 08:05
> > > An: ofbizuser 
> > > Betreff: Re: Multiple services run immediately
> > >
> > > Hello Ingo,
> > >
> > > Hope 

Re: Multiple services run immediately

2020-04-27 Thread Rishi Solanki
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 <
ankush.upadh...@hotwaxsystems.com> 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 
> 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".
> >  persist="true"/>
> >  
> >
> > 2) sync services - the second service would wait for the first service +
> > it is possible to use the result of service one.
> > 
> >  
> >
> > @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 
> > Gesendet: Samstag, 25. April 2020 08:05
> > An: ofbizuser 
> > 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 
> > wrote:
> >
> > > Hi everybody,
> > >
> > > I want to run two or more services immediately after another service
> > > has finished.
> > >
> > > For example printing creating/printing the inv

Re: Multiple services run immediately

2020-04-26 Thread 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 <
ankush.upadh...@hotwaxsystems.com> 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 
> 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".
> >  persist="true"/>
> >  
> >
> > 2) sync services - the second service would wait for the first service +
> > it is possible to use the result of service one.
> > 
> >  
> >
> > @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 
> > Gesendet: Samstag, 25. April 2020 08:05
> > An: ofbizuser 
> > 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 
> > 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 

Re: Multiple services run immediately

2020-04-26 Thread Ankush Upadhyay
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 
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".
> 
>  
>
> 2) sync services - the second service would wait for the first service +
> it is possible to use the result of service one.
> 
>  
>
> @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 
> Gesendet: Samstag, 25. April 2020 08:05
> An: ofbizuser 
> 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 
> 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:
> >
> > 
> > > value="SALES_ORDER"/>
> >  > value="ORDER_APPROVED"/>
> >  > to-field-name="oldStatusId"/>
> >  > persist="true"/>
> >  > persist="true"/> 
> >
> > 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
> >
>


Re: Multiple services run immediately

2020-04-25 Thread Nameet Jain
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 
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:
>
> 
> value="SALES_ORDER"/>
>  value="ORDER_APPROVED"/>
>  to-field-name="oldStatusId"/>
>  persist="true"/>
> 
> 
>
> 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
>


Re: Multiple services run immediately

2020-04-25 Thread Pawan Verma
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 
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 
> 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:
> >
> > 
> > > value="SALES_ORDER"/>
> >  > value="ORDER_APPROVED"/>
> >  > to-field-name="oldStatusId"/>
> >  > persist="true"/>
> > 
> > 
> >
> > 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
> >
>


Re: Multiple services run immediately

2020-04-25 Thread Suraj Khurana
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 
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:
>
> 
> value="SALES_ORDER"/>
>  value="ORDER_APPROVED"/>
>  to-field-name="oldStatusId"/>
>  persist="true"/>
> 
> 
>
> 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
>