Fix handling of unencodable messages
Fix handling of unencodable messages

Move `Key.Encode()` and `Value.Encode()` calls slightly earlier (to
`groupAndFilter`) where we have access to the batch in order to be able to
remove them from consideration on error. Otherwise failed messages would not be
removed from the batch and could end up returned twice.

Add cache members to the ProducerMessage struct to store the results until we
actually need them.

Fixes #449.

This is perhaps not the most elegant solution. However it is correct and a
better solution would be a lot more invasive. This will do in order to ship the
fix in a 1.5.1 patch release.

raisemarketplace/sarama,Shopify/sarama,VividCortex/sarama,remerge/sarama,mailgun/sarama,DataDog/sarama,HelixEducation/sarama,vrischmann/sarama,cep21/sarama,jepst/sarama,kmiku7/sarama,HelixEducation/sarama,scalingdata/sarama,VividCortex/sarama,scalingdata/sarama,raisemarketplace/sarama,remerge/sarama,jepst/sarama,Shopify/sarama,mailgun/sarama,vrischmann/sarama,DataDog/sarama,kmiku7/sarama,cep21/sarama