Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions service/example.rest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -77,4 +77,12 @@ along with this software (see the LICENSE.md file). If not, see
</resource>
</id>
</resource>
<resource name="test" require-authentication="anonymous-view">
<resource name="scheduleService">
<method type="post"><service name="moqui.example.ExampleServices.test#ScheduleService"/></method>
</resource>
<resource name="scheduleRealJob">
<method type="post"><service name="moqui.example.ExampleServices.test#ScheduleRealJob"/></method>
</resource>
</resource>
</resource>
41 changes: 41 additions & 0 deletions service/moqui/example/ExampleServices.xml
Original file line number Diff line number Diff line change
Expand Up @@ -194,4 +194,45 @@ along with this software (see the LICENSE.md file). If not, see
<auto-parameters entity-name="moqui.example.Example"/>
</out-parameters>
</service>

<!-- ========== Example Scheduled Services ========== -->
<service verb="test" noun="ScheduleService" authenticate="false" allow-remote="true">
<in-parameters>
<parameter name="taskName" default-value="hz-dist-test"/>
</in-parameters>
<actions>
<service-schedule name="moqui.example.ExampleServices.test#Echo"
task-name="${taskName}" type="at-fixed-rate" distribute="true" initial-delay="500"
polling-interval="200" duration="15000" in-map="[taskName:taskName]"/>
<cancel-scheduled-service task-name="${taskName}" cancel-delay="10000"/>
</actions>
</service>
<service verb="test" noun="Echo" authenticate="false">
<in-parameters>
<parameter name="taskName"/>
</in-parameters>
<actions>
<log level="info" message="HZ Test Echo Service task=${taskName} runtime=${ec.factory.runtimePath} thread=${Thread.currentThread().name}"/>
</actions>
</service>

<service verb="test" noun="ScheduleRealJob" authenticate="false" allow-remote="true">
<in-parameters>
<parameter name="taskName" default-value="hz-autoapprove-test"/>
</in-parameters>
<actions>
<service-schedule name="moqui.example.ExampleServices.test#RunAutoApproveDistributed"
task-name="${taskName}" distribute="true" initial-delay="2000" in-map="[taskName:taskName]"/>
</actions>
</service>
<service verb="test" noun="RunAutoApproveDistributed" authenticate="false">
<in-parameters>
<parameter name="taskName"/>
</in-parameters>
<actions>
<log level="info" message="[HZ-DIST-JOB] autoApprove#OrdersDelayed task=${taskName} runtime=${ec.factory.runtimePath} thread=${Thread.currentThread().name}"/>
<service-call name="mantle.order.OrderServices.autoApprove#OrdersDelayed" ignore-error="true"/>
<log level="info" message="[HZ-DIST-JOB] autoApprove#OrdersDelayed completed on runtime=${ec.factory.runtimePath}"/>
</actions>
</service>
</services>