Search in sources :

Example 1 with KuraResponseChannel

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;
}
Also used : KuraResponseChannel(org.eclipse.kapua.service.device.call.message.app.response.kura.KuraResponseChannel) TranslatorException(org.eclipse.kapua.translator.exception.TranslatorException)

Example 2 with 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);
}
Also used : KuraResponseMessage(org.eclipse.kapua.service.device.call.message.app.response.kura.KuraResponseMessage) KuraResponseChannel(org.eclipse.kapua.service.device.call.message.app.response.kura.KuraResponseChannel) KuraResponsePayload(org.eclipse.kapua.service.device.call.message.app.response.kura.KuraResponsePayload)

Aggregations

KuraResponseChannel (org.eclipse.kapua.service.device.call.message.app.response.kura.KuraResponseChannel)2 KuraResponseMessage (org.eclipse.kapua.service.device.call.message.app.response.kura.KuraResponseMessage)1 KuraResponsePayload (org.eclipse.kapua.service.device.call.message.app.response.kura.KuraResponsePayload)1 TranslatorException (org.eclipse.kapua.translator.exception.TranslatorException)1