Package org.apache.qpid.protonj2.client
Interface Tracker
-
- All Known Subinterfaces:
StreamTracker
- All Known Implementing Classes:
ClientNoOpStreamTracker
,ClientNoOpTracker
,ClientStreamTracker
public interface Tracker
Tracker object used to track the state of a sentMessage
at the remote and allows for local settlement and disposition management.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Tracker
awaitAccepted()
Waits if necessary for the remote to settle the sent delivery with anAccepted
disposition unless it has either already been settled and accepted or the original delivery was sent settled in which case the remote will not send aDisposition
back.Tracker
awaitAccepted(long timeout, java.util.concurrent.TimeUnit unit)
Waits if necessary for the remote to settle the sent delivery with anAccepted
disposition unless it has either already been settled and accepted or the original delivery was sent settled in which case the remote will not send aDisposition
back.Tracker
awaitSettlement()
Waits if necessary for the remote to settle the sent delivery unless it has either already been settled or the original delivery was sent settled in which case the remote will not send aDisposition
back.Tracker
awaitSettlement(long timeout, java.util.concurrent.TimeUnit unit)
Waits if necessary for the remote to settle the sent delivery unless it has either already been settled or the original delivery was sent settled in which case the remote will not send aDisposition
back.Tracker
disposition(DeliveryState state, boolean settle)
Updates the DeliveryState, and optionally settle the delivery as well.boolean
remoteSettled()
Gets whether the delivery was settled by the remote peer yet.DeliveryState
remoteState()
Gets the current remote state for the tracked delivery.Sender
sender()
Tracker
settle()
Settles the delivery locally, if notauto-settling
.boolean
settled()
java.util.concurrent.Future<Tracker>
settlementFuture()
Returns a future that can be used to wait for the remote to acknowledge receipt of a sent message by settling it.DeliveryState
state()
Gets the current local state for the tracked delivery.
-
-
-
Method Detail
-
sender
Sender sender()
- Returns:
- the
Sender
that was used to send the delivery that is being tracked.
-
settle
Tracker settle() throws ClientException
Settles the delivery locally, if notauto-settling
.- Returns:
- this
Tracker
instance. - Throws:
ClientException
- if an error occurs while performing the settlement.
-
settled
boolean settled()
- Returns:
- true if the sent message has been locally settled.
-
state
DeliveryState state()
Gets the current local state for the tracked delivery.- Returns:
- the delivery state
-
remoteState
DeliveryState remoteState()
Gets the current remote state for the tracked delivery.- Returns:
- the remote
DeliveryState
once a value is received from the remote.
-
remoteSettled
boolean remoteSettled()
Gets whether the delivery was settled by the remote peer yet.- Returns:
- whether the delivery is remotely settled
-
disposition
Tracker disposition(DeliveryState state, boolean settle) throws ClientException
Updates the DeliveryState, and optionally settle the delivery as well.- Parameters:
state
- the delivery state to applysettle
- whether tosettle()
the delivery at the same time- Returns:
- this
Tracker
instance. - Throws:
ClientException
- if an error occurs while applying the given disposition
-
settlementFuture
java.util.concurrent.Future<Tracker> settlementFuture()
Returns a future that can be used to wait for the remote to acknowledge receipt of a sent message by settling it.- Returns:
- a
Future
that can be used to wait on remote settlement.
-
awaitSettlement
Tracker awaitSettlement() throws ClientException
Waits if necessary for the remote to settle the sent delivery unless it has either already been settled or the original delivery was sent settled in which case the remote will not send aDisposition
back.- Returns:
- this
Tracker
instance. - Throws:
ClientException
- if an error occurs while awaiting the remote settlement.
-
awaitSettlement
Tracker awaitSettlement(long timeout, java.util.concurrent.TimeUnit unit) throws ClientException
Waits if necessary for the remote to settle the sent delivery unless it has either already been settled or the original delivery was sent settled in which case the remote will not send aDisposition
back.- Parameters:
timeout
- the maximum time to wait for the remote to settle.unit
- the time unit of the timeout argument.- Returns:
- this
Tracker
instance. - Throws:
ClientException
- if an error occurs while awaiting the remote settlement.
-
awaitAccepted
Tracker awaitAccepted() throws ClientException
Waits if necessary for the remote to settle the sent delivery with anAccepted
disposition unless it has either already been settled and accepted or the original delivery was sent settled in which case the remote will not send aDisposition
back.- Returns:
- this
Tracker
instance. - Throws:
ClientDeliveryStateException
- if the remote sends a disposition other than Accepted.ClientException
- if an error occurs while awaiting the remote settlement.
-
awaitAccepted
Tracker awaitAccepted(long timeout, java.util.concurrent.TimeUnit unit) throws ClientException
Waits if necessary for the remote to settle the sent delivery with anAccepted
disposition unless it has either already been settled and accepted or the original delivery was sent settled in which case the remote will not send aDisposition
back.- Parameters:
timeout
- the maximum time to wait for the remote to settle.unit
- the time unit of the timeout argument.- Returns:
- this
Tracker
instance. - Throws:
ClientDeliveryStateException
- if the remote sends a disposition other than Accepted.ClientException
- if an error occurs while awaiting the remote settlement.
-
-