Skip to content
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

How to handle max_payload limit? #31

Open
jkrcma opened this issue May 30, 2019 · 1 comment
Open

How to handle max_payload limit? #31

jkrcma opened this issue May 30, 2019 · 1 comment

Comments

@jkrcma
Copy link

jkrcma commented May 30, 2019

I've been trying to code my app so it can react to various max_payload sizes provided by NATS server properly, including a rewrite from text-based content to a simple binary one with fixed byte-lengths. But then I found out that STAN implements certain message structures on top of NATS protocol using protobuf and that protobuf isn't fixed in the byte-length. So basically I can't determine the exact message length I can send through the client because I don't know how large the protobuf overhead is.

One of the ideas which got in my mind was to patch the publish method so it will create the protobuf structure first, filling the clientID, guid and subject. Then if payload is a callback calling it and passing the structure into it so my code can dynamically generate a part of payload inside with the exact byte-length.

The other idea is maybe cleaner and consists of separating the protobuf structure instantiation into a separate factory method, allowing publish to accept the object directly.

What do you think about it? Or do you have any other ideas? I don't want to avoid the problem by setting the max_payload server-side to any unreal number or doing any wibbly wobbly bisection aka do ... while raises exception.

@gavrilyuc
Copy link

up

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants