Hello Folks,

Please help me understand few concepts on the usage of proton-j/reactor API:

While using the receiver – I am overriding BaseHandler.onDelivery 
event-callback to receive a batch of Messages. I am proactively flushing all 
available deliveries that comes as a batch – if available. Here’s pseudo-code 
of what I am doing – pls. correct if the intent is right. We are running into 
blocked Receiver when we are running 1 receiver per connection (using reactor 
framework) – does the below code ring any bells ?

        while (delivery != null && delivery.isReadable() && 
!delivery.isPartial())
                {    
                        int size = delivery.pending();
                        byte[] buffer = new byte[size];
                        int read = receiveLink.recv(buffer, 0, buffer.length);
            
                        Message msg = Proton.message();
                        msg.decode(buffer, 0, read);
            
                        messages.add(msg);
                        deliveries.add(delivery);
            
                        if (!receiveLink.advance())
                         {
                                break;
                         }
                         else
                         {
                                delivery = receiveLink.current();
                         }
                }
        application.onReceiveCallBack(messages);
        for(Delivery unsettledDelivery: deliveries)
                {
                        unsettledDelivery.settle();
                }
        
- Qstn: on a Receiver, Under what circumstances will a delivery be not readable 
?               

Thanks a lot for the Collaboration effort!
Sree

Reply via email to