Avro
  1. Avro
  2. AVRO-267

Tool (for "avroj") to send and receive a single RPC from the commandline

    Details

    • Type: New Feature New Feature
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.3.0
    • Component/s: java
    • Labels:
      None
    • Hadoop Flags:
      Reviewed

      Description

      Vaguely similar to "netcat" and "netcat -l", "avroj rpcreceive" and "avroj rpcsend" would send receive or send a single RPC (using the HTTP transport). The former is required to have a response pre-determined and echoes the request; the latter echoes any response it receives.

      1. AVRO-267.patch.txt
        14 kB
        Philip Zeyliger
      2. AVRO-267.patch.txt
        14 kB
        Philip Zeyliger
      3. AVRO-267.patch.txt
        14 kB
        Philip Zeyliger
      4. AVRO-267.patch.txt
        14 kB
        Philip Zeyliger

        Activity

        Hide
        Philip Zeyliger added a comment -

        Attaching a patch that implements rpcsend and rpcreceive.

        One questionable thing I'll point out is that I extended JsonDecoder to take a String (in addition to an InputStream). Since command-line arguments end up as strings, I wanted to avoid converting a string to a byte array in order to make an InputStream. Jackson has lots of constructors, Reader and String amongst them. What do you think?

        I thought about the server accepting many RPCs (not just one), but I decided against it. Partially because of netcat's model, and partially because the server has to return something, and "null" isn't always an option (since it may not be in the schema). Returning an exception is always possible, but since these are essentially tools for facilitating testing of servers I went for one message.

        Finally, applying this patch depends very slightly (Main and Util classes) on AVRO-245.

        – Philip

        Show
        Philip Zeyliger added a comment - Attaching a patch that implements rpcsend and rpcreceive. One questionable thing I'll point out is that I extended JsonDecoder to take a String (in addition to an InputStream). Since command-line arguments end up as strings, I wanted to avoid converting a string to a byte array in order to make an InputStream. Jackson has lots of constructors, Reader and String amongst them. What do you think? I thought about the server accepting many RPCs (not just one), but I decided against it. Partially because of netcat's model, and partially because the server has to return something, and "null" isn't always an option (since it may not be in the schema). Returning an exception is always possible, but since these are essentially tools for facilitating testing of servers I went for one message. Finally, applying this patch depends very slightly (Main and Util classes) on AVRO-245 . – Philip
        Hide
        Philip Zeyliger added a comment -

        Updating patch to get rid of some unused imports and a tab character (the horror!). Thanks checkstyle.

        Show
        Philip Zeyliger added a comment - Updating patch to get rid of some unused imports and a tab character (the horror!). Thanks checkstyle.
        Hide
        Doug Cutting added a comment -

        This needs to be updated post AVRO-263.

        Show
        Doug Cutting added a comment - This needs to be updated post AVRO-263 .
        Hide
        Philip Zeyliger added a comment -

        Updating post AVRO-243 (return values in tools). This still depends on AVRO-245.

        Show
        Philip Zeyliger added a comment - Updating post AVRO-243 (return values in tools). This still depends on AVRO-245 .
        Hide
        Doug Cutting added a comment -

        Overall this looks good. Some comments:

        • the new public methods in JsonDecoder need javadoc.
        • the "Expected two arguments" message expects four.
        • the checking of the message name is redundant with checks Requestor and Responder perform, no?
        Show
        Doug Cutting added a comment - Overall this looks good. Some comments: the new public methods in JsonDecoder need javadoc. the "Expected two arguments" message expects four. the checking of the message name is redundant with checks Requestor and Responder perform, no?
        Hide
        Philip Zeyliger added a comment -

        Thanks for the review!

        the new public methods in JsonDecoder need javadoc.

        Done.

        the "Expected two arguments" message expects four.

        Whoops; fixed.

        the checking of the message name is redundant with checks Requestor and Responder perform, no?

        I think I have to do the check to avoid throwing NPE when I convert the data from JSON into a datum.

        Show
        Philip Zeyliger added a comment - Thanks for the review! the new public methods in JsonDecoder need javadoc. Done. the "Expected two arguments" message expects four. Whoops; fixed. the checking of the message name is redundant with checks Requestor and Responder perform, no? I think I have to do the check to avoid throwing NPE when I convert the data from JSON into a datum.
        Hide
        Doug Cutting added a comment -

        I committed this with the following changes:

        • skip tools in first java compilation pass, as they now depend on specific compiler
        • remove dependency on logger from rpcreceive tool, since a logging backend is not included in avroj.

        It appears that 'ant clean test-java test-avroj' was not performed before posting this patch.

        Show
        Doug Cutting added a comment - I committed this with the following changes: skip tools in first java compilation pass, as they now depend on specific compiler remove dependency on logger from rpcreceive tool, since a logging backend is not included in avroj. It appears that 'ant clean test-java test-avroj' was not performed before posting this patch.

          People

          • Assignee:
            Philip Zeyliger
            Reporter:
            Philip Zeyliger
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development