Moves processing logic

This PR moves the processing logic out of the publisher and into a separate class.

The processor can then optionally be injected into the publisher, allowing different consumers to process the msg in different ways, or the default way provided by the publisher.