+ NS_LOGD ("JNIProviderService: nativeDisableRemoteService - OUT");
+ return;
+}
+
+JNIEXPORT void JNICALL
+Java_org_iotivity_service_ns_provider_ProviderService_nativeSubscribeMQService
+(JNIEnv *env, jobject jObj, jstring jserverAddress, jstring jTopicName)
+{
+ NS_LOGD ("JNIProviderService: nativeSubscribeMQService - IN");
+ if (!jserverAddress)
+ {
+ ThrowNSException(JNI_INVALID_VALUE, "Server Address Can't be NULL");
+ return;
+ }
+ if (!jTopicName)
+ {
+ ThrowNSException(JNI_INVALID_VALUE, "TopicName Can't be NULL");
+ return;
+ }
+
+ const char *address = env->GetStringUTFChars( jserverAddress, NULL);
+ std::string servAddress(address);
+ const char *topic = env->GetStringUTFChars( jTopicName, NULL);
+ std::string topicName(topic);
+
+ OIC::Service::NSResult result =
+ OIC::Service::NSProviderService::getInstance()->subscribeMQService(
+ servAddress, topicName);
+ if (result != OIC::Service::NSResult::OK)
+ {
+ ThrowNSException((int) result, "Fail to Subscribe to MQ Service");
+ return;
+ }
+ env->ReleaseStringUTFChars(jserverAddress, address);
+ env->ReleaseStringUTFChars(jTopicName, topic);
+ NS_LOGD ("JNIProviderService: nativeSubscribeMQService - OUT");
+ return;