In general the idea is that "credit" represents how many messages a
receiver can handle at a given point in time. The sender never sets this
amount independently (except for initializing it to zero), he only sets it
to what the receiver has told him. As for what you do as a sender when you
don't have sufficient credit to send messages, you simply have to wait for
the receiver to tell you that they can handle more messages. This
guarantees that the sender will never send more messages than a receiver
can handle.

On Tue, Mar 19, 2013 at 11:48 AM, Rakesh Kushwaha <[email protected]>wrote:

>  I am looking for
>  how link credit protocol works with respect to producer and consumer .
>
>  my main confusion points are ,
>
>  1> let say I have any create producer API which should in turn create link
> with sender role (amqp protocol),
>       what should be link credit for this producer (at create producer API)
> so the it can enqueue message.
>

Initially the receiver hasn't told the sender anything, so the protocol
specification defines the initial link credit for a producer to be zero.


>
>  2> In case ,sender is done with all link credit then how It gets link
> credit again when It tries to enqueue message .
>
>       like in case of  sender gets flow per-formative frame with drain flag
> (flow (drain= true))set as true , it has to consume all link credit , how
> it will again get link credit .
>
>   Off course if I am not able understand above two points , I may be
> missing something else also :).
>

The only way the sender ever increases its credit levels is when the
receiver tells it to do so by sending a flow performative with additional
credit. This applies both to the initial case, and to the drain case you
mention above, and would also apply if the producer simply sent enough
messages that the credit level fell to zero.

I hope this helps. Let me know if you still have questions.

--Rafael

Reply via email to