Uploaded image for project: 'Apache Avro'
  1. Apache Avro
  2. AVRO-1423

Avrogen doesn't create the RPC methods from .avrp files

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Resolved
    • 1.7.5
    • 1.7.6
    • csharp
    • None
    • csharp avrogen

    Description

      1. Get the .avpr file from https://github.com/phunt/avro-rpc-quickstart/blob/master/src/main/avro/mail.avpr

      2. use the csharp avrogen.exe (eg: release-1.7.5\lang\csharp\build\codegen\Release\avrogen.exe ) to produce the csharp code-gen files as

       avrogen.exe -p mail.avpr . 

      3. Review the generated .cs file - no RPC methods found (you should have a

       public String send (Message message)  { ... }  

      method in that code-gen'd .cs file; current code-gen copy-pasted below)

      // ------------------------------------------------------------------------------
      // <auto-generated>
      //    Generated by avrogen.exe, version 0.9.0.0
      //    Changes to this file may cause incorrect behavior and will be lost if code
      //    is regenerated
      // </auto-generated>
      // ------------------------------------------------------------------------------
      namespace example.proto
      {
      	using System;
      	using System.Collections.Generic;
      	using System.Text;
      	using Avro;
      	using Avro.Specific;
      	
      	public partial class Message : ISpecificRecord
      	{
      		public static Schema _SCHEMA = Avro.Schema.Parse("{\"type\":\"record\",\"name\":\"Message\",\"namespace\":\"example.proto\",\"fields\":[{\"name\":\"" +
      				"to\",\"type\":\"string\"},{\"name\":\"from\",\"type\":\"string\"},{\"name\":\"body\",\"type\":\"stri" +
      				"ng\"}]}");
      		private string _to;
      		private string _from;
      		private string _body;
      		public virtual Schema Schema
      		{
      			get
      			{
      				return Message._SCHEMA;
      			}
      		}
      		public string to
      		{
      			get
      			{
      				return this._to;
      			}
      			set
      			{
      				this._to = value;
      			}
      		}
      		public string from
      		{
      			get
      			{
      				return this._from;
      			}
      			set
      			{
      				this._from = value;
      			}
      		}
      		public string body
      		{
      			get
      			{
      				return this._body;
      			}
      			set
      			{
      				this._body = value;
      			}
      		}
      		public virtual object Get(int fieldPos)
      		{
      			switch (fieldPos)
      			{
      			case 0: return this.to;
      			case 1: return this.from;
      			case 2: return this.body;
      			default: throw new AvroRuntimeException("Bad index " + fieldPos + " in Get()");
      			};
      		}
      		public virtual void Put(int fieldPos, object fieldValue)
      		{
      			switch (fieldPos)
      			{
      			case 0: this.to = (System.String)fieldValue; break;
      			case 1: this.from = (System.String)fieldValue; break;
      			case 2: this.body = (System.String)fieldValue; break;
      			default: throw new AvroRuntimeException("Bad index " + fieldPos + " in Put()");
      			};
      		}
      	}
      }
      

      Attachments

        Activity

          People

            Unassigned Unassigned
            user874144 Sid S
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: