use of org.apache.flink.runtime.source.event.SourceEventWrapper in project flink by apache.
the class SourceCoordinatorContext method sendEventToSourceReader.
@Override
public void sendEventToSourceReader(int subtaskId, SourceEvent event) {
checkSubtaskIndex(subtaskId);
callInCoordinatorThread(() -> {
final OperatorCoordinator.SubtaskGateway gateway = getGatewayAndCheckReady(subtaskId);
gateway.sendEvent(new SourceEventWrapper(event));
return null;
}, String.format("Failed to send event %s to subtask %d", event, subtaskId));
}
use of org.apache.flink.runtime.source.event.SourceEventWrapper in project flink by apache.
the class SourceOperatorTest method testHandleAddSourceEvent.
@Test
public void testHandleAddSourceEvent() throws Exception {
operator.initializeState(context.createStateContext());
operator.open();
SourceEvent event = new SourceEvent() {
};
operator.handleOperatorEvent(new SourceEventWrapper(event));
// The source reader should have been assigned two splits.
assertEquals(Collections.singletonList(event), mockSourceReader.getReceivedSourceEvents());
}
Aggregations