Open aloneguid opened 6 years ago
I am interested as well. I want to write a generic piece of code for adding custom headers and with this feature I can just iterate the custom headers. Any news on this? Should we create a PR?
@amanbha
@aloneguid Could you explain more on your usecase for enumerating headers instead of using GetHeader Api?
@Expecho Here is sample on how to add custom headers . https://github.com/amanbha/servicefabric/blob/master/samples/ServiceCustomMessageHandler/Stateless1/CustomMessageHandler.cs
@suchiagicha I know how to add them, that is not the problem.
But at runtime headers are added, and I need to read them. It is not a fixed set of headers and not known on beforehand how they are named. See here for an example of how headers are added and here how I now have to read them.
Or take a look at the docs.
@Expecho I glanced at your code, you should not create ServiceProxyFactory for every proxy. You should cache it. Its an expensive object.
Second, you could make your CustomHeader class serializable and add that in SF headers. Header can be anything . It doesnt needs to be a string. Since it accept value as byte[]. This way you don't need to rely on our internal headers implementation.
@suchiagicha thank you for your time and effort. I suppose using a serializable answer is the best solution in this case.
So, there is no way to iterate headers yet?
I'm not quite sure why this interface doesn't expose a way to enumerate headers, this is something obvious I need to do:
Service Fabric default implementation uses a dictionary internally, therefore we should be able to expose it? Decompiled code: