PROTON-736: Ruby Message does not return all content. The content method was not expanding the return size of the data to accomodate large payloads.
Project: http://git-wip-us.apache.org/repos/asf/qpid-proton/repo Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton/commit/24cda63f Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton/tree/24cda63f Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton/diff/24cda63f Branch: refs/heads/examples Commit: 24cda63f0399c0f8fc9b091d35226340a8fdd737 Parents: cce4247 Author: Darryl L. Pierce <mcpie...@gmail.com> Authored: Tue Nov 4 10:24:26 2014 -0500 Committer: Darryl L. Pierce <mcpie...@apache.org> Committed: Thu Nov 6 13:05:03 2014 -0500 ---------------------------------------------------------------------- .../bindings/ruby/lib/qpid_proton/message.rb | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/24cda63f/proton-c/bindings/ruby/lib/qpid_proton/message.rb ---------------------------------------------------------------------- diff --git a/proton-c/bindings/ruby/lib/qpid_proton/message.rb b/proton-c/bindings/ruby/lib/qpid_proton/message.rb index 6cc7c24..d840299 100644 --- a/proton-c/bindings/ruby/lib/qpid_proton/message.rb +++ b/proton-c/bindings/ruby/lib/qpid_proton/message.rb @@ -405,6 +405,9 @@ module Qpid # Sets the message content. # + # *WARNING:* This method has been deprecated. Please use #body= instead to + # set the content of a message. + # # ==== Options # # * content - the content @@ -415,8 +418,22 @@ module Qpid # Returns the message content. # + # *WARNING:* This method has been deprecated. Please use #body instead to + # retrieve the content of a message. + # def content - Cproton.pn_message_save(@impl, 1024)[1] + size = 16 + loop do + result = Cproton.pn_message_save(@impl, size) + error = result[0] + data = result[1] + if error == Qpid::Proton::Error::OVERFLOW + size = size * 2 + else + check(error) + return data + end + end end # Sets the content encoding type. --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@qpid.apache.org For additional commands, e-mail: commits-h...@qpid.apache.org