-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Notifications Workflow #18735
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Notifications Workflow #18735
Changes from 33 commits
Commits
Show all changes
35 commits
Select commit
Hold shift + click to select a range
e74764d
new notification workflow
alovew 29004de
add schema change notification methods
alovew d37b8f4
add params
alovew e7e4f9e
add functionality
alovew 9ec0f4b
add workflow
alovew 53f3514
update tests
alovew 71d35e1
updates
alovew 778becf
add wip
alovew aaff7e8
use api endpoint
alovew 3790d4f
remove logs
alovew cc0f1bb
formatting, removing loggin
alovew 2740661
pmd and formatting
alovew 3dd1f7c
Merge branch 'master' into anne/notifications-workflow
alovew 08a2325
Merge branch 'master' into anne/notifications-workflow
alovew 584a9f6
Merge branch 'master' into anne/notifications-workflow
alovew d10c20d
Merge branch 'master' into anne/notifications-workflow
alovew 3000294
Merge branch 'master' into anne/notifications-workflow
alovew 943a64b
ternary for rendering template
alovew aa1b182
formatting
alovew f682ab1
singleton annotation
alovew 419f67a
Merge branch 'master' into anne/notifications-workflow
alovew 7afb9e3
default env variable to false
alovew 6719670
default to false
alovew 848e999
add to docker compose
alovew 5b8a45e
more places
alovew d41ab7c
add one more place
alovew 4c164ed
fetch connection in activity
alovew 7e69177
add config fetch activity to list
alovew f1224c7
formatting
alovew acb5ab5
fix test
alovew 1dbfb64
add finals
alovew a4d68b1
format
alovew 6f4c250
add max notify workers
alovew a32c0e3
Merge branch 'master' into anne/notifications-workflow
alovew 751492a
Merge branch 'master' into anne/notifications-workflow
alovew File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we need that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was throwing an error when I tried to construct the SlackNotificationClient without this: