Task Scheduler Adapter

Introduction

The TIBCO StreamBase® Task Scheduler adapter enables Studio to fire tuples at specific intervals. The adapter allows you to add, delete, pause, and resume scheduled triggers at runtime with a control port.

The Task Scheduler adapter is implemented using the Quartz Scheduler library.

Adapter Properties

This section describes the properties you can set for this adapter, using the various tabs of the Properties view in StreamBase Studio.

General Tab

Name: Use this required field to specify or change the name of this instance of this component, which must be unique in the current EventFlow module. The name must contain only alphabetic characters, numbers, and underscores, and no hyphens or other special characters. The first character must be alphabetic or an underscore.

Adapter: A read-only field that shows the formal name of the adapter.

Class name: Shows the fully qualified class name that implements the functionality of this adapter. If you need to reference this class name elsewhere in your application, you can right-click this field and select Copy from the context menu to place the full class name in the system clipboard.

Start options: This field provides a link to the Cluster Aware tab, where you configure the conditions under which this adapter starts.

Enable Error Output Port: Select this check box to add an Error Port to this component. In the EventFlow canvas, the Error Port shows as a red output port, always the last port for the component. See Using Error Ports to learn about Error Ports.

Description: Optionally enter text to briefly describe the component's purpose and function. In the EventFlow Editor canvas, you can see the description by pressing Ctrl while the component's tooltip is displayed.

Adapter Properties Tab

Property Type Description
Enable Status Port check box When enabled, the adapter sends informational data on the status port about various states of the adapter. For more information see Status Port. The default state is unchecked.
Log Level INFO Controls the level of verbosity the adapter uses to issue informational traces to the console. This setting is independent of the containing application's overall log level. Available values, in increasing order of verbosity, are: OFF, ERROR, WARN, INFO, DEBUG, TRACE.

Advanced Tab

Property Type Description
Scheduler Properties Key/Value These settings give you direct access to set the Quartz scheduler's initialization properties. See the Quartz Configuration Reference.

Cluster Aware Tab

Use the settings in this tab to allow this operator or adapter to start and stop based on conditions that occur at runtime in a cluster with more than one node. During initial development of the fragment that contains this operator or adapter, and for maximum compatibility with TIBCO Streaming releases before 10.5.0, leave the Cluster start policy control in its default setting, Start with module.

Cluster awareness is an advanced topic that requires an understanding of StreamBase Runtime architecture features, including clusters, quorums, availability zones, and partitions. See Cluster Awareness Tab Settings on the Using Cluster Awareness page for instructions on configuring this tab.

Control Input Port

Description

Use the command port to send commands to the adapter to add, delete, pause, and resume schedules.

All fields passed into this control port will output in the status and data output ports.

Control Port Schema

  • schedulerControl, Tuple. The control tuple which contains all the information required when performing a control command. All other fields are passed through to the output events.

    • command, String. The command to send to the adapter. Valid values are:

      • add — Add a schedule trigger. This command requires that the id and either cronSchedule or simpleSchedule fields have a value.

      • delete — Delete a scheduled trigger. This command requires that the id field has a value.

      • pause — Pause a scheduled trigger. This command requires that the id field has a value. NOTE: if you suspend the adapter, it remembers which scheduled triggers you have paused by control. When you resume the adapter it will NOT resume the user-paused scheduled triggers.

      • resume — Resume a scheduled trigger. This command requires that the id field has a value. NOTE: if you suspend the adapter, it remembers which scheduled triggers you have paused by control. When you resume the adapter it will NOT resume the user paused scheduled triggers.

    • id, String. The ID of this trigger to add, delete, pause, or resume. This value is mandatory and cannot be null or empty (applicable to all commands).

    • cronSchedule, Tuple. The fields to create a cron schedule:

      • cron, String. The cron expression to use when adding a new trigger. The cron expression format:

        Field Name Mandatory Allowed Values Allowed Special Characters
        Seconds YES 0-59 \t, - * /
        Minutes YES 0-59 \t, - * /
        Hours YES 0-23 \t, - * /
        Day of month YES 1-31 \t, - * ? / L W
        Month YES 1-12 or JAN-DEC , - * /
        Day of week YES 1-7 or SUN-SAT , - * ? / L #
        Year NO empty, 1970-2099 , - *
      • fireTimes, int. The number of times to fire this trigger before stopping. A null value means forever. The data port tuples field nextFireTime is null if the trigger is complete and will not fire again.

      • startAt, Timestamp. The specific time to start this schedule. If null, it starts immediately.

    • simpleSchedule, Tuple. The fields to create a simple schedule:

      • intervalHours, int. Specify a repeat interval in hours. If this value is set no other interval field may be set. 0 is considered not set.

      • intervalMinutes, int. Specify a repeat interval in minutes. If this value is set no other interval field may be set. 0 is considered not set.

      • intervalSeconds, int. Specify a repeat interval in seconds. If this value is set no other interval field may be set. 0 is considered not set.

      • intervalMilliSeconds, int. Specify a repeat interval in milliseconds. If this value is set no other interval field may be set. 0 is considered not set.

      • repeatCount, int. Specify a the number of time the trigger will repeat — total number of firings will be this number, + 1. The output tuples nextFireTime field is null for the last fired. For example, a value of 0 means fire only one time, a value of 2 means fire three times.

      • startAt, Timestamp. The specific time to start this schedule. If null, it starts immediately.

