Implement message writer.

Document whether this is externally thread safe?