TIBCOSoftware / flogo-cli

Project Flogo Command Line Interface
http://flogo.io
BSD 3-Clause "New" or "Revised" License
57 stars 28 forks source link

flogogen trigger creates template with deprecated interface #91

Closed ayh20 closed 6 years ago

ayh20 commented 6 years ago

flogogen trigger test will create template code that has:

trigger.go // Init implements trigger.Trigger.Init func (t *udpTrigger) Init(runner action.Runner) { t.runner = runner } rather than Initialize

trigger_test.go

runner := &TestRunner{}
tgr.Init(runner)

is Init correct ?

mellistibco commented 6 years ago

Thanks @ayh20. You are correct, Init() is deprecated, per the interfaces. We should implement Initialize()

type Trigger interface {
    util.Managed

    // Metadata returns the metadata of the trigger
    Metadata() *Metadata

    // Init sets up the trigger, it is called before Start()
    //DEPRECATED
    Init(actionRunner action.Runner)
}

// Init interface should be implemented by all Triggers, the Initialize method
// will eventually move up to Trigger to replace the deprecated "Init" method
type Init interface {

    // Init initialize the Activity for a particular configuration
    Initialize(ctx InitContext) error
}