Services
Last updated
Last updated
Linx Services are similar in concept to Windows Services or Daemons. They are code that is loaded and kept running by the Linx Server and communicates with Linx through Events. The steps to implement a Service are:
Use Linx Designer to develop a solution that contains a Linx Service and reacts to its Events. At this point, you have a design but nothing is running.
Deploy the solution to a Linx Server and start the Linx Service. Now the Service is loaded by the Linx Server and triggers events, which in turn do 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.
This example explains how to write to a file every 10 seconds to illustrate how the Timer Service can be used:
Drag the Timer Service from the Utilities plugin onto the Solution Explorer panel.
Set the “Run every” property to 10 seconds.
Install the File plugin and add the TextFileWrite function to the TimerEvent.
Set the File path property.
Set the Contents property to $.Parameters.Data
. This is the data that the Event passes to Linx, which in this case is the date and time that the event fires.
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.
Go for a list of available services.