void sendUpdateMessageToTarget( final String tenant, final Target target, final Long actionId, final Collection<org.eclipse.hawkbit.repository.model.SoftwareModule> modules) { if (target == null) { return; } final URI targetAdress = target.getTargetInfo().getAddress(); if (!IpUtil.isAmqpUri(targetAdress)) { return; } final DownloadAndUpdateRequest downloadAndUpdateRequest = new DownloadAndUpdateRequest(); downloadAndUpdateRequest.setActionId(actionId); final String targetSecurityToken = systemSecurityContext.runAsSystem(target::getSecurityToken); downloadAndUpdateRequest.setTargetSecurityToken(targetSecurityToken); for (final org.eclipse.hawkbit.repository.model.SoftwareModule softwareModule : modules) { final SoftwareModule amqpSoftwareModule = convertToAmqpSoftwareModule(target, softwareModule); downloadAndUpdateRequest.addSoftwareModule(amqpSoftwareModule); } final Message message = getMessageConverter() .toMessage( downloadAndUpdateRequest, createConnectorMessageProperties( tenant, target.getControllerId(), EventTopic.DOWNLOAD_AND_INSTALL)); amqpSenderService.sendMessage(message, targetAdress); }
void sendCancelMessageToTarget( final String tenant, final String controllerId, final Long actionId, final URI address) { final Message message = getMessageConverter() .toMessage( actionId, createConnectorMessageProperties(tenant, controllerId, EventTopic.CANCEL_DOWNLOAD)); amqpSenderService.sendMessage(message, address); }