Module Thrift::Client
In: ruby/lib/thrift/client.rb

Methods

Public Class methods

[Source]

    # File ruby/lib/thrift/client.rb, line 22
22:     def initialize(iprot, oprot=nil)
23:       @iprot = iprot
24:       @oprot = oprot || iprot
25:       @seqid = 0
26:     end

Public Instance methods

[Source]

    # File ruby/lib/thrift/client.rb, line 53
53:     def handle_exception(mtype)
54:       if mtype == MessageTypes::EXCEPTION
55:         x = ApplicationException.new
56:         x.read(@iprot)
57:         @iprot.read_message_end
58:         raise x
59:       end
60:     end

[Source]

    # File ruby/lib/thrift/client.rb, line 44
44:     def receive_message(result_klass)
45:       fname, mtype, rseqid = @iprot.read_message_begin
46:       handle_exception(mtype)
47:       result = result_klass.new
48:       result.read(@iprot)
49:       @iprot.read_message_end
50:       result
51:     end

[Source]

    # File ruby/lib/thrift/client.rb, line 28
28:     def send_message(name, args_class, args = {})
29:       @oprot.write_message_begin(name, MessageTypes::CALL, @seqid)
30:       data = args_class.new
31:       args.each do |k, v|
32:         data.send("#{k.to_s}=", v)
33:       end
34:       begin
35:         data.write(@oprot)
36:       rescue StandardError => e
37:         @oprot.trans.close
38:         raise e
39:       end
40:       @oprot.write_message_end
41:       @oprot.trans.flush
42:     end

[Validate]