I am trying, in the line of google.golang.org/grpc/reflection to marshall a protoreflect.MessageDescriptor. The idea is to have a server serving protoreflect.MessageDescriptor to a client.
The client would use the protoreflect.MessageDescriptor with dynamicpb.NewMessage to instanciate protobuf messages.
I am not able to marshal protoreflect.MessageDescriptor because it does not implement ProtoReflect(). It does not seem to be possible to marshall it and "send" it on the wire.
Anyone has tried that already? Am I trying to do something forbidden by design in the go implementation of GRPC?
I believe you want to be using DescriptorProto in your protocol, not a protoreflect.MessageDescriptor. There are conversion functions in the protodesc package like: https://pkg.go.dev/google.golang.org/protobuf/reflect/protodesc#ToDescriptorProto
Related
I have one project in aws lambda in Golang.
There we are using aws-api-gateway to accept rest api.
I wanted to sort the xml payload based on element coming from the user side.
But the problem is unmarshalling the xml payload is not allowed.
I see somewhere that I can use xslt processor to sort the xml. But I’m unable to use this go package(github.com/wamuir/go-xslt) as it requires me to install some extra packages which is not in go. And our platform-team will not allowed it.
Is there any other go package that I can use.
I'm trying to use utls.HelloChrome_Auto from https://github.com/refraction-networking/utls. In the documentation it says to use the tlsConnection from uTLS, however i can't seem to figure out where it'd fit with the net/http library.
Is there any way to handle application/stream+json content with the old fashioned RestTemplate the way webClient does?
As far as my attempts go, wrapping the results of something like restTemplate.getForEntity in Flux.just(<convert response entity to mono here>) would just return the first element and stop at that, while webClient handles it properly, populating that resulting json with new entries as they appear. Haven't tried working with inputStream yet, but at first glance it doesn't seem to be what i need, despite having a "stream" in its name.
Unfortunately, using webClient would be a rather costly option in this case (still waiting for https://github.com/spring-projects/spring-security/issues/4921). I'd rather implement things that would "soon" appear officially only if there's absolutely no other way.
RestTemplate is exposing an API which is not meant to be used to stream the HTTP response. The underlying HTTP response is read and closed after each call, whereas the "application/stream+json" media type is meant for streaming responses.
I don't see any way to properly handle this use case (reading streaming responses) with RestTemplate, by design (check out SPR-14882 for another example of that). So you'll probably have to wait for that issue to be resolved or use another HTTP client with such features.
Using protobuf I am able to serialize data. I need to send this serialzed packet to different location. As I know I need protobuf again to de-serialize the data.
Is there a way in which we can de-serialize data without using full protobuf library or maybe a minimum version of protobuf.
TIA...
Once you have generated the serialization and deserialization code you don't need the protoBuff library. The ParseFromIstream() method is all you need.
From what I've read you never actually import Protobuf, you just run it to generate code that is dropped into the project. The generated code does not require the program that generated it.
How can I view the raw XML or Json response when doing a search for users using the LinqToTwitter library? I'm using the SingleUserAuthorizer for oAuth.
If you have any ideas using other libraries or even a simple oAuth framework, I'm open to suggestions.
Thanks.
TwitterContext has a RawResults property you can use.
If this is just for debugging purposes, I'd use Wireshark or Fiddler - that way you get to see the complete HTTP requests/responses.