plugin_main.goの作成

EdgeStreaming Pluginは、単体の実行モジュールとして作成されます。

そのためmain関数を実装する必要があります。

 

  1. externalフォルダ直下に、plugin_main.goファイルを作成し、以下のように定義します。

    package main
    
    import (
        "os" 
    
        // 作成したプラグインのパッケージをインポート 
        "github.com/saison-sherpa/es-agent/external/plugin"
        _ "github.com/saison-sherpa/es-agent/sample/plugin"
    )
    
    func main() {
        if err := plugin.NewServer().ListenAndServe(); err != nil {
            os.Exit(1)
        }
    }
    

     

    = 備考 =

    plugin_main.goは、インポートするプラグインのパッケージ以外は、常に同じ実装です。

     

以上で、実行環境の実装が完了しました。

 

実行環境のPluginの実装の詳細は、以下を参照してください。

http://docs.sensorbee.io/en/latest/server_programming.html