Contents

The Timer5.0 microservice is used to trigger sending of messages to the microservices connected to its output ports. The date and the time at which this microservice needs to start sending messages can be configured in the Configuration Property Sheet (CPS). The number of messages and the format of the message can also be specified here.

Icon

This microservice has no input ports, but output ports are generated for each scheduler.

Timer5.0 allows adding multiple schedulers and configuring input messages. It is capable of sending messages to its output port in the format as specified in the CPS. The microservice uses the java.util.Timer class for scheduling.

Points to note

If any of the scheduler configuration of the Timer microservice is configured for a start date and time which is in the past, when the microservice starts, all the messages which could have been sent had the microservice started at the configured date and time, is sent immediately on startup. To avoid this, the scheduler can be configured to send the first message at the first interval which comes in the future of the time when the microservice is launched. The configuration parameter to check is Start execution from next interval.

Configuration and Testing

Scheduler Service Configuration

The microservice can be configured using the properties in the Custom Property Sheet (CPS) shown in the figure below.


Figure 1: Custom Property Sheet (CPS)

Timer Configurations

Add/Modify Timer Configuration

Add the timer configurations which is used in the creation of microservice output ports. By default, the microservice has no ports. Depending on the names provided in the property sheet, output port gets generated.

For each timer configuration, Scheduler Configuration panel, Advanced Configuration panel and Message Configuration panel (the 3 tabs on the right side of the Scheduler Service Configuration window) can be configured, which are explained in the following sections.

Scheduler Configuration

Parameters that can be configured in the Scheduler Service Configuration panel (see the figure above) are described below.

  • Message Sending Interval: Time interval after which the message needs to be sent. It can be set in:
    • milli seconds

    • seconds

    • minutes

    • hours

    • days

  • Number of Messages: Number of times the message needs to be sent.
  • Infinite Times: Select this check box to send the messages without a count limit.

  • Start time: The time at which the Timer has to start sending the messages. This can be configured for a future time or past time.

  • Start date: The date on which the Timer has to start sending the messages.

Advanced Configuration


Figure 2: Advance Configuration section in Scheduler Service Configuration Panel

  • Schedule Type
    • Daily: The message is sent every day between the Start Time and the End Time as defined in the Sessions table below. The time format has to be in "hh:mm:ss".
    • Weekly: The message is sent on the predefined days of a week. The days in a week can be chosen by clicking the ellipsis against the property Scheduled Days in Week. The messages are sent only during the intervals as provided in the Sessions table.
    • Monthly:The message is sent on predefined dates in a month. The dates in a month can be chosen by clicking the ellipsis against the property Scheduled Dates in Month. The messages are sent only during the intervals as provided in the Sessions table.
  • Start Time: The time when the Timer should start sending the messages.
  • End Time: The time when the Timer should stop sending the messages.
  • End Date: This is to set the date when the timer should stop sending the messages

    Icon

    End Date option gets enabled only if the Use End Date check box is selected.

Message Configuration

Message Type


Figure 3: Message Type Configuration panel

The output message format for the Timer output port can be configured in this panel.

Timer supports Plain Text format and XML format messages. If the timer is configured to send Plain Text message, then the content can be specified in the text area in the next tab (Message Property). If you select the message format as XML, then provide a sample XSD in this panel.The schema can also be loaded from a file by clicking the Load button or from the ports by clicking the Connected Port Schemas button.

Message Property


Figure 4: Message Details Configuration panel

This panel is used to generate the sample message which has to be sent by the Timer service configuration . If you configure to send the message in the XML format, then you can create a sample by clicking the Generate Sample button.

Functional Demonstration

Scenario

The figure below illustrates the event process where Timer microservice sends messages on to the corresponding output ports when the timer clicks.

Configure the Timer as described in the Configuration section to send messages to its Output Ports after the microservice launch. Three display microservices are connected to output ports to receive the sample output.


Figure 5: Sample Event process using Timer

Timer0 is configured to send two XML messages  after every 10 seconds. Messages will be sent to display from the output port to the Display3 microservice.


Figure 6: Output
 sample when Message type is XML

Timer1 is configured to send two Plain Text messages after every 10 seconds. Messages will be sent from the output port to the Display2 microservice.


Figure 7: Output sample when Message type is Plain Text

Adaptavist ThemeBuilder EngineAtlassian Confluence