Search in sources :

Example 1 with StructuredNotificationEvent

use of com.sequenceiq.cloudbreak.structuredevent.event.StructuredNotificationEvent in project cloudbreak by hortonworks.

the class CloudbreakEventHandler method accept.

@Override
public void accept(Event<StructuredNotificationEvent> cloudbreakEvent) {
    StructuredNotificationEvent structuredNotificationEvent = cloudbreakEvent.getData();
    structuredEventClient.sendStructuredEvent(structuredNotificationEvent);
    CloudbreakEventsJson cloudbreakEventsJson = conversionService.convert(structuredNotificationEvent, CloudbreakEventsJson.class);
    notificationSender.send(notificationAssemblingService.createNotification(cloudbreakEventsJson));
}
Also used : CloudbreakEventsJson(com.sequenceiq.cloudbreak.api.model.CloudbreakEventsJson) StructuredNotificationEvent(com.sequenceiq.cloudbreak.structuredevent.event.StructuredNotificationEvent)

Example 2 with StructuredNotificationEvent

use of com.sequenceiq.cloudbreak.structuredevent.event.StructuredNotificationEvent in project cloudbreak by hortonworks.

the class DefaultCloudbreakEventService method fireCloudbreakInstanceGroupEvent.

@Override
public void fireCloudbreakInstanceGroupEvent(Long stackId, String eventType, String eventMessage, String instanceGroupName) {
    StructuredNotificationEvent eventData = structuredFlowEventFactory.createStructuredNotificationEvent(stackId, eventType, eventMessage, instanceGroupName);
    LOGGER.info("Firing Cloudbreak event: stackId: {}, type: {}, message: {}, instancegroup: {}", stackId, eventType, eventMessage, instanceGroupName);
    reactor.notify(CLOUDBREAK_EVENT, eventFactory.createEvent(eventData));
}
Also used : StructuredNotificationEvent(com.sequenceiq.cloudbreak.structuredevent.event.StructuredNotificationEvent)

Example 3 with StructuredNotificationEvent

use of com.sequenceiq.cloudbreak.structuredevent.event.StructuredNotificationEvent in project cloudbreak by hortonworks.

the class DefaultCloudbreakEventService method fireCloudbreakEvent.

@Override
public void fireCloudbreakEvent(Long entityId, String eventType, String eventMessage) {
    StructuredNotificationEvent eventData = structuredFlowEventFactory.createStructuredNotificationEvent(entityId, eventType, eventMessage, null);
    LOGGER.info("Firing Cloudbreak event: entityId: {}, type: {}, message: {}", entityId, eventType, eventMessage);
    reactor.notify(CLOUDBREAK_EVENT, eventFactory.createEvent(eventData));
}
Also used : StructuredNotificationEvent(com.sequenceiq.cloudbreak.structuredevent.event.StructuredNotificationEvent)

Example 4 with StructuredNotificationEvent

use of com.sequenceiq.cloudbreak.structuredevent.event.StructuredNotificationEvent in project cloudbreak by hortonworks.

the class ServiceTestUtils method createEvent.

public static StructuredNotificationEvent createEvent(Long stackId, int nodeCount, String eventStatus, Date eventTimestamp) {
    OperationDetails operation = new OperationDetails(eventTimestamp.getTime(), "NOTIFICATION", "STACK", stackId, "account", "userid", "username", "cbId", "cbVersion");
    NotificationDetails notification = new NotificationDetails();
    notification.setNotificationType(eventStatus);
    notification.setNodeCount(nodeCount);
    return new StructuredNotificationEvent(operation, notification);
}
Also used : OperationDetails(com.sequenceiq.cloudbreak.structuredevent.event.OperationDetails) NotificationDetails(com.sequenceiq.cloudbreak.structuredevent.event.NotificationDetails) StructuredNotificationEvent(com.sequenceiq.cloudbreak.structuredevent.event.StructuredNotificationEvent)

Example 5 with StructuredNotificationEvent

use of com.sequenceiq.cloudbreak.structuredevent.event.StructuredNotificationEvent in project cloudbreak by hortonworks.

the class StructuredNotificationEventToCloudbreakEventJsonConverterTest method createSource.

@Override
public StructuredNotificationEvent createSource() {
    OperationDetails operation = new OperationDetails(Calendar.getInstance().getTimeInMillis(), "NOTIFICATION", "STACK", 1L, "account", "owner", "userName", "cbId", "cbVersion");
    NotificationDetails notification = new NotificationDetails();
    notification.setInstanceGroup("master");
    notification.setRegion("us");
    notification.setStackName("usagestack");
    notification.setStackId(1L);
    notification.setNotification("message");
    notification.setNotificationType("eventType");
    notification.setCloud(GCP);
    notification.setBlueprintName("blueprintName");
    notification.setBlueprintId(1L);
    notification.setStackStatus(AVAILABLE.name());
    notification.setNodeCount(1);
    notification.setClusterStatus(AVAILABLE.name());
    notification.setClusterId(1L);
    notification.setClusterName("test");
    return new StructuredNotificationEvent(operation, notification);
}
Also used : OperationDetails(com.sequenceiq.cloudbreak.structuredevent.event.OperationDetails) NotificationDetails(com.sequenceiq.cloudbreak.structuredevent.event.NotificationDetails) StructuredNotificationEvent(com.sequenceiq.cloudbreak.structuredevent.event.StructuredNotificationEvent)

Aggregations

StructuredNotificationEvent (com.sequenceiq.cloudbreak.structuredevent.event.StructuredNotificationEvent)6 NotificationDetails (com.sequenceiq.cloudbreak.structuredevent.event.NotificationDetails)3 OperationDetails (com.sequenceiq.cloudbreak.structuredevent.event.OperationDetails)3 CloudbreakEventsJson (com.sequenceiq.cloudbreak.api.model.CloudbreakEventsJson)1 Blueprint (com.sequenceiq.cloudbreak.domain.Blueprint)1 Cluster (com.sequenceiq.cloudbreak.domain.Cluster)1 Stack (com.sequenceiq.cloudbreak.domain.Stack)1 UserProfile (com.sequenceiq.cloudbreak.domain.UserProfile)1