Adding capability to control number of messages published.