Go-based plugins, kong.ctx.shared and consumers

I’ve been looking into Go-based custom plugins to work around some concurrency issues we’ve seen with Lua and some of its SQL Server bindings when dealing with connectivity issues. As these plugins are for interaction with legacy authentication systems in use at my company, they are going to interact with shared request state and, potentially, Kong consumers.

My imagination is that there is an analogue in the Kong Go PDK to kong.client.authenticate in order to set the Kong consumer for a request, but is there an analogue to kong.ctx.shared within the Kong Go PDK for setting shared state for a request, state that interacts with usage of kong.ctx.shared from Lua? We currently use the shared context for a few different bits of functionality, including logging, and I’m just wondering if said shared context is something we could rely upon if we had mixed Go and Lua plugins.

Thanks!

Yes, we plan to include kong.ctx.shared support in the Go PDK, but the specifics of the API of the final version are still under development.

1 Like