Skip to content

Commit 83f5951

Browse files
committed
update legacy producer folder
1 parent a1491a2 commit 83f5951

File tree

3 files changed

+20
-5
lines changed

3 files changed

+20
-5
lines changed

conf/default-config.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@
2424
"optout_delete_expired": true,
2525
"optout_s3_bucket": null,
2626
"optout_s3_folder": null,
27+
"optout_sqs_queue_url": null,
28+
"optout_sqs_s3_folder": null,
2729
"cloud_download_threads": 8,
2830
"cloud_upload_threads": 2,
2931
"cloud_refresh_interval": 60,
@@ -34,8 +36,7 @@
3436
"operator_type": "public",
3537
"uid_instance_id_prefix": "local-optout",
3638
"optout_enqueue_sqs_enabled": false,
37-
"optout_sqs_queue_url": null,
38-
"optout_sqs_s3_folder": "sqs-delta",
39+
"optout_legacy_producer_s3_folder": null,
3940
"optout_sqs_max_queue_size": 0,
4041
"optout_sqs_max_messages_per_poll": 10,
4142
"optout_sqs_visibility_timeout": 300,

src/main/java/com/uid2/optout/Const.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ public static class Config extends com.uid2.shared.Const.Config {
1919
public static final String PartnersMetadataPathProp = "partners_metadata_path";
2020
public static final String OptOutSqsQueueUrlProp = "optout_sqs_queue_url";
2121
public static final String OptOutSqsEnabledProp = "optout_enqueue_sqs_enabled";
22-
public static final String OptOutSqsS3FolderProp = "optout_sqs_s3_folder"; // Default: "sqs-delta" - folder within same S3 bucket as regular optout
22+
public static final String OptOutSqsS3FolderProp = "optout_sqs_s3_folder"; // sqs delta producer writes to this folder
23+
public static final String OptOutLegacyProducerS3FolderProp = "optout_legacy_producer_s3_folder"; // legacy producer writes to this folder
2324
public static final String OptOutSqsMaxMessagesPerPollProp = "optout_sqs_max_messages_per_poll";
2425
public static final String OptOutSqsVisibilityTimeoutProp = "optout_sqs_visibility_timeout";
2526
public static final String OptOutDeltaJobTimeoutSecondsProp = "optout_delta_job_timeout_seconds";

src/main/java/com/uid2/optout/Main.java

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ public void run(String[] args) throws IOException {
246246

247247
List<Future> futs = new ArrayList<>();
248248

249-
// create optout cloud sync verticle
249+
// create optout cloud sync verticle (reads from optout_s3_folder)
250250
OptOutCloudSync cs = new OptOutCloudSync(this.config, true);
251251
CloudSyncVerticle cloudSyncVerticle = new CloudSyncVerticle("optout", this.fsOptOut, this.fsLocal, cs, this.config);
252252

@@ -268,8 +268,21 @@ public void run(String[] args) throws IOException {
268268
OptOutLogProducer logProducer = new OptOutLogProducer(this.config, eventUpload, eventUpload);
269269
futs.add(this.deploySingleInstance(logProducer));
270270

271+
// create cloud sync for legacy producer uploads
272+
// if optout_legacy_producer_s3_folder is set, old producer writes to that folder instead of optout_s3_folder
273+
String legacyFolder = this.config.getString(Const.Config.OptOutLegacyProducerS3FolderProp);
274+
OptOutCloudSync legacyProducerCs;
275+
if (legacyFolder != null) {
276+
JsonObject legacyConfig = new JsonObject().mergeIn(this.config)
277+
.put(Const.Config.OptOutS3FolderProp, legacyFolder);
278+
legacyProducerCs = new OptOutCloudSync(legacyConfig, true);
279+
LOGGER.info("legacy producer will write to separate folder: {}", legacyFolder);
280+
} else {
281+
legacyProducerCs = cs;
282+
}
283+
271284
// upload last delta produced and potentially not uploaded yet
272-
futs.add((this.uploadLastDelta(cs, logProducer, cloudSyncVerticle.eventUpload(), cloudSyncVerticle.eventRefresh())));
285+
futs.add((this.uploadLastDelta(legacyProducerCs, logProducer, cloudSyncVerticle.eventUpload(), cloudSyncVerticle.eventRefresh())));
273286
}
274287

275288
// deploy sqs producer if enabled

0 commit comments

Comments
 (0)