static Message readMessageFromDelivery ( Receiver receiveLink , Delivery delivery ) { int msgSize = delivery . pending ( ) ; byte [ ] buffer = new byte [ msgSize ] ; int read = receiveLink . recv ( buffer , 0 , msgSize ) ; Message message = Proton . message ( ) ; message . decode ( buffer , 0 , read ) ; return message ; }
This is not super stable for some reason