[jira] [Commented] (OFBIZ-9233) Enable a service to run by a specific service engine
[ https://issues.apache.org/jira/browse/OFBIZ-9233?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16315569#comment-16315569 ] Shi Jinghai commented on OFBIZ-9233: I'm working on this issue, I'll try to create a new patch to comply with the new pattern Nicolas mentioned. > Enable a service to run by a specific service engine > > > Key: OFBIZ-9233 > URL: https://issues.apache.org/jira/browse/OFBIZ-9233 > Project: OFBiz > Issue Type: Improvement > Components: framework >Affects Versions: Trunk >Reporter: Shi Jinghai >Assignee: Shi Jinghai >Priority: Minor > Attachments: OFBIZ-9233-20170301.patch, OFBIZ-9233-20170413.patch, > OFBIZ-9233-MultiServiceEnginesEnv.png > > > Currently, all of the services of OFBiz are run by the 'default' service > engine. > In a project, we have to make a service run by different service engines > rather than the 'default' one, i.e. order services run by 'order' service > engine and 'orderpool', shipment services run by 'shipment' service engine > and 'shipmentpool'. -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (OFBIZ-9233) Enable a service to run by a specific service engine
[ https://issues.apache.org/jira/browse/OFBIZ-9233?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16309307#comment-16309307 ] Shi Jinghai commented on OFBIZ-9233: Thanks Nicolas! Yes, I agree with you, the relation between service and pool can be defined in new files. > Enable a service to run by a specific service engine > > > Key: OFBIZ-9233 > URL: https://issues.apache.org/jira/browse/OFBIZ-9233 > Project: OFBiz > Issue Type: Improvement > Components: framework >Affects Versions: Trunk >Reporter: Shi Jinghai >Assignee: Shi Jinghai >Priority: Minor > Attachments: OFBIZ-9233-20170301.patch, OFBIZ-9233-20170413.patch, > OFBIZ-9233-MultiServiceEnginesEnv.png > > > Currently, all of the services of OFBiz are run by the 'default' service > engine. > In a project, we have to make a service run by different service engines > rather than the 'default' one, i.e. order services run by 'order' service > engine and 'orderpool', shipment services run by 'shipment' service engine > and 'shipmentpool'. -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (OFBIZ-9233) Enable a service to run by a specific service engine
[ https://issues.apache.org/jira/browse/OFBIZ-9233?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16309286#comment-16309286 ] Nicolas Malin commented on OFBIZ-9233: -- I review this patch and It's seems complicate to mixing service definition and executing plan. I propose to thinking about an other way to do this with separate them. We can introduce an other model job plan definition that can be dedicate on each environment like this {code} {code} The most advantage would be don't modify the service definition to introduce the execution plan. > Enable a service to run by a specific service engine > > > Key: OFBIZ-9233 > URL: https://issues.apache.org/jira/browse/OFBIZ-9233 > Project: OFBiz > Issue Type: Improvement > Components: framework >Affects Versions: Trunk >Reporter: Shi Jinghai >Assignee: Shi Jinghai >Priority: Minor > Attachments: OFBIZ-9233-20170301.patch, OFBIZ-9233-20170413.patch, > OFBIZ-9233-MultiServiceEnginesEnv.png > > > Currently, all of the services of OFBiz are run by the 'default' service > engine. > In a project, we have to make a service run by different service engines > rather than the 'default' one, i.e. order services run by 'order' service > engine and 'orderpool', shipment services run by 'shipment' service engine > and 'shipmentpool'. -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (OFBIZ-9233) Enable a service to run by a specific service engine
[ https://issues.apache.org/jira/browse/OFBIZ-9233?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16061946#comment-16061946 ] Jacques Le Roux commented on OFBIZ-9233: Thanks JInghai, I just tested again (sorry for the delay) but it does not apply. There are still some tabs in ServiceUtil class, please check, especially around purgeOldJobs, thanks (I tried to replace them but did not work, not sure why, stopped then) > Enable a service to run by a specific service engine > > > Key: OFBIZ-9233 > URL: https://issues.apache.org/jira/browse/OFBIZ-9233 > Project: OFBiz > Issue Type: Improvement > Components: framework >Affects Versions: Trunk >Reporter: Shi Jinghai >Assignee: Shi Jinghai >Priority: Minor > Fix For: Trunk > > Attachments: OFBIZ-9233-20170301.patch, OFBIZ-9233-20170413.patch, > OFBIZ-9233-MultiServiceEnginesEnv.png > > > Currently, all of the services of OFBiz are run by the 'default' service > engine. > In a project, we have to make a service run by different service engines > rather than the 'default' one, i.e. order services run by 'order' service > engine and 'orderpool', shipment services run by 'shipment' service engine > and 'shipmentpool'. -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (OFBIZ-9233) Enable a service to run by a specific service engine
[ https://issues.apache.org/jira/browse/OFBIZ-9233?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15964360#comment-15964360 ] Jacques Le Roux commented on OFBIZ-9233: Hi Jinghai, I began to review and decided to apply on trunk for easier review and test, but stumbled upon an issue. This hunk, and only this one, does not apply {code} @@ -371,163 +372,165 @@ } public static MappurgeOldJobs(DispatchContext dctx, Map context) { -Locale locale = (Locale)context.get("locale"); +Locale locale = (Locale)context.get("locale"); Debug.logWarning("purgeOldJobs service invoked. This service is obsolete - the Job Scheduler will purge old jobs automatically.", module); String sendPool = null; -Calendar cal = Calendar.getInstance(); try { -sendPool = ServiceConfigUtil.getServiceEngine().getThreadPool().getSendToPool(); -int daysToKeep = ServiceConfigUtil.getServiceEngine().getThreadPool().getPurgeJobDays(); -cal.add(Calendar.DAY_OF_YEAR, -daysToKeep); -} catch (GenericConfigException e) { -Debug.logWarning(e, "Exception thrown while getting service configuration: ", module); -return returnError(UtilProperties.getMessage(ServiceUtil.resource, "ServiceExceptionThrownWhileGettingServiceConfiguration", UtilMisc.toMap("errorString", e), locale)); -} -Delegator delegator = dctx.getDelegator(); +for (ServiceEngine engine : ServiceConfigUtil.getServiceConfig().getServiceEngines()) { +Calendar cal = Calendar.getInstance(); +sendPool = engine.getThreadPool().getSendToPool(); +int daysToKeep = engine.getThreadPool().getPurgeJobDays(); +cal.add(Calendar.DAY_OF_YEAR, -daysToKeep); +Delegator delegator = dctx.getDelegator(); -Timestamp purgeTime = new Timestamp(cal.getTimeInMillis()); +Timestamp purgeTime = new Timestamp(cal.getTimeInMillis()); -// create the conditions to query -EntityCondition pool = EntityCondition.makeCondition("poolId", sendPool); +// create the conditions to query +EntityCondition pool = EntityCondition.makeCondition("poolId", sendPool); -List finExp = UtilMisc.toList(EntityCondition.makeCondition("finishDateTime", EntityOperator.NOT_EQUAL, null)); -finExp.add(EntityCondition.makeCondition("finishDateTime", EntityOperator.LESS_THAN, purgeTime)); +List finExp = UtilMisc.toList(EntityCondition.makeCondition("finishDateTime", EntityOperator.NOT_EQUAL, null)); +finExp.add(EntityCondition.makeCondition("finishDateTime", EntityOperator.LESS_THAN, purgeTime)); -List canExp = UtilMisc.toList(EntityCondition.makeCondition("cancelDateTime", EntityOperator.NOT_EQUAL, null)); -canExp.add(EntityCondition.makeCondition("cancelDateTime", EntityOperator.LESS_THAN, purgeTime)); +List canExp = UtilMisc.toList(EntityCondition.makeCondition("cancelDateTime", EntityOperator.NOT_EQUAL, null)); +canExp.add(EntityCondition.makeCondition("cancelDateTime", EntityOperator.LESS_THAN, purgeTime)); -EntityCondition cancelled = EntityCondition.makeCondition(canExp); -EntityCondition finished = EntityCondition.makeCondition(finExp); +EntityCondition cancelled = EntityCondition.makeCondition(canExp); +EntityCondition finished = EntityCondition.makeCondition(finExp); -EntityCondition doneCond = EntityCondition.makeCondition(UtilMisc.toList(cancelled, finished), EntityOperator.OR); +EntityCondition doneCond = EntityCondition.makeCondition(UtilMisc.toList(cancelled, finished), EntityOperator.OR); -// always suspend the current transaction; use the one internally -Transaction parent = null; -try { -if (TransactionUtil.getStatus() != TransactionUtil.STATUS_NO_TRANSACTION) { -parent = TransactionUtil.suspend(); -} - -// lookup the jobs - looping 1000 at a time to avoid problems with cursors -// also, using unique transaction to delete as many as possible even with errors -boolean noMoreResults = false; -boolean beganTx1 = false; -while (!noMoreResults) { -// current list of records -List curList = null; +// always suspend the current transaction; use the one internally +Transaction parent = null; try { -// begin this transaction -beganTx1 = TransactionUtil.begin(); +if (TransactionUtil.getStatus() != TransactionUtil.STATUS_NO_TRANSACTION) { +
[jira] [Commented] (OFBIZ-9233) Enable a service to run by a specific service engine
[ https://issues.apache.org/jira/browse/OFBIZ-9233?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15924369#comment-15924369 ] Jacques Le Roux commented on OFBIZ-9233: Hi Jinghai, I'll try to completely review this week, not sure yet, but should be > Enable a service to run by a specific service engine > > > Key: OFBIZ-9233 > URL: https://issues.apache.org/jira/browse/OFBIZ-9233 > Project: OFBiz > Issue Type: Improvement > Components: framework >Affects Versions: Trunk >Reporter: Shi Jinghai >Assignee: Shi Jinghai >Priority: Minor > Fix For: Trunk > > Attachments: OFBIZ-9233-20170301.patch, > OFBIZ-9233-MultiServiceEnginesEnv.png > > > Currently, all of the services of OFBiz are run by the 'default' service > engine. > In a project, we have to make a service run by different service engines > rather than the 'default' one, i.e. order services run by 'order' service > engine and 'orderpool', shipment services run by 'shipment' service engine > and 'shipmentpool'. -- This message was sent by Atlassian JIRA (v6.3.15#6346)
[jira] [Commented] (OFBIZ-9233) Enable a service to run by a specific service engine
[ https://issues.apache.org/jira/browse/OFBIZ-9233?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15891928#comment-15891928 ] Shi Jinghai commented on OFBIZ-9233: Hi Jacques, Thanks for your reviewing! Very appreciated. BTW, I didn't change the service-config.xsd, it allows multiple elements of service-engine in serviceengine.xml, so it's ok. Yeah, I should write more test cases :(, for example, poolId in JobSandbox can be corrected to the one in the service configuration automatically. Kind Regards, > Enable a service to run by a specific service engine > > > Key: OFBIZ-9233 > URL: https://issues.apache.org/jira/browse/OFBIZ-9233 > Project: OFBiz > Issue Type: Improvement > Components: framework >Affects Versions: Trunk >Reporter: Shi Jinghai >Assignee: Shi Jinghai >Priority: Minor > Fix For: Trunk > > Attachments: OFBIZ-9233-20170301.patch, > OFBIZ-9233-MultiServiceEnginesEnv.png > > > Currently, all of the services of OFBiz are run by the 'default' service > engine. > In a project, we have to make a service run by different service engines > rather than the 'default' one, i.e. order services run by 'order' service > engine and 'orderpool', shipment services run by 'shipment' service engine > and 'shipmentpool'. -- This message was sent by Atlassian JIRA (v6.3.15#6346)
[jira] [Commented] (OFBIZ-9233) Enable a service to run by a specific service engine
[ https://issues.apache.org/jira/browse/OFBIZ-9233?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15891787#comment-15891787 ] Jacques Le Roux commented on OFBIZ-9233: Hi Jinghai, I just cursorily read the patch for now, and I think it's missing changes in service-config.xsd, thanks. It's great to see a test in your patch :) > Enable a service to run by a specific service engine > > > Key: OFBIZ-9233 > URL: https://issues.apache.org/jira/browse/OFBIZ-9233 > Project: OFBiz > Issue Type: Improvement > Components: framework >Affects Versions: Trunk >Reporter: Shi Jinghai >Assignee: Shi Jinghai >Priority: Minor > Fix For: Trunk > > Attachments: OFBIZ-9233-20170301.patch, > OFBIZ-9233-MultiServiceEnginesEnv.png > > > Currently, all of the services of OFBiz are run by the 'default' service > engine. > In a project, we have to make a service run by different service engines > rather than the 'default' one, i.e. order services run by 'order' service > engine and 'orderpool', shipment services run by 'shipment' service engine > and 'shipmentpool'. -- This message was sent by Atlassian JIRA (v6.3.15#6346)