How to manage middleware state in custom plugin

Hello,

My team has a gRPC sidecar for the Tyk GW to create custom plugin written in Java.

We would need to pass information along the middleware chain, we can call this managing state.
My question is that how exactly could we achieve this?

When I look inside CoprocessObject.Object it has a metadata map, but that is immutable, so I haven’t found a way to put extra information in there. I think modifying the request e.g., adding temporary headers would be a bit strange, but I can hardly think of any other way.

I hope there is a supported way to achieve this.

Thanks in advance,
Peter

@ppesti thank you for your question, welcome to the community :tada:

I think modifying the request e.g., adding temporary headers would be a bit strange, but I can hardly think of any other way

Looks like that will be the only way :thinking:

The metadata map will be populated with session metadata , if you were curious.
i.e from the key, if the API is authenticated.

Hey @Ubong,
Thanks for the insight!