@Override
	public void run() {

		while (true) {
			String msg = null;
			/*
			 * Take a message from queue and publish it
			 */
			try {
				msg = messagesToPublish.take();
				
				/*
				 * Randomness might be needed in the message because some services do not 
				 * accept duplicate messages, e.g. twitter.
				 */
				if (this.randomness) {
					MessageDigest md = MessageDigest.getInstance("MD5");
					Date date = new Date();
					String randomString = String.format("%s%d", date.toString(), randomInt.nextInt());
					md.update(randomString.getBytes());
					msg = String.format("%s #%s", msg, this.bytesToHex(md.digest()).substring(0, 8));
				}
				System.out.println(String.format("[PUBLISH]: %s", msg));
				publisher.publish(msg);
			} catch (InterruptedException e) {

			} catch (NoSuchAlgorithmException e) {
				e.printStackTrace();
			} catch (PublisherException e) {
				/*
				 * If a publisher error happens, try to publish it again.
				 */
				if(msg != null) {
					messagesToPublish.offerFirst(msg);
				}
			}
		}
	}