...
- LinkRegistry.putSendingLinkIfAbsent(String localContainerId, String remoteContrainerId, String linkName, Source source, Target target) -> Pair<Source, Target>
- LinkRegistry.putReceivingLinkIfAbsent(String localContainerId, String remoteContrainerId, String linkName, Source source, Target target) -> Pair<Source, Target>
- LinkRegistry.getSendvingLink(String localContainerId, String remoteContrainerId, String linkName) -> Pair<Source, Target>
- LinkRegistry.getReceivingLink(String localContainerId, String remoteContrainerId, String linkName) -> Pair<Source, Target>
- LinkRegistry.removeSendingLink(String localContainerId, String remoteContrainerId, String linkName) -> Pair<Source, Target>
- LinkRegistry.removeReceivingLink(String localContainerId, String remoteContrainerId, String linkName) -> Pair<Source, Target>
Alternative Design
In stead of a LinkRegistry we introduce a LinkManager with expanded responsibilities.
Link
The Link encapsulates the Source, Target, and LinkEndpoint and keeps a reference to the associated Session.
API
- sendFlow
- sendTransfer
- sendDisposition
- receiveFlow
- receiveTransfer
- receiveDisposition
The send* methods will most likely end up calling the corresponding methods on the session to do some session specific housekeeping and the actual sending
LinkManager API
- Link attachLink(Session_1_0 s, Attach a)
- void detachLink(Link l, Detach d)
Alternative Design 2
As in the other designs the Terminus will hold persistent state (e.g., Map<delivery-tag, unsettled state>)
LinkRegistry
The link registry is responsible for ensuring Link uniqueness and persistence.
API
- getSendingLink(String remoteContainerId, String linkName) -> Link
Always returns a non-null link. The session is responsible for checking that the link has valid Source and Targets.
Needs to be thread-safe - getReceivingLink(String remoteContainerId, String linkName) -> Link
See #getSendingLink() - removeSendingLink(String remoteContainerId, String linkName)
- removeReceivingLink(String remoteContainerId, String linkName)
- updateLinkTermini(Link link, Source source, Target target)
Link
The Link encapsulates the Source, Target, and LinkEndpoint and no further state.
API
- getLinkName() -> String
- getLocalContainerId() -> String
- getRemoteContainerId() -> String
- attach(Session s, Source s, Target t) -> Future<LinkEndpoint>
This must take care of link stealing (e.g., theifQueue)
LinkEndpoint
The LinkEndpoint is the object that the session interacts with.
This will have session related state (e.g., Map<delivery-ids, unsettled delivery state>).
API
- detach() -> Future<?>
Probably needs to be async to support Link stealing - send-/receive(Flow, Transfer, Disposition)