Search in sources :

Example 1 with MqttPublish

use of org.eclipse.paho.client.mqttv3.internal.wire.MqttPublish in project pinpoint by naver.

the class MqttV3CallbackMessageArrivedInterceptor method recordDataByVersion.

@Override
protected void recordDataByVersion(Object target, SpanRecorder recorder, Object[] args) {
    MqttPublish mqttPublish = ArrayArgumentUtils.getArgument(args, 0, MqttPublish.class);
    if (mqttPublish != null) {
        recorder.recordRpcName(buildRpcName(mqttPublish.getTopicName(), mqttPublish.getMessage().getQos()));
        MqttMessage mqttMessage = mqttPublish.getMessage();
        String payload = BytesUtils.toString(mqttMessage.getPayload());
        recorder.recordAttribute(MQTT_MESSAGE_PAYLOAD_ANNOTATION_KEY, payload);
        String endPoint = getEndPoint(target);
        recorder.recordEndPoint(endPoint);
    }
}
Also used : MqttMessage(org.eclipse.paho.client.mqttv3.MqttMessage) MqttPublish(org.eclipse.paho.client.mqttv3.internal.wire.MqttPublish)

Aggregations

MqttMessage (org.eclipse.paho.client.mqttv3.MqttMessage)1 MqttPublish (org.eclipse.paho.client.mqttv3.internal.wire.MqttPublish)1