You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 3 Next »

WORK IN PROGRESS!

The new JITL jobs JSSmtpMailClientAdapter and SmtpMailMonitor are included since JobScheduler Release 1.5.3253.
These job is now without a documentation. It is useful for sending emails.
It contains all parameters like the JobSchedulerManagedMailJob.

JSSmtpMailClientAdapter has more features than JobSchedulerManagedMailJob, for example

  1. All parameters can have a prefix "MailOnSuccess_", "MailOnError_" and "MailOnJobStart_".
  2. Other parameter can be substituted
  3. The job can be used in a pre- or post-processing.

Example job using com.sos.jitl.mail.smtp.JSSmtpMailClientAdapterClass:

<job>
  <params>
    <param name="subject" value="Test-Mail"/>
    <param name="body" value="This is the body"/>
    <param name="to" value="myMail@address.com"/>
    <param name="host" value="mysmtp"/>
  </params>
  <script java_class="com.sos.jitl.mail.smtp.JSSmtpMailClientAdapterClass" language="java"/>
  <run_time/>
</job>

SmtpMailMonitor

Example job using com.sos.jitl.mail.smtp.SmtpMailMonitor:

<job>
    <params >
        <param  name="MailOnSuccess_host" value="smtp.sos"/>

        <param  name="MailOnSuccess_subject" value="%SCHEDULER_JOB_NAME% has run successfully"/>

        <param  name="MailOnSuccess_body" value="%SCHEDULER_JOB_NAME% has run successfully"/>

        <param  name="MailOnSuccess_to" value="oh@sos-berlin.com"/>
    </params>

    <script  language="shell">
        <![CDATA[
exit 5
        ]]>
    </script>

    <monitor  name="process0" ordering="0">
        <script  language="java" java_class_path="" java_class="com.sos.jitl.mail.smtp.SmtpMailMonitor"/>
    </monitor>

    <delay_after_error  error_count="1" delay="10"/>

    <delay_order_after_setback  setback_count="1" is_maximum="no" delay="20"/>

    <run_time />
</job>



=== Example for prefix MailOnSuccess_ ===
With this prefix and the "MailOnError_" prefix you can specify e.g. different recipients for the cases that the job has an error or finished successfully.
You want that a job should sends a mail in the case of an error in the normal way via the JobScheduler mail notification. 
This mail has the task log as attachment. Further you want a success mail but without the task log.

<source lang="xml">
<job>
  <params>
    <param name="subject" value="Test-Mail"/>
    <param name="body" value="This is the body"/>
    <param name="to" value="myMail@address.com"/>
    <param name="host" value="mysmtp"/>
  </params>
  <script java_class="com.sos.jitl.mail.smtp.JSSmtpMailClientAdapterClass" language="java"/>
  <run_time/>
</job>

Example for prefix MailOnJobStart_

Example for substitute other parameters

Example for post-processing

  • No labels