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


   @wolfstudy @flowchartsman
   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:
us...@infra.apache.org


Reply via email to