use of org.eclipse.kapua.service.device.call.message.app.response.kura.KuraResponseChannel in project kapua by eclipse.
the class TranslatorResponseMqttKura method translate.
private KuraResponseChannel translate(MqttTopic mqttTopic) throws KapuaException {
String[] mqttTopicTokens = mqttTopic.getSplittedTopic();
if (!CONTROL_MESSAGE_CLASSIFIER.equals(mqttTopicTokens[0])) {
throw new TranslatorException(TranslatorErrorCodes.INVALID_CHANNEL_CLASSIFIER, null, mqttTopicTokens[0]);
}
KuraResponseChannel kuraResponseChannel = new KuraResponseChannel(mqttTopicTokens[0], mqttTopicTokens[1], mqttTopicTokens[2]);
kuraResponseChannel.setAppId(mqttTopicTokens[3]);
kuraResponseChannel.setReplyPart(mqttTopicTokens[4]);
kuraResponseChannel.setRequestId(mqttTopicTokens[5]);
// Return Kura Channel
return kuraResponseChannel;
}
use of org.eclipse.kapua.service.device.call.message.app.response.kura.KuraResponseChannel in project kapua by eclipse.
the class TranslatorResponseMqttKura method translate.
@Override
public KuraResponseMessage translate(MqttMessage mqttMessage) throws KapuaException {
//
// Kura topic
KuraResponseChannel kuraChannel = translate(mqttMessage.getRequestTopic());
//
// Kura payload
KuraResponsePayload kuraPayload = translate(mqttMessage.getPayload());
// Kura message
return new KuraResponseMessage(kuraChannel, mqttMessage.getTimestamp(), kuraPayload);
}
Aggregations