-
Notifications
You must be signed in to change notification settings - Fork 95
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Supporting gob stream encoder? #636
Comments
I have considered it - but there is an infinite amount of options so seems like a losing battle so it supports emitting the data raw (no decorations or metadata) and you should be able to pipe or to other, encoding specific, tools or use things like xargs. If anything rather than a long series of supported encoding formats I am more likely to add the ability to pass each message through an external binary for deciding before rendering so it can support anything. |
I see, and I also thought about piping it through some decoder (and would implement one right away). Still, using b64 / hex seems like an easy way to support everything for a quick "copy & paste" or in the case of hex even for reading it "natively". While "gob" is one of the NATS supported internal decoders (at least I am coming right from an example that shows its usage). I have no insights, but it feels like a practical option for encoding when staying in the Go language domain for clients and services.
Furthermore, the current implementation just spills everything into the terminal, even if you do not use |
Yeah it’s certainly not ideal at present with binary data (though iirc I do base64 it? Might remeber wrong) hex and base64 decoders at the least would be good. But I would need to be carefully to detect if the output is not a terminal to enable that behaviour since it will almost certainly be binary data then |
I wonder if some people already rely on it being binary in the non |
This is what I currently get using json and gob encoder: $ nats sub "hello"
21:37:41 Subscribing on hello
[#1] Received on "hello"
{"Name":"derek","Address":"140 New Montgomery Street, San Francisco, CA","Age":22}
[#2] Received on "hello"
1��person��Name
Address
Age:��derek,140 New Montgomery Street, San Francisco, CA,
|
Ah yes, nats sub just dumps what it finds, its pretty low level on purpose. will give it some thought, for sure dumping binary to stdout is bad news |
Closing this since we have the translation feature |
I consider using some kind of gob encoding for the payload (see
GOB_ENCODER
) and think that it would be nice to have something likenats sub --gob gobsubject
which then dumps the result in some more readable way. I also wonder if there should be a--hex
or--b64
flag to output the data as hex or base64 encoded data. This probably would help when debugging something which is not using JSON or the default encoder. As these tools are really cool, I wonder it this was considered before and what the state is for that.The text was updated successfully, but these errors were encountered: