record.getSchema());
writer.write(record, encoder);
byte[] serializedValue = bos.toByteArray();
//Get the md5 for the schema
SchemaId schemaId = SchemaId.createWithMd5(dbUpdate.getSchema());
//Determine the operation type and convert to dbus opcode
DbusOpcode opCode;
if(dbUpdate.getOpType() == DbUpdateState.DBUpdateImage.OpType.INSERT || dbUpdate.getOpType() == DbUpdateState.DBUpdateImage.OpType.UPDATE)
{
opCode = DbusOpcode.UPSERT;
if(_log.isDebugEnabled())
_log.debug("The event with scn "+ scn +" is INSERT/UPDATE");
}
else if(dbUpdate.getOpType() == DbUpdateState.DBUpdateImage.OpType.DELETE)
{
opCode = DbusOpcode.DELETE;
if(_log.isDebugEnabled())
_log.debug("The event with scn "+ scn +" is DELETE");
}
else
{
throw new DatabusException("Unknown opcode from dbUpdate for event with scn:" + scn);
}
//Construct the dbusEvent info
DbusEventInfo dbusEventInfo = new DbusEventInfo(opCode,
scn,
(short)_pConfig.getId(),
lPartitionId,
timestamp,
sourceId,
schemaId.getByteArray(),
serializedValue,
false,
false);
dbusEventInfo.setReplicated(dbUpdate.isReplicated());