Package org.apache.qpid.protonj2.client
Interface Link<T extends Link<T>>
- Type Parameters:
T
- The actual link type that is being created (Sender or Receiver).
- All Superinterfaces:
AutoCloseable
- All Known Subinterfaces:
Receiver
,Sender
,StreamReceiver
,StreamSender
- All Known Implementing Classes:
ClientLinkType
,ClientReceiver
,ClientReceiverLinkType
,ClientSender
,ClientSenderLinkType
,ClientStreamReceiver
,ClientStreamSender
Base for all AMQP link types (Sender, Receiver etc).
-
Method Summary
Modifier and TypeMethodDescriptionaddress()
Returns the address that theLink
instance will be subscribed to.client()
void
close()
Requests a close of theLink
at the remote and waits until the Link has been fully closed or until the configured close timeout is exceeded.void
close
(ErrorCondition error) Requests a close of theLink
at the remote and waits until the Link has been fully closed or until the configuredLinkOptions.closeTimeout()
is exceeded.closeAsync
(ErrorCondition error) String[]
Returns the desired capabilities that the remote provided upon successfully opening theLink
.void
detach()
Requests a detach of theLink
at the remote and waits until the Link has been fully detached or until the configuredLinkOptions.closeTimeout()
is exceeded.void
detach
(ErrorCondition error) Requests a detach of theLink
at the remote and waits until the Link has been fully detached or until the configuredLinkOptions.closeTimeout()
is exceeded.detachAsync
(ErrorCondition error) String[]
Returns the offered capabilities that the remote provided upon successfully opening theLink
.Returns the properties that the remote provided upon successfully opening theLink
.session()
source()
Returns an immutable view of the remoteSource
object assigned to this link.target()
Returns an immutable view of the remoteTarget
object assigned to this sender link.
-
Method Details
-
openFuture
-
client
Client client() -
connection
Connection connection()- Returns:
- the
Connection
instance that holds this session'sLink
-
session
Session session() -
close
void close()Requests a close of theLink
at the remote and waits until the Link has been fully closed or until the configured close timeout is exceeded.- Specified by:
close
in interfaceAutoCloseable
-
close
Requests a close of theLink
at the remote and waits until the Link has been fully closed or until the configuredLinkOptions.closeTimeout()
is exceeded.- Parameters:
error
- TheErrorCondition
to transmit to the remote along with the close operation.
-
detach
void detach()Requests a detach of theLink
at the remote and waits until the Link has been fully detached or until the configuredLinkOptions.closeTimeout()
is exceeded. -
detach
Requests a detach of theLink
at the remote and waits until the Link has been fully detached or until the configuredLinkOptions.closeTimeout()
is exceeded.- Parameters:
error
- TheErrorCondition
to transmit to the remote along with the detach operation.
-
closeAsync
-
closeAsync
Requests a close of theLink
link at the remote and returns aFuture
that will be completed once the link has been closed.- Parameters:
error
- TheErrorCondition
to transmit to the remote along with the close operation.- Returns:
- a
Future
that will be completed when the remote closes thisLink
link.
-
detachAsync
-
detachAsync
Requests a detach of theLink
link at the remote and returns aFuture
that will be completed once the link has been detached.- Parameters:
error
- TheErrorCondition
to transmit to the remote along with the detach operation.- Returns:
- a
Future
that will be completed when the remote detaches thisLink
link.
-
address
Returns the address that theLink
instance will be subscribed to. This method can block based on the type of link and how it was configured.- If the link is a Sender and it was configured as an anonymous sender then this method returns null as the link has no address.
- If a link was created with the dynamic node value enabled then the method will return the dynamically created address once the remote has attached its end of the opened link. Due to the need to await the remote peer to populate the dynamic address this method will block until the open of the link has completed.
- If not a dynamic link then the address returned is the address passed to the original link creation method.
- Returns:
- the address that this
Link
is was assigned to. - Throws:
ClientException
- if an error occurs while obtaining theLink
address.
-
source
Returns an immutable view of the remoteSource
object assigned to this link. If the attach has not completed yet this method will block to await the attach response which carries the remoteSource
.- Returns:
- the remote
Source
node configuration. - Throws:
ClientException
- if an error occurs while obtaining theLink
remoteSource
.
-
target
Returns an immutable view of the remoteTarget
object assigned to this sender link. If the attach has not completed yet this method will block to await the attach response which carries the remoteTarget
.- Returns:
- the remote
Target
node configuration. - Throws:
ClientException
- if an error occurs while obtaining theLink
remoteTarget
.
-
properties
Returns the properties that the remote provided upon successfully opening theLink
. If the attach has not completed yet this method will block to await the attach response which carries the remote properties. If the remote provides no properties this method will return null.- Returns:
- any properties provided from the remote once the sender has successfully opened.
- Throws:
ClientException
- if an error occurs while obtaining theLink
remote properties.
-
offeredCapabilities
Returns the offered capabilities that the remote provided upon successfully opening theLink
. If the attach has not completed yet this method will block to await the attach response which carries the remote offered capabilities. If the remote provides no capabilities this method will return null.- Returns:
- any capabilities provided from the remote once the sender has successfully opened.
- Throws:
ClientException
- if an error occurs while obtaining theLink
remote offered capabilities.
-
desiredCapabilities
Returns the desired capabilities that the remote provided upon successfully opening theLink
. If the attach has not completed yet this method will block to await the attach response which carries the remote desired capabilities. If the remote provides no capabilities this method will return null.- Returns:
- any desired capabilities provided from the remote once the sender has successfully opened.
- Throws:
ClientException
- if an error occurs while obtaining theLink
remote desired capabilities.
-