AmqpMessageDispatcherService extends BaseAmqpService { @EventListener(classes = CancelTargetAssignmentEvent.class) protected void targetCancelAssignmentToDistributionSet(final CancelTargetAssignmentEvent cancelEvent) { if (!shouldBeProcessed(cancelEvent)) { return; } final Target target = cancelEvent.getEntity(); if (target != null) { sendCancelMessageToTarget(cancelEvent.getTenant(), target.getControllerId(), cancelEvent.getActionId(), target.getAddress()); } else { LOG.warn( "Cannot process the received CancelTargetAssignmentEvent with action ID {} because the referenced target with ID {} does no longer exist.", cancelEvent.getActionId(), cancelEvent.getEntityId()); } } protected  AmqpMessageDispatcherService(final RabbitTemplate rabbitTemplate,
            final AmqpMessageSenderService amqpSenderService, final ArtifactUrlHandler artifactUrlHandler,
            final SystemSecurityContext systemSecurityContext, final SystemManagement systemManagement,
            final TargetManagement targetManagement, final ServiceMatcher serviceMatcher,
            final DistributionSetManagement distributionSetManagement,
            final SoftwareModuleManagement softwareModuleManagement, final DeploymentManagement deploymentManagement);   }
@Test @Description("Verifies that send cancel event works") public void testSendCancelRequest() { final CancelTargetAssignmentEvent cancelTargetAssignmentDistributionSetEvent = new CancelTargetAssignmentEvent( testTarget, 1L, serviceMatcher.getServiceId()); amqpMessageDispatcherService .targetCancelAssignmentToDistributionSet(cancelTargetAssignmentDistributionSetEvent); final Message sendMessage = createArgumentCapture( cancelTargetAssignmentDistributionSetEvent.getEntity().getAddress()); assertCancelMessage(sendMessage); }