private static void initSender(Vertx vertx, ProtonConnection connection, ProtonSender sender) { org.apache.qpid.proton.amqp.messaging.Source remoteSource = (org.apache.qpid.proton.amqp.messaging.Source) sender.getRemoteSource(); if(remoteSource == null) {
public Source getRemoteSource() { return sender.getRemoteSource(); }
private void partitionsAssignedHandler(Set<TopicPartition> partitions) { if (partitions.isEmpty()) { sendAmqpError(AmqpBridge.newError(AmqpBridge.AMQP_ERROR_NO_PARTITIONS, "All partitions already have a receiver")); } else { if (!this.sender.isOpen()) { this.sender .setSource(this.sender.getRemoteSource()) .open(); } } }
private void senderOpenHandler(ProtonConnection connection, ProtonSender sender) { Source source = (Source) sender.getRemoteSource(); sender.setSource(source); log.info("[{}]: Got subscription request from {} on {}", containerId, connection.getRemoteContainer(), source.getAddress()); if (result.succeeded()) { sender.open(); log.info("[{}]: Opened sender for subscriber {} for address {}", containerId, connection.getRemoteContainer(), sender.getRemoteSource().getAddress()); } else { sender.close(); log.info("[{}]: Failed creating subscriber {} for address {}", containerId, connection.getRemoteContainer(), sender.getRemoteSource().getAddress(), result.cause());
protected void handleSenderOpen(final ProtonConnection con, final ProtonSender sender) { final Source remoteSource = sender.getRemoteSource(); LOG.debug("client [{}] wants to open a link for receiving messages [address: {}]", con.getRemoteContainer(), remoteSource); } else { Constants.copyProperties(con, sender); sender.setSource(sender.getRemoteSource()); endpoint.onLinkAttach(con, sender, targetResource);
final Source remoteSource = sender.getRemoteSource(); LOG.debug("client [{}] wants to open a link for receiving messages [address: {}]", con.getRemoteContainer(), remoteSource); if (isAuthorized) { copyConnectionId(con.attachments(), sender.attachments()); sender.setSource(sender.getRemoteSource()); endpoint.onLinkAttach(sender, targetResource); } else {
final Source remoteSource = sender.getRemoteSource(); LOG.debug("client [container: {}] wants to open a link [address: {}] for receiving messages", con.getRemoteContainer(), remoteSource); if (authAttempt.succeeded() && authAttempt.result()) { Constants.copyProperties(con, sender); sender.setSource(sender.getRemoteSource()); sender.setTarget(sender.getRemoteTarget()); endpoint.onLinkAttach(con, sender, targetResource);
final Source remoteSource = sender.getRemoteSource(); LOG.debug("client [container: {}] wants to open a link [address: {}] for receiving messages", con.getRemoteContainer(), remoteSource); if (authAttempt.succeeded() && authAttempt.result()) { Constants.copyProperties(con, sender); sender.setSource(sender.getRemoteSource()); sender.setTarget(sender.getRemoteTarget()); endpoint.onLinkAttach(con, sender, targetResource);
String address = this.sender.getRemoteSource().getAddress(); Source source = (Source) this.sender.getRemoteSource(); Map<Symbol, Object> filters = source.getFilter();
private Future<MessageConsumer> openCommandSenderLink( final ProtonSender sender, final ResourceIdentifier address, final Device authenticatedDevice, final Span span) { return createCommandConsumer(sender, address).map(consumer -> { final String tenantId = address.getTenantId(); final String deviceId = address.getResourceId(); sender.setSource(sender.getRemoteSource()); sender.setTarget(sender.getRemoteTarget()); sender.setQoS(ProtonQoS.AT_LEAST_ONCE); final Handler<AsyncResult<ProtonSender>> detachHandler = link -> { final Span detachHandlerSpan = newSpan("detach Command receiver", authenticatedDevice); sendDisconnectedTtdEvent(tenantId, deviceId, authenticatedDevice, detachHandlerSpan.context()); consumer.close(null); onLinkDetach(sender); detachHandlerSpan.finish(); }; HonoProtonHelper.setCloseHandler(sender, detachHandler); HonoProtonHelper.setDetachHandler(sender, detachHandler); sender.open(); // At this point, the remote peer's receiver link is successfully opened and is ready to receive // commands. Send "device ready for command" notification downstream. LOG.debug("established link [address: {}] for sending commands to device", address); sendConnectedTtdEvent(tenantId, deviceId, authenticatedDevice, span.context()); return consumer; }).otherwise(t -> { throw new ServerErrorException(HttpURLConnection.HTTP_UNAVAILABLE, "cannot create command consumer"); }); }
getResourceIdentifier(sender.getRemoteSource()) .compose(address -> validateAddress(address, authenticatedDevice)) .map(validAddress -> {
Source remoteSource = (Source) serverSender.getRemoteSource(); context.assertNotNull(remoteSource, "source should not be null"); context.assertEquals(testName, remoteSource.getAddress(), "expected given address");
Source remoteSource = (Source) serverSender.getRemoteSource(); context.assertNotNull(remoteSource, "source should not be null"); context.assertEquals(testAddress, remoteSource.getAddress(), "expected given address");
Source remoteSource = (Source) serverSender.getRemoteSource(); context.assertNotNull(remoteSource, "source should not be null"); context.assertEquals(testName, remoteSource.getAddress(), "expected given address");
Source remoteSource = (Source) serverSender.getRemoteSource(); context.assertNotNull(remoteSource, "source should not be null"); context.assertTrue(remoteSource.getDynamic(), "source should be dynamic");
Source remoteSource = (Source) serverSender.getRemoteSource(); context.assertNotNull(remoteSource, "source should not be null"); context.assertEquals(testName, remoteSource.getAddress(), "expected given address");
Source remoteSource = (Source) serverSender.getRemoteSource(); context.assertNotNull(remoteSource, "source should not be null"); context.assertEquals(testName, remoteSource.getAddress(), "expected given address");