Dev focused conversations, questions and discussions around PRs, etc should happen here.
mellistibco on readme-updates
mellistibco on master
Readme updates (#570) * Update… (compare)
mellistibco on readme-updates
Update README.md (compare)
mellistibco on readme-updates
Update README.md (compare)
~/work/repos/flogo/projects:$ flogo plugin install github.com/project-flogo/cli-plugins/devtool
Installing plugin: github.com/project-flogo/cli-plugins/devtool
Error adding plugin: open /home/asd/go/bin/flogo: text file busy
~/go/pkg:$ flogo plugin install github.com/project-flogo/cli-plugins/devtool --verbose
Installing plugin: github.com/project-flogo/cli-plugins/devtool
go: downloading github.com/project-flogo/cli-plugins v0.0.0-20190725132608-2f3a6e16bf7c
go: downloading github.com/project-flogo/cli-plugins/devtool v0.0.0-20190725132608-2f3a6e16bf7c
go get: added github.com/project-flogo/cli-plugins/devtool v0.0.0-20190725132608-2f3a6e16bf7c
Error adding plugin: open /home/asd/go/bin/flogo: text file busy
~/go/pkg:$
╭─samip@samip-mac-0 ~/tdv-vol
╰─$ flogo plugin install github.com/project-flogo/cli-plugins/devtool
Installing plugin: github.com/project-flogo/cli-plugins/devtool
Installed plugin: github.com/project-flogo/cli-plugins/devtool
I would make sure if the GOPATH and GOROOT are properly set.
flogo —version
go env
GO111MODULE="on"
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/mellis/Library/Caches/go-build"
GOENV="/Users/mellis/Library/Application Support/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="/Users/mellis/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/Users/mellis/flogo/cli/go.mod"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/t9/2d315wj12g5f6pw50k0pw5dm0000gp/T/go-build758199665=/tmp/go-build -gno-record-gcc-switches -fno-common”
~/work/repos/edge-sdk:$ go env
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/asd/.cache/go-build"
GOENV="/home/asd/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/home/asd/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/asd/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GOVCS=""
GOVERSION="go1.16.2"
GCCGO="gccgo"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/home/asd/work/repos/edge-sdk/go.mod"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build1497462169=/tmp/go-build -gno-record-gcc-switches"
~/work/repos/edge-sdk:$
~/work/repos/flogo/cli-plugins/devtool:$ flogo plugin install github.com/project-flogo/cli-plugins/devtool --verbose
Installing plugin: github.com/project-flogo/cli-plugins/devtool
# github.com/project-flogo/cli/common
../../common/pluginlist.go:8:2: undefined: pluginPkgs
error:
/home/asd/go/pkg/mod/github.com/spf13/cobra@v0.0.3/bash_completions.go:11:2: no required module provides package github.com/spf13/pflag; to add it:
go get github.com/spf13/pflag
Error adding plugin:
text file busy
error
go get -u github.com/project-flogo/cli/...
and then flogo plugin install github.com/project-flogo/cli-plugins/devtool
cli-plugin
it requires the 0.9 version of cli
Peformance of TCI as development utility - in the past few weeks I have started to notice significant performance degradation while using TCI to edit/review flogo applications. The problem is very sporadic and unpredictable, but sometimes opening a Flogo application hangs for minutes at a time on the ‘open validation' window. Also anytime one renames an activity or property that causes a several ( > 20 ) validation errors, the user experience is less than usable, where every edit operation continually re-evaluates the entire flow and can take 15 - 30 seconds for each keystroke … Should there not be monitoring in flogo to determine if/when the validation process is taking excessive cpu cycles, the auto-validate-the-world feature can be disabled ? many thanks from a flogo fan
Hi @rayhindman_gitlab if you are using TCI, Could you please go-ahead to create a support ticket on this?
Peformance of TCI as development utility - in the past few weeks I have started to notice significant performance degradation while using TCI to edit/review flogo applications. The problem is very sporadic and unpredictable, but sometimes opening a Flogo application hangs for minutes at a time on the ‘open validation' window. Also anytime one renames an activity or property that causes a several ( > 20 ) validation errors, the user experience is less than usable, where every edit operation continually re-evaluates the entire flow and can take 15 - 30 seconds for each keystroke … Should there not be monitoring in flogo to determine if/when the validation process is taking excessive cpu cycles, the auto-validate-the-world feature can be disabled ? many thanks from a flogo fan
Hi @rayhindman_gitlab if you are using TCI, Could you please go-ahead to create a support ticket on this?
Hi @rayhindman_gitlab We are actively looking into this issue, Could you please share more info here.
Thanks.
// app start
func main() {
app := myApp()
e, err := api.NewEngine(app)
if err != nil {
fmt.Println("Error:", err)
return
}
engine.RunEngine(e)
}
type timerStruct struct{}
func myApp() *api.App {
app := api.NewApp()
trg := app.NewTrigger(&Trigger{}, timerStruct{})
h, _ := trg.NewHandler(&HandlerSettings{})
h.NewAction(RunActivities)
//store in map to avoid activity instance recreation
logAct, _ := api.NewActivity(&logg.Activity{})
activities = map[string]activity.Activity{"log": logAct}
return app
}
var activities map[string]activity.Activity
type reply struct {
code int
}
func RunActivities(ctx context.Context, inputs map[string]interface{}) (map[string]interface{}, error) {
fmt.Println("hello fellow !!", inputs)
m := make(map[string]interface{})
m["message"] = "Bonjour"
return m, nil
}
package main
import (
"context"
"fmt"
logg "github.com/project-flogo/contrib/activity/log"
"github.com/project-flogo/core/activity"
"github.com/project-flogo/core/api"
"github.com/project-flogo/core/engine"
"github.com/project-flogo/core/support/log"
"github.com/project-flogo/core/trigger"
"errors"
"github.com/edgexfoundry/app-functions-sdk-go/appcontext"
"github.com/edgexfoundry/app-functions-sdk-go/appsdk"
"github.com/edgexfoundry/app-functions-sdk-go/pkg/transforms"
"os"
)
// trigger starts here
type HandlerSettings struct{}
var triggerMd = trigger.NewMetadata(&HandlerSettings{})
func init() {
_ = trigger.Register(&Trigger{}, &Factory{})
}
type Factory struct{}
// Metadata implements trigger.Factory.Metadata
func (*Factory) Metadata() *trigger.Metadata {
return triggerMd
}
// New implements trigger.Factory.New
func (*Factory) New(config *trigger.Config) (trigger.Trigger, error) {
return &Trigger{}, nil
}
type Trigger struct {
logger log.Logger
handlers []trigger.Handler
}
// Init implements trigger.Init
func (t *Trigger) Initialize(ctx trigger.InitContext) error {
t.logger = ctx.Logger()
t.handlers = ctx.GetHandlers()
return nil
}
// Start implements ext.Trigger.Start
func (t *Trigger) Start() error {
fmt.Println("flogo trigger just started")
//Assume you just have one handler.
go edgexEventCatcher(t.handlers[0])
return nil
}
// Stop implements ext.Trigger.Stop
func (t *Trigger) Stop() error {
fmt.Println("flogo trigger stopped")
return nil
}
type callHandler struct {
handler trigger.Handler
}
// edgex
func edgexEventCatcher(handler trigger.Handler) {
// turn off secure mode for examples. Not recommended for production
os.Setenv("EDGEX_SECURITY_SECRET_STORE", "false")
// 1) First thing to do is to create an instance of the EdgeX SDK, giving it a service key
edgexSdk := &appsdk.AppFunctionsSDK{ServiceKey: "sampleFilterJSON"}
// 2) Next, we need to initialize the SDK
if err := edgexSdk.Initialize(); err != nil {
edgexSdk.LoggingClient.Error(fmt.Sprintf("SDK initialization failed: %v\n", err))
os.Exit(-1)
}
// 3) Shows how to access the application's specific configuration settings.
deviceNames, err := edgexSdk.GetAppSettingStrings("DeviceNames")
if err != nil {
edgexSdk.LoggingClient.Error(err.Error())
os.Exit(-1)
}
edgexSdk.LoggingClient.Info(fmt.Sprintf("Filtering for devices &v", deviceNames))
// 4) This is our pipeline configuration, the collection of functions to
// execute every time an event is triggered.
callHandler := &callHandler{handler: handler}
if err = edgexSdk.SetFunctionsPipeline(
transforms.NewFilter(deviceNames).FilterByDeviceName,
transforms.NewConversion().TransformToJSON,
callHandler.printXMLToConsole,
); err != nil {
edgexSdk.LoggingClient.Error(fmt.Sprintf("SDK SetPipeline failed: %v\n", err))
os.Exit(-1)
}
// 5) Lastly, we'll go ahead and tell the SDK to "start" and begin listening for events to trigger the pipeline.
err = edgexSdk.MakeItRun()
if err != nil {
edgexSdk.LoggingClient.Error("MakeItRun returned error: ", err.Error())
os.Exit(-1)
}
os.Exit(0)
}
func (c *callHandler) printXMLToConsole(edgexcontext *appcontext.Context, params ...interface{}) (bool, interface{}) {
if len(params) < 1 {
// We didn't receive a result
return false, errors.New("No Data Received")
}
println(params[0].(string))
// Leverage the built in logging service in EdgeX
edgexcontext.LoggingClient.Debug("JSON printed to console")
//Here go and call flows, and data goes to flow
triggerData := map[string]interface{}{}
triggerData["jsonData"] = params
results, err := c.handler.Handle(context.Background(), triggerData)
//You can handle returned result and possible error.
println(err)
println(results)
return true, nil
}