6
6
import io .fabric8 .kubernetes .client .dsl .Resource ;
7
7
import io .javaoperatorsdk .operator .api .*;
8
8
import io .javaoperatorsdk .operator .processing .event .Event ;
9
+ import io .javaoperatorsdk .operator .processing .event .EventSourceManager ;
9
10
import io .javaoperatorsdk .operator .processing .event .internal .CustomResourceEvent ;
10
11
import org .slf4j .Logger ;
11
12
import org .slf4j .LoggerFactory ;
@@ -28,6 +29,7 @@ public class EventDispatcher {
28
29
private final CustomResourceFacade customResourceFacade ;
29
30
private final boolean generationAware ;
30
31
private final Map <String , Long > lastGenerationProcessedSuccessfully = new ConcurrentHashMap <>();
32
+ private EventSourceManager eventSourceManager ;
31
33
32
34
public EventDispatcher (ResourceController controller ,
33
35
String finalizer ,
@@ -38,6 +40,10 @@ public EventDispatcher(ResourceController controller,
38
40
this .generationAware = generationAware ;
39
41
}
40
42
43
+ public void setEventSourceManager (EventSourceManager eventSourceManager ) {
44
+ this .eventSourceManager = eventSourceManager ;
45
+ }
46
+
41
47
public PostExecutionControl handleEvent (ExecutionScope event ) {
42
48
try {
43
49
return handDispatch (event );
@@ -61,7 +67,7 @@ private PostExecutionControl handDispatch(ExecutionScope executionScope) {
61
67
log .debug ("Skipping event dispatching since its marked for deletion but has no finalizer: {}" , executionScope );
62
68
return PostExecutionControl .defaultDispatch ();
63
69
}
64
- Context context = new DefaultContext (executionScope . getCustomResource () , executionScope .getEvents ());
70
+ Context context = new DefaultContext (eventSourceManager , executionScope .getEvents ());
65
71
if (markedForDeletion (resource )) {
66
72
return handleDelete (resource , context );
67
73
} else {
0 commit comments