*/
@Override
public ConsumerCallbackResult printEvent(DbusEventInternalReadable e,
DbusEventDecoder eventDecoder)
{
DbusEventAvroDecoder avroDecoder = (DbusEventAvroDecoder)eventDecoder;
switch (_metadataOutput)
{
case NONE:
GenericRecord payload = eventDecoder.getGenericRecord(e, null);
return payload != null ? printGenericRecord(payload) : ConsumerCallbackResult.SUCCESS;
case ONLY:
GenericRecord metadata = avroDecoder.getMetadata(e, null);
return null != metadata ? printGenericRecord(metadata) : ConsumerCallbackResult.SUCCESS;
case INCLUDE:
GenericRecord payload1 = avroDecoder.getGenericRecord(e, null);
GenericRecord metadata1 = avroDecoder.getMetadata(e, null);
Schema pschema = Schema.createUnion(Arrays.asList(avroDecoder.getPayloadSchema(e).getSchema(),
Schema.create(Type.NULL)));
Field pfield = new Field("payload", pschema, "payload", null);
VersionedSchema metaschema = avroDecoder.getMetadataSchema(e);
Schema mschema = null != metaschema ?
Schema.createUnion(Arrays.asList(metaschema.getSchema(), Schema.create(Type.NULL))) :
Schema.createUnion(Arrays.asList(Schema.create(Type.INT), Schema.create(Type.NULL)));
Field mfield = new Field("metadata", mschema, "metadata", null);
Schema combined = Schema.createRecord(Arrays.asList(pfield, mfield));