Search in sources :

Example 1 with CreateUserDataSuccess

use of com.sequenceiq.cloudbreak.reactor.api.event.stack.userdata.CreateUserDataSuccess in project cloudbreak by hortonworks.

the class CreateUserDataHandler method accept.

@Override
public void accept(Event<CreateUserDataRequest> event) {
    StackEvent request = event.getData();
    Selectable response;
    try {
        idBrokerService.generateIdBrokerSignKey(request.getResourceId());
        userDataService.createUserData(request.getResourceId());
        response = new CreateUserDataSuccess(request.getResourceId());
    } catch (Exception e) {
        LOGGER.error("Creating user data has failed", e);
        response = new CreateUserDataFailed(request.getResourceId(), e);
    }
    eventBus.notify(response.selector(), new Event<>(event.getHeaders(), response));
}
Also used : CreateUserDataFailed(com.sequenceiq.cloudbreak.reactor.api.event.stack.userdata.CreateUserDataFailed) StackEvent(com.sequenceiq.cloudbreak.reactor.api.event.StackEvent) Selectable(com.sequenceiq.cloudbreak.common.event.Selectable) CreateUserDataSuccess(com.sequenceiq.cloudbreak.reactor.api.event.stack.userdata.CreateUserDataSuccess)

Aggregations

Selectable (com.sequenceiq.cloudbreak.common.event.Selectable)1 StackEvent (com.sequenceiq.cloudbreak.reactor.api.event.StackEvent)1 CreateUserDataFailed (com.sequenceiq.cloudbreak.reactor.api.event.stack.userdata.CreateUserDataFailed)1 CreateUserDataSuccess (com.sequenceiq.cloudbreak.reactor.api.event.stack.userdata.CreateUserDataSuccess)1