Job-Requests

From Plex-XML

Jump to: navigation, search

You could use the <jobrequest> element for periodic scheduled requests.

Job requests are executed in the background like a batch process and don't have any user interaction. For the usage of job-requests you need to define a "SchedulerServlet" in your web.xml. See Web.xml#Servlet for details.


Job request are basically defined like normal web request. Except for an additional <schedule> element for the definition of the execution interval.
See http://www.opensymphony.com/quartz/api/org/quartz/CronTrigger.html for details

<!-- scheduled for every weekday at 3pm -->
<schedule type="cron" interval="0 0 15 ? * MON-FRI"/>
<!-- scheduled for every 10 minutes -->
<schedule type="simple" interval="10"/>


A common response for a job-request is 'nothing'. Because a batch request can't have any interaction.

<response>
 <error type="default" name="DEFAULT"/>
 <reaction type="DEFAULT" target="NOTHING"/>
</response>

If you like to give any feedback about the execution of you request you could send a e-mail (target=SENDMAIL) as reaction for any request.

<jobrequest name="EZBImport">
 <schedule type="cron" interval="0 0 15 ? * MON-FRI"/>
 <request name="SessionAndUser">
  <plex-parameter type="fix" name="Input_BrowserLanguage" value="en_US"/>
  <plex-parameter type="fix" name="Input_RemoteHost" value="localhost" />
  <stoponerror successcode="OK"/>
 </request>
 <request name="doSomthing">
  <stoponerror successcode="OK"/>
 </request>
 <request name="SendEMail" asynchron="true">
  <reaction type="DEFAULT" mime="text/html" target="SENDMAIL" localized="true" name="/WEB-INF/helpdesk/style/MainSendMail.xslt">
   <parameter type="web" targetfield="server" response="ActMainSendMail" field="ControlOutput_MailServer"/>
   <parameter type="web" targetfield="user" response="ActMainSendMail" field="ControlOutput_MailSMTPUser"/>
   <parameter type="web" targetfield="password" response="ActMainSendMail" field="ControlOutput_MailSMTPPassword"/>
   <parameter type="web" targetfield="subject" response="ActMainSendMail" field="ControlOutput_MailSubject"/>
   <parameter type="web" targetfield="to" response="ActMainSendMail" field="ControlOutput_MailAddressTo"/>
   <parameter type="web" targetfield="cc" response="ActMainSendMail" field="ControlOutput_MailAddressCC"/>
   <parameter type="web" targetfield="bcc" response="ActMainSendMail" field="ControlOutput_MailAddressBCC"/>
   <parameter type="web" targetfield="from" response="ActMainSendMail" field="ControlOutput_MailAddressFrom"/>
   <parameter type="web" targetfield="replyto" response="ActMainSendMail" field="ControlOutput_MailAddressReplyTo"/>
  </reaction>
 </request>
 <response>
  <error type="default" name="DEFAULT"/>
  <save-parameter response="SessionAndUser" field="ControlInput_SessionID" targetfield="session.ID"/>
  <save-parameter response="SessionAndUser" field="Output_SessionResTxt1" targetfield="rememberid"/>
  <reaction type="DEFAULT" target="NOTHING"/>
 </response>
</jobrequest>

Example for a job request scheduled every weekday at 3pm with no respone:

<jobrequest name="EZBImport">
 <schedule type="cron" interval="0 0 15 ? * MON-FRI"/>
 <request name="SessionAndUser">
  <plex-parameter type="fix" name="Input_BrowserLanguage" value="en_US"/>
  <plex-parameter type="fix" name="Input_RemoteHost" value="localhost" />
  <stoponerror successcode="OK"/>
 </request>
 <response>
  <error type="default" name="DEFAULT"/>
  <save-parameter response="SessionAndUser" field="ControlInput_SessionID" targetfield="session.ID"/>
  <save-parameter response="SessionAndUser" field="Output_SessionResTxt1" targetfield="rememberid"/>
  <reaction type="DEFAULT" target="NOTHING"/>
 </response>
</jobrequest>
Personal tools