-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* notification workflow
- Loading branch information
Showing
30 changed files
with
513 additions
and
7 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,5 +11,6 @@ public enum TemporalJobType { | |
SYNC, | ||
RESET_CONNECTION, | ||
CONNECTION_UPDATER, | ||
REPLICATE | ||
REPLICATE, | ||
NOTIFY | ||
} |
22 changes: 22 additions & 0 deletions
22
.../src/main/java/io/airbyte/commons/temporal/scheduling/ConnectionNotificationWorkflow.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,22 @@ | ||
/* | ||
* Copyright (c) 2022 Airbyte, Inc., all rights reserved. | ||
*/ | ||
|
||
package io.airbyte.commons.temporal.scheduling; | ||
|
||
import io.airbyte.api.client.invoker.generated.ApiException; | ||
import io.airbyte.config.persistence.ConfigNotFoundException; | ||
import io.airbyte.validation.json.JsonValidationException; | ||
import io.temporal.workflow.WorkflowInterface; | ||
import io.temporal.workflow.WorkflowMethod; | ||
import java.io.IOException; | ||
import java.util.UUID; | ||
|
||
@WorkflowInterface | ||
public interface ConnectionNotificationWorkflow { | ||
|
||
@WorkflowMethod | ||
boolean sendSchemaChangeNotification(UUID connectionId) | ||
throws IOException, InterruptedException, ApiException, ConfigNotFoundException, JsonValidationException; | ||
|
||
} |
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
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
3 changes: 3 additions & 0 deletions
3
...te-notification/src/main/resources/slack/breaking_schema_change_notification_template.txt
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,3 @@ | ||
Your source schema has changed for connection ID: %s | ||
|
||
Airbyte has disabled this connection because this source schema change will cause broken syncs. Visit your connection page, refresh your source schema, and reset your data in order to fix this connection. |
3 changes: 3 additions & 0 deletions
3
...otification/src/main/resources/slack/non_breaking_schema_change_notification_template.txt
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,3 @@ | ||
Your source schema has changed for connection ID: %s | ||
|
||
Visit your connection page, refresh your source schema, and reset your data in order to update this connection. |
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
51 changes: 51 additions & 0 deletions
51
.../main/java/io/airbyte/workers/temporal/scheduling/ConnectionNotificationWorkflowImpl.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,51 @@ | ||
/* | ||
* Copyright (c) 2022 Airbyte, Inc., all rights reserved. | ||
*/ | ||
|
||
package io.airbyte.workers.temporal.scheduling; | ||
|
||
import io.airbyte.api.client.invoker.generated.ApiException; | ||
import io.airbyte.commons.temporal.scheduling.ConnectionNotificationWorkflow; | ||
import io.airbyte.config.Notification; | ||
import io.airbyte.config.Notification.NotificationType; | ||
import io.airbyte.config.SlackNotificationConfiguration; | ||
import io.airbyte.config.StandardSync; | ||
import io.airbyte.config.persistence.ConfigNotFoundException; | ||
import io.airbyte.notification.SlackNotificationClient; | ||
import io.airbyte.validation.json.JsonValidationException; | ||
import io.airbyte.workers.temporal.annotations.TemporalActivityStub; | ||
import io.airbyte.workers.temporal.scheduling.activities.ConfigFetchActivity; | ||
import io.airbyte.workers.temporal.scheduling.activities.NotifySchemaChangeActivity; | ||
import io.airbyte.workers.temporal.scheduling.activities.SlackConfigActivity; | ||
import java.io.IOException; | ||
import java.util.Optional; | ||
import java.util.UUID; | ||
import lombok.extern.slf4j.Slf4j; | ||
|
||
@Slf4j | ||
public class ConnectionNotificationWorkflowImpl implements ConnectionNotificationWorkflow { | ||
|
||
@TemporalActivityStub(activityOptionsBeanName = "shortActivityOptions") | ||
private NotifySchemaChangeActivity notifySchemaChangeActivity; | ||
@TemporalActivityStub(activityOptionsBeanName = "shortActivityOptions") | ||
private SlackConfigActivity slackConfigActivity; | ||
@TemporalActivityStub(activityOptionsBeanName = "shortActivityOptions") | ||
private ConfigFetchActivity configFetchActivity; | ||
|
||
@Override | ||
public boolean sendSchemaChangeNotification(final UUID connectionId) | ||
throws IOException, InterruptedException, ApiException, ConfigNotFoundException, JsonValidationException { | ||
final StandardSync standardSync = configFetchActivity.getStandardSync(connectionId); | ||
final Optional<SlackNotificationConfiguration> slackConfig = slackConfigActivity.fetchSlackConfiguration(connectionId); | ||
if (slackConfig.isPresent()) { | ||
final Notification notification = | ||
new Notification().withNotificationType(NotificationType.SLACK).withSendOnFailure(false).withSendOnSuccess(false) | ||
.withSlackConfiguration(slackConfig.get()); | ||
final SlackNotificationClient notificationClient = new SlackNotificationClient(notification); | ||
return notifySchemaChangeActivity.notifySchemaChange(notificationClient, connectionId, standardSync.getBreakingChange()); | ||
} else { | ||
return false; | ||
} | ||
} | ||
|
||
} |
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.