Closed reidlai closed 4 years ago
@reidlai We do have a cleanup mechanism in our activity and trigger.
Example:
// Stop implements util.Managed.Stop
func (t *Trigger) Stop() error {
return t.server.Stop()
}
func (a *Activity) Cleanup() error {
if a.stmt != nil {
err := a.stmt.Close()
log.RootLogger().Warnf("error cleaning up SQL Query activity: %v", err)
}
log.RootLogger().Tracef("cleaning up SQL Query activity")
return a.db.Close()
}
@reidlai We also have connection management which manages the connections per engine. Take an example here: https://github.com/project-flogo/datastore-contrib/blob/master/mongodb/connection/connection.go
Closing this one.
@reidlai We do have a cleanup mechanism in our activity and trigger.
- Trigger Stop() method which will be called when engine terminates
- Activity Cleanup() method will be called when the engine terminates.
Example:
// Stop implements util.Managed.Stop func (t *Trigger) Stop() error { return t.server.Stop() }
func (a *Activity) Cleanup() error { if a.stmt != nil { err := a.stmt.Close() log.RootLogger().Warnf("error cleaning up SQL Query activity: %v", err) } log.RootLogger().Tracef("cleaning up SQL Query activity") return a.db.Close() }
Thanks a lot... i don't know there is Stop method of trigger. Thanks.
Current behavior:
No Close method in Activity or Trigger interface. Developer has no way to clean up connection of backend service before microservice is terminated.
Expected behavior:
What is the motivation / use case for changing the behavior?
Most of backend service is expected golang developer to implement Close method and use defer statement to make sure all connections will be closed before end of service.
Additional information you deem important (e.g. I need this tomorrow):