updated to also write to kafka brokers

Should this increment the errorsOccurred field (in some safe way)?