protected void processLinkOpen(Link link) throws Exception { link.setSource(link.getRemoteSource()); link.setTarget(link.getRemoteTarget()); AmqpSession session = (AmqpSession) link.getSession().getContext(); if (link instanceof Receiver) { if (link.getRemoteTarget() instanceof Coordinator) { session.createCoordinator((Receiver) link); } else { session.createReceiver((Receiver) link); } } else { session.createSender((Sender) link); } }
protected void processLinkClose(Link link) throws Exception { Object context = link.getContext(); if (context instanceof AmqpLink) { ((AmqpLink) context).close();; } else { link.close(); link.free(); } }
@Override public void onFlow(Link link) throws Exception { if (link.getContext() != null) { ((ProtonDeliveryHandler) link.getContext()).onFlow(link.getCredit(), link.getDrain()); } }
protected void processLinkDetach(Link link) throws Exception { Object context = link.getContext(); if (context instanceof AmqpLink) { ((AmqpLink) context).detach(); } else { link.detach(); link.free(); } }
pumpIn( link.getSource().getAddress(), (Receiver)link ); if (link.getRemoteSource() != null) { link.setSource(link.getRemoteSource().copy()); if (link.getRemoteTarget() != null) { link.setTarget(link.getRemoteTarget().copy()); link.open(); _logger.log(Level.FINE, "Opened link " + link); pumpOut(link.getTarget().getAddress(), (Sender)link); if (link.getLocalState() == EndpointState.ACTIVE) link.close();
@Override public void onLinkRemoteOpen(Event event) { Link link = event.getLink(); if (link.getLocalState() == EndpointState.UNINITIALIZED) { if (link.getRemoteSource() != null) { link.setSource(link.getRemoteSource().copy()); } if (link.getRemoteTarget() != null) { link.setTarget(link.getRemoteTarget().copy()); } } open(link); }
if (link.getName().equals(this.senderLinkTag)) link.setTarget(target); link.setSenderSettleMode(SenderSettleMode.UNSETTLED); if (link.getName().equals(this.receiverLinkTag)) link.setSource(source);
link.setSource(link.getRemoteSource()); link.setTarget(link.getRemoteTarget()); link.open(); _logger.log(Level.FINE, "Opened link " + link); link.close();
logger.data(this, methodName, "LINK_REMOTE {} {} {}", link, link.getLocalState(), link.getRemoteState()); if (link.getLocalState() == EndpointState.ACTIVE) { final EngineConnection engineConnection = (EngineConnection)event.getConnection().getContext(); final EngineConnection.SubscriptionData sd = engineConnection.subscriptionData.get(link.getName()); if (link.getRemoteState() == EndpointState.ACTIVE) { sd.subscriber.tell(new SubscribeResponse(engineConnection, new SubscriptionTopic(link.getName())), this); } else if (link.getRemoteState() == EndpointState.CLOSED) { final ClientException clientException = getClientException(link.getRemoteCondition()); logger.data(this, methodName, event, clientException, this); sd.subscriber.tell(new SubscribeResponse(engineConnection, new SubscriptionTopic(link.getName()), clientException), this); if (link.getRemoteState() == EndpointState.CLOSED) { ClientException clientException = getClientException(link.getRemoteCondition()); if (link.getLocalState() != EndpointState.CLOSED && !link.detached()) { if (clientException == null) { clientException = new ClientException( link.close(); link.free(); EngineConnection.SubscriptionData sd = engineConnection.subscriptionData.remove(link.getName()); sd.subscriber.tell(new UnsubscribeResponse(engineConnection, new SubscriptionTopic(link.getName()), clientException), this); link.getRemoteState() == EndpointState.CLOSED) { if (link.getLocalState() != EndpointState.CLOSED) {
@Override public void onLinkInit(Event event) { // Codes_SRS_SERVICE_SDK_JAVA_AMQPFEEDBACKRECEIVEDHANDLER_12_015: [The event handler shall create a new Target (Proton) object using the given endpoint address] // Codes_SRS_SERVICE_SDK_JAVA_AMQPFEEDBACKRECEIVEDHANDLER_12_016: [The event handler shall get the Link (Proton) object and set its target to the created Target (Proton) object] Link link = event.getLink(); if (event.getLink().getName().equals(RECEIVE_TAG)) { Target t = new Target(); t.setAddress(ENDPOINT); Source source = new Source(); source.setAddress(ENDPOINT); link.setTarget(t); link.setSource(source); } }
@Override public void onResponse(AmqpProtocolConverter converter, Response response) throws IOException { if (response.isException()) { link.setSource(null); Throwable exception = ((ExceptionResponse) response).getException(); if (exception instanceof SecurityException) { link.setCondition(new ErrorCondition(AmqpError.UNAUTHORIZED_ACCESS, exception.getMessage())); } else { link.setCondition(new ErrorCondition(AmqpError.INTERNAL_ERROR, exception.getMessage())); } link.close(); link.free(); } } });
@Override public void onLinkRemoteDetach(Event event) { final Link link = event.getLink(); if(link != null) { TRACE_LOGGER.debug("link remote detach. linkName:{}", link.getName()); if (link.getLocalState() != EndpointState.CLOSED) { link.close(); } this.processOnClose(link, link.getRemoteCondition()); closeSession(link); } }
@Override public void close(ErrorCondition error) { if (!closed) { if (getEndpoint() != null) { if (getEndpoint() instanceof Sender) { getEndpoint().setSource(null); } else { getEndpoint().setTarget(null); } getEndpoint().setCondition(error); } close(); } }
private void handleRemoteLinkClosed(final Event event) { final Link link = event.getLink(); final ErrorCondition condition = link.getRemoteCondition(); if (link.getLocalState() != EndpointState.CLOSED) { link.setCondition(condition); link.close(); } this.processOnClose(link, condition); this.closeSession(link, condition); } }
if (link.getLocalState() != EndpointState.CLOSED) { if (TRACE_LOGGER.isWarnEnabled()) { TRACE_LOGGER.warn(String.format(Locale.US, "onConnectionError: messagingFactory[%s], hostname[%s], closing link [%s]", this.getClientId(), this.hostName, link.getName())); link.setCondition(error); link.close(); closedLinks.add(link);
protected void processLinkFlow(Link link) throws Exception { Object context = link.getContext(); if (context instanceof AmqpLink) { ((AmqpLink) context).flow(); } }
@Override public String getName() { return link.getName(); }
@Override public void close() { if (!closed) { if (getEndpoint() != null) { getEndpoint().setContext(null); getEndpoint().close(); getEndpoint().free(); } for (Runnable action : closeActions) { action.run(); } closeActions.clear(); opened = false; closed = true; } }
private void closeSession(Link link) { if (link.getSession() != null && link.getSession().getLocalState() != EndpointState.CLOSED) link.getSession().close(); } }
event.getLink().close(); event.getLink().free(); receiver.advance(); EngineConnection.SubscriptionData subData = engineConnection.subscriptionData.get(event.getLink().getName()); subData.unsettled++; QOS qos = delivery.remotelySettled() ? QOS.AT_MOST_ONCE : QOS.AT_LEAST_ONCE; subData.subscriber.tell(new DeliveryRequest(data, qos, event.getLink().getName(), delivery, event.getConnection()), this);