Skip to main content

Plugin-side implementation

CgiRemoteControl.exe is the execution trigger that starts plugin processing from the command line; the actual processing is implemented and executed on the plugin side. Therefore, on the plugin side, implement the IEventListener interface to handle events.

  • Set the EventsToSubscribe property to include EventId.PluginControlCommand. If this is not set, OnPluginControl will not be called.
  • The OnPluginControl method processes the received command string and returns a status code indicating success or failure.
  • If OnPluginControl returns a non‑zero value, subsequent calls to OnPluginControl in other plugins will not occur.

This design ensures that when the --PlugInControl argument is specified, the plugin is invoked correctly.

See the Sample Implementation Guide for step-by-step instructions and the complete source code.

Implementation Example:
public class SamplePlugin : IEventListener
{
    // Subscribe to specific events by implementing this property
    public virtual EventId EventsToSubscribe
    {
        get { return EventId.PluginControlCommand; }
    }

    // Implement the OnPluginControl method to handle the plugin command
    public int OnPluginControl(string command)
    {
        //this.LoggerSvc.Info(DateTime.Now + ":test log start"); // Info: 1/17/2025 11:13:01 AM:test log start
        //Console.WriteLine($"Received command: {command}");     // Received command: BuildHost 4711
        // Perform actions based on the command
        return 0; // Return an appropriate status code
    }
}