use of com.sequenceiq.freeipa.flow.freeipa.downscale.event.stoptelemetry.StopTelemetryRequest in project cloudbreak by hortonworks.
the class FreeIpaDownscaleActions method stopTelemetryAction.
@Bean(name = "DOWNSCALE_STOP_TELEMETRY_STATE")
public Action<?, ?> stopTelemetryAction() {
return new AbstractDownscaleAction<>(StackEvent.class) {
@Override
protected void doExecute(StackContext context, StackEvent payload, Map<Object, Object> variables) {
Stack stack = context.getStack();
stackUpdater.updateStackStatus(stack.getId(), getInProgressStatus(variables), "Stopping telemetry");
List<String> repairInstanceIds = getInstanceIds(variables);
StopTelemetryRequest stopTelemetryRequest = new StopTelemetryRequest(stack.getId(), repairInstanceIds);
sendEvent(context, stopTelemetryRequest.selector(), stopTelemetryRequest);
}
};
}
use of com.sequenceiq.freeipa.flow.freeipa.downscale.event.stoptelemetry.StopTelemetryRequest in project cloudbreak by hortonworks.
the class StopTelemetryHandler method accept.
@Override
public void accept(Event<StopTelemetryRequest> event) {
StopTelemetryRequest request = event.getData();
LOGGER.info("Stop telemetry agents gracefully (if needed)...");
telemetryAgentService.stopTelemetryAgent(request.getResourceId(), request.getInstanceIds());
StopTelemetryResponse response = new StopTelemetryResponse(request.getResourceId());
eventBus.notify(EventSelectorUtil.selector(StopTelemetryResponse.class), new Event<>(event.getHeaders(), response));
}
use of com.sequenceiq.freeipa.flow.freeipa.downscale.event.stoptelemetry.StopTelemetryRequest in project cloudbreak by hortonworks.
the class StopTelemetryHandlerTest method testCallsTelemetryAgentService.
@Test
void testCallsTelemetryAgentService() {
List<String> instanceIds = List.of("i-1");
StopTelemetryRequest request = new StopTelemetryRequest(1L, instanceIds);
underTest.accept(new Event<>(request));
verify(telemetryAgentService, times(1)).stopTelemetryAgent(1L, instanceIds);
verify(eventBus).notify(eq("STOPTELEMETRYRESPONSE"), ArgumentMatchers.<Event>any());
}
Aggregations