+#ifdef WITH_MQ
+NSResult NSProviderSubscribeMQService(const char * serverAddress, const char * topicName)
+{
+ NS_LOG(DEBUG, "NSProviderSubscribeMQService - IN");
+ pthread_mutex_lock(&nsInitMutex);
+
+ if (!initProvider || !serverAddress || !topicName)
+ {
+ NS_LOG(DEBUG, "Provider service has not been started yet or set the server "
+ "address and topicName");
+ pthread_mutex_unlock(&nsInitMutex);
+ return NS_FAIL;
+ }
+
+ NSMQTopicAddress * topicAddr = (NSMQTopicAddress *)OICMalloc(sizeof(NSMQTopicAddress));
+
+ if (!topicAddr)
+ {
+ NS_LOG(DEBUG, "fail to memory allocate");
+ pthread_mutex_unlock(&nsInitMutex);
+ return NS_FAIL;
+ }
+
+ topicAddr->serverAddr = NSGetQueryAddress(serverAddress);
+ topicAddr->topicName = OICStrdup(topicName);
+
+ NS_LOG_V(DEBUG, "input Topic Name : %s", topicAddr->topicName);
+
+ NSPushQueue(SUBSCRIPTION_SCHEDULER, TASK_MQ_REQ_SUBSCRIBE, (void *) topicAddr);
+
+ pthread_mutex_unlock(&nsInitMutex);
+ NS_LOG(DEBUG, "NSProviderSubscribeMQService - OUT");
+ return NS_OK;
+}
+#endif
+