avro-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Marcelo Elias Del Valle <mvall...@gmail.com>
Subject problems with python RPC
Date Wed, 10 Sep 2014 17:27:01 GMT
Hi,

I am new to avro and I am trying to use it for RPC calls from Python to
Python.

I follow the same structure shown in
https://github.com/phunt/avro-rpc-quickstart/blob/master/src/main/python/

When my message returns just a string, everything works fine.
However, when it should return a list of a complex type, it gives me a
weird exception with no clue of where the error could be. I used the exact
same structure shown in the github project above.

What could I do to get more info about the error? Any clue of what could I
be doing wrong?

My code
def invoke(self, msg, req):
        result = []
        return (result)

The exception:
Traceback (most recent call last):
  File "./client.py", line 47, in <module>
    result = perform_call("list_categories", params)
  File "./client.py", line 33, in perform_call
    result = requestor.request(message, args)
  File "/home/mvalle/pyve01/local/lib/python2.7/site-packages/avro/ipc.py",
line 145, in request
    return self.issue_request(call_request, message_name, request_datum)
  File "/home/mvalle/pyve01/local/lib/python2.7/site-packages/avro/ipc.py",
line 262, in issue_request
    return self.read_call_response(message_name, buffer_decoder)
  File "/home/mvalle/pyve01/local/lib/python2.7/site-packages/avro/ipc.py",
line 238, in read_call_response
    return self.read_response(writers_schema, readers_schema, decoder)
  File "/home/mvalle/pyve01/local/lib/python2.7/site-packages/avro/ipc.py",
line 246, in read_response
    result = datum_reader.read(decoder)
  File "/home/mvalle/pyve01/local/lib/python2.7/site-packages/avro/io.py",
line 445, in read
    return self.read_data(self.writers_schema, self.readers_schema, decoder)
  File "/home/mvalle/pyve01/local/lib/python2.7/site-packages/avro/io.py",
line 488, in read_data
    return self.read_union(writers_schema, readers_schema, decoder)
  File "/home/mvalle/pyve01/local/lib/python2.7/site-packages/avro/io.py",
line 646, in read_union
    index_of_schema = int(decoder.read_long())
  File "/home/mvalle/pyve01/local/lib/python2.7/site-packages/avro/io.py",
line 184, in read_long
    b = ord(self.read(1))
TypeError: ord() expected a character, but string of length 0 found


My protocol definition:

{
   "protocol":"s1mbi0se",
   "namespace":"modules.service_bus",
   "messages":{
      "list_categories":{
         "request":[
            {
               "type":"string",
               "name":"prefix"
            },
            {
               "type":"string",
               "name":"type"
            }
         ],
         "response":[
            {
               "type":"Category",
               "name":"category"
            }
         ]
      }
   },
   "types":[
      {
         "fields":[
            {
               "type":"string",
               "name":"tos"
            },
            {
               "type":"string",
               "name":"froms"
            },
            {
               "type":"string",
               "name":"bodys"
            }
         ],
         "type":"record",
         "name":"Category"
      }
   ]
}

Best regards,
-- 
Marcelo Elias Del Valle
http://mvalle.com - @mvallebr

Mime
View raw message