Skip to content

Commit

Permalink
Move S3EventNotificationCallback from Exporter to Worker
Browse files Browse the repository at this point in the history
  • Loading branch information
DwayneJengSage committed Feb 15, 2023
1 parent ba0daf7 commit 7619bc8
Show file tree
Hide file tree
Showing 6 changed files with 0 additions and 410 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
import org.sagebionetworks.bridge.config.PropertiesConfig;
import org.sagebionetworks.bridge.dynamodb.DynamoQueryHelper;
import org.sagebionetworks.bridge.dynamodb.DynamoScanHelper;
import org.sagebionetworks.bridge.exporter.notification.S3EventNotificationCallback;
import org.sagebionetworks.bridge.exporter.request.BridgeExporterSqsCallback;
import org.sagebionetworks.bridge.exporter.synapse.ColumnDefinition;
import org.sagebionetworks.bridge.exporter.util.BridgeExporterUtil;
Expand Down Expand Up @@ -181,19 +180,6 @@ public PollSqsWorker exporterSqsWorker(BridgeExporterSqsCallback exporterSqsCall
return sqsWorker;
}

@Bean
@Autowired
public PollSqsWorker s3NotificationSqsWorker(S3EventNotificationCallback s3NotificationCallback) {
Config config = bridgeConfig();

PollSqsWorker sqsWorker = new PollSqsWorker();
sqsWorker.setCallback(s3NotificationCallback);
sqsWorker.setQueueUrl(config.get("s3.notification.sqs.queue.url"));
sqsWorker.setSleepTimeMillis(config.getInt("s3.notification.sqs.sleep.time.millis"));
sqsWorker.setSqsHelper(sqsHelper());
return sqsWorker;
}

@Bean
public SynapseClient synapseClient() {
Config config = bridgeConfig();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,22 +41,6 @@ public final void setBridgeClientManager(ClientManager bridgeClientManager) {
this.bridgeClientManager = bridgeClientManager;
}

/**
* Signals Bridge Server that the upload is completed and to begin processing the upload. Used by Upload
* Auto-Complete.
*
* @param uploadId
* upload to mark completed and begin processing
*/
public void completeUpload(String uploadId) {
try {
bridgeClientManager.getClient(ForWorkersApi.class).completeUploadSession(uploadId, null)
.execute();
} catch (IOException ex) {
throw new BridgeSDKException("Error completing upload to Bridge: " + ex.getMessage(), ex);
}
}

/** Gets the participant from Bridge for the specified study and health code. */
@Cacheable(lifetime = 5, unit = TimeUnit.MINUTES)
public StudyParticipant getParticipantByHealthCode(String studyId, String healthCode) {
Expand Down

This file was deleted.

6 changes: 0 additions & 6 deletions src/main/resources/BridgeExporter.conf
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ synapse.access.token=your-access-token-here
synapse.principal.id=your-principal-id-here

exporter.request.sqs.sleep.time.millis=125
s3.notification.sqs.sleep.time.millis=125
heartbeat.interval.minutes=30
record.loop.delay.millis=30
record.loop.progress.report.period=1000
Expand All @@ -37,11 +36,6 @@ dev.exporter.request.sqs.queue.url=https://sqs.us-east-1.amazonaws.com/649232250
uat.exporter.request.sqs.queue.url=https://sqs.us-east-1.amazonaws.com/649232250620/Bridge-EX-Request-uat
prod.exporter.request.sqs.queue.url=https://sqs.us-east-1.amazonaws.com/649232250620/Bridge-EX-Request-prod

local.s3.notification.sqs.queue.url=https://sqs.us-east-1.amazonaws.com/649232250620/Bridge-UploadComplete-Notification-local
dev.s3.notification.sqs.queue.url=https://sqs.us-east-1.amazonaws.com/649232250620/Bridge-UploadComplete-Notification-dev
uat.s3.notification.sqs.queue.url=https://sqs.us-east-1.amazonaws.com/649232250620/Bridge-UploadComplete-Notification-uat
prod.s3.notification.sqs.queue.url=https://sqs.us-east-1.amazonaws.com/649232250620/Bridge-UploadComplete-Notification-prod

team.bridge.admin = 3388390
team.bridge.staff = 3388389
prod.team.bridge.admin = 3388392
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
import org.sagebionetworks.bridge.rest.model.UploadFieldType;
import org.sagebionetworks.bridge.rest.model.UploadSchema;
import org.sagebionetworks.bridge.rest.model.UploadSchemaType;
import org.sagebionetworks.bridge.rest.model.UploadValidationStatus;
import org.sagebionetworks.bridge.schema.UploadSchemaKey;

@SuppressWarnings("unchecked")
Expand Down Expand Up @@ -81,17 +80,6 @@ public void setup() {
bridgeHelper.setBridgeClientManager(mockClientManager);
}

@Test
public void completeUpload() throws Exception {
// mock call
Call<UploadValidationStatus> mockCall = mock(Call.class);
when(mockWorkersApi.completeUploadSession("test-upload", null)).thenReturn(mockCall);

// execute and verify
bridgeHelper.completeUpload("test-upload");
verify(mockCall).execute();
}

@Test
public void getParticipantByHealthCode() throws Exception {
// mock Bridge client
Expand Down
Loading

0 comments on commit 7619bc8

Please sign in to comment.