Package org.apache.qpid.protonj2.client
Interface Link<T extends Link<T>>
-
- All Superinterfaces:
java.lang.AutoCloseable
- All Known Subinterfaces:
Receiver,Sender,StreamReceiver,StreamSender
- All Known Implementing Classes:
ClientLinkType,ClientReceiver,ClientReceiverLinkType,ClientSender,ClientSenderLinkType,ClientStreamReceiver,ClientStreamSender
public interface Link<T extends Link<T>> extends java.lang.AutoCloseableBase for all AMQP link types (Sender, Receiver etc).
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description java.lang.Stringaddress()Returns the address that theLinkinstance will be subscribed to.Clientclient()voidclose()Requests a close of theLinkat the remote and waits until the Link has been fully closed or until the configured close timeout is exceeded.voidclose(ErrorCondition error)Requests a close of theLinkat the remote and waits until the Link has been fully closed or until the configuredLinkOptions.closeTimeout()is exceeded.java.util.concurrent.Future<T>closeAsync()Requests a close of theLinklink at the remote and returns aFuturethat will be completed once the link has been closed.java.util.concurrent.Future<T>closeAsync(ErrorCondition error)Requests a close of theLinklink at the remote and returns aFuturethat will be completed once the link has been closed.Connectionconnection()java.lang.String[]desiredCapabilities()Returns the desired capabilities that the remote provided upon successfully opening theLink.voiddetach()Requests a detach of theLinkat the remote and waits until the Link has been fully detached or until the configuredLinkOptions.closeTimeout()is exceeded.voiddetach(ErrorCondition error)Requests a detach of theLinkat the remote and waits until the Link has been fully detached or until the configuredLinkOptions.closeTimeout()is exceeded.java.util.concurrent.Future<T>detachAsync()Requests a detach of theLinklink at the remote and returns aFuturethat will be completed once the link has been detached.java.util.concurrent.Future<T>detachAsync(ErrorCondition error)Requests a detach of theLinklink at the remote and returns aFuturethat will be completed once the link has been detached.java.lang.String[]offeredCapabilities()Returns the offered capabilities that the remote provided upon successfully opening theLink.java.util.concurrent.Future<T>openFuture()java.util.Map<java.lang.String,java.lang.Object>properties()Returns the properties that the remote provided upon successfully opening theLink.Sessionsession()Sourcesource()Returns an immutable view of the remoteSourceobject assigned to this link.Targettarget()Returns an immutable view of the remoteTargetobject assigned to this sender link.
-
-
-
Method Detail
-
openFuture
java.util.concurrent.Future<T> openFuture()
- Returns:
- a
Futurethat will be completed when the remote opens thisLink.
-
connection
Connection connection()
- Returns:
- the
Connectioninstance that holds this session'sLink
-
close
void close()
Requests a close of theLinkat the remote and waits until the Link has been fully closed or until the configured close timeout is exceeded.- Specified by:
closein interfacejava.lang.AutoCloseable
-
close
void close(ErrorCondition error)
Requests a close of theLinkat the remote and waits until the Link has been fully closed or until the configuredLinkOptions.closeTimeout()is exceeded.- Parameters:
error- TheErrorConditionto transmit to the remote along with the close operation.
-
detach
void detach()
Requests a detach of theLinkat the remote and waits until the Link has been fully detached or until the configuredLinkOptions.closeTimeout()is exceeded.
-
detach
void detach(ErrorCondition error)
Requests a detach of theLinkat the remote and waits until the Link has been fully detached or until the configuredLinkOptions.closeTimeout()is exceeded.- Parameters:
error- TheErrorConditionto transmit to the remote along with the detach operation.
-
closeAsync
java.util.concurrent.Future<T> closeAsync()
Requests a close of theLinklink at the remote and returns aFuturethat will be completed once the link has been closed.- Returns:
- a
Futurethat will be completed when the remote closes thisLinklink.
-
closeAsync
java.util.concurrent.Future<T> closeAsync(ErrorCondition error)
Requests a close of theLinklink at the remote and returns aFuturethat will be completed once the link has been closed.- Parameters:
error- TheErrorConditionto transmit to the remote along with the close operation.- Returns:
- a
Futurethat will be completed when the remote closes thisLinklink.
-
detachAsync
java.util.concurrent.Future<T> detachAsync()
Requests a detach of theLinklink at the remote and returns aFuturethat will be completed once the link has been detached.- Returns:
- a
Futurethat will be completed when the remote detaches thisLinklink.
-
detachAsync
java.util.concurrent.Future<T> detachAsync(ErrorCondition error)
Requests a detach of theLinklink at the remote and returns aFuturethat will be completed once the link has been detached.- Parameters:
error- TheErrorConditionto transmit to the remote along with the detach operation.- Returns:
- a
Futurethat will be completed when the remote detaches thisLinklink.
-
address
java.lang.String address() throws ClientExceptionReturns the address that theLinkinstance 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
Linkis was assigned to. - Throws:
ClientException- if an error occurs while obtaining theLinkaddress.
-
source
Source source() throws ClientException
Returns an immutable view of the remoteSourceobject 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
Sourcenode configuration. - Throws:
ClientException- if an error occurs while obtaining theLinkremoteSource.
-
target
Target target() throws ClientException
Returns an immutable view of the remoteTargetobject 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
Targetnode configuration. - Throws:
ClientException- if an error occurs while obtaining theLinkremoteTarget.
-
properties
java.util.Map<java.lang.String,java.lang.Object> properties() throws ClientExceptionReturns 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 theLinkremote properties.
-
offeredCapabilities
java.lang.String[] offeredCapabilities() throws ClientExceptionReturns 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 theLinkremote offered capabilities.
-
desiredCapabilities
java.lang.String[] desiredCapabilities() throws ClientExceptionReturns 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 theLinkremote desired capabilities.
-
-