Skip to end of metadata
Go to start of metadata

In Progress

Icon
  • This article applies to JobScheduler releases from 1.11.4 JS-1634 - JobScheduler Agent supports jobs and monitors implemented with .NET C# language Released

Creating JobScheduler API Jobs using .NET

In addition to the programming languages natively supported by the JobScheduler API, JobScheduler can call .NET Objects with access on its API.

JobScheduler .NET API

The JobScheduler .NET API dlls are included in the lib\sos\com.sos-berlin.jobscheduler.engine.engine-taskserver-dotnet-<version>.jar file of a JobScheduler Windows Agent installation.

Extract lib\sos\com.sos-berlin.jobscheduler.engine.engine-taskserver-dotnet-<version>.jar to any location and find two dll files in the com\sos\scheduler\engine\taskserver\dotnet\dlls subdirectory:

  • com.sos-berlin.engine.engine-job-api-dotnet.dll
  • jni4net.n-0.8.8.0.dll

.

Setting up a project in Visual Studio

  • Create a new project of type "Class Library"
  • Choose .NET Framework 4
  • Add References:
    • Add Reference com.sos-berlin.engine.engine-job-api-dotnet.dll
    • Add Reference jni4net.n-0.8.8.0.dll
  • Create a Class to implement a JobScheduler job or a JobScheduler monitor

Job API

Implementing the job

JobScheduler will later try to find the .NET class as "namespace.classname".

Code for a simple c# job:

SampleJob

 

Running the job

In JobScheduler the job for the above example is configured as follows:

SampleJob

Monitor API

Implementing the monitor

JobScheduler will later try to find the .NET class as "namespace.classname".

Code for a simple c# monitor:

SampleMonitor

Running the monitor

In JobScheduler the monitor for the above example is configured as follows:

SampleMonitor

C# compiling on Windows without Visual Studio

For the both JobScheduler versions (x86 and x64) both .NET Framework x86 and .NET Framework x64 (see WINDOWS_NET_SDK_HOME below) can be used for compilation.

csharp_compilation.cmd

 

Samples

Download and extract JobSchedulerSamples.NET.zip

  • Copy dlls folder to the agent working directory (agent_home)
    • Unblock if necessary a downloaded dlls/JobSchedulerSamples.dll file to avoid security warnings. To unblock a file:
      • right-click it in Windows Explorer
      • choose Properties from the context menu
      • click the Unblock button in the lower right-hand corner of the resulting dialog
      • hit OK or Apply
  • Copy dotnet_samples folder to the master live directory (config/live)
    • Configure agent url in the agent.process_class.xml
  • Run samples