Fix DMF update cancel message (#397)

* Fix bug where DMF sends cancel for DDI targets.

Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com>

* Fix nullpointer when event consumer access target info.

Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com>
This commit is contained in:
Kai Zimmermann
2016-12-22 09:29:07 +01:00
committed by GitHub
parent e6f702c882
commit eb9fd0fea7
2 changed files with 9 additions and 0 deletions

View File

@@ -156,6 +156,10 @@ public class AmqpMessageDispatcherService extends BaseAmqpService {
void sendCancelMessageToTarget(final String tenant, final String controllerId, final Long actionId,
final URI address) {
if (!IpUtil.isAmqpUri(address)) {
return;
}
final Message message = getMessageConverter().toMessage(actionId,
createConnectorMessageProperties(tenant, controllerId, EventTopic.CANCEL_DOWNLOAD));

View File

@@ -409,10 +409,15 @@ public class JpaDeploymentManagement implements DeploymentManagement {
* the action id of the assignment
*/
private void cancelAssignDistributionSetEvent(final Target target, final Long actionId) {
loadLazyTargetInfo(target);
afterCommit.afterCommit(() -> eventPublisher
.publishEvent(new CancelTargetAssignmentEvent(target, actionId, applicationContext.getId())));
}
private static void loadLazyTargetInfo(final Target target) {
target.getTargetInfo();
}
@Override
@Modifying
@Transactional(isolation = Isolation.READ_COMMITTED)