// Path: src/com/ibm/mqttv3/binding/MQTT.java
// public enum Operation {
// 	GET,
// 	POST,
// 	PUT,
// 	DELETE,
// 	RESET;
// };


import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ScheduledThreadPoolExecutor;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.eclipse.paho.client.mqttv3.IMqttDeliveryToken;
import org.eclipse.paho.client.mqttv3.MqttCallback;
import org.eclipse.paho.client.mqttv3.MqttMessage;
import com.ibm.mqttv3.binding.MQTT.Operation;

	protected void handleMessage(String topic, MqttMessage message) {
		LOG.info("MSG { "+topic + " ["+message.toString()+"]}");
		
		if(topic.startsWith(Request.RESPONSE_TOPIC_STARTER)) {
			String[] paths = topic.split("/");
			Long messageID = Long.valueOf(paths[paths.length - 1]);
			// the last one must contain the message-id
			AbstractRequestObserver requestObserver = 
					requestObservers.get(messageID);
			if(requestObserver != null) {
				Response response = new Response(message);
				if(ResponseCode.isSuccess(ResponseCode.valueOf(response.getCode()))) {
					requestObserver.onResponse(response);
				} else {
					requestObserver.onError(response);
				}
			}
			return;
		}
		
		Request request = new Request(topic, message);
		MQTTExchange exchange = new MQTTExchange(request, null);
		exchange.setMqttClient(this.mqttClient);
		
		Resource resource = getResource(request);
		if(resource == null) {
			// Check if its a POST operation, in which case
			// we need to return the parent resource to create
			// the new instance
// Path: src/com/ibm/mqttv3/binding/MQTT.java
// public enum Operation {
// 	GET,
// 	POST,
// 	PUT,
// 	DELETE,
// 	RESET;
// };


// Path: src/com/ibm/mqttv3/binding/MqttV3MessageReceiver.java
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ScheduledThreadPoolExecutor;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.eclipse.paho.client.mqttv3.IMqttDeliveryToken;
import org.eclipse.paho.client.mqttv3.MqttCallback;
import org.eclipse.paho.client.mqttv3.MqttMessage;
import com.ibm.mqttv3.binding.MQTT.Operation;


	protected void handleMessage(String topic, MqttMessage message) {
		LOG.info("MSG { "+topic + " ["+message.toString()+"]}");
		
		if(topic.startsWith(Request.RESPONSE_TOPIC_STARTER)) {
			String[] paths = topic.split("/");
			Long messageID = Long.valueOf(paths[paths.length - 1]);
			// the last one must contain the message-id
			AbstractRequestObserver requestObserver = 
					requestObservers.get(messageID);
			if(requestObserver != null) {
				Response response = new Response(message);
				if(ResponseCode.isSuccess(ResponseCode.valueOf(response.getCode()))) {
					requestObserver.onResponse(response);
				} else {
					requestObserver.onError(response);
				}
			}
			return;
		}
		
		Request request = new Request(topic, message);
		MQTTExchange exchange = new MQTTExchange(request, null);
		exchange.setMqttClient(this.mqttClient);
		
		Resource resource = getResource(request);
		if(resource == null) {
			// Check if its a POST operation, in which case
			// we need to return the parent resource to create
			// the new instance
			if(request.getOperation() == Operation.POST) {