Name

Add-JobSchedulerEvent

SYNOPSIS

Adds an event to a JobScheduler instance.

SYNTAX

Add-JobSchedulerEvent [[-EventClass] <String>] [-EventId] <String> [[-ExitCode] <Int32>] [[-AllowedExitCodes] <Int32[]>] [[-Job] <String>] [[-JobChain] <String>] [[-Order] <String>] [[-MasterUrl] <Uri>] [[-SupervisorJobChain] <String>] [[-ExpirationDate] <DateTime>] [[-ExpirationCycle] <String>] [[-ExpirationPeriod] <String>] [[-Timezone] <TimeZoneInfo>] [-NoExpiration] [[-Parameters] <Hashtable>] [<CommonParameters>]

DESCRIPTION

Events can be added to a JobScheduler Master or Supervisor instance that implements event handling.

Should the JobScheduler Master or Supervisor not be accessible then events are stored in
the local file %TEMP%\jobscheduler_events.xml for later dequeueing. Subsequent calls to this
cmdlet will dequeue any previously stored events.

PARAMETERS

EventClass

-EventClass <String>
Specifies a common name for a set of events that enable event handlers to process multiple events of the
same class. For example, "daily_closing" could be an event class for jobs that should start once day-time
business processes have drawn to a close.

Specifies a unique identifier when used together with the -EventId parameter.

Required?false
Position?1
Default value
Accept pipeline input?true (ByPropertyName)
Accept wildcard characters?false

EventId

-EventId <String>
An identifier for an event. Allows event handlers to react to events having a particular ID.

Specifies a unique identifier when used together with the -EventClass parameter. An event id is required to be unique
for the same event class.

Required?true
Position?2
Default value
Accept pipeline input?true (ByPropertyName)
Accept wildcard characters?false

ExitCode

-ExitCode <Int32>
Specifies the exit code that is added to the event. Usually this signals the execution status of a job,
however, you can assign a specific numeric exit code.

Without this parameter being used the $LastExitCode is implicitely assumed, i.e. the last exit code
that was provided from a command or program.

Consider that exit codes other than 0 signal failed execution. You can specify allowed exit codes
with the -AllowedExitCodes parameter.

Default: last script exit code or failed execution of previous command.

Required?false
Position?3
Default value0
Accept pipeline input?true (ByPropertyName)
Accept wildcard characters?false

AllowedExitCodes

-AllowedExitCodes <Int32[]>
Specifies a list of exit codes that signal that a job is considered as having run successfully.
This is useful if job scripts provide return values in the form of exit codes and these codes
should not be considered as errors. When adding an event then any exit codes that match one of the
allowed exit codes are set to 0.

A range of allowed exit codes is specified by e.g -AllowedExitCodes 1..4 or -AllowedExitCodes 1,2,3,4.

Required?false
Position?4
Default value
Accept pipeline input?true (ByPropertyName)
Accept wildcard characters?false

Job

-Job <String>
Specifies the name of the job that is assigned to the event.

Default: the current job name if the cmdlet is used by a job.

Required?false
Position?5
Default value
Accept pipeline input?true (ByPropertyName)
Accept wildcard characters?false

JobChain

-JobChain <String>
Specifies the name of the job chain that is assigned to the event.

Default: the current job chain name if the cmdlet is used by a job chain.

Required?false
Position?6
Default value
Accept pipeline input?true (ByPropertyName)
Accept wildcard characters?false

Order

-Order <String>
Specifies the identifier of the order assigned to the event.

Default: the current order identification (order id) if the cmdlet is used by a job chain.

Required?false
Position?7
Default value
Accept pipeline input?true (ByPropertyName)
Accept wildcard characters?false

MasterUrl

-MasterUrl <Uri>
Specifies the Job Scheduler Master instance URL.

The URL consists of the protocol, host name and port, e.g. http://localhost:4454.

Default: If used with a job then the CLI will assign by default the JobScheduler Master that the job is running for
otherwise the JobScheduler Master as specified with the Use-JobSchedulerMaster cmdlet will be used.

Required?false
Position?8
Default value
Accept pipeline input?true (ByPropertyName)
Accept wildcard characters?false

SupervisorJobChain

-SupervisorJobChain <String>
Specifies the path of the job chain in the JobScheduler Master or Supervisor instance that implements the event
processor.

Default: /sos/events/scheduler_event_service

Required?false
Position?9
Default value/sos/events/scheduler_event_service
Accept pipeline input?true (ByPropertyName)
Accept wildcard characters?false

ExpirationDate

