public AttachmentQuery forNotification(Notification notification) { this.notificationId = notification.getNotificationId(); return this; }
public void deleteNotification(String domainName, Notification notification) { Response response = client.target(apiPath + "/v2/admin/domains").path(domainName).path("notifications").path(notification.getNotificationId()) .request(MediaType.APPLICATION_JSON_TYPE) .delete(); HttpStatusCode statusCode = HttpStatusCode.findByCode(response.getStatus()); if (statusCode != HttpStatusCode.NO_CONTENT) { throw ApiException.fromCode(statusCode, "Delete of notification FAILED: " + response.getStatusInfo()); } }
private void createTask(NotificationDomain notificationDomain, Notification notification, List<TaskEntity> tasks, NotificationRef notificationRef, Destination destination) { try { log.info("Creating task (notification={}, destination={})", notification.getNotificationId(), destination.getName()); CreateTask create = CreateTask.create(notificationRef, destination); TaskEntity task = notificationDomain.createTask(create, notification); tasks.add(task); // log.info("Signalling creation of the task (notification={}, destination={}, task={})", notification.getNotificationId(), task.getTaskId(), destination); // eventBus.taskCreated(notificationDomain.getDomainName(), task, notification); } catch (Exception e) { notify(notification, e, format("Exception generating task (notification=%s, destination=%s).", notification.getNotificationId(), destination.getName())); } }
private List<TaskEntity> createTask(NotificationDomain notificationDomain, Notification notification) { log.info("Generating tasks for notification {}", notification.getNotificationId()); List<TaskEntity> tasks = new ArrayList<>(); try { // Find destinations. NotificationRef notificationRef = notification.toNotificationRef(); Set<Destination> destinations = notificationDomain.findDestinations(notification); log.info("Found {} destinations", destinations.size()); for (Destination destination : destinations) { createTask(notificationDomain, notification, tasks, notificationRef, destination); } log.info("Created {} tasks.", tasks.size()); } catch (Exception e) { notify(notification, e, format("Exception generating tasks (notification=%s).", notification.getNotificationId())); } return tasks; }
@Override public void taskCreated(String domainName, TaskEntity task, Notification notification) { try { NotificationDomain notificationDomain = domainKernel.notificationDomain(domainName); Map<String, List<TaskEntity>> tasks = new HashMap<>(); tasks.put(task.getDestination().getProvider(), Arrays.asList(task)); processTasksByProvider(notificationDomain, tasks); } catch (Exception e) { notify(notification, e, format("Unexpected exception while processing task (domain=%s, notification=%s, task=%s).", domainName, notification.getNotificationId(), task.getTaskId())); } }
public boolean isMatch(Notification notification) { try { engine.eval(jsFunc); return (boolean) invocable.invokeFunction("eval", notification); } catch (Exception e) { notify(notification, e, format("Exception testing match (domain=%s, notification=%s, route=%s)", notification.getDomainName(), notification.getNotificationId(), route.getName())); // Don't blow up the world, just return false. return false; } }
public MessageModel(DomainProfile domainProfile, Notification notification, Task task) { destinationName = task.getDestination().getName(); destinationMap = task.getDestination().getArguments(); cc = destinationMap.get("cc"); self = (notification.getSelf() == null) ? null : notification.getSelf().toASCIIString(); notificationId = notification.getNotificationId(); revision = notification.getRevision(); topic = notification.getTopic(); summary = notification.getSummary(); trackingId = notification.getTrackingId(); attachments = notification.getAttachmentInfoList(); exception = notification.getExceptionInfo(); causes = (exception == null) ? emptyList() : unmodifiableList(exception.getCauses()); traitMap = notification.getTraitMap(); ZoneId zoneId = ZoneId.systemDefault(); createdAt = notification.getCreatedAt().withZoneSameInstant(zoneId); profileId = domainProfile.getProfileId(); domainName = domainProfile.getDomainName(); domainStatus = domainProfile.getDomainStatus(); apiKey = domainProfile.getApiKey(); apiPassword = domainProfile.getApiPassword(); notificationDbName = domainProfile.getNotificationDbName(); requestDbName = domainProfile.getRequestDbName(); routeCatalog = domainProfile.getRouteCatalog(); }
domainName, processorName, notification.getNotificationId(), localTaskEntity.getTaskId()));