Skip to content

Instantly share code, notes, and snippets.

@antwatkins
antwatkins / AvroClientActivity.java
Created July 12, 2012 15:21
Building an Ad Request with Avro's generated objects
AdRequest adRequest = AdRequest.newBuilder().setAdSpaceName(adSpaceNames[0]).build();
@antwatkins
antwatkins / AdRequest.java
Created July 12, 2012 15:17
Avro Auto-generated Schema definition
public static final org.apache.avro.Schema SCHEMA$ = new org.apache.avro.Schema.Parser().parse("{\"type\":\"record\",\"name\":\"AdRequest\",\"namespace\":\"com.flurry.avroserver.protocol.v1\",\"fields\":[{\"name\":\"adSpaceName\",\"type\":\"string\"},{\"name\":\"location\",\"type\":{\"type\":\"record\",\"name\":\"Location\",\"fields\":[{\"name\":\"lat\",\"type\":\"float\",\"default\":0.0},{\"name\":\"lon\",\"type\":\"float\",\"default\":0.0}]},\"default\":\"null\"}]}");
@antwatkins
antwatkins / AvroServerCurl
Created July 12, 2012 15:14
Curl to Avro Sample Server
curl -v -H "Accept: application/json" -H "Content-type: application/json" -X POST -d '{"adSpaceName":"splash_screen","location":{"lat":12.231212,"lon":23.3435},
}' http://localhost:8080
@antwatkins
antwatkins / AvroAdResponse.avpr
Created July 12, 2012 14:32
Sample Avro Ad Response
{
"protocol": "AvroAdResponse", "namespace": "com.flurry.avroserver.protocol.v1",
"types": [
{"name": "Ad", "type": "record",
"fields": [
{"name": "adSpace", "type": "string"},
{"name": "adName", "type": "string"}
]
},
{"name": "AdResponse", "type": "record",
@antwatkins
antwatkins / AvroAdRequest.avpr
Created July 12, 2012 14:27
Sample Avro Ad Request
{
"protocol": "AvroAdRequest", "namespace": "com.flurry.avroserver.protocol.v1",
"types": [
{"name": "Location", "type": "record",
"fields": [
{"name": "lat", "type": "float", "default":0.0},
{"name": "lon", "type": "float", "default":0.0}
]
},
{"name": "AdRequest", "type": "record",