'If the class is not stopping, publish a message to RabbitMQ,
appending a list of deliveries with the message number that was sent.
This list will be used to check for delivery confirmations in the
on_delivery_confirmations method.
Once the message has been sent, schedule another message to be sent.
The main reason I put scheduling in was just so you can get a good idea
of how the process is flowing by slowing down and speeding up the
delivery intervals by changing the PUBLISH_INTERVAL constant in the
class.'

def publish_message(self):

    if ((self._channel is None) or (not self._channel.is_open)):
        return
    hdrs = {u'\u0645\u0641\u062a\u0627\u062d': u'    \u0642\u064a\u0645\u0629', u'\u952e': u'\u503c', u'\u30ad\u30fc': u'\u5024'}
    properties = pika.BasicProperties(app_id='example-publisher', content_type='application/json', headers=hdrs)
    message = u'\u0645\u0641\u062a\u0627\u062d    \u0642\u064a\u0645\u0629    \u952e    \u503c    \u30ad\u30fc    \u5024'
    self._channel.basic_publish(self.EXCHANGE, self.ROUTING_KEY, json.dumps(message, ensure_ascii=False), properties)
    self._message_number += 1
    self._deliveries.append(self._message_number)
    LOGGER.info('Published    message    #    %i', self._message_number)
    self.schedule_next_message()
