Class PendingConfirm
- java.lang.Object
-
- org.springframework.amqp.rabbit.connection.PendingConfirm
-
public class PendingConfirm extends Object
Instances of this object track pending publisher confirms. The timestamp allows the pending confirmation to be expired. It also holdsCorrelationData
for the client to correlate a confirm with a sent message.- Since:
- 1.0.1
- Author:
- Gary Russell
-
-
Constructor Summary
Constructors Constructor Description PendingConfirm(CorrelationData correlationData, long timestamp)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
countDown()
Count down the returned message latch; call after the listener has been called.String
getCause()
CorrelationData
getCorrelationData()
The correlation data supplied by the client when sending the message corresponding to this confirmation.long
getTimestamp()
boolean
isReturned()
True if a returned message has been received.void
setCause(String cause)
When the confirmation is nacked, set the cause when available.void
setReturned(boolean isReturned)
Indicate that a returned message has been received.String
toString()
boolean
waitForReturnIfNeeded()
Return true if a return has been passed to the listener or if no return has been received.
-
-
-
Constructor Detail
-
PendingConfirm
public PendingConfirm(@Nullable CorrelationData correlationData, long timestamp)
- Parameters:
correlationData
- The correlation data.timestamp
- The timestamp.
-
-
Method Detail
-
getCorrelationData
@Nullable public CorrelationData getCorrelationData()
The correlation data supplied by the client when sending the message corresponding to this confirmation.- Returns:
- The correlation data.
-
getTimestamp
public long getTimestamp()
- Returns:
- The time the message was sent.
-
setCause
public void setCause(String cause)
When the confirmation is nacked, set the cause when available.- Parameters:
cause
- The cause.- Since:
- 1.4
-
isReturned
public boolean isReturned()
True if a returned message has been received.- Returns:
- true if there is a return.
- Since:
- 2.2.10
-
setReturned
public void setReturned(boolean isReturned)
Indicate that a returned message has been received.- Parameters:
isReturned
- true if there is a return.- Since:
- 2.2.10
-
waitForReturnIfNeeded
public boolean waitForReturnIfNeeded() throws InterruptedException
Return true if a return has been passed to the listener or if no return has been received.- Returns:
- false if an expected returned message has not been passed to the listener.
- Throws:
InterruptedException
- if interrupted.- Since:
- 2.2.10
-
countDown
public void countDown()
Count down the returned message latch; call after the listener has been called.- Since:
- 2.2.10
-
-