Skip to content

Commit

Permalink
Refactor code
Browse files Browse the repository at this point in the history
  • Loading branch information
ravinperera00 committed Oct 9, 2024
1 parent f4c030c commit 4d02e87
Showing 1 changed file with 4 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -113,11 +113,9 @@ private void invokeOnMessage(MqttMessage message, String topic) {
callerObject.addNativeData(MqttConstants.CORRELATION_DATA,
message.getProperties().getCorrelationData());
}
result = runtime.startNonIsolatedWorker(service, MqttConstants.ONMESSAGE, null, metadata, null,
bMqttMessage, true, callerObject, true).get();
result = runtime.call(service, MqttConstants.ONMESSAGE, bMqttMessage, true, callerObject, true);
} else {
result = runtime.startNonIsolatedWorker(service, MqttConstants.ONMESSAGE, null, metadata, null,
bMqttMessage, true).get();
result = runtime.call(service, MqttConstants.ONMESSAGE, bMqttMessage, true);
}
BServiceInvokeCallbackImpl.notifySuccess(result);
} catch (BError bError) {
Expand All @@ -130,10 +128,8 @@ private void invokeOnError(BError bError) {
bError.printStackTrace();
return;
}
StrandMetadata metadata = getStrandMetadata(MqttConstants.ONERROR);
try {
Object result = runtime.startNonIsolatedWorker(service, MqttConstants.ONERROR, null, metadata, null,
bError, true);
Object result = runtime.call(service, MqttConstants.ONERROR, bError, true);
BServiceInvokeCallbackImpl.notifySuccess(result);
} catch (BError error) {
BServiceInvokeCallbackImpl.notifyFailure(error);
Expand All @@ -147,10 +143,8 @@ private void invokeOnComplete(IMqttToken token) {
}
BMap<BString, Object> bMqttToken;
bMqttToken = getMqttDeliveryToken(token);
StrandMetadata metadata = getStrandMetadata(MqttConstants.ONCOMPLETE);
try {
Object result = runtime.startNonIsolatedWorker(service, MqttConstants.ONCOMPLETE, null,
metadata, null, bMqttToken, true);
Object result = runtime.call(service, MqttConstants.ONCOMPLETE, bMqttToken, true);
BServiceInvokeCallbackImpl.notifySuccess(result);
} catch (BError bError) {
BServiceInvokeCallbackImpl.notifyFailure(bError);
Expand Down

0 comments on commit 4d02e87

Please sign in to comment.