Avro
  1. Avro
  2. AVRO-1029

I want to transfer files beetwin server and client by Avro-c.

    Details

    • Type: Test Test
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: 1.5.4
    • Fix Version/s: None
    • Component/s: c
    • Labels:
    • Environment:

      avro in C, linux in vmware.

    • Tags:
      Client by avro-c

      Description

      I want to transfer files beetwin server and client by Avro-c. I know that there must be two parts in this model, the server and the client. My question is how to make the connection? Please forgive me as this maybe a simle question, But I'm fresh in Avro, your simple worlds maybe helpful for me. If only there is an example for it.

        Activity

        Doug Cutting made changes -
        Fix Version/s 1.5.4 [ 12317878 ]
        Hide
        menghaocheng added a comment -

        In the function "add_person()" in example/quicstop.c, after executing the following code:

        if (avro_record_set(person, "ID", id_datum)

        avro_record_set(person, "First", first_datum)
        avro_record_set(person, "Last", last_datum)
        avro_record_set(person, "Age", age_datum)
        avro_record_set(person, "Phone", phone_datum)) { fprintf(stderr, "Unable to create Person datum structure\n"); exit(EXIT_FAILURE); }

        there is a record in "person". Now, I want to transmit this "person" by TCP socket. How to got the bytes stream of "person" from a schema?

        Show
        menghaocheng added a comment - In the function "add_person()" in example/quicstop.c, after executing the following code: if (avro_record_set(person, "ID", id_datum) avro_record_set(person, "First", first_datum) avro_record_set(person, "Last", last_datum) avro_record_set(person, "Age", age_datum) avro_record_set(person, "Phone", phone_datum)) { fprintf(stderr, "Unable to create Person datum structure\n"); exit(EXIT_FAILURE); } there is a record in "person". Now, I want to transmit this "person" by TCP socket. How to got the bytes stream of "person" from a schema?
        Hide
        menghaocheng added a comment -

        Thanks Dounglas.

        I think you have got exactly what I meant. I know the step to do it.
        1)got the binary encoding.
        2)transmit them by TCP socket.
        The 2nd step is easy. But there is a question to the 1st step. I didn't know how to get the binary encoding. The C API in the Documentation doesn't mention at all http://avro.apache.org/docs/1.5.4/api/c/index.html. So I have to read the rsc files. I find a function in the file src/avro/consumer.h:
        avro_consume_binary(avro_reader_t reader,avro_consumer_t *consumer, void *ud);
        I'm not sure if it is the right function that I need.

        Show
        menghaocheng added a comment - Thanks Dounglas. I think you have got exactly what I meant. I know the step to do it. 1)got the binary encoding. 2)transmit them by TCP socket. The 2nd step is easy. But there is a question to the 1st step. I didn't know how to get the binary encoding. The C API in the Documentation doesn't mention at all http://avro.apache.org/docs/1.5.4/api/c/index.html . So I have to read the rsc files. I find a function in the file src/avro/consumer.h: avro_consume_binary(avro_reader_t reader,avro_consumer_t *consumer, void *ud); I'm not sure if it is the right function that I need.
        Hide
        Douglas Creager added a comment -

        Hi there. It sounds like you're trying to use the RPC mechanism defined in the Avro spec, is that right? Unfortunately, the Avro C bindings don't support the RPC mechanism yet. The C bindings will let you create instances of an Avro schema, and you can create the binary encoding of those instances. But then you'd be responsible for transmitting the binary encoding using some other library, like ZeroMQ or raw TCP sockets.

        I hope this helps, please let me know if you have any further questions.

        Show
        Douglas Creager added a comment - Hi there. It sounds like you're trying to use the RPC mechanism defined in the Avro spec, is that right? Unfortunately, the Avro C bindings don't support the RPC mechanism yet. The C bindings will let you create instances of an Avro schema, and you can create the binary encoding of those instances. But then you'd be responsible for transmitting the binary encoding using some other library, like ZeroMQ or raw TCP sockets. I hope this helps, please let me know if you have any further questions.
        menghaocheng made changes -
        Field Original Value New Value
        Description  I want to transfer files beetwin server and client by Avro-c. I know that there must be two parts in this model, the server and the client. My question is how to make the connection? Please forgive me as this maybe a simle question, But I'm fresh in Avro, myour simple worlds maybe helpful for me. If only there is an example for it.  I want to transfer files beetwin server and client by Avro-c. I know that there must be two parts in this model, the server and the client. My question is how to make the connection? Please forgive me as this maybe a simle question, But I'm fresh in Avro, your simple worlds maybe helpful for me. If only there is an example for it.
        menghaocheng created issue -

          People

          • Assignee:
            Unassigned
            Reporter:
            menghaocheng
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:

              Time Tracking

              Estimated:
              Original Estimate - 168h
              168h
              Remaining:
              Remaining Estimate - 168h
              168h
              Logged:
              Time Spent - Not Specified
              Not Specified

                Development