Search in sources :

Example 6 with AmqpsMessage

use of com.microsoft.azure.sdk.iot.deps.transport.amqp.AmqpsMessage in project azure-iot-sdk-java by Azure.

the class ReceiverLinkHandler method getMessageFromReceiverLink.

protected AmqpsMessage getMessageFromReceiverLink() {
    Delivery delivery = receiverLink.current();
    if (delivery.isReadable() && !delivery.isPartial()) {
        int size = delivery.pending();
        byte[] buffer = new byte[size];
        int read = receiverLink.recv(buffer, 0, buffer.length);
        receiverLink.advance();
        AmqpsMessage message = new AmqpsMessage();
        message.decode(buffer, 0, read);
        message.setDelivery(delivery);
        return message;
    }
    return null;
}
Also used : Delivery(org.apache.qpid.proton.engine.Delivery) AmqpsMessage(com.microsoft.azure.sdk.iot.deps.transport.amqp.AmqpsMessage)

Aggregations

AmqpsMessage (com.microsoft.azure.sdk.iot.deps.transport.amqp.AmqpsMessage)6 DeliveryState (org.apache.qpid.proton.amqp.transport.DeliveryState)3 Map (java.util.Map)2 UUID (java.util.UUID)2 Properties (org.apache.qpid.proton.amqp.messaging.Properties)2 IotHubTransportMessage (com.microsoft.azure.sdk.iot.device.transport.IotHubTransportMessage)1 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)1 Verifications (mockit.Verifications)1 Delivery (org.apache.qpid.proton.engine.Delivery)1 Test (org.junit.Test)1