Services

Linx Services are similar in concept to Windows Services or Daemons. It is code that is loaded and kept running by the Linx Server and communicates with Linx through Events. The steps to implement a Service are:

  1. Use Linx Designer to develop a solution which contains a Linx Service and reacts to its Events. At this point you have a design but nothing is running.
  2. Deploy the solution to a Linx Server and start the Linx Service. Now the Service is loaded by the Linx Server and triggering events which in turn does whatever you told it to do.

Examples of Linx Services are:

  • Timer: Fires a TimerEvent at specified times.
  • RESTHost: Fires events when its endpoints are called by clients.

Using a Linx Service

This example explains how to write to a file every 10 seconds to illustrate how the Timer Service can be used.

  1. Drag the Timer Service from the Utilities plugin onto your project.
  2. Set the “Run every” property to 10 seconds.
  3. Install the File plugin and add the TextFileWrite function to the TimerEvent.
  4. Set the File path property.
  5. Set the Contents property to $.Parameters.Data. It is the data that the Event passes to Linx. In this case the date and time that the event fires.
  6. Select Timer in the Solution Explorer and click DEBUG to start the Timer Service.

You will see the events firing in the Debug Output panel. You can also select the TimerEvent and click DEBUG to run the event once. Debugging an event works just like debugging a Function.

services

Tutorial video



Previous | Next