-ExpirationDate <DateTime>
Specifies the point in time for which an event automatically expires: this parameter is considered by the
Event Processor. Should no expiration be considered then use of the -NoExpiration parameter is recommended.

The parameters -ExpirationDate, -ExpirationCycle, -ExpirationPeriod, -NoExpiration may not be used at the same time.

Default: midnight on the following day in the UTC time zone.

Required?false
Position?10
Default value
Accept pipeline input?true (ByPropertyName)
Accept wildcard characters?false

ExpirationCycle

-ExpirationCycle <String>
Specifies the time for which the event will expire in the current period.
Periods start at 00:00 and end at 24:00. An expiration cycle of 21:00
specifies 9pm of the current cycle for event expiration.

The time zone specified with the -Timezone parameter is applied to the value
of the expiration cycle.

Values are specified by use of the format HH:mm:ss.

The parameters -ExpirationDate, -ExpirationCycle, -ExpirationPeriod, -NoExpiration may not be used at the same time.

Required?false
Position?11
Default value
Accept pipeline input?true (ByPropertyName)
Accept wildcard characters?false

ExpirationPeriod

-ExpirationPeriod <String>
Specifies the duration after which the event will expire in the current period.
Periods start at 00:00 and end at 24:00. An expiration period of 04:00
specifies that the event will expire 4 hours starting from the current point in time.

Values are specified by use of the format HH:mm:ss.

The parameters -ExpirationDate, -ExpirationCycle, -ExpirationPeriod, -NoExpiration may not be used at the same time.

Required?false
Position?12
Default value
Accept pipeline input?true (ByPropertyName)
Accept wildcard characters?false

Timezone

-Timezone <TimeZoneInfo>
Specifies the time zone that is applied to the -ExpirationCycle parameter.
This parameter is not used for the -ExpirationDate parameter that implicitly specifies its time zone.

A time zone can e.g. be specified like this:

Add-JobSchedulerEvent -ExpirationCycle 04:00 -Timezone (Get-Timezone -Id 'GMT Standard Time') ...

Default: The value of the -ExpirationCycle parameters is considered for the UTC time zone.

Required?false
Position?13
Default value(Get-Timezone -Id 'UTC')
Accept pipeline input?true (ByPropertyName)
Accept wildcard characters?false

NoExpiration

-NoExpiration <SwitchParameter>
Specifies that an event will not expire. Such events have to be removed by event action scripts.

Required?false
Position?named
Default valueFalse
Accept pipeline input?true (ByPropertyName)
Accept wildcard characters?false

Parameters

-Parameters <Hashtable>
Allows additional parameters for event handlers to be specified. Parameters are created using name-value
pairs from a hashmap as e.g. @{'name1'='value1'; 'name2'='value2'}.

Parameter names can be freely chosen and event handlers configured to
take account of values handed over. Any number of parameters can be added.

Required?false
Position?14
Default value
Accept pipeline input?true (ByPropertyName)
Accept wildcard characters?false

about_JobScheduler

EXAMPLES

-------------------------- EXAMPLE 1 --------------------------

PS > Add-JobSchedulerEvent -EventClass daily_closing -EventId 12345678

Creates an event with the specified event class and event id.

-------------------------- EXAMPLE 2 --------------------------

PS > Add-JobSchedulerEvent -EventClass daily_closing -EventId 12345678 -AllowedExitCodes @(1..4)

Creates an event with the specified event class and event id. The exit code is implicitely added from the global $LastExitCode value. Should the exit code be contained in the list of allowed exit codes then its value is set to 0.

-------------------------- EXAMPLE 3 --------------------------

PS > Add-JobSchedulerEvent -EventClass daily_closing -EventId 12345678 -ExpirationPeriod 04:00

Creates an event that will expire 4 hrs. from now.

-------------------------- EXAMPLE 4 --------------------------

PS > Add-JobSchedulerEvent -EventClass daily_closing -EventId 12345678 -ExpirationCycle 21:00

Creates an event that will expire at 9pm of the current day.

-------------------------- EXAMPLE 5 --------------------------

PS > Add-JobSchedulerEvent -EventClass daily_closing -EventId 12345678 -ExpirationDate (Get-Date).AddDays(2)

Creates an event that will expire two days later.

-------------------------- EXAMPLE 6 --------------------------

PS > Add-JobSchedulerEvent -EventClass daily_closing -EventId 12345678 -Parameters @{'name1'='value1'; 'name2'='value2'}

Creates an event with two additional parameters from a hashtable.

  • No labels