You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
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 theclientID
,guid
andsubject
. Then ifpayload
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.The text was updated successfully, but these errors were encountered: