You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2020/11/12 08:42:40 UTC

[GitHub] [pulsar] freeznet commented on pull request #8467: [Go functions] access to user config before function loop

freeznet commented on pull request #8467:
URL: https://github.com/apache/pulsar/pull/8467#issuecomment-725931779


   I think to get `userConfigs` by create a new `FunctionContext` is a little bit odd, especially in some scenarios like initialize database connections before go function starts. The reason I think it is odd is that `FunctionContext` is an implementation of request-scoped values that passed with `context.Value`, and the context should only be integrated within the instance of go function. Once we propagate `FunctionContext` outside the go function instance, it will break the design of `context`.
   
   So i suggest we have two ways to get `userConfigs`:
   
   - When go function starts (`pf.Start` called), user can get `userConfigs` with `FromContext(ctx)`, like `contextFunc` defined above. This is just like Java and Python functions and follows the design of context.
   - Before go function starts (before `pf.Start` called), user can get `userConfigs` from `Conf` defined in `conf/conf.go`, with json string -> map. 
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org