Data Output Port

The data port will output the events as triggers occur.

The data output port schema is:

  • id, String. The id of this trigger.

  • fireTime, Timestamp. The timestamp for when this trigger was fired.

  • nextFireTime, Timestamp. The timestamp for the next execution of this trigger. This value will be null if the trigger has completed. See fireCount in the Control Port Schema.

  • previousFireTime, Timestamp. The timestamp for when this trigger previously fired.

  • scheduledFireTime, Timestamp. The timestamp for when this trigger was scheduled to fired. You can use this to determine if the trigger fired with a skew.

  • fireCount, int. The number of times this trigger fired.

  • inputTuple, tuple. This field is the control tuple that was input to start the scheduled trigger.

Status Output Port

Description

You can optionally enable the status output port for this adapter instance by means of the Enable Status Port property in the Adapter Properties page of the Properties view. Use the status port to retrieve status output messages from the adapter.

Status Port Schema

  • type, string. The type of status information emitted. Status types are:

    • Error — This message relates to an error that occurred.

    • Warn — This message relates to a warning that the user should be aware of.

    • Info — This message relates to extra status information.

  • action, string. Valid values are:

    • Execute — This action relates errors or warnings that may occur when the trigger fires and the data output tuple is being created and sent.

    • Added — This action occurs when a schedule trigger is added. The object contains the id of the trigger added.

    • Updated — This action occurs when a scheduled trigger is updated via the control port using the same id as an existing trigger. The object contains the id of the updated trigger.

    • Add — This action occurs during an add command and relates to any errors or warning that may have occurred when trying to add a trigger, such as, empty ID or cron field, or invalid cron. If the issue is an invalid cron, the object field contains the cron used.

    • Deleted — This action occurs when a schedule trigger is deleted. The object contains the id of the trigger deleted.

    • Delete — This action occurs during a delete command and relates to any errors or warning that may have occurred when trying to delete a trigger, such as an empty ID field.

    • Paused — This action occurs when a schedule trigger is paused. The object contains the ID of the paused trigger.

    • Pause — This action occurs during an pause command and relates to any errors or warning that may have occurred when trying to pause a trigger, such as an empty ID field.

    • Resumed — This action occurs when a schedule trigger is resumed. The object contains the ID of the trigger resumed.

    • Resume — This action occurs during an resume command and relates to any errors or warning that may have happened when trying to resume a trigger, such as, empty ID field.

  • object, string. This value may be null. If not null, it contains a value relevant to the status message.

  • message, string. This is a formatted, human-readable message that explains the status message.

  • time, timestamp. The time the status message occurred.

  • inputTuple, tuple. This field is the control tuple that was input to create the scheduled trigger.

Suspend and Resume

If a suspend command is sent to the adapter, all triggers are paused. The adapter remembers which triggers are paused via the control port and will NOT resume those triggers when a resume command is sent to the adapter. You must resume those triggers manually via the control port.