Skip to content

Commit 0060457

Browse files
committed
feat: external resource with generated id support
1 parent 0092f0a commit 0060457

File tree

3 files changed

+23
-1
lines changed

3 files changed

+23
-1
lines changed

operator-framework-core/src/main/java/io/javaoperatorsdk/operator/processing/event/source/AbstractEventSource.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
public abstract class AbstractEventSource implements EventSource {
77
private EventHandler handler;
88
private volatile boolean running = false;
9+
private EventSourceStartPriority eventSourceStartPriority;
910

1011
protected EventHandler getEventHandler() {
1112
return handler;
@@ -29,4 +30,14 @@ public void start() throws OperatorException {
2930
public void stop() throws OperatorException {
3031
running = false;
3132
}
33+
34+
@Override
35+
public EventSourceStartPriority priority() {
36+
return eventSourceStartPriority;
37+
}
38+
39+
public AbstractEventSource setEventSourcePriority(EventSourceStartPriority eventSourceStartPriority) {
40+
this.eventSourceStartPriority = eventSourceStartPriority;
41+
return this;
42+
}
3243
}

operator-framework-core/src/main/java/io/javaoperatorsdk/operator/processing/event/source/EventSource.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,7 @@ public interface EventSource extends LifecycleAware {
2020
*/
2121
void setEventHandler(EventHandler handler);
2222

23-
23+
default EventSourceStartPriority priority() {
24+
return EventSourceStartPriority.DEFAULT;
25+
}
2426
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
package io.javaoperatorsdk.operator.processing.event.source;
2+
3+
public enum EventSourceStartPriority {
4+
5+
RESOURCE_STATE_LOADER,
6+
DEFAULT
7+
8+
9+
}

0 commit comments

Comments
 (0)