You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@avro.apache.org by cu...@apache.org on 2010/08/18 23:28:45 UTC
svn commit: r986955 - in /avro/trunk: CHANGES.txt
doc/src/content/xdocs/idl.xml lang/java/src/java/org/apache/avro/idl/idl.jj
lang/java/src/test/idl/input/simple.avdl
lang/java/src/test/idl/output/simple.avpr
Author: cutting
Date: Wed Aug 18 21:28:45 2010
New Revision: 986955
URL: http://svn.apache.org/viewvc?rev=986955&view=rev
Log:
AVRO-611. IDL: Add support for one-way messages.
Modified:
avro/trunk/CHANGES.txt
avro/trunk/doc/src/content/xdocs/idl.xml
avro/trunk/lang/java/src/java/org/apache/avro/idl/idl.jj
avro/trunk/lang/java/src/test/idl/input/simple.avdl
avro/trunk/lang/java/src/test/idl/output/simple.avpr
Modified: avro/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/avro/trunk/CHANGES.txt?rev=986955&r1=986954&r2=986955&view=diff
==============================================================================
--- avro/trunk/CHANGES.txt (original)
+++ avro/trunk/CHANGES.txt Wed Aug 18 21:28:45 2010
@@ -55,6 +55,8 @@ Avro 1.4.0 (unreleased)
AVRO-495. IDL: Add support for file includes. (cutting)
+ AVRO-611. IDL: Add support for one-way messages. (cutting)
+
IMPROVEMENTS
AVRO-587. Add Charts and Templating to Stats View
Modified: avro/trunk/doc/src/content/xdocs/idl.xml
URL: http://svn.apache.org/viewvc/avro/trunk/doc/src/content/xdocs/idl.xml?rev=986955&r1=986954&r2=986955&view=diff
==============================================================================
--- avro/trunk/doc/src/content/xdocs/idl.xml (original)
+++ avro/trunk/doc/src/content/xdocs/idl.xml Wed Aug 18 21:28:45 2010
@@ -288,6 +288,12 @@ void logMessage(string message);
<source>
void goKaboom() throws Kaboom;
</source>
+ <p>To define a one-way message, use the
+ keyword <code>oneway</code> after the parameter list, for example:
+ </p>
+ <source>
+void fireAndForget(string message) oneway;
+ </source>
</section> <!-- define messages -->
<section id="minutiae">
<title>Other Language Features</title>
@@ -386,6 +392,7 @@ protocol Simple {
int add(int arg1, int arg2);
bytes echoBytes(bytes data);
void `error`() throws TestError;
+ void ping() oneway;
}
</source>
<p>Additional examples may be found in the Avro source tree under the <code>src/test/idl/input</code> directory.</p>
Modified: avro/trunk/lang/java/src/java/org/apache/avro/idl/idl.jj
URL: http://svn.apache.org/viewvc/avro/trunk/lang/java/src/java/org/apache/avro/idl/idl.jj?rev=986955&r1=986954&r2=986955&view=diff
==============================================================================
--- avro/trunk/lang/java/src/java/org/apache/avro/idl/idl.jj (original)
+++ avro/trunk/lang/java/src/java/org/apache/avro/idl/idl.jj Wed Aug 18 21:28:45 2010
@@ -160,6 +160,7 @@ TOKEN :
| < INT: "int" >
| < LONG: "long" >
| < MAP: "map" >
+| < ONEWAY: "oneway" >
| < BYTES: "bytes" >
| < SCHEMA: "schema" >
| < STRING: "string" >
@@ -1225,6 +1226,7 @@ Message MessageDeclaration(Protocol p):
String name;
Schema request;
Schema response;
+ boolean oneWay = false;
List<Schema> errorSchemata = new ArrayList<Schema>();
errorSchemata.add(Protocol.SYSTEM_ERROR);
}
@@ -1232,11 +1234,18 @@ Message MessageDeclaration(Protocol p):
response = ResultType()
name = Identifier()
request = FormalParameters()
- [ "throws" ErrorList(errorSchemata) ]
+ [ "oneway" {oneWay = true; } | "throws" ErrorList(errorSchemata) ]
";"
{
Schema errors = Schema.createUnion(errorSchemata);
- return p.createMessage(name, null, request, response, errors);
+ if (oneWay && response.getType() != Type.NULL)
+ throw new ParseException("One-way message'" + name + "' must return void"
+ + " at line " + token.beginLine + ", column " +
+ token.beginColumn);
+ return oneWay
+ ? p.createMessage(name, null, request)
+ : p.createMessage(name, null, request, response, errors);
+
}
}
Modified: avro/trunk/lang/java/src/test/idl/input/simple.avdl
URL: http://svn.apache.org/viewvc/avro/trunk/lang/java/src/test/idl/input/simple.avdl?rev=986955&r1=986954&r2=986955&view=diff
==============================================================================
--- avro/trunk/lang/java/src/test/idl/input/simple.avdl (original)
+++ avro/trunk/lang/java/src/test/idl/input/simple.avdl Wed Aug 18 21:28:45 2010
@@ -50,4 +50,5 @@ protocol Simple {
int add(int arg1, int arg2 = 0);
bytes echoBytes(bytes data);
void `error`() throws TestError;
+ void ping() oneway;
}
Modified: avro/trunk/lang/java/src/test/idl/output/simple.avpr
URL: http://svn.apache.org/viewvc/avro/trunk/lang/java/src/test/idl/output/simple.avpr?rev=986955&r1=986954&r2=986955&view=diff
==============================================================================
--- avro/trunk/lang/java/src/test/idl/output/simple.avpr (original)
+++ avro/trunk/lang/java/src/test/idl/output/simple.avpr Wed Aug 18 21:28:45 2010
@@ -78,6 +78,11 @@
"request" : [ ],
"response" : "null",
"errors" : [ "TestError" ]
+ },
+ "ping" : {
+ "request" : [ ],
+ "response" : "null",
+ "one-way" : true
}
}
}
\ No newline at end of file