Skip to content

Commit

Permalink
[ YC-887 ] Improve modules/plugin registration mechanism
Browse files Browse the repository at this point in the history
- reworked cron triggers extension
  • Loading branch information
denyspavlov committed Mar 24, 2018
1 parent 6a54ff3 commit 52ad72f
Show file tree
Hide file tree
Showing 6 changed files with 118 additions and 7 deletions.
16 changes: 16 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,22 @@ theme/theme.iml

theme/target/**

search/search-api/search-api.iml

search/search-api/target/**

search/search-lucene-core/search-lucene-core.iml

search/search-lucene-core/target/**

search/search-lucene-embeded/search-lucene-embeded.iml

search/search-lucene-embeded/target/**

search/search.iml

search/target/**

web/api/yes-api.iml

web/api/logs/net.authorize.aim.log
Expand Down
4 changes: 2 additions & 2 deletions env/migration/migrate-3.4.0-3.5.0/YC-873-README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ implementation in put to ./libs

The following extension points are defined:

core-index-cronjob.xml
websupport-cronjob-ext.xml
imported by:
- support/websupport-cronjob.xml
exposes beans:
exposes trigger beans via trigger extension list:
- reindexDiscontinuedProductsTrigger
- productsGlobalIndexProcessorTrigger
- productInventoryChangedProcessorJobCronTrigger
Expand Down
2 changes: 2 additions & 0 deletions env/migration/migrate-3.4.0-3.5.0/YC-887-README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,12 @@ manager/jam
- adm-applicationContext-ext.xml in applicationContext.xml
- adm-servlet-ext.xml in jam-servlet.xml
- for @Controller the following packages are scanned "org.yes.cart.service.endpoint,org.yes.cart.service.endpoint.impl"
- adm-cronjob-ext.xml in manager-cronjob.xml

web/support

- websupport-ext.xml in websupport-webapp.xml
- websupport-cronjob-ext.xml in websupport-cronjob.xml

web/api

Expand Down
24 changes: 21 additions & 3 deletions manager/jam/src/main/resources/manager-cronjob.xml
Original file line number Diff line number Diff line change
Expand Up @@ -341,9 +341,8 @@
</property>
</bean>

<bean id="managerCronSchedule" class="org.springframework.scheduling.quartz.SchedulerFactoryBean"
depends-on="quartzSysPropsSkipUpdateCheck1,quartzSysPropsSkipUpdateCheck2">
<property name="triggers">
<bean id="managerCronScheduleTriggers" class="org.springframework.beans.factory.config.ListFactoryBean">
<property name="sourceList">
<list>
<ref bean="preOrderJobCronTrigger" />
<ref bean="deliveryInfoUpdateJobCronTrigger" />
Expand All @@ -358,6 +357,25 @@
<ref bean="imageVaultProcessorJobCronTrigger" />
</list>
</property>
</bean>

<!-- Extension for cron triggers example that should be put in "adm-cronjob-ext.xml":
<bean id="extensionSample" parent="managerCronScheduleTriggers" class="org.springframework.beans.factory.config.ListFactoryBean">
<property name="sourceList">
<list merge="true">
<ref bean="customTriggerX" />
<ref bean="customTriggerY" />
....
</list>
</property>
</bean>
-->

<import resource="classpath*:adm-cronjob-ext.xml"/>

<bean id="managerCronSchedule" class="org.springframework.scheduling.quartz.SchedulerFactoryBean"
depends-on="quartzSysPropsSkipUpdateCheck1,quartzSysPropsSkipUpdateCheck2">
<property name="triggers" ref="managerCronScheduleTriggers"/>
<property name="quartzProperties">
<props>
<prop key="org.quartz.scheduler.skipUpdateCheck">true</prop>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright 2009 Denys Pavlov, Igor Azarnyi
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->

<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd">

<import resource="core-index-cronjob.xml"/>

<bean id="ftCronExtension" parent="webCronScheduleTriggers" class="org.springframework.beans.factory.config.ListFactoryBean">
<property name="sourceList">
<list merge="true">
<!--
reindexDiscontinuedProductsTrigger and productsGlobalIndexProcessorTrigger are two alternatives
that perform full reindex.
Only one of these should be enabled. reindexDiscontinuedProductsTrigger is aimed at locating
items that are no longer available and then removing them out of the search index.
productsGlobalIndexProcessorTrigger simply does full reindex (that includes removing outdated).
The enable/disable should be controlled by cron schedule set to far future (say 2099). By default
only reindexDiscontinuedProductsTrigger is set to 5am daily and productsGlobalIndexProcessorTrigger
is set to 2099 (i.e. disabled)
-->
<ref bean="reindexDiscontinuedProductsTrigger" />
<ref bean="productsGlobalIndexProcessorTrigger" />
<!--
Cron job that detect inventory changes between job runs and then
re-indexes the SKU corresponding to those inventory items.
This is needed for delta changes updates in index for example when
inventory is updated either due to inventory update or changes caused
by customer order
-->
<ref bean="productInventoryChangedProcessorJobCronTrigger" />
</list>
</property>
</bean>

</beans>

24 changes: 22 additions & 2 deletions web/support/src/main/resources/websupport-cronjob.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd">

<import resource="classpath:core-index-cronjob.xml"/>

<!-- ################################ Scheduler ####################################################### -->


Expand All @@ -48,6 +46,28 @@
</property>
</bean>

<bean id="webCronScheduleTriggers" class="org.springframework.beans.factory.config.ListFactoryBean">
<property name="sourceList">
<list/>
</property>
</bean>


<!-- Extension for cron triggers example that should be put in "websupport-cronjob-ext.xml":
<bean id="extensionSample" parent="webCronScheduleTriggers" class="org.springframework.beans.factory.config.ListFactoryBean">
<property name="sourceList">
<list merge="true">
<ref bean="customTriggerX" />
<ref bean="customTriggerY" />
....
</list>
</property>
</bean>
-->

<import resource="classpath*:websupport-cronjob-ext.xml"/>


<bean id="webCronSchedule" class="org.springframework.scheduling.quartz.SchedulerFactoryBean"
depends-on="quartzSysPropsSkipUpdateCheck1,quartzSysPropsSkipUpdateCheck2">
<property name="triggers">
Expand Down

0 comments on commit 52ad72f

Please sign in to comment.