Search in sources :

Example 1 with UploadRecipesRequest

use of com.sequenceiq.cloudbreak.reactor.api.event.recipe.UploadRecipesRequest in project cloudbreak by hortonworks.

the class UploadRecipesHandler method accept.

@Override
public void accept(Event<UploadRecipesRequest> event) {
    UploadRecipesRequest request = event.getData();
    Selectable result;
    Long stackId = request.getStackId();
    try {
        Stack stack = stackService.getByIdWithLists(stackId);
        Set<HostGroup> hostGroups = hostGroupService.getByCluster(stack.getCluster().getId());
        recipeEngine.uploadRecipes(stack, hostGroups);
        result = new UploadRecipesSuccess(stackId);
    } catch (Exception e) {
        LOGGER.error("Failed to upload recipes", e);
        result = new UploadRecipesFailed(stackId, e);
    }
    eventBus.notify(result.selector(), new Event<>(event.getHeaders(), result));
}
Also used : UploadRecipesFailed(com.sequenceiq.cloudbreak.reactor.api.event.recipe.UploadRecipesFailed) Selectable(com.sequenceiq.cloudbreak.cloud.event.Selectable) HostGroup(com.sequenceiq.cloudbreak.domain.HostGroup) UploadRecipesSuccess(com.sequenceiq.cloudbreak.reactor.api.event.recipe.UploadRecipesSuccess) UploadRecipesRequest(com.sequenceiq.cloudbreak.reactor.api.event.recipe.UploadRecipesRequest) Stack(com.sequenceiq.cloudbreak.domain.Stack)

Aggregations

Selectable (com.sequenceiq.cloudbreak.cloud.event.Selectable)1 HostGroup (com.sequenceiq.cloudbreak.domain.HostGroup)1 Stack (com.sequenceiq.cloudbreak.domain.Stack)1 UploadRecipesFailed (com.sequenceiq.cloudbreak.reactor.api.event.recipe.UploadRecipesFailed)1 UploadRecipesRequest (com.sequenceiq.cloudbreak.reactor.api.event.recipe.UploadRecipesRequest)1 UploadRecipesSuccess (com.sequenceiq.cloudbreak.reactor.api.event.recipe.UploadRecipesSuccess)1