Member since
06-07-2017
11
Posts
0
Kudos Received
0
Solutions
01-19-2018
08:29 AM
@Shu Thank you so much for your answer and for taking time to prepare an environment to test my PoC. I really appreciate that. My problem was that I was trying to read the Json with "JsonPathReader" service. Changing to "JsonTreeReader" made the trick. Anyway, I went forward with the PoC and now I'm sending the converted Avro data to a Kafka cluster and I'm trying to deserialize it after consuming. For all this, I'm using the Hortonworks schema-registry which works fine in Nifi but I can't get it to work in Java. I've tryied the example here but I'm getting an error at the time of declaring the deserializedObject. Here you can see the code: public void runAvroSerDesApis(byte[] serializedData, String name) throws IOException {
this.serializedData = serializedData;
this.name = name;
//using builtin avro serializer/deserializer
/*AvroSnapshotSerializer avroSnapshotSerializer = new AvroSnapshotSerializer();
avroSnapshotSerializer.init(config);*/
AvroSnapshotDeserializer deserializer = schemaRegistryClient.getDefaultDeserializer(AvroSchemaProvider.TYPE);
deserializer.init(config);
Object deviceObject = createGenericRecordForDevice(name);
SchemaMetadata schemaMetadata = createSchemaMetadata("avro-serializer-schema-" + System.currentTimeMillis());
//byte[] serializedData = avroSnapshotSerializer.serialize(deviceObject, schemaMetadata);
Object deserializedObj = deserializer.deserialize(new ByteArrayInputStream(serializedData), schemaMetadata, null);
LOG.info("Serialized and deserialized objects are equal: [{}] ", deviceObject.equals(deserializedObj));
}
The line retrieving the error is "Object deserializedObj = deserializer.deserialize(new ByteArrayInputStream(serializedData), schemaMetadata, null);" and it says more or less that "actual and format argument lists differ in lenght" Is there any example someone could provide about how to deserialize an Avro message in Java using Hortonworks Schema-Registry? I'm using v0.2.1. Thanks in advance.
... View more
09-08-2017
07:19 AM
Hi, New question added here: https://community.hortonworks.com/questions/135939/compare-attributes-of-different-flowfiles.html Hope you can help me. Jon
... View more
09-15-2017
01:42 PM
1 Kudo
@Jon Rodriguez Breton There are no dedicated processors for removing cached entries from the distributed map cache. You can try using the "Age Off Duration" property in the detect duplicate processor or use a scripting processor in NiFi to execute a script to clear the cache. The follwoing Jira covers this missing processor as well as provide a sample template https://issues.apache.org/jira/browse/NIFI-4173
... View more