Karaf: Scheduling GoGo Commands Via Blueprint
A new feature with mhu-lib 3.3 is the karaf scheduling service. The service is designed to be configured by blueprint and executes gogo-shell scripts. In this way you are able to execute every regular maintenance by automation.
Use this sample blueprint to print a hello world for every 2 minutes:
Use this sample blueprint to print a hello world for every 2 minutes:
<?xml version="1.0" encoding="UTF-8"?>
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0">
<bean id="cmd"
class="de.mhus.lib.karaf.services.ScheduleGogo"
init-method="init" destroy-method="destroy">
<property name="name" value="cmd_hello"/>
<property name="interval" value="*/2 * * * *"/>
<property name="command" value="echo 'hello world!'"/>
<property name="timerFactory" ref="TimerFactoryRef" />
</bean>
<reference
id="TimerFactoryRef"
interface="de.mhus.lib.core.util.TimerFactory" />
<service
interface="de.mhus.lib.karaf.services.SimpleServiceIfc"
ref="cmd">
<service-properties>
<entry key="osgi.jndi.service.name" value="cmd_hello"/>
</service-properties>
</service>
</blueprint>
Kommentare
Kommentar veröffentlichen