-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(event-subscriptions): event consumer extension
- implemented DI for event consumers - added custom config for event consumers - initialize the event scheduler along with application - added workflow custom type
- Loading branch information
Showing
16 changed files
with
161 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
...data-service/src/main/java/org/openmetadata/service/events/scheduled/ConsumerService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package org.openmetadata.service.events.scheduled; | ||
|
||
import org.openmetadata.schema.entity.automations.Workflow; | ||
import org.openmetadata.schema.entity.services.ingestionPipelines.PipelineServiceClientResponse; | ||
|
||
public interface ConsumerService { | ||
PipelineServiceClientResponse runAutomationWorkflow(Workflow wf); | ||
} |
19 changes: 19 additions & 0 deletions
19
...-service/src/main/java/org/openmetadata/service/events/scheduled/ConsumerServiceImpl.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package org.openmetadata.service.events.scheduled; | ||
|
||
import org.openmetadata.schema.entity.automations.Workflow; | ||
import org.openmetadata.schema.entity.services.ingestionPipelines.PipelineServiceClientResponse; | ||
import org.openmetadata.sdk.PipelineServiceClientInterface; | ||
import org.openmetadata.service.util.DIContainer; | ||
|
||
public class ConsumerServiceImpl implements ConsumerService { | ||
private final DIContainer di; | ||
|
||
public ConsumerServiceImpl(DIContainer diContainer) { | ||
di = diContainer; | ||
} | ||
|
||
@Override | ||
public PipelineServiceClientResponse runAutomationWorkflow(Workflow wf) { | ||
return di.getResource(PipelineServiceClientInterface.class).runAutomationsWorkflow(wf); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
openmetadata-service/src/main/java/org/openmetadata/service/util/DIContainer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package org.openmetadata.service.util; | ||
|
||
import java.util.HashMap; | ||
import java.util.Map; | ||
|
||
public class DIContainer { | ||
private final Map<Class<?>, Object> resources = new HashMap<>(); | ||
|
||
public <T> void registerResource(Class<T> resourceClass, T resource) { | ||
resources.put(resourceClass, resource); | ||
} | ||
|
||
public <T> T getResource(Class<T> resourceClass) { | ||
T resource = resourceClass.cast(resources.get(resourceClass)); | ||
if (resource == null) { | ||
throw new IllegalStateException("Resource not initialized: " + resourceClass.getName()); | ||
} | ||
return resource; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.