@Override
	public void run() {
		logger.info("Listener thread started.");
		try {
			Connection connection = factory.createConnection();
			connection.start();
			Session session = connection.createSession(false,
					Session.AUTO_ACKNOWLEDGE);
			Destination dest = new ActiveMQTopic(topic);

			MessageConsumer consumer = session.createConsumer(dest);

			while (true) {
				Message message = consumer.receive();

				String id = message.getStringProperty(Strings.ID);
				if (id == null) {
					logger.error("Property ID is null. Message is " + message);
				} else {
					messageResponse
							.put(id, MessageFactory.wrapMessage(message));
					logger.info(String.format(
							"Message %s received on topic %s.",
							message.getStringProperty(Strings.ID), topic));
//					logger.debug(""+messageResponse+" "+messageResponse.size());
				}

			}
		} catch (JMSException e) {
			logger.error("Error occur on receiving message", e);
		}
	}