Modified code to read the stream and to publish to MQ.