Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.
TypeScript agentaiai-agentsall-in-onecrmcrm-systememaillinearmcpmessagingnotesnotionofficerustslackslack-alternativestartupstartup-toolstypescriptworkspace
refactor(queues): macro queues crate (#4339)
Will Hutchinson841792eb4e5b
diff --git a/.github/workspace-dep-closures.json b/.github/workspace-dep-closures.jsonindex ceb184ce23..881a1c772d 100644--- a/.github/workspace-dep-closures.json+++ b/.github/workspace-dep-closures.json@@ -62,6 +62,7 @@"macro_env","macro_env_var","macro_middleware",+ "macro_queues","macro_service_urls","macro_user_id","macro_uuid",@@ -135,6 +136,7 @@"macro_entrypoint","macro_env","macro_env_var",+ "macro_queues","macro_user_id","macro_uuid","model",@@ -199,6 +201,7 @@"macro_env","macro_env_var","macro_middleware",+ "macro_queues","macro_service_urls","macro_user_id","macro_uuid",@@ -336,6 +339,7 @@"macro_env_var","macro_env_vars/database_env_vars","macro_middleware",+ "macro_queues","macro_redis","macro_service_urls","macro_tower_layers",@@ -614,6 +618,7 @@"macro_env","macro_env_var","macro_middleware",+ "macro_queues","macro_service_urls","macro_user_id","macro_uuid",@@ -975,6 +980,7 @@"macro_env_var","macro_env_vars/database_env_vars","macro_middleware",+ "macro_queues","macro_service_urls","macro_user_id","macro_uuid",@@ -1032,6 +1038,7 @@"macro_env_var","macro_env_vars/database_env_vars","macro_middleware",+ "macro_queues","macro_user_id","macro_uuid","model",@@ -1148,6 +1155,7 @@"macro_entrypoint","macro_env","macro_env_var",+ "macro_queues","macro_user_id","macro_uuid","model",@@ -1226,6 +1234,7 @@"macro_env","macro_env_var","macro_middleware",+ "macro_queues","macro_service_urls","macro_user_id","macro_uuid",@@ -1340,6 +1349,7 @@"macro_env_var","macro_middleware","macro_project_utils",+ "macro_queues","macro_service_urls","macro_sha_count_client","macro_tower_layers",@@ -1639,6 +1649,7 @@"macro_entrypoint","macro_env","macro_env_var",+ "macro_queues","macro_sha_count_client","macro_user_id","macro_uuid",@@ -1761,6 +1772,7 @@"macro_entrypoint","macro_env","macro_env_var",+ "macro_queues","macro_user_id","macro_uuid","model",@@ -1800,6 +1812,7 @@"macro_entrypoint","macro_env","macro_env_var",+ "macro_queues","macro_user_id","macro_uuid","model",@@ -1856,6 +1869,7 @@"macro_env","macro_env_var","macro_middleware",+ "macro_queues","macro_service_urls","macro_user_id","macro_uuid",@@ -1946,6 +1960,7 @@"macro_entrypoint","macro_env","macro_env_var",+ "macro_queues","macro_user_id","macro_uuid","model",@@ -2523,6 +2538,12 @@"macro_project_utils","workspace-hack"],+ "macro_queues": [+ "macro_env",+ "macro_env_var",+ "macro_queues",+ "workspace-hack"+ ],"macro_redis": ["macro_redis","workspace-hack"@@ -2646,6 +2667,7 @@"macro_env_var","macro_env_vars/database_env_vars","macro_middleware",+ "macro_queues","macro_service_urls","macro_user_id","macro_uuid",@@ -2743,6 +2765,7 @@"macro_env","macro_env_var","macro_middleware",+ "macro_queues","macro_service_urls","macro_user_id","macro_uuid",@@ -3186,6 +3209,7 @@"macro_env_var","macro_env_vars/database_env_vars","macro_middleware",+ "macro_queues","macro_service_urls","macro_tower_layers","macro_user_id",@@ -3248,6 +3272,7 @@"macro_entrypoint","macro_env","macro_env_var",+ "macro_queues","macro_user_id","macro_uuid","model",@@ -3287,6 +3312,7 @@"macro_entrypoint","macro_env","macro_env_var",+ "macro_queues","macro_user_id","macro_uuid","model",@@ -3521,6 +3547,7 @@"macro_env_var","macro_env_vars/database_env_vars","macro_middleware",+ "macro_queues","macro_service_urls","macro_user_id","macro_uuid",@@ -3615,6 +3642,7 @@"macro_env","macro_env_var","macro_middleware",+ "macro_queues","macro_service_urls","macro_user_id","macro_uuid",@@ -3830,6 +3858,7 @@"macro_entrypoint","macro_env","macro_env_var",+ "macro_queues","macro_service_urls","macro_user_id","macro_uuid",@@ -4102,6 +4131,7 @@"macro_env","macro_env_var","macro_middleware",+ "macro_queues","macro_service_urls","macro_user_id","macro_uuid",@@ -4382,6 +4412,7 @@"macro_entrypoint","macro_env","macro_env_var",+ "macro_queues","macro_user_id","macro_uuid","model",diff --git a/docker-compose.local-e2e.yml b/docker-compose.local-e2e.ymlindex 482df4bb75..c415b5dfc7 100644--- a/docker-compose.local-e2e.yml+++ b/docker-compose.local-e2e.yml@@ -26,27 +26,33 @@ x-local-e2e-env: &local-e2e-envCONNECTION_GATEWAY_TABLE: connection-gateway-tableSTATIC_FILE_SERVICE_DYNAMODB_TABLE_NAME: static-file-metadata- BACKFILL_QUEUE: email-service-backfill-queue- CHAT_DELETE_QUEUE: delete-chat-handler-queue- CONTACTS_QUEUE: contacts-queue- CONVERT_QUEUE: convert-service-queue- DOCUMENT_DELETE_QUEUE: delete-document-handler-queue- DOCUMENT_TEXT_EXTRACTOR_QUEUE: document-text-extractor-lambda-queue- EMAIL_SCHEDULED_QUEUE: email-service-scheduled-queue- GMAIL_INBOX_SYNC_QUEUE: email-service-gmail-inbox-sync-queue- GMAIL_INBOX_SYNC_RETRY_QUEUE: email-service-gmail-inbox-retry-queue- GMAIL_OPS_QUEUE: email-service-gmail-ops-queue- GMAIL_OPS_RETRY_QUEUE: email-service-gmail-ops-retry-queue- LINK_MANAGER_QUEUE: email-service-refresh-queue- NOTIFICATION_QUEUE: http://localstack:4566/000000000000/notification-queue- NOTIFICATION_INGRESS_QUEUE: http://localstack:4566/000000000000/notification-ingress-queue- PUSH_NOTIFICATION_EVENT_HANDLER_QUEUE: push-delivery-queue- SEARCH_EVENT_QUEUE: search-event-queue- AI_PROJECTION_QUEUE: http://localstack:4566/000000000000/ai-projection-queue- SFS_DELETE_QUEUE: email-sfs-delete-queue- SFS_UPLOADER_QUEUE: email-service-sfs-mapper-queue- STATIC_FILE_SERVICE_S3_EVENT_QUEUE_URL: http://localstack:4566/000000000000/static-file-s3-event-notification-queue- EMAIL_BACKFILL_QUEUE: http://localstack:4566/000000000000/email-service-backfill-queue+ # Queue names now live in the `macro_queues` crate; these OVERRIDE_* vars point+ # the local-e2e services at the localstack queues (OVERRIDE_ wins over the+ # per-environment constant regardless of ENVIRONMENT).+ OVERRIDE_CHAT_DELETE_QUEUE: delete-chat-handler-queue+ OVERRIDE_CONTACTS_QUEUE: contacts-queue+ OVERRIDE_CONVERT_QUEUE: convert-service-queue+ OVERRIDE_DOCUMENT_DELETE_QUEUE: delete-document-handler-queue+ OVERRIDE_DOCUMENT_TEXT_EXTRACTOR_QUEUE: document-text-extractor-lambda-queue+ OVERRIDE_EMAIL_SCHEDULED_QUEUE: email-service-scheduled-queue+ OVERRIDE_GMAIL_INBOX_SYNC_QUEUE: email-service-gmail-inbox-sync-queue+ OVERRIDE_GMAIL_INBOX_SYNC_RETRY_QUEUE: email-service-gmail-inbox-retry-queue+ OVERRIDE_GMAIL_OPS_QUEUE: email-service-gmail-ops-queue+ OVERRIDE_GMAIL_OPS_RETRY_QUEUE: email-service-gmail-ops-retry-queue+ OVERRIDE_LINK_MANAGER_QUEUE: email-service-refresh-queue+ OVERRIDE_NOTIFICATION_QUEUE: http://localstack:4566/000000000000/notification-queue+ OVERRIDE_NOTIFICATION_INGRESS_QUEUE: http://localstack:4566/000000000000/notification-ingress-queue+ OVERRIDE_PUSH_NOTIFICATION_EVENT_HANDLER_QUEUE: push-delivery-queue+ OVERRIDE_SEARCH_EVENT_QUEUE: search-event-queue+ OVERRIDE_AI_PROJECTION_QUEUE: http://localstack:4566/000000000000/ai-projection-queue+ OVERRIDE_SFS_DELETE_QUEUE: email-sfs-delete-queue+ OVERRIDE_SFS_UPLOADER_QUEUE: email-service-sfs-mapper-queue+ OVERRIDE_STATIC_FILE_SERVICE_S3_EVENT_QUEUE_URL: http://localstack:4566/000000000000/static-file-s3-event-notification-queue+ OVERRIDE_EMAIL_BACKFILL_QUEUE: http://localstack:4566/000000000000/email-service-backfill-queue++ # The ai_tools context wires these queues only when explicitly enabled.+ ENABLE_EMAIL_SCHEDULED_QUEUE: "true"+ ENABLE_GMAIL_OPS_QUEUE: "true"services:authentication-service:diff --git a/infra/packages/shared/src/ai_tools.ts b/infra/packages/shared/src/ai_tools.tsindex 9debb86f1a..1f52b0ff7a 100644--- a/infra/packages/shared/src/ai_tools.ts+++ b/infra/packages/shared/src/ai_tools.ts@@ -42,6 +42,8 @@ export function getAiToolsInfra(): AiToolsInfra {.getOutput('docxUploadBucketArn').apply((v) => v as string);+ // Queue names come from the `macro_queues` crate at runtime; we only need the+ // ARNs here for the IAM send/receive grants below.const emailScheduledQueueArn: pulumi.Output<string> = emailServiceStack.getOutput('scheduledQueueArn').apply((v) => v as string);diff --git a/infra/stacks/bulk-upload/index.ts b/infra/stacks/bulk-upload/index.tsindex f429a76f2c..5f5870f276 100644--- a/infra/stacks/bulk-upload/index.ts+++ b/infra/stacks/bulk-upload/index.ts@@ -132,7 +132,6 @@ if (stack !== 'local') {{envVars: {DYNAMODB_TABLE: pulumi.interpolate`${dynamoTableName}`,- UPLOAD_EXTRACTOR_QUEUE: pulumi.interpolate`${bulkUploadQueue.queue.name}`,ENVIRONMENT: stack,RUST_LOG: 'upload_extractor_lambda_trigger=trace',},diff --git a/infra/stacks/bulk-upload/upload-extractor-lambda-trigger.ts b/infra/stacks/bulk-upload/upload-extractor-lambda-trigger.tsindex a5ee6bd716..c6d51af010 100644--- a/infra/stacks/bulk-upload/upload-extractor-lambda-trigger.ts+++ b/infra/stacks/bulk-upload/upload-extractor-lambda-trigger.ts@@ -9,7 +9,6 @@ const ZIP_LOCATION = `${CLOUD_STORAGE_BASE}/target/lambda/${LAMBDA_BASE_NAME}/boexport type UploadExtractorLambdaTriggerEnvVars = {DYNAMODB_TABLE: pulumi.Output<string> | string;- UPLOAD_EXTRACTOR_QUEUE: pulumi.Output<string> | string;ENVIRONMENT: pulumi.Output<string> | string;RUST_LOG: pulumi.Output<string> | string;};diff --git a/infra/stacks/cloud-storage-service/docx-unzip-handler-lambda.ts b/infra/stacks/cloud-storage-service/docx-unzip-handler-lambda.tsindex 739ce39d7f..56d98d7402 100644--- a/infra/stacks/cloud-storage-service/docx-unzip-handler-lambda.ts+++ b/infra/stacks/cloud-storage-service/docx-unzip-handler-lambda.ts@@ -16,7 +16,6 @@ export type DocxUnzipLambdaEnvVars = {DOCUMENT_STORAGE_BUCKET: pulumi.Output<string> | string;DOCX_DOCUMENT_UPLOAD_BUCKET: pulumi.Output<string> | string;WEB_SOCKET_RESPONSE_LAMBDA: pulumi.Output<string> | string;- CONVERT_QUEUE: pulumi.Output<string> | string;};type DocxUnzipHandlerLambdaArgs = {diff --git a/infra/stacks/cloud-storage-service/index.ts b/infra/stacks/cloud-storage-service/index.tsindex 55bcca39b7..12b134694a 100644--- a/infra/stacks/cloud-storage-service/index.ts+++ b/infra/stacks/cloud-storage-service/index.ts@@ -302,10 +302,6 @@ const convertServiceRoleArn: pulumi.Output<string> = convertServiceStack.getOutput('convertServiceRoleArn').apply((arn) => arn as string);-const convertQueueName: pulumi.Output<string> = convertServiceStack- .getOutput('convertQueueName')- .apply((name) => name as string);-const convertQueueArn: pulumi.Output<string> = convertServiceStack.getOutput('convertQueueArn').apply((arn) => arn as string);@@ -319,7 +315,6 @@ const docxUnzipHandlerEnvVars: DocxUnzipLambdaEnvVars = {DOCUMENT_STORAGE_BUCKET: pulumi.interpolate`${documentStorageBucketId}`,DOCX_DOCUMENT_UPLOAD_BUCKET: pulumi.interpolate`${docxUploadBucketName}`,WEB_SOCKET_RESPONSE_LAMBDA: pulumi.interpolate`${jobUpdateHandlerLambdaName}`,- CONVERT_QUEUE: pulumi.interpolate`${convertQueueName}`,};const docxUnzipHandler = new DocxUnzipHandlerLambda(diff --git a/infra/stacks/deleted-item-poller/index.ts b/infra/stacks/deleted-item-poller/index.tsindex 13a08782eb..2a49589bce 100644--- a/infra/stacks/deleted-item-poller/index.ts+++ b/infra/stacks/deleted-item-poller/index.ts@@ -27,19 +27,11 @@ const deleteDocumentQueueArn: pulumi.Output<string> = cloudStorageServiceStack.getOutput('deleteDocumentQueueArn').apply((arn) => arn as string);-const deleteDocumentQueueName: pulumi.Output<string> = cloudStorageServiceStack- .getOutput('deleteDocumentQueueName')- .apply((name) => name as string);-const deleteChatQueueArn: pulumi.Output<string> = cloudStorageServiceStack.getOutput('deleteChatQueueArn').apply((arn) => arn as string);-const deleteChatQueueName: pulumi.Output<string> = cloudStorageServiceStack- .getOutput('deleteChatQueueName')- .apply((name) => name as string);--const { searchEventQueueName, searchEventQueueArn } = getSearchEventQueue();+const { searchEventQueueArn } = getSearchEventQueue();const vpc = get_coparse_api_vpc();@@ -48,9 +40,6 @@ const deletedItemPoller = new DeleteItemPoller('deleted-item-poller', {vpc,envVars: {DATABASE_URL: pulumi.interpolate`${DATABASE_URL}`,- DOCUMENT_DELETE_QUEUE: pulumi.interpolate`${deleteDocumentQueueName}`,- CHAT_DELETE_QUEUE: pulumi.interpolate`${deleteChatQueueName}`,- SEARCH_EVENT_QUEUE: pulumi.interpolate`${searchEventQueueName}`,ENVIRONMENT: stack,RUST_LOG: 'deleted_item_poller=info',},diff --git a/infra/stacks/deleted-item-poller/lambda.ts b/infra/stacks/deleted-item-poller/lambda.tsindex 474170c732..be675c664a 100644--- a/infra/stacks/deleted-item-poller/lambda.ts+++ b/infra/stacks/deleted-item-poller/lambda.ts@@ -9,9 +9,6 @@ const ZIP_LOCATION = `${CLOUD_STORAGE_BASE}/target/lambda/${LAMBDA_BASE_NAME}/boexport type EnvVars = {DATABASE_URL: pulumi.Output<string> | string;- DOCUMENT_DELETE_QUEUE: pulumi.Output<string> | string;- CHAT_DELETE_QUEUE: pulumi.Output<string> | string;- SEARCH_EVENT_QUEUE: pulumi.Output<string> | string;ENVIRONMENT: pulumi.Output<string> | string;RUST_LOG: pulumi.Output<string> | string;};diff --git a/infra/stacks/document-cognition-service/ai-projections-refresh-trigger.ts b/infra/stacks/document-cognition-service/ai-projections-refresh-trigger.tsindex 4552d654bc..5a85a4e004 100644--- a/infra/stacks/document-cognition-service/ai-projections-refresh-trigger.ts+++ b/infra/stacks/document-cognition-service/ai-projections-refresh-trigger.ts@@ -21,7 +21,6 @@ const CADENCE_SCHEDULES: {export type AiProjectionsRefreshTriggerEnvVars = {DATABASE_URL: pulumi.Output<string> | string;- AI_PROJECTION_QUEUE: pulumi.Output<string> | string;ENVIRONMENT: pulumi.Output<string> | string;RUST_LOG: pulumi.Output<string> | string;};diff --git a/infra/stacks/document-cognition-service/index.ts b/infra/stacks/document-cognition-service/index.tsindex 678962add5..921c479004 100644--- a/infra/stacks/document-cognition-service/index.ts+++ b/infra/stacks/document-cognition-service/index.ts@@ -127,7 +127,6 @@ const aiProjectionsRefreshTrigger = new AiProjectionsRefreshTrigger(`ai-projections-refresh-trigger-${stack}`,{envVars: {- AI_PROJECTION_QUEUE: pulumi.interpolate`${aiProjectionQueue.queue.name}`,DATABASE_URL: pulumi.interpolate`${PROXY_DATABASE_URL}`,ENVIRONMENT: stack,RUST_LOG: 'ai_projections_refresh_handler=trace,sqs_client=trace',diff --git a/infra/stacks/email-service/index.ts b/infra/stacks/email-service/index.tsindex c5d0eb19c6..c6eefdaa86 100644--- a/infra/stacks/email-service/index.ts+++ b/infra/stacks/email-service/index.ts@@ -379,7 +379,6 @@ const emailRefreshHandler = new EmailRefreshHandler('email-refresh-handler', {vpc: coparse_api_vpc,envVars: {DATABASE_URL: pulumi.interpolate`${MACRO_DB_URL}`,- LINK_MANAGER_QUEUE: pulumi.interpolate`${linkManagerQueueName}`,ENVIRONMENT: stack,RUST_LOG: 'email_refresh_handler=info',DELETE_UNUSED_AFTER_DAYS: pulumi.interpolate`${DELETE_UNUSED_AFTER_DAYS}`,@@ -396,7 +395,6 @@ const emailScheduledHandler = new EmailScheduledHandler(vpc: coparse_api_vpc,envVars: {DATABASE_URL: pulumi.interpolate`${MACRO_DB_URL}`,- EMAIL_SCHEDULED_QUEUE: pulumi.interpolate`${scheduledQueueName}`,ENVIRONMENT: stack,RUST_LOG: 'email_scheduled_handler=info',},diff --git a/infra/stacks/email-service/refresh_lambda.ts b/infra/stacks/email-service/refresh_lambda.tsindex c15b72e959..cb3afc95a5 100644--- a/infra/stacks/email-service/refresh_lambda.ts+++ b/infra/stacks/email-service/refresh_lambda.ts@@ -9,7 +9,6 @@ const ZIP_LOCATION = `${CLOUD_STORAGE_BASE}/target/lambda/${EMAIL_LAMBDA_BASE_NAexport type EnvVars = {DATABASE_URL: pulumi.Output<string> | string;- LINK_MANAGER_QUEUE: pulumi.Output<string> | string;ENVIRONMENT: pulumi.Output<string> | string;RUST_LOG: pulumi.Output<string> | string;DELETE_UNUSED_AFTER_DAYS: pulumi.Output<string> | string;diff --git a/infra/stacks/email-service/scheduled_lambda.ts b/infra/stacks/email-service/scheduled_lambda.tsindex f5a6d0b041..ee89d47d3c 100644--- a/infra/stacks/email-service/scheduled_lambda.ts+++ b/infra/stacks/email-service/scheduled_lambda.ts@@ -9,7 +9,6 @@ const ZIP_LOCATION = `${CLOUD_STORAGE_BASE}/target/lambda/${EMAIL_LAMBDA_BASE_NAexport type EnvVars = {DATABASE_URL: pulumi.Output<string> | string;- EMAIL_SCHEDULED_QUEUE: pulumi.Output<string> | string;ENVIRONMENT: pulumi.Output<string> | string;RUST_LOG: pulumi.Output<string> | string;};diff --git a/infra/stacks/email-sfs-delete-handler/index.ts b/infra/stacks/email-sfs-delete-handler/index.tsindex c8e28e641c..68b82cc676 100644--- a/infra/stacks/email-sfs-delete-handler/index.ts+++ b/infra/stacks/email-sfs-delete-handler/index.ts@@ -38,7 +38,6 @@ const emailSfsDeleteHandler = new EmailSfsDeleteHandler(DATABASE_URL: pulumi.interpolate`${MACRO_DB_URL}`,ENVIRONMENT: stack,RUST_LOG: 'email_sfs_delete_handler=info',- SFS_DELETE_QUEUE: pulumi.interpolate`${sfsDeleteQueueName}`,},tags,}diff --git a/infra/stacks/email-sfs-delete-handler/sfs_delete_lambda.ts b/infra/stacks/email-sfs-delete-handler/sfs_delete_lambda.tsindex 5f285e3d3b..f2fda2991a 100644--- a/infra/stacks/email-sfs-delete-handler/sfs_delete_lambda.ts+++ b/infra/stacks/email-sfs-delete-handler/sfs_delete_lambda.ts@@ -9,7 +9,6 @@ const ZIP_LOCATION = `${CLOUD_STORAGE_BASE}/target/lambda/${EMAIL_LAMBDA_BASE_NAexport type EnvVars = {DATABASE_URL: pulumi.Output<string> | string;- SFS_DELETE_QUEUE: pulumi.Output<string> | string;ENVIRONMENT: pulumi.Output<string> | string;RUST_LOG: pulumi.Output<string> | string;};diff --git a/infra/stacks/organization-retention/index.ts b/infra/stacks/organization-retention/index.tsindex 68a8c565dc..ffae47597c 100644--- a/infra/stacks/organization-retention/index.ts+++ b/infra/stacks/organization-retention/index.ts@@ -52,8 +52,6 @@ const organizationRetentionHandler = new OrganizationRetentionHandler(DATABASE_URL: pulumi.interpolate`${DATABASE_URL_PROXY}`,ENVIRONMENT: stack,RUST_LOG: 'organization_retention_handler=trace',- DOCUMENT_DELETE_QUEUE: deleteDocumentQueueName,- CHAT_DELETE_QUEUE: deleteChatQueueName,},deleteDocumentQueueArn,deleteChatQueueArn,@@ -75,7 +73,6 @@ const organizationRetentionTrigger = new OrganizationRetentionTrigger(`organization-retention-trigger-${stack}`,{envVars: {- ORGANIZATION_RETENTION_QUEUE: pulumi.interpolate`${organizationRetentionQueueName}`,DATABASE_URL: pulumi.interpolate`${DATABASE_URL_PROXY}`,ENVIRONMENT: stack,RUST_LOG: 'organization_retention_trigger=trace,sqs_client=trace',diff --git a/infra/stacks/organization-retention/organization-retention-handler.ts b/infra/stacks/organization-retention/organization-retention-handler.tsindex 0b9e9b3cb2..1fce6242df 100644--- a/infra/stacks/organization-retention/organization-retention-handler.ts+++ b/infra/stacks/organization-retention/organization-retention-handler.ts@@ -12,8 +12,6 @@ export type OrganizationRetentionhandlerEnvVars = {DATABASE_URL: pulumi.Output<string> | string;ENVIRONMENT: pulumi.Output<string> | string;RUST_LOG: pulumi.Output<string> | string;- DOCUMENT_DELETE_QUEUE: pulumi.Output<string> | string;- CHAT_DELETE_QUEUE: pulumi.Output<string> | string;};type OrganizationRetentionHandlerArgs = {diff --git a/infra/stacks/organization-retention/organization-retention-trigger.ts b/infra/stacks/organization-retention/organization-retention-trigger.tsindex 5a2415a068..02f90a92e2 100644--- a/infra/stacks/organization-retention/organization-retention-trigger.ts+++ b/infra/stacks/organization-retention/organization-retention-trigger.ts@@ -9,7 +9,6 @@ const ZIP_LOCATION = `${CLOUD_STORAGE_BASE}/target/lambda/${LAMBA_BASE_NAME}/booexport type OrganizationRetentionTriggerEnvVars = {DATABASE_URL: pulumi.Output<string> | string;- ORGANIZATION_RETENTION_QUEUE: pulumi.Output<string> | string;ENVIRONMENT: pulumi.Output<string> | string;RUST_LOG: pulumi.Output<string> | string;};diff --git a/infra/stacks/search-upload/index.ts b/infra/stacks/search-upload/index.tsindex da2575f9d4..3fbb6a9cb3 100644--- a/infra/stacks/search-upload/index.ts+++ b/infra/stacks/search-upload/index.ts@@ -15,7 +15,7 @@ const tags = {project: 'cloud-storage-search',};-const { searchEventQueueName, searchEventQueueArn } = getSearchEventQueue();+const { searchEventQueueArn } = getSearchEventQueue();const DOCUMENT_STORAGE_SERVICE_AUTH_KEY = aws.secretsmanager.getSecretVersionOutput({@@ -31,7 +31,6 @@ const searchUploadHandler = new SearchUploadHandler(envVars: {ENVIRONMENT: pulumi.interpolate`${stack}`,RUST_LOG: 'search_upload_handler=info',- SEARCH_EVENT_QUEUE: pulumi.interpolate`${searchEventQueueName}`,DOCUMENT_STORAGE_SERVICE_URL: getServiceUrl(ServiceUrl.DOCUMENT_STORAGE_SERVICE_URL),diff --git a/infra/stacks/search-upload/search-upload-lambda.ts b/infra/stacks/search-upload/search-upload-lambda.tsindex e6e4569acd..89cc07f7e6 100644--- a/infra/stacks/search-upload/search-upload-lambda.ts+++ b/infra/stacks/search-upload/search-upload-lambda.ts@@ -10,7 +10,6 @@ const ZIP_LOCATION = `${CLOUD_STORAGE_BASE}/target/lambda/${LAMBA_BASE_NAME}/bootype EnvVars = {ENVIRONMENT: pulumi.Output<string> | string;RUST_LOG: pulumi.Output<string> | string;- SEARCH_EVENT_QUEUE: pulumi.Output<string> | string;DOCUMENT_STORAGE_SERVICE_URL: pulumi.Output<string> | string;DOCUMENT_STORAGE_SERVICE_AUTH_KEY: pulumi.Output<string> | string;};diff --git a/infra/stacks/static-file-service/static-file-service.ts b/infra/stacks/static-file-service/static-file-service.tsindex 59251cb103..99c4d74aac 100644--- a/infra/stacks/static-file-service/static-file-service.ts+++ b/infra/stacks/static-file-service/static-file-service.ts@@ -573,10 +573,6 @@ export class StaticFileService extends pulumi.ComponentResource {name: `STATIC_FILE_SERVICE_DYNAMODB_TABLE_NAME`,value: args.dynamoDbTableName,},- {- name: 'STATIC_FILE_SERVICE_S3_EVENT_QUEUE_URL',- value: queueQueue.url,- },...(args.containerEnvVars ?? []),],secrets: [...dopplerEcsEnvironment.containerSecrets],diff --git a/rust/cloud-storage/Cargo.lock b/rust/cloud-storage/Cargo.lockindex a92319d96a..be99653aa2 100644--- a/rust/cloud-storage/Cargo.lock+++ b/rust/cloud-storage/Cargo.lock@@ -145,6 +145,7 @@ dependencies = ["macro_entrypoint","macro_env","macro_env_var",+ "macro_queues","models_ai_projection","serde","serde_json",@@ -192,6 +193,7 @@ dependencies = ["macro_db_client","macro_env","macro_env_var",+ "macro_queues","macro_service_urls","macro_user_id","model",@@ -785,6 +787,7 @@ dependencies = ["macro_env","macro_env_var","macro_middleware",+ "macro_queues","macro_service_urls","macro_tower_layers","macro_user_id",@@ -2674,6 +2677,7 @@ dependencies = ["macro_env","macro_env_var","macro_middleware",+ "macro_queues","macro_service_urls","macro_user_id","model",@@ -2724,6 +2728,7 @@ dependencies = ["macro_env","macro_env_var","macro_middleware",+ "macro_queues","macro_uuid","model","nix 0.29.0",@@ -3333,6 +3338,7 @@ dependencies = ["macro_entrypoint","macro_env","macro_env_var",+ "macro_queues","macro_uuid","model","serde",@@ -3625,6 +3631,7 @@ dependencies = ["macro_env","macro_env_var","macro_middleware",+ "macro_queues","macro_service_urls","macro_user_id","macro_uuid",@@ -3736,6 +3743,7 @@ dependencies = ["macro_env_var","macro_middleware","macro_project_utils",+ "macro_queues","macro_service_urls","macro_sha_count_client","macro_tower_layers",@@ -3959,6 +3967,7 @@ dependencies = ["macro_entrypoint","macro_env","macro_env_var",+ "macro_queues","macro_sha_count_client","macro_uuid","model",@@ -4266,6 +4275,7 @@ dependencies = ["macro_entrypoint","macro_env","macro_env_var",+ "macro_queues","model","models_email","sqlx",@@ -4290,6 +4300,7 @@ dependencies = ["macro_entrypoint","macro_env","macro_env_var",+ "macro_queues","models_email","sqlx","sqs_client",@@ -4344,6 +4355,7 @@ dependencies = ["macro_env","macro_env_var","macro_middleware",+ "macro_queues","macro_service_urls","macro_user_id","macro_uuid",@@ -4419,6 +4431,7 @@ dependencies = ["macro_entrypoint","macro_env","macro_env_var",+ "macro_queues","sqlx","sqs_client","tokio",@@ -7123,6 +7136,16 @@ dependencies = ["workspace-hack",]+[[package]]+name = "macro_queues"+version = "0.1.0"+dependencies = [+ "macro_env",+ "paste",+ "serde",+ "workspace-hack",+]+[[package]]name = "macro_redis"version = "0.1.0"@@ -7396,6 +7419,7 @@ dependencies = ["macro_env","macro_env_var","macro_middleware",+ "macro_queues","macro_service_urls","macro_user_id","mcp_auth_proxy",@@ -8303,6 +8327,7 @@ dependencies = ["macro_env","macro_env_var","macro_middleware",+ "macro_queues","macro_service_urls","macro_tower_layers","macro_user_id",@@ -8782,6 +8807,7 @@ dependencies = ["macro_aws_config","macro_entrypoint","macro_env_var",+ "macro_queues","sqlx","sqs_client","tokio",@@ -8800,6 +8826,7 @@ dependencies = ["macro_aws_config","macro_entrypoint","macro_env_var",+ "macro_queues","serde_json","sqlx","sqs_client",@@ -10721,6 +10748,7 @@ dependencies = ["macro_env","macro_env_var","macro_middleware",+ "macro_queues","macro_service_urls","macro_user_id","macro_uuid",@@ -10845,6 +10873,7 @@ dependencies = ["macro_env","macro_env_var","macro_middleware",+ "macro_queues","macro_service_urls","macro_user_id","macro_uuid",@@ -10955,6 +10984,7 @@ dependencies = ["macro_aws_config","macro_entrypoint","macro_env_var",+ "macro_queues","macro_service_urls","s3_key","sqs_client",@@ -11988,6 +12018,7 @@ dependencies = ["macro_env","macro_env_var","macro_middleware",+ "macro_queues","macro_service_urls","model","models_sfs",@@ -13197,6 +13228,7 @@ dependencies = ["macro_aws_config","macro_entrypoint","macro_env_var",+ "macro_queues","models_bulk_upload","s3_key","serde",diff --git a/rust/cloud-storage/Cargo.toml b/rust/cloud-storage/Cargo.tomlindex ce6f8cf296..1ea5465520 100644--- a/rust/cloud-storage/Cargo.toml+++ b/rust/cloud-storage/Cargo.toml@@ -59,6 +59,7 @@ members = ["user_link_cleanup_handler","worker_trigger","macro_config",+ "macro_queues","prompt","workspace-hack","tools/xtask",diff --git a/rust/cloud-storage/ai_projections_refresh_handler/Cargo.toml b/rust/cloud-storage/ai_projections_refresh_handler/Cargo.tomlindex aa7dec3e10..53e5922f79 100644--- a/rust/cloud-storage/ai_projections_refresh_handler/Cargo.toml+++ b/rust/cloud-storage/ai_projections_refresh_handler/Cargo.toml@@ -15,6 +15,7 @@ lambda_runtime = { workspace = true }macro_entrypoint = { path = "../macro_entrypoint" }macro_env = { path = "../macro_env" }macro_env_var = { path = "../macro_env_var" }+macro_queues = { path = "../macro_queues" }models_ai_projection = { path = "../models_ai_projection" }serde = { workspace = true }serde_json = { workspace = true }diff --git a/rust/cloud-storage/ai_projections_refresh_handler/src/config.rs b/rust/cloud-storage/ai_projections_refresh_handler/src/config.rsindex b0ca7cafe8..95f25f5243 100644--- a/rust/cloud-storage/ai_projections_refresh_handler/src/config.rs+++ b/rust/cloud-storage/ai_projections_refresh_handler/src/config.rs@@ -3,7 +3,6 @@ use macro_env_var::env_vars;env_vars! {pub struct DatabaseUrl;- pub struct AiProjectionQueue;}#[derive(macro_config::MacroConfig)]@@ -11,9 +10,6 @@ env_vars! {pub struct Config {/// The connection URL for the Postgres database this application should use.pub database_url: DatabaseUrl,-- /// The ai projection queue- pub ai_projection_queue: AiProjectionQueue,}impl Config {diff --git a/rust/cloud-storage/ai_projections_refresh_handler/src/main.rs b/rust/cloud-storage/ai_projections_refresh_handler/src/main.rsindex fadc62e7d2..4069d3ff66 100644--- a/rust/cloud-storage/ai_projections_refresh_handler/src/main.rs+++ b/rust/cloud-storage/ai_projections_refresh_handler/src/main.rs@@ -32,10 +32,11 @@ async fn main() -> Result<(), Error> {.await.context("could not connect to db")?;+ let ai_projection_queue = macro_queues::AiProjectionQueue::new();let sqs_client = sqs_client::SQS::new(aws_sdk_sqs::Client::new(¯o_aws_config::get_macro_aws_config().await,))- .ai_projection_queue(&config.ai_projection_queue);+ .ai_projection_queue(&ai_projection_queue);let ctx = context::Context {db,diff --git a/rust/cloud-storage/ai_tools/Cargo.toml b/rust/cloud-storage/ai_tools/Cargo.tomlindex 2f8d56d945..59351d0315 100644--- a/rust/cloud-storage/ai_tools/Cargo.toml+++ b/rust/cloud-storage/ai_tools/Cargo.toml@@ -41,6 +41,7 @@ lexical_client = { path = "../lexical_client" }macro_aws_config = { path = "../macro_aws_config" }macro_db_client = { path = "../macro_db_client" }macro_env_var = { path = "../macro_env_var" }+macro_queues = { path = "../macro_queues" }macro_user_id = { path = "../macro_user_id" }model = { path = "../model" }model-entity = { path = "../model-entity" }diff --git a/rust/cloud-storage/ai_tools/src/build_context.rs b/rust/cloud-storage/ai_tools/src/build_context.rsindex da2340774d..4fda1681a2 100644--- a/rust/cloud-storage/ai_tools/src/build_context.rs+++ b/rust/cloud-storage/ai_tools/src/build_context.rs@@ -51,7 +51,6 @@ env_var! {SyncServiceAuthKey,DocumentStorageBucket,DocxDocumentUploadBucket,- EmailScheduledQueue,DocumentStorageServiceCloudfrontDistributionUrl,DocumentStorageServiceCloudfrontSignerPublicKeyId,DocumentStorageServiceCloudfrontSignerPrivateKeySecretName,@@ -60,8 +59,9 @@ env_var! {maybe_env_var! {struct ToolContextMaybeEnvVars {- NotificationQueue,- GmailOpsQueue,+ EnableEmailScheduledQueue,+ EnableGmailOpsQueue,+ EnableNotificationQueue,}}@@ -75,17 +75,20 @@ maybe_env_var! {////// Required env vars: `SYNC_SERVICE_AUTH_KEY`,/// `DOCUMENT_STORAGE_SERVICE_AUTH_KEY`, `DOCUMENT_STORAGE_BUCKET`,-/// `DOCX_DOCUMENT_UPLOAD_BUCKET`, `EMAIL_SCHEDULED_QUEUE`,+/// `DOCX_DOCUMENT_UPLOAD_BUCKET`,/// `DOCUMENT_STORAGE_SERVICE_CLOUDFRONT_DISTRIBUTION_URL`,/// `DOCUMENT_STORAGE_SERVICE_CLOUDFRONT_SIGNER_PUBLIC_KEY_ID`,/// `DOCUMENT_STORAGE_SERVICE_CLOUDFRONT_SIGNER_PRIVATE_KEY_SECRET_NAME`.///-/// Service URLs are resolved through the `macro_service_urls` crate, using optional-/// `OVERRIDE_*` env vars before environment defaults.+/// Service URLs are resolved through the `macro_service_urls` crate, and queue+/// names through the `macro_queues` crate (both using optional `OVERRIDE_*` env+/// vars before environment defaults).///-/// Optional env vars:-/// - `NOTIFICATION_QUEUE` (if omitted, notification status updates skip push clearing)-/// - `GMAIL_OPS_QUEUE` (if omitted, thread-label updates can't enqueue Gmail sync ops)+/// Queue wiring is opt-in via boolean flags (default `false`); the queue name+/// itself comes from `macro_queues` when enabled:+/// - `ENABLE_EMAIL_SCHEDULED_QUEUE`+/// - `ENABLE_GMAIL_OPS_QUEUE` (if disabled, thread-label updates can't enqueue Gmail sync ops)+/// - `ENABLE_NOTIFICATION_QUEUE` (if disabled, notification status updates skip push clearing)#[tracing::instrument(skip(pool), err)]pub async fn build_tool_service_context_from_env(pool: sqlx::PgPool,@@ -100,18 +103,43 @@ pub async fn build_tool_service_context_from_env(let aws_config = macro_aws_config::get_macro_aws_config().await;let aws_sqs_client = aws_sdk_sqs::Client::new(&aws_config);- let mut sqs_client = sqs_client::SQS::new(aws_sqs_client.clone())- .email_scheduled_queue(&env.email_scheduled_queue);- if let Some(gmail_ops_queue) = maybe_env.gmail_ops_queue.as_ref() {- sqs_client = sqs_client.gmail_ops_queue(gmail_ops_queue);- }- let notification_queue = maybe_env- .notification_queue+ let enable_email_scheduled_queue = maybe_env+ .enable_email_scheduled_queue+ .as_ref()+ .and_then(|v| v.value())+ .and_then(|v| v.parse::<bool>().ok())+ .unwrap_or(false);+ let enable_gmail_ops_queue = maybe_env+ .enable_gmail_ops_queue.as_ref()- .map(|queue_url| {- ToolNotificationQueue::Sqs(SqsQueue::new(aws_sqs_client, queue_url.to_string()))- })- .unwrap_or(ToolNotificationQueue::NoOp);+ .and_then(|v| v.value())+ .and_then(|v| v.parse::<bool>().ok())+ .unwrap_or(false);+ let enable_notification_queue = maybe_env+ .enable_notification_queue+ .as_ref()+ .and_then(|v| v.value())+ .and_then(|v| v.parse::<bool>().ok())+ .unwrap_or(false);++ let mut sqs_client = sqs_client::SQS::new(aws_sqs_client.clone());+ if enable_email_scheduled_queue {+ let email_scheduled_queue = macro_queues::EmailScheduledQueue::new();+ sqs_client = sqs_client.email_scheduled_queue(email_scheduled_queue.as_ref());+ }+ if enable_gmail_ops_queue {+ let gmail_ops_queue = macro_queues::GmailOpsQueue::new();+ sqs_client = sqs_client.gmail_ops_queue(gmail_ops_queue.as_ref());+ }+ let notification_queue = if enable_notification_queue {+ let notification_queue = macro_queues::NotificationQueue::new();+ ToolNotificationQueue::Sqs(SqsQueue::new(+ aws_sqs_client,+ notification_queue.to_string(),+ ))+ } else {+ ToolNotificationQueue::NoOp+ };let secretsmanager_client =SecretsManager::new(aws_sdk_secretsmanager::Client::new(&aws_config));diff --git a/rust/cloud-storage/authentication_service/Cargo.toml b/rust/cloud-storage/authentication_service/Cargo.tomlindex aa99c566fc..ff1887f0c1 100644--- a/rust/cloud-storage/authentication_service/Cargo.toml+++ b/rust/cloud-storage/authentication_service/Cargo.toml@@ -77,6 +77,7 @@ macro_db_client = { path = "../macro_db_client", default-features = false, featumacro_entrypoint = { path = "../macro_entrypoint" }macro_env = { path = "../macro_env" }macro_env_var = { path = "../macro_env_var" }+macro_queues = { path = "../macro_queues" }macro_middleware = { path = "../macro_middleware", default-features = false, features = ["auth","tracking",diff --git a/rust/cloud-storage/authentication_service/src/config.rs b/rust/cloud-storage/authentication_service/src/config.rsindex f0361a9910..b242fb5542 100644--- a/rust/cloud-storage/authentication_service/src/config.rs+++ b/rust/cloud-storage/authentication_service/src/config.rs@@ -26,10 +26,6 @@ env_vars! {pub struct GoogleClientSecretKey;pub struct StripeSecretKey;pub struct ServiceInternalAuthKey;- pub struct NotificationQueue;- pub struct SearchEventQueue;- pub struct LinkManagerQueue;- pub struct EmailBackfillQueue;pub struct GithubClientId;pub struct GithubClientSecret;pub struct GithubIdpId;@@ -89,16 +85,6 @@ pub struct Config {pub environment: Environment,/// The internal auth key used by other servicespub service_internal_auth_key: ServiceInternalAuthKey,- /// The notification queue- pub notification_queue: NotificationQueue,- /// The search event queue- pub search_event_queue: SearchEventQueue,- /// The email link manager queue- pub link_manager_queue: LinkManagerQueue,- /// The email backfill queue. Used by `join_team` to enqueue a- /// `PopulateCrmForUser` message that seeds CRM tables with the new- /// member's historical sent-mail contacts.- pub email_backfill_queue: EmailBackfillQueue,/// The github client idpub github_client_id: GithubClientId,/// The github client secretdiff --git a/rust/cloud-storage/authentication_service/src/main.rs b/rust/cloud-storage/authentication_service/src/main.rsindex ff5e89f21c..26f18c44e2 100644--- a/rust/cloud-storage/authentication_service/src/main.rs+++ b/rust/cloud-storage/authentication_service/src/main.rs@@ -181,9 +181,13 @@ async fn main() -> anyhow::Result<()> {.await.context("failed to get multiplexed redis connection")?;+ let notification_queue = macro_queues::NotificationQueue::new();+ let search_event_queue = macro_queues::SearchEventQueue::new();+ let link_manager_queue = macro_queues::LinkManagerQueue::new();+ let email_backfill_queue = macro_queues::EmailBackfillQueue::new();let ingress_queue = SqsQueue::new(aws_sdk_sqs::Client::new(¯o_aws_config::get_macro_aws_config().await),- config.notification_queue.to_string().clone(),+ notification_queue.to_string(),);let notification_ingress_service = SqsNotificationIngress {queue: ingress_queue,@@ -193,9 +197,9 @@ async fn main() -> anyhow::Result<()> {let sqs_client = sqs_client::SQS::new(aws_sdk_sqs::Client::new(¯o_aws_config::get_macro_aws_config().await,))- .search_event_queue(&config.search_event_queue)- .email_link_manager_queue(&config.link_manager_queue)- .email_backfill_queue(&config.email_backfill_queue);+ .search_event_queue(&search_event_queue)+ .email_link_manager_queue(&link_manager_queue)+ .email_backfill_queue(&email_backfill_queue);tracing::trace!("initialized sqs client");// Initialize analytics client with configured providersdiff --git a/rust/cloud-storage/contacts_service/Cargo.toml b/rust/cloud-storage/contacts_service/Cargo.tomlindex 6844852dc2..921646fbce 100644--- a/rust/cloud-storage/contacts_service/Cargo.toml+++ b/rust/cloud-storage/contacts_service/Cargo.toml@@ -47,6 +47,7 @@ utoipa-swagger-ui = { workspace = true }macro_service_urls = { path = "../macro_service_urls" }workspace-hack = { version = "0.1", path = "../workspace-hack" }macro_env_var = { path = "../macro_env_var" }+macro_queues = { path = "../macro_queues" }macro_config = { path = "../macro_config" }database_env_vars = { path = "../macro_env_vars/database_env_vars" }doppler-config = { workspace = true }diff --git a/rust/cloud-storage/contacts_service/src/config.rs b/rust/cloud-storage/contacts_service/src/config.rsindex 656b939083..9fba844d42 100644--- a/rust/cloud-storage/contacts_service/src/config.rs+++ b/rust/cloud-storage/contacts_service/src/config.rs@@ -6,7 +6,6 @@ use macro_middleware::auth::internal_access::InternalApiKey;env_vars! {pub struct BaseUrl;- pub struct ContactsQueue;}maybe_env_vars! {@@ -27,8 +26,6 @@ pub struct Config {pub database_url: DatabaseUrl,/// The Redis URI for rate limiting.pub redis_uri: RedisUri,- /// SQS URL- pub contacts_queue: ContactsQueue,/// The notification queue max messages per pollpub contacts_queue_max_messages: ContactsQueueMaxMessages,/// The notification queue wait time seconds@@ -51,7 +48,6 @@ impl Config {environment: Environment::Local,database_url: DatabaseUrl::Comptime(""),redis_uri: RedisUri::Comptime(""),- contacts_queue: ContactsQueue::new_testing(""),contacts_queue_max_messages: ContactsQueueMaxMessages::new_unset(),contacts_queue_wait_time_seconds: ContactsQueueWaitTimeSeconds::new_unset(),internal_api_key: InternalApiKey::Comptime(""),diff --git a/rust/cloud-storage/contacts_service/src/main.rs b/rust/cloud-storage/contacts_service/src/main.rsindex 5d79bc556d..13c8196072 100644--- a/rust/cloud-storage/contacts_service/src/main.rs+++ b/rust/cloud-storage/contacts_service/src/main.rs@@ -37,7 +37,7 @@ async fn connect_to_database(config: &Config) -> anyhow::Result<sqlx::PgPool> {}async fn create_sqs_worker(config: &Config) -> SQSWorker {- let queue_url = config.contacts_queue.to_string().clone();+ let queue_url = macro_queues::ContactsQueue::new().to_string();let aws_config = macro_aws_config::get_macro_aws_config().await;let sqs_client = aws_sdk_sqs::Client::new(&aws_config);diff --git a/rust/cloud-storage/convert_service/Cargo.toml b/rust/cloud-storage/convert_service/Cargo.tomlindex f58acbb1a6..456e04f355 100644--- a/rust/cloud-storage/convert_service/Cargo.toml+++ b/rust/cloud-storage/convert_service/Cargo.toml@@ -36,6 +36,7 @@ macro_env_var = { path = "../macro_env_var" }macro_middleware = { path = "../macro_middleware", default-features = false, features = ["auth",] }+macro_queues = { path = "../macro_queues" }macro_uuid = { path = "../macro_uuid" }model = { path = "../model" }s3_key = { path = "../s3_key" }diff --git a/rust/cloud-storage/convert_service/src/config.rs b/rust/cloud-storage/convert_service/src/config.rsindex 7b910cb7a8..9c8c3551a0 100644--- a/rust/cloud-storage/convert_service/src/config.rs+++ b/rust/cloud-storage/convert_service/src/config.rs@@ -23,7 +23,6 @@ pub static WEB_SOCKET_RESPONSE_LAMBDA: LazyLock<String> = LazyLock::new(|| {});env_vars! {- pub struct ConvertQueue;pub struct LokPath;pub struct DocumentStorageBucket;pub struct WebSocketResponseLambda;@@ -39,8 +38,6 @@ env_vars! {#[derive(macro_config::MacroConfig)]#[serde(rename_all = "SCREAMING_SNAKE_CASE")]pub struct Config {- /// The SQS queue for convert jobs- pub convert_queue: ConvertQueue,/// The queue max messages per poll#[macro_config_default(5)]pub queue_max_messages: i32,diff --git a/rust/cloud-storage/convert_service/src/main.rs b/rust/cloud-storage/convert_service/src/main.rsindex 90803f6ab9..e7de67bf43 100644--- a/rust/cloud-storage/convert_service/src/main.rs+++ b/rust/cloud-storage/convert_service/src/main.rs@@ -80,15 +80,16 @@ async fn main() -> anyhow::Result<()> {let s3_client = s3_client::S3::new(macro_aws_config::s3_client().await);tracing::trace!("initialized s3 client");+ let convert_queue = macro_queues::ConvertQueue::new();let sqs_client = sqs_client::SQS::new(aws_sdk_sqs::Client::new(&queue_aws_config))- .convert_queue(&config.convert_queue);+ .convert_queue(&convert_queue);tracing::trace!("initialized sqs client");if !cfg!(feature = "disable_worker") {let sqs_client = aws_sdk_sqs::Client::new(&queue_aws_config);let sqs_worker = sqs_worker::SQSWorker::new(sqs_client,- config.convert_queue.to_string(),+ convert_queue.to_string(),config.queue_max_messages,config.queue_wait_time_seconds,);diff --git a/rust/cloud-storage/deleted_item_poller/Cargo.toml b/rust/cloud-storage/deleted_item_poller/Cargo.tomlindex 1566e4305f..f60cf36894 100644--- a/rust/cloud-storage/deleted_item_poller/Cargo.toml+++ b/rust/cloud-storage/deleted_item_poller/Cargo.toml@@ -17,6 +17,7 @@ macro_db_client = { path = "../macro_db_client" }macro_entrypoint = { path = "../macro_entrypoint" }macro_env = { path = "../macro_env" }macro_env_var = { path = "../macro_env_var" }+macro_queues = { path = "../macro_queues" }macro_uuid = { path = "../macro_uuid" }model = { path = "../model" }serde = { workspace = true }diff --git a/rust/cloud-storage/deleted_item_poller/src/config.rs b/rust/cloud-storage/deleted_item_poller/src/config.rsindex 1471f78471..3bf0211428 100644--- a/rust/cloud-storage/deleted_item_poller/src/config.rs+++ b/rust/cloud-storage/deleted_item_poller/src/config.rs@@ -4,9 +4,6 @@ use macro_env_var::env_vars;env_vars! {struct DatabaseUrl;- struct DocumentDeleteQueue;- struct ChatDeleteQueue;- struct SearchEventQueue;}#[derive(Debug, Clone)]@@ -14,15 +11,6 @@ pub struct Config {/// The connection URL for the Postgres database this application should use.pub database_url: String,- /// The document delete queue- pub document_delete_queue: String,-- /// The chat delete queue- pub chat_delete_queue: String,-- /// The search text extractor queue- pub search_event_queue: String,-/// The environment we are in#[allow(dead_code)]pub environment: Environment,@@ -34,23 +22,8 @@ impl Config {.context("DATABASE_URL must be provided")?.to_string();- let document_delete_queue = DocumentDeleteQueue::new()- .context("DOCUMENT_DELETE_QUEUE must be provided")?- .to_string();-- let chat_delete_queue = ChatDeleteQueue::new()- .context("CHAT_DELETE_QUEUE must be provided")?- .to_string();-- let search_event_queue = SearchEventQueue::new()- .context("SEARCH_EVENT_QUEUE must be provided")?- .to_string();-Ok(Config {database_url,- document_delete_queue,- chat_delete_queue,- search_event_queue,environment: Environment::new_or_prod(),})}diff --git a/rust/cloud-storage/deleted_item_poller/src/main.rs b/rust/cloud-storage/deleted_item_poller/src/main.rsindex a0162c1281..7033137cee 100644--- a/rust/cloud-storage/deleted_item_poller/src/main.rs+++ b/rust/cloud-storage/deleted_item_poller/src/main.rs@@ -32,12 +32,15 @@ async fn main() -> Result<(), Error> {.await.context("could not connect to db")?;+ let document_delete_queue = macro_queues::DocumentDeleteQueue::new();+ let chat_delete_queue = macro_queues::ChatDeleteQueue::new();+ let search_event_queue = macro_queues::SearchEventQueue::new();let sqs_client = sqs_client::SQS::new(aws_sdk_sqs::Client::new(¯o_aws_config::get_macro_aws_config().await,))- .document_delete_queue(&config.document_delete_queue)- .chat_delete_queue(&config.chat_delete_queue)- .search_event_queue(&config.search_event_queue);+ .document_delete_queue(&document_delete_queue)+ .chat_delete_queue(&chat_delete_queue)+ .search_event_queue(&search_event_queue);let ctx = context::Context {db,diff --git a/rust/cloud-storage/document_cognition_service/Cargo.toml b/rust/cloud-storage/document_cognition_service/Cargo.tomlindex 4bfc3ff1f3..870f71b652 100644--- a/rust/cloud-storage/document_cognition_service/Cargo.toml+++ b/rust/cloud-storage/document_cognition_service/Cargo.toml@@ -73,6 +73,7 @@ macro_db_client = { path = "../macro_db_client" }macro_entrypoint = { path = "../macro_entrypoint" }macro_env = { path = "../macro_env" }macro_env_var = { path = "../macro_env_var" }+macro_queues = { path = "../macro_queues" }macro_middleware = { path = "../macro_middleware", default-features = false, features = ["auth","cloud_storage",diff --git a/rust/cloud-storage/document_cognition_service/src/config.rs b/rust/cloud-storage/document_cognition_service/src/config.rsindex 135dfb6bca..d1ff511723 100644--- a/rust/cloud-storage/document_cognition_service/src/config.rs+++ b/rust/cloud-storage/document_cognition_service/src/config.rs@@ -9,14 +9,7 @@ use crate::core::constants::DEFAULT_DOCUMENT_BATCH_LIMIT;env_vars!(pub struct DatabaseUrl;pub struct DocumentStorageBucket;- pub struct DocumentTextExtractorQueue;- pub struct ChatDeleteQueue;- pub struct EmailScheduledQueue;- pub struct GmailOpsQueue;- pub struct NotificationQueue;pub struct DocumentStorageServiceAuthKey;- pub struct SearchEventQueue;- pub struct AiProjectionQueue;pub struct SyncServiceAuthKey;pub struct AuthenticationServiceUrl;pub struct AuthenticationServiceSecretKey;@@ -51,19 +44,6 @@ pub struct Config {pub document_storage_bucket: DocumentStorageBucket,/// document storage service auth keypub document_storage_service_auth_key: DocumentStorageServiceAuthKey,- /// The sqs queue to send document text extract jobs to- pub document_text_extractor_queue: DocumentTextExtractorQueue,- /// The sqs queue to send chat delete jobs- pub chat_delete_queue: ChatDeleteQueue,- /// The sqs queue to enqueue outbound email sends- pub email_scheduled_queue: EmailScheduledQueue,- /// The sqs queue to enqueue Gmail label/sync operations- pub gmail_ops_queue: GmailOpsQueue,- /// The sqs queue to send notifications to- pub notification_queue: NotificationQueue,- pub search_event_queue: SearchEventQueue,- /// The sqs queue used to enqueue and poll ai projection materialization jobs- pub ai_projection_queue: AiProjectionQueue,pub sync_service_auth_key: LocalOrRemoteSecret<SyncServiceAuthKey>,/// authentication service secret key (for soup service)pub authentication_service_secret_key: AuthenticationServiceSecretKey,@@ -103,15 +83,6 @@ impl Config {document_storage_service_auth_key: DocumentStorageServiceAuthKey::Comptime("DOCUMENT_STORAGE_SERVICE_AUTH_KEY",),- document_text_extractor_queue: DocumentTextExtractorQueue::Comptime(- "DOCUMENT_TEXT_EXTRACTOR_QUEUE",- ),- chat_delete_queue: ChatDeleteQueue::Comptime("CHAT_DELETE_QUEUE"),- email_scheduled_queue: EmailScheduledQueue::Comptime("EMAIL_SCHEDULED_QUEUE"),- gmail_ops_queue: GmailOpsQueue::Comptime("GMAIL_OPS_QUEUE"),- notification_queue: NotificationQueue::Comptime("NOTIFICATION_QUEUE"),- search_event_queue: SearchEventQueue::Comptime("SEARCH_EVENT_QUEUE"),- ai_projection_queue: AiProjectionQueue::Comptime("AI_PROJECTION_QUEUE"),sync_service_auth_key: LocalOrRemoteSecret::Local(SyncServiceAuthKey::Comptime("SYNC_SERVICE_AUTH_KEY",)),diff --git a/rust/cloud-storage/document_cognition_service/src/main.rs b/rust/cloud-storage/document_cognition_service/src/main.rsindex 993cb693a5..4ab8678e6f 100644--- a/rust/cloud-storage/document_cognition_service/src/main.rs+++ b/rust/cloud-storage/document_cognition_service/src/main.rs@@ -94,13 +94,20 @@ async fn main() -> anyhow::Result<()> {let dynamodb_client = aws_sdk_dynamodb::Client::new(&aws_config);let queue_aws_client = aws_sdk_sqs::Client::new(&aws_config);+ let document_text_extractor_queue = macro_queues::DocumentTextExtractorQueue::new();+ let chat_delete_queue = macro_queues::ChatDeleteQueue::new();+ let email_scheduled_queue = macro_queues::EmailScheduledQueue::new();+ let gmail_ops_queue = macro_queues::GmailOpsQueue::new();+ let search_event_queue = macro_queues::SearchEventQueue::new();+ let ai_projection_queue = macro_queues::AiProjectionQueue::new();+ let notification_queue = macro_queues::NotificationQueue::new();let sqs_client = sqs_client::SQS::new(queue_aws_client)- .document_text_extractor_queue(&config.document_text_extractor_queue)- .chat_delete_queue(&config.chat_delete_queue)- .email_scheduled_queue(&config.email_scheduled_queue)- .gmail_ops_queue(&config.gmail_ops_queue)- .search_event_queue(&config.search_event_queue)- .ai_projection_queue(&config.ai_projection_queue);+ .document_text_extractor_queue(&document_text_extractor_queue)+ .chat_delete_queue(&chat_delete_queue)+ .email_scheduled_queue(&email_scheduled_queue)+ .gmail_ops_queue(&gmail_ops_queue)+ .search_event_queue(&search_event_queue)+ .ai_projection_queue(&ai_projection_queue);let internal_api_key = config.internal_api_key.to_string();@@ -177,7 +184,7 @@ async fn main() -> anyhow::Result<()> {let ingress_queue = SqsQueue::new(aws_sdk_sqs::Client::new(&aws_config),- config.notification_queue.to_string(),+ notification_queue.to_string(),);let notification_ingress_service = Arc::new(SqsNotificationIngress {queue: ingress_queue,@@ -185,7 +192,7 @@ async fn main() -> anyhow::Result<()> {let notification_reader_queue = SqsQueue::new(aws_sdk_sqs::Client::new(&aws_config),- config.notification_queue.to_string(),+ notification_queue.to_string(),);let notification_reader_service = NotificationReaderService {repository: DbNotificationRepository::new(db.clone()),@@ -437,7 +444,7 @@ async fn main() -> anyhow::Result<()> {let ai_projection_worker = ai_projections::worker::AiProjectionWorker::new(sqs_worker::SQSWorker::new(aws_sdk_sqs::Client::new(&aws_config),- config.ai_projection_queue.to_string(),+ ai_projection_queue.to_string(),10,10,),diff --git a/rust/cloud-storage/document_storage_service/Cargo.toml b/rust/cloud-storage/document_storage_service/Cargo.tomlindex 7b2c99da2a..2092ef1b55 100644--- a/rust/cloud-storage/document_storage_service/Cargo.toml+++ b/rust/cloud-storage/document_storage_service/Cargo.toml@@ -90,6 +90,7 @@ macro_entrypoint = { path = "../macro_entrypoint" }macro_env = { path = "../macro_env" }macro_service_urls = { path = "../macro_service_urls" }macro_env_var = { path = "../macro_env_var" }+macro_queues = { path = "../macro_queues" }macro_middleware = { path = "../macro_middleware", default-features = false, features = ["auth","cloud_storage",diff --git a/rust/cloud-storage/document_storage_service/src/config.rs b/rust/cloud-storage/document_storage_service/src/config.rsindex 96074212c6..deec257101 100644--- a/rust/cloud-storage/document_storage_service/src/config.rs+++ b/rust/cloud-storage/document_storage_service/src/config.rs@@ -12,19 +12,15 @@ env_vars! {pub struct DatabaseUrlReadonly;pub struct DocumentStorageBucket;pub struct DocxDocumentUploadBucket;- pub struct DocumentDeleteQueue;pub struct DocumentStorageServiceCloudfrontDistributionUrl;pub struct DocumentStorageServiceCloudfrontSignerPublicKeyId;pub struct RedisUri;- pub struct NotificationQueue;- pub struct SearchEventQueue;pub struct BulkUploadRequestsTable;pub struct UploadStagingBucket;pub struct SyncServiceAuthKey;pub struct OpensearchUrl;pub struct OpensearchUsername;pub struct OpensearchPassword;- pub struct ContactsQueue;pub struct GithubSyncAppUrl;pub struct GithubSyncAppClientId;pub struct LivekitServerUrl;@@ -80,21 +76,17 @@ pub struct Config {pub database_url_readonly: DatabaseUrlReadonly,pub document_storage_bucket: DocumentStorageBucket,pub docx_document_upload_bucket: DocxDocumentUploadBucket,- pub document_delete_queue: DocumentDeleteQueue,pub document_storage_service_cloudfront_distribution_url:DocumentStorageServiceCloudfrontDistributionUrl,pub document_storage_service_cloudfront_signer_public_key_id:DocumentStorageServiceCloudfrontSignerPublicKeyId,pub redis_uri: RedisUri,- pub notification_queue: NotificationQueue,- pub search_event_queue: SearchEventQueue,pub bulk_upload_requests_table: BulkUploadRequestsTable,pub upload_staging_bucket: UploadStagingBucket,pub sync_service_auth_key: LocalOrRemoteSecret<SyncServiceAuthKey>,pub opensearch_url: OpensearchUrl,pub opensearch_username: OpensearchUsername,pub opensearch_password: OpensearchPassword,- pub contacts_queue: ContactsQueue,pub github_sync_app_url: GithubSyncAppUrl,pub github_sync_app_client_id: GithubSyncAppClientId,pub livekit_server_url: LivekitServerUrl,diff --git a/rust/cloud-storage/document_storage_service/src/main.rs b/rust/cloud-storage/document_storage_service/src/main.rsindex f0e4b44c47..f5382dd8f1 100644--- a/rust/cloud-storage/document_storage_service/src/main.rs+++ b/rust/cloud-storage/document_storage_service/src/main.rs@@ -171,14 +171,18 @@ async fn main() -> anyhow::Result<()> {tracing::trace!("initialized s3 client");+ let search_event_queue = macro_queues::SearchEventQueue::new();+ let document_delete_queue = macro_queues::DocumentDeleteQueue::new();+ let contacts_queue = macro_queues::ContactsQueue::new();+ let notification_queue = macro_queues::NotificationQueue::new();let sqs_client = sqs_client::SQS::new(aws_sdk_sqs::Client::new(&aws_config))- .search_event_queue(&config.search_event_queue)- .document_delete_queue(&config.document_delete_queue);+ .search_event_queue(&search_event_queue)+ .document_delete_queue(&document_delete_queue);let contacts_ingress = Arc::new(contacts::domain::service::SqsContactsIngress {queue: contacts::outbound::ingress::SqsContactsQueue::new(aws_sdk_sqs::Client::new(&aws_config),- config.contacts_queue.to_string(),+ contacts_queue.to_string(),),});@@ -259,7 +263,7 @@ async fn main() -> anyhow::Result<()> {SystemPropertiesServiceImpl::new(PgSystemPropertiesRepository::new(db.clone()));let ingress_queue = SqsQueue::new(aws_sdk_sqs::Client::new(&aws_config),- config.notification_queue.to_string(),+ notification_queue.to_string(),);let notification_ingress_service = Arc::new(SqsNotificationIngress {queue: ingress_queue.clone(),@@ -536,7 +540,7 @@ async fn main() -> anyhow::Result<()> {// Create the SQS worker for delete document processing before config is movedlet delete_document_worker = sqs_worker::SQSWorker::new(aws_sdk_sqs::Client::new(&aws_config),- config.document_delete_queue.to_string(),+ document_delete_queue.to_string(),config.queue_max_messages,config.queue_wait_time_seconds,);diff --git a/rust/cloud-storage/docx_unzip_handler/Cargo.toml b/rust/cloud-storage/docx_unzip_handler/Cargo.tomlindex a324a4241a..1d40a7828d 100644--- a/rust/cloud-storage/docx_unzip_handler/Cargo.toml+++ b/rust/cloud-storage/docx_unzip_handler/Cargo.toml@@ -42,4 +42,5 @@ urlencoding = { workspace = true }zip = { workspace = true }workspace-hack = { version = "0.1", path = "../workspace-hack" }macro_env_var = { path = "../macro_env_var" }+macro_queues = { path = "../macro_queues" }diff --git a/rust/cloud-storage/docx_unzip_handler/src/config.rs b/rust/cloud-storage/docx_unzip_handler/src/config.rsindex 43564bf35d..dc1ab58a56 100644--- a/rust/cloud-storage/docx_unzip_handler/src/config.rs+++ b/rust/cloud-storage/docx_unzip_handler/src/config.rs@@ -6,7 +6,6 @@ env_vars! {pub struct RedisUri;pub struct DocumentStorageBucket;pub struct WebSocketResponseLambda;- pub struct ConvertQueue;}/// The configuration parameters for the application.@@ -29,9 +28,6 @@ pub struct Config {/// The name of the lambda function that will be used to send the response to the websocketpub web_socket_response_lambda: String,-- /// The name of the convert queue- pub convert_queue: String,}impl Config {@@ -48,16 +44,11 @@ impl Config {let web_socket_response_lambda = WebSocketResponseLambda::new().context("WEB_SOCKET_RESPONSE_LAMBDA must be provided")?.to_string();- let convert_queue = ConvertQueue::new()- .context("CONVERT_QUEUE must be provided")?- .to_string();-Ok(Config {database_url,redis_uri,document_storage_bucket,web_socket_response_lambda,- convert_queue,})}}diff --git a/rust/cloud-storage/docx_unzip_handler/src/main.rs b/rust/cloud-storage/docx_unzip_handler/src/main.rsindex a63218cfc5..db75428714 100644--- a/rust/cloud-storage/docx_unzip_handler/src/main.rs+++ b/rust/cloud-storage/docx_unzip_handler/src/main.rs@@ -48,8 +48,9 @@ async fn main() -> Result<(), Error> {let lambda_client = lambda_client::Lambda::new(aws_sdk_lambda::Client::new(&aws_config));tracing::trace!("initialized lambda client");- let sqs_client = sqs_client::SQS::new(aws_sdk_sqs::Client::new(&aws_config))- .convert_queue(&config.convert_queue);+ let convert_queue = macro_queues::ConvertQueue::new();+ let sqs_client =+ sqs_client::SQS::new(aws_sdk_sqs::Client::new(&aws_config)).convert_queue(&convert_queue);tracing::trace!("initialized sqs client");let redis_client = redis::Client::open(config.redis_uri.clone())diff --git a/rust/cloud-storage/email_refresh_handler/Cargo.toml b/rust/cloud-storage/email_refresh_handler/Cargo.tomlindex 99cc57bade..e2b35ff630 100644--- a/rust/cloud-storage/email_refresh_handler/Cargo.toml+++ b/rust/cloud-storage/email_refresh_handler/Cargo.toml@@ -14,6 +14,7 @@ lambda_runtime = { workspace = true }macro_entrypoint = { path = "../macro_entrypoint" }macro_env = { path = "../macro_env" }macro_env_var = { path = "../macro_env_var" }+macro_queues = { path = "../macro_queues" }model = { path = "../model" }models_email = { path = "../models_email" }sqlx = { workspace = true }diff --git a/rust/cloud-storage/email_refresh_handler/src/config.rs b/rust/cloud-storage/email_refresh_handler/src/config.rsindex 4a7de5399a..6efca955ac 100644--- a/rust/cloud-storage/email_refresh_handler/src/config.rs+++ b/rust/cloud-storage/email_refresh_handler/src/config.rs@@ -4,7 +4,6 @@ use macro_env_var::env_vars;env_vars! {struct DatabaseUrl;- struct LinkManagerQueue;struct DeleteUnusedAfterDays;struct DeleteInactiveAfterDays;struct InboxHealthPollIntervalHours;@@ -15,9 +14,6 @@ pub struct Config {/// The connection URL for the Postgres database this application should use.pub database_url: String,- /// The queue we put the emails on that need refreshing- pub link_manager_queue: String,-/// The environment we are in#[allow(dead_code)]pub environment: Environment,@@ -38,10 +34,6 @@ impl Config {.context("DATABASE_URL must be provided")?.to_string();- let link_manager_queue = LinkManagerQueue::new()- .context("LINK_MANAGER_QUEUE must be provided")?- .to_string();-let environment = Environment::new_or_prod();let delete_unused_after_days = DeleteUnusedAfterDays::new()@@ -61,7 +53,6 @@ impl Config {Ok(Config {database_url,- link_manager_queue,environment,delete_unused_after_days,delete_inactive_after_days,diff --git a/rust/cloud-storage/email_refresh_handler/src/main.rs b/rust/cloud-storage/email_refresh_handler/src/main.rsindex d975c214e6..9225eb1e1c 100644--- a/rust/cloud-storage/email_refresh_handler/src/main.rs+++ b/rust/cloud-storage/email_refresh_handler/src/main.rs@@ -27,10 +27,11 @@ async fn main() -> Result<(), Error> {.await.context("could not connect to db")?;+ let link_manager_queue = macro_queues::LinkManagerQueue::new();let sqs_client = sqs_client::SQS::new(aws_sdk_sqs::Client::new(¯o_aws_config::get_macro_aws_config().await,))- .email_link_manager_queue(&config.link_manager_queue);+ .email_link_manager_queue(&link_manager_queue);let ctx = context::Context {db,diff --git a/rust/cloud-storage/email_scheduled_handler/Cargo.toml b/rust/cloud-storage/email_scheduled_handler/Cargo.tomlindex 955fa78902..fbcf654db1 100644--- a/rust/cloud-storage/email_scheduled_handler/Cargo.toml+++ b/rust/cloud-storage/email_scheduled_handler/Cargo.toml@@ -14,6 +14,7 @@ lambda_runtime = { workspace = true }macro_entrypoint = { path = "../macro_entrypoint" }macro_env = { path = "../macro_env" }macro_env_var = { path = "../macro_env_var" }+macro_queues = { path = "../macro_queues" }models_email = { path = "../models_email" }sqlx = { workspace = true }sqs_client = { path = "../sqs_client" }diff --git a/rust/cloud-storage/email_scheduled_handler/src/config.rs b/rust/cloud-storage/email_scheduled_handler/src/config.rsindex 697dcd9c1f..ab2092618c 100644--- a/rust/cloud-storage/email_scheduled_handler/src/config.rs+++ b/rust/cloud-storage/email_scheduled_handler/src/config.rs@@ -4,7 +4,6 @@ use macro_env_var::env_vars;env_vars! {struct DatabaseUrl;- struct EmailScheduledQueue;}#[derive(Debug, Clone)]@@ -12,9 +11,6 @@ pub struct Config {/// The connection URL for the Postgres database this application should use.pub database_url: String,- /// The queue we put the emails on that need refreshing- pub email_scheduled_queue: String,-/// The environment we are in#[allow(dead_code)]pub environment: Environment,@@ -26,15 +22,10 @@ impl Config {.context("DATABASE_URL must be provided")?.to_string();- let email_scheduled_queue = EmailScheduledQueue::new()- .context("EMAIL_SCHEDULED_QUEUE must be provided")?- .to_string();-let environment = Environment::new_or_prod();Ok(Config {database_url,- email_scheduled_queue,environment,})}diff --git a/rust/cloud-storage/email_scheduled_handler/src/main.rs b/rust/cloud-storage/email_scheduled_handler/src/main.rsindex bb6565391e..f715304389 100644--- a/rust/cloud-storage/email_scheduled_handler/src/main.rs+++ b/rust/cloud-storage/email_scheduled_handler/src/main.rs@@ -27,10 +27,11 @@ async fn main() -> Result<(), Error> {.await.context("could not connect to db")?;+ let email_scheduled_queue = macro_queues::EmailScheduledQueue::new();let sqs_client = sqs_client::SQS::new(aws_sdk_sqs::Client::new(¯o_aws_config::get_macro_aws_config().await,))- .email_scheduled_queue(&config.email_scheduled_queue);+ .email_scheduled_queue(&email_scheduled_queue);let ctx = context::Context {db,diff --git a/rust/cloud-storage/email_service/Cargo.toml b/rust/cloud-storage/email_service/Cargo.tomlindex 2ddcff7eb6..2996e1b05d 100644--- a/rust/cloud-storage/email_service/Cargo.toml+++ b/rust/cloud-storage/email_service/Cargo.toml@@ -109,6 +109,7 @@ macro_entrypoint = { path = "../macro_entrypoint" }macro_env = { path = "../macro_env" }mailparse = "0.16.1"macro_env_var = { path = "../macro_env_var" }+macro_queues = { path = "../macro_queues" }macro_middleware = { path = "../macro_middleware", default-features = false, features = ["auth", "cloud_storage"] }diff --git a/rust/cloud-storage/email_service/src/bin/backfill_contacts/backfill_contacts.rs b/rust/cloud-storage/email_service/src/bin/backfill_contacts/backfill_contacts.rsindex 1be834c10b..0d0f25130e 100644--- a/rust/cloud-storage/email_service/src/bin/backfill_contacts/backfill_contacts.rs+++ b/rust/cloud-storage/email_service/src/bin/backfill_contacts/backfill_contacts.rs@@ -29,7 +29,7 @@ async fn main() -> anyhow::Result<()> {let contacts_ingress = contacts::domain::service::SqsContactsIngress {queue: contacts::outbound::ingress::SqsContactsQueue::new(aws_sdk_sqs::Client::new(&aws_config),- config.contacts_queue.clone(),+ macro_queues::ContactsQueue::new().to_string(),),};diff --git a/rust/cloud-storage/email_service/src/bin/backfill_contacts/config.rs b/rust/cloud-storage/email_service/src/bin/backfill_contacts/config.rsindex 0845f58c60..456c3adbe2 100644--- a/rust/cloud-storage/email_service/src/bin/backfill_contacts/config.rs+++ b/rust/cloud-storage/email_service/src/bin/backfill_contacts/config.rs@@ -5,13 +5,11 @@ use macro_env_var::env_vars;pub struct Config {pub macro_ids: String,pub database_url: String,- pub contacts_queue: String,}env_vars! {struct MacroIds;struct DatabaseUrl;- struct ContactsQueue;}impl Config {@@ -23,9 +21,6 @@ impl Config {database_url: DatabaseUrl::new().context("DATABASE_URL not set")?.to_string(),- contacts_queue: ContactsQueue::new()- .context("CONTACTS_QUEUE not set")?- .to_string(),})}}diff --git a/rust/cloud-storage/email_service/src/bin/pubsub_workers/pubsub_workers.rs b/rust/cloud-storage/email_service/src/bin/pubsub_workers/pubsub_workers.rsindex 9c0c265df0..cf43a55be5 100644--- a/rust/cloud-storage/email_service/src/bin/pubsub_workers/pubsub_workers.rs+++ b/rust/cloud-storage/email_service/src/bin/pubsub_workers/pubsub_workers.rs@@ -66,35 +66,48 @@ async fn main() -> anyhow::Result<()> {let gmail_queue_aws_config = macro_aws_config::get_macro_aws_config().await;+ let gmail_inbox_sync_queue = macro_queues::GmailInboxSyncQueue::new();+ let gmail_inbox_sync_retry_queue = macro_queues::GmailInboxSyncRetryQueue::new();+ let gmail_ops_queue = macro_queues::GmailOpsQueue::new();+ let gmail_ops_retry_queue = macro_queues::GmailOpsRetryQueue::new();+ let search_event_queue = macro_queues::SearchEventQueue::new();+ let backfill_queue = macro_queues::EmailBackfillQueue::new();+ let email_scheduled_queue = macro_queues::EmailScheduledQueue::new();+ let sfs_uploader_queue = macro_queues::SfsUploaderQueue::new();+ let sfs_delete_queue = macro_queues::SfsDeleteQueue::new();+ let link_manager_queue = macro_queues::LinkManagerQueue::new();+ let contacts_queue = macro_queues::ContactsQueue::new();+ let notification_queue = macro_queues::NotificationQueue::new();+let sqs_client = sqs_client::SQS::new(aws_sdk_sqs::Client::new(&gmail_queue_aws_config))- .gmail_inbox_sync_queue(&config.gmail_inbox_sync_queue)- .gmail_inbox_sync_retry_queue(&config.gmail_inbox_sync_retry_queue)- .gmail_ops_queue(&config.gmail_ops_queue)- .gmail_ops_retry_queue(&config.gmail_ops_retry_queue)- .search_event_queue(&config.search_event_queue)- .email_backfill_queue(&config.backfill_queue)- .email_scheduled_queue(&config.email_scheduled_queue)- .sfs_uploader_queue(&config.sfs_uploader_queue)- .sfs_delete_queue(&config.sfs_delete_queue)- .email_link_manager_queue(&config.link_manager_queue);+ .gmail_inbox_sync_queue(&gmail_inbox_sync_queue)+ .gmail_inbox_sync_retry_queue(&gmail_inbox_sync_retry_queue)+ .gmail_ops_queue(&gmail_ops_queue)+ .gmail_ops_retry_queue(&gmail_ops_retry_queue)+ .search_event_queue(&search_event_queue)+ .email_backfill_queue(&backfill_queue)+ .email_scheduled_queue(&email_scheduled_queue)+ .sfs_uploader_queue(&sfs_uploader_queue)+ .sfs_delete_queue(&sfs_delete_queue)+ .email_link_manager_queue(&link_manager_queue);let contacts_ingress = Arc::new(contacts::domain::service::SqsContactsIngress {queue: contacts::outbound::ingress::SqsContactsQueue::new(aws_sdk_sqs::Client::new(&gmail_queue_aws_config),- config.contacts_queue.to_string(),+ contacts_queue.to_string(),),});let link_manager_worker = sqs_worker::SQSWorker::new(aws_sdk_sqs::Client::new(&gmail_queue_aws_config),- config.link_manager_queue.to_string(),+ link_manager_queue.to_string(),config.queue_max_messages,config.queue_wait_time_seconds,);let scheduled_worker = sqs_worker::SQSWorker::new(aws_sdk_sqs::Client::new(&gmail_queue_aws_config),- config.email_scheduled_queue.to_string(),+ email_scheduled_queue.to_string(),config.queue_max_messages,config.queue_wait_time_seconds,);@@ -103,7 +116,7 @@ async fn main() -> anyhow::Result<()> {.map(|_| {sqs_worker::SQSWorker::new(aws_sdk_sqs::Client::new(&gmail_queue_aws_config),- config.sfs_uploader_queue.to_string(),+ sfs_uploader_queue.to_string(),config.queue_max_messages,config.queue_wait_time_seconds,)@@ -112,7 +125,7 @@ async fn main() -> anyhow::Result<()> {let sfs_delete_worker = sqs_worker::SQSWorker::new(aws_sdk_sqs::Client::new(&gmail_queue_aws_config),- config.sfs_delete_queue.to_string(),+ sfs_delete_queue.to_string(),config.queue_max_messages,config.queue_wait_time_seconds,);@@ -121,7 +134,7 @@ async fn main() -> anyhow::Result<()> {.map(|_| {sqs_worker::SQSWorker::new(aws_sdk_sqs::Client::new(&gmail_queue_aws_config),- config.backfill_queue.to_string(),+ backfill_queue.to_string(),config.backfill_queue_max_messages,config.queue_wait_time_seconds,)@@ -132,7 +145,7 @@ async fn main() -> anyhow::Result<()> {.map(|_| {sqs_worker::SQSWorker::new(aws_sdk_sqs::Client::new(&gmail_queue_aws_config),- config.gmail_ops_queue.to_string(),+ gmail_ops_queue.to_string(),config.gmail_ops_queue_max_messages,config.queue_wait_time_seconds,)@@ -143,7 +156,7 @@ async fn main() -> anyhow::Result<()> {.map(|_| {sqs_worker::SQSWorker::new(aws_sdk_sqs::Client::new(&gmail_queue_aws_config),- config.gmail_ops_retry_queue.to_string(),+ gmail_ops_retry_queue.to_string(),config.gmail_ops_retry_queue_max_messages,config.queue_wait_time_seconds,)@@ -154,7 +167,7 @@ async fn main() -> anyhow::Result<()> {.map(|_| {sqs_worker::SQSWorker::new(aws_sdk_sqs::Client::new(&gmail_queue_aws_config),- config.gmail_inbox_sync_queue.to_string(),+ gmail_inbox_sync_queue.to_string(),config.inbox_sync_queue_max_messages,config.queue_wait_time_seconds,)@@ -165,7 +178,7 @@ async fn main() -> anyhow::Result<()> {.map(|_| {sqs_worker::SQSWorker::new(aws_sdk_sqs::Client::new(&gmail_queue_aws_config),- config.gmail_inbox_sync_retry_queue.to_string(),+ gmail_inbox_sync_retry_queue.to_string(),config.inbox_sync_retry_queue_max_messages,config.queue_wait_time_seconds,)@@ -196,7 +209,7 @@ async fn main() -> anyhow::Result<()> {let ingress_queue = SqsQueue::new(aws_sdk_sqs::Client::new(&aws_config),- config.notification_queue.to_string(),+ notification_queue.to_string(),);let notification_ingress_service = Arc::new(SqsNotificationIngress {queue: ingress_queue,diff --git a/rust/cloud-storage/email_service/src/config.rs b/rust/cloud-storage/email_service/src/config.rsindex cd86f9476c..85527373a8 100644--- a/rust/cloud-storage/email_service/src/config.rs+++ b/rust/cloud-storage/email_service/src/config.rs@@ -8,19 +8,7 @@ env_vars! {pub struct EmailServiceCloudfrontSignerPrivateKey;pub struct MacroDbUrl;pub struct RedisUri;- pub struct LinkManagerQueue;- pub struct EmailScheduledQueue;- pub struct GmailInboxSyncQueue;- pub struct GmailInboxSyncRetryQueue;- pub struct GmailOpsQueue;- pub struct GmailOpsRetryQueue;- pub struct SearchEventQueue;pub struct GmailGcpQueue;- pub struct NotificationQueue;- pub struct BackfillQueue;- pub struct ContactsQueue;- pub struct SfsUploaderQueue;- pub struct SfsDeleteQueue;#[derive(Debug)]pub struct AttachmentBucket;pub struct NotificationsEnabled;@@ -44,48 +32,9 @@ pub struct Config {/// The Redis URI for the Redis this application should use.pub redis_uri: RedisUri,- /// The SQS queue name that email_refresh_handler publishes messages to for refreshing- /// inbox sync subscriptions, and we will publish delete link messages to.- pub link_manager_queue: LinkManagerQueue,-- /// The SQS queue name that email_scheduled_handler publishes messages to for sending- /// scheduled messages.- pub email_scheduled_queue: EmailScheduledQueue,-- /// The SQS queue name we process inbox updates from.- pub gmail_inbox_sync_queue: GmailInboxSyncQueue,-- /// The SQS queue name we process inbox update retries from. Separate from the main queue- /// to avoid backups for large inbox update operations- pub gmail_inbox_sync_retry_queue: GmailInboxSyncRetryQueue,-- /// The SQS queue name for async Gmail operations (label changes, block/unblock, etc.)- pub gmail_ops_queue: GmailOpsQueue,-- /// The SQS queue name for retrying rate-limited Gmail operations- pub gmail_ops_retry_queue: GmailOpsRetryQueue,-- /// The SQS queue name for search event- pub search_event_queue: SearchEventQueue,-/// The GCP queue name that has the subscription that hits our webhook endpointpub gmail_gcp_queue: GmailGcpQueue,- /// The SQS queue name for notification-service- pub notification_queue: NotificationQueue,-- /// The SQS queue name for the backfill process- pub backfill_queue: BackfillQueue,-- /// The SQS queue name for the sfs_uploader process- pub sfs_uploader_queue: SfsUploaderQueue,-- /// The SQS queue name for the sfs_delete process- pub sfs_delete_queue: SfsDeleteQueue,-- /// The SQS queue name for contacts service- pub contacts_queue: ContactsQueue,-/// The amount of time to delay processing of a sent message (undo send window) - default 10s#[macro_config_default(10)]pub sent_undo_delay_secs: u32,diff --git a/rust/cloud-storage/email_service/src/main.rs b/rust/cloud-storage/email_service/src/main.rsindex a5556ad59f..4db6447d48 100644--- a/rust/cloud-storage/email_service/src/main.rs+++ b/rust/cloud-storage/email_service/src/main.rs@@ -59,15 +59,23 @@ async fn main() -> anyhow::Result<()> {.await.context("could not connect to db")?;+ let gmail_inbox_sync_queue = macro_queues::GmailInboxSyncQueue::new();+ let gmail_inbox_sync_retry_queue = macro_queues::GmailInboxSyncRetryQueue::new();+ let gmail_ops_queue = macro_queues::GmailOpsQueue::new();+ let search_event_queue = macro_queues::SearchEventQueue::new();+ let backfill_queue = macro_queues::EmailBackfillQueue::new();+ let email_scheduled_queue = macro_queues::EmailScheduledQueue::new();+ let sfs_uploader_queue = macro_queues::SfsUploaderQueue::new();+ let link_manager_queue = macro_queues::LinkManagerQueue::new();let sqs_client = sqs_client::SQS::new(macro_aws_config::sqs_client().await)- .gmail_inbox_sync_queue(&config.gmail_inbox_sync_queue)- .gmail_inbox_sync_retry_queue(&config.gmail_inbox_sync_retry_queue)- .gmail_ops_queue(&config.gmail_ops_queue)- .search_event_queue(&config.search_event_queue)- .email_backfill_queue(&config.backfill_queue)- .email_scheduled_queue(&config.email_scheduled_queue)- .sfs_uploader_queue(&config.sfs_uploader_queue)- .email_link_manager_queue(&config.link_manager_queue);+ .gmail_inbox_sync_queue(&gmail_inbox_sync_queue)+ .gmail_inbox_sync_retry_queue(&gmail_inbox_sync_retry_queue)+ .gmail_ops_queue(&gmail_ops_queue)+ .search_event_queue(&search_event_queue)+ .email_backfill_queue(&backfill_queue)+ .email_scheduled_queue(&email_scheduled_queue)+ .sfs_uploader_queue(&sfs_uploader_queue)+ .email_link_manager_queue(&link_manager_queue);let auth_service_client = authentication_service_client::AuthServiceClient::new(configdiff --git a/rust/cloud-storage/email_sfs_delete_handler/Cargo.toml b/rust/cloud-storage/email_sfs_delete_handler/Cargo.tomlindex e5e287d317..69ae449ca0 100644--- a/rust/cloud-storage/email_sfs_delete_handler/Cargo.toml+++ b/rust/cloud-storage/email_sfs_delete_handler/Cargo.toml@@ -13,6 +13,7 @@ lambda_runtime = { workspace = true }macro_entrypoint = { path = "../macro_entrypoint" }macro_env = { path = "../macro_env" }macro_env_var = { path = "../macro_env_var" }+macro_queues = { path = "../macro_queues" }sqlx = { workspace = true }sqs_client = { path = "../sqs_client", default-features = false, features = ["email", "sfs_delete"] }tokio = { workspace = true }diff --git a/rust/cloud-storage/email_sfs_delete_handler/src/config.rs b/rust/cloud-storage/email_sfs_delete_handler/src/config.rsindex 1431214b27..ab2092618c 100644--- a/rust/cloud-storage/email_sfs_delete_handler/src/config.rs+++ b/rust/cloud-storage/email_sfs_delete_handler/src/config.rs@@ -4,7 +4,6 @@ use macro_env_var::env_vars;env_vars! {struct DatabaseUrl;- struct SfsDeleteQueue;}#[derive(Debug, Clone)]@@ -12,9 +11,6 @@ pub struct Config {/// The connection URL for the Postgres database this application should use.pub database_url: String,- /// The queue we put messages on for deletion- pub email_sfs_delete_queue: String,-/// The environment we are in#[allow(dead_code)]pub environment: Environment,@@ -26,15 +22,10 @@ impl Config {.context("DATABASE_URL must be provided")?.to_string();- let email_sfs_delete_queue = SfsDeleteQueue::new()- .context("SFS_DELETE_QUEUE must be provided")?- .to_string();-let environment = Environment::new_or_prod();Ok(Config {database_url,- email_sfs_delete_queue,environment,})}diff --git a/rust/cloud-storage/email_sfs_delete_handler/src/main.rs b/rust/cloud-storage/email_sfs_delete_handler/src/main.rsindex 06da956420..e1eb64b1b7 100644--- a/rust/cloud-storage/email_sfs_delete_handler/src/main.rs+++ b/rust/cloud-storage/email_sfs_delete_handler/src/main.rs@@ -25,10 +25,11 @@ async fn main() -> Result<(), Error> {.await.context("could not connect to db")?;+ let sfs_delete_queue = macro_queues::SfsDeleteQueue::new();let sqs_client = sqs_client::SQS::new(aws_sdk_sqs::Client::new(¯o_aws_config::get_macro_aws_config().await,))- .sfs_delete_queue(&config.email_sfs_delete_queue);+ .sfs_delete_queue(&sfs_delete_queue);let ctx = context::Context {db,diff --git a/rust/cloud-storage/macro_queues/Cargo.toml b/rust/cloud-storage/macro_queues/Cargo.tomlnew file mode 100644index 0000000000..494f6dc1c3--- /dev/null+++ b/rust/cloud-storage/macro_queues/Cargo.toml@@ -0,0 +1,11 @@+[package]+edition = "2024"+name = "macro_queues"+publish = false+version = "0.1.0"++[dependencies]+macro_env = { path = "../macro_env" }+paste = { workspace = true }+serde = { workspace = true }+workspace-hack = { version = "0.1", path = "../workspace-hack" }diff --git a/rust/cloud-storage/macro_queues/src/lib.rs b/rust/cloud-storage/macro_queues/src/lib.rsnew file mode 100644index 0000000000..71cbc23920--- /dev/null+++ b/rust/cloud-storage/macro_queues/src/lib.rs@@ -0,0 +1,602 @@+#![deny(missing_docs)]++//! Macro queue name values with per-environment defaults and environment+//! variable overrides.+//!+//! Use [`queue!`] to define a newtype whose default value is selected from+//! [`macro_env::Environment`]. The generated type also checks an override+//! environment variable derived from the type name. For example,+//! `EmailScheduledQueue` checks `OVERRIDE_EMAIL_SCHEDULED_QUEUE` before falling+//! back to its `local`, `dev`, or `prod` default.+//!+//! Queue values are opaque strings (SQS queue names or, in some cases, full+//! queue URLs); this crate does not parse or validate them.++use std::{borrow::Cow, fmt, ops::Deref};++#[doc(hidden)]+pub use macro_env;+#[doc(hidden)]+pub use paste;+#[doc(hidden)]+pub use serde;++#[cfg(test)]+mod test;++#[cfg(test)]+mod testing_harness {+ use std::cell::Cell;++ type MockValue = Cell<Option<Box<dyn Fn(&'static str) -> Result<String, std::env::VarError>>>>;++ thread_local! {+ static MOCK_VAR_GETTER: MockValue = const { Cell::new(None) };+ }++ struct ResetMockEnv;++ impl Drop for ResetMockEnv {+ fn drop(&mut self) {+ MOCK_VAR_GETTER.replace(None);+ }+ }++ #[doc(hidden)]+ #[allow(+ clippy::disallowed_methods,+ reason = "Test harness fallback used when no mock override is set"+ )]+ pub fn read_override_env(var_name: &'static str) -> Option<String> {+ let cur_getter = MOCK_VAR_GETTER.replace(None);+ match cur_getter {+ Some(mock) => {+ let out = mock(var_name);+ MOCK_VAR_GETTER.replace(Some(mock));+ out+ }+ None => std::env::var(var_name),+ }+ .ok()+ }++ pub(crate) fn with_mock_override_env<F, Cb, U>(f: F, cb: Cb) -> U+ where+ F: Fn(&'static str) -> Result<String, std::env::VarError> + 'static,+ Cb: FnOnce() -> U,+ {+ MOCK_VAR_GETTER.replace(Some(Box::new(f)));+ let _guard = ResetMockEnv;+ cb()+ }+}++#[cfg(test)]+#[doc(hidden)]+pub use testing_harness::read_override_env;++/// Read an override environment variable for a queue. Returns `None` if the+/// variable is unset or cannot be read.+#[cfg(not(test))]+#[doc(hidden)]+#[allow(+ clippy::disallowed_methods,+ reason = "Used when running locally to override queues"+)]+pub fn read_override_env(var_name: &'static str) -> Option<String> {+ std::env::var(var_name).ok()+}++/// A queue name string that can either borrow an existing string slice or own+/// a runtime override value.+#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]+pub struct Queue<'a>(Cow<'a, str>);++impl<'a> Queue<'a> {+ /// Create a queue that borrows a string slice.+ pub const fn borrowed(queue: &'a str) -> Self {+ Self(Cow::Borrowed(queue))+ }++ /// Create a queue that owns a runtime string.+ pub fn owned(queue: impl Into<String>) -> Queue<'static> {+ Queue(Cow::Owned(queue.into()))+ }++ /// Return the queue name as a string slice.+ pub fn as_str(&self) -> &str {+ self.0.as_ref()+ }++ /// Return a cheaply copied borrowed view of this queue.+ pub fn copied(&self) -> Queue<'_> {+ Queue(Cow::Borrowed(self.as_str()))+ }++ /// Convert this queue into an owned `'static` value.+ pub fn into_owned(self) -> Queue<'static> {+ Queue(Cow::Owned(self.0.into_owned()))+ }++ /// Convert this queue into its internal [`Cow`].+ pub fn into_cow(self) -> Cow<'a, str> {+ self.0+ }++ /// Return the borrowed string if this queue is currently borrowed.+ pub fn borrowed_inner(&self) -> Option<&'a str> {+ match &self.0 {+ Cow::Borrowed(queue) => Some(*queue),+ Cow::Owned(_) => None,+ }+ }++ /// Return the owned string if this queue is currently owned.+ pub fn owned_inner(&self) -> Option<&String> {+ match &self.0 {+ Cow::Borrowed(_) => None,+ Cow::Owned(queue) => Some(queue),+ }+ }+}++impl<'a> From<&'a str> for Queue<'a> {+ fn from(value: &'a str) -> Self {+ Self::borrowed(value)+ }+}++impl From<String> for Queue<'static> {+ fn from(value: String) -> Self {+ Self(Cow::Owned(value))+ }+}++impl<'a> From<Cow<'a, str>> for Queue<'a> {+ fn from(value: Cow<'a, str>) -> Self {+ Self(value)+ }+}++impl<'a> From<Queue<'a>> for String {+ fn from(value: Queue<'a>) -> Self {+ value.0.into_owned()+ }+}++impl<'a> Deref for Queue<'a> {+ type Target = str;++ fn deref(&self) -> &Self::Target {+ self.as_str()+ }+}++impl<'a> AsRef<str> for Queue<'a> {+ fn as_ref(&self) -> &str {+ self.as_str()+ }+}++impl<'a> fmt::Display for Queue<'a> {+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {+ f.write_str(self.as_str())+ }+}++/// Define typed queue name values with per-environment defaults and override+/// environment variables.+///+/// The override environment variable name is derived from the struct name:+/// `EmailScheduledQueue` checks `OVERRIDE_EMAIL_SCHEDULED_QUEUE`. If that+/// override is not set, [`macro_env::Environment`] selects one of the provided+/// `local`, `dev`, or `prod` defaults.+///+/// # Example+///+/// ```+/// macro_queues::queue! {+/// #[derive(Debug, Clone)]+/// pub struct ExampleQueue {+/// local: "example-queue",+/// dev: "example-queue-dev",+/// prod: "example-queue-prod",+/// }+/// }+///+/// let queue = ExampleQueue::new();+/// assert_eq!(queue.override_env_var_name(), "OVERRIDE_EXAMPLE_QUEUE");+/// ```+#[macro_export]+macro_rules! queue {+ (+ $(#[$attr:meta])*+ $v:vis struct $n:ident {+ local: $local:literal,+ dev: $dev:literal,+ prod: $prod:literal $(,)?+ }+ ) => {+ $crate::paste::paste! {+ #[doc = "Typed queue name loaded from `OVERRIDE_" $n:snake:upper "` or selected from per-environment defaults."]+ $(#[$attr])*+ $v struct $n($crate::Queue<'static>);++ impl $n {+ #[doc = "Override environment variable checked before falling back to per-environment defaults."]+ $v const OVERRIDE_ENV_VAR_NAME: &'static str = concat!("OVERRIDE_", stringify!([<$n:snake:upper>]));++ #[doc = "Default queue name for [`macro_env::Environment::Local`]."]+ $v const LOCAL: &'static str = $local;++ #[doc = "Default queue name for [`macro_env::Environment::Develop`]."]+ $v const DEV: &'static str = $dev;++ #[doc = "Default queue name for [`macro_env::Environment::Production`]."]+ $v const PROD: &'static str = $prod;++ #[doc = "Create a new instance of [`Self`], using the override env var if set and otherwise selecting a default from [`macro_env::Environment::new_or_prod`]."]+ #[allow(dead_code, clippy::new_without_default)]+ $v fn new() -> Self {+ Self::new_for_environment($crate::macro_env::Environment::new_or_prod())+ }++ #[doc = "Create a new instance of [`Self`] for a specific environment, using the override env var if set."]+ #[allow(dead_code)]+ $v fn new_for_environment(environment: $crate::macro_env::Environment) -> Self {+ if let Some(value) = $crate::read_override_env(Self::OVERRIDE_ENV_VAR_NAME) {+ return Self($crate::Queue::owned(value));+ }++ Self::default_for_environment(environment)+ }++ #[doc = "Create a new instance of [`Self`] for a specific environment without checking the override env var."]+ #[allow(dead_code)]+ $v const fn default_for_environment(environment: $crate::macro_env::Environment) -> Self {+ match environment {+ $crate::macro_env::Environment::Local => Self::from_static(Self::LOCAL),+ $crate::macro_env::Environment::Develop => Self::from_static(Self::DEV),+ $crate::macro_env::Environment::Production => Self::from_static(Self::PROD),+ }+ }++ #[doc = "Create a new instance of [`Self`] from the local default queue name."]+ #[allow(dead_code)]+ $v const fn local() -> Self {+ Self::from_static(Self::LOCAL)+ }++ #[doc = "Create a new instance of [`Self`] from the dev default queue name."]+ #[allow(dead_code)]+ $v const fn dev() -> Self {+ Self::from_static(Self::DEV)+ }++ #[doc = "Create a new instance of [`Self`] from the prod default queue name."]+ #[allow(dead_code)]+ $v const fn prod() -> Self {+ Self::from_static(Self::PROD)+ }++ #[doc = "Create a new instance of [`Self`] from a static queue name."]+ #[allow(dead_code)]+ $v const fn from_static(queue: &'static str) -> Self {+ Self($crate::Queue::borrowed(queue))+ }++ #[doc = "Create a new instance of [`Self`] from an owned runtime queue name."]+ #[allow(dead_code)]+ $v fn from_owned(queue: impl Into<String>) -> Self {+ Self($crate::Queue::owned(queue))+ }++ #[doc = "Return the override environment variable name checked by [`Self::new`]."]+ #[allow(dead_code)]+ $v const fn override_env_var_name(&self) -> &'static str {+ Self::OVERRIDE_ENV_VAR_NAME+ }++ #[doc = "Return the contained [`Queue`]."]+ #[allow(dead_code)]+ $v fn into_inner(self) -> $crate::Queue<'static> {+ self.0+ }++ #[doc = "Return a reference to the contained [`Queue`]."]+ #[allow(dead_code)]+ $v fn inner(&self) -> &$crate::Queue<'static> {+ &self.0+ }++ #[doc = "Return the queue name as a string slice."]+ #[allow(dead_code)]+ $v fn as_str(&self) -> &str {+ self.0.as_str()+ }++ #[doc = "Return a cheaply copied borrowed view of this queue."]+ #[allow(dead_code)]+ $v fn copied(&self) -> $crate::Queue<'_> {+ self.0.copied()+ }+ }++ impl std::ops::Deref for $n {+ type Target = str;++ fn deref(&self) -> &Self::Target {+ self.as_str()+ }+ }++ impl std::convert::AsRef<str> for $n {+ fn as_ref(&self) -> &str {+ self.as_str()+ }+ }++ impl std::fmt::Display for $n {+ fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {+ f.write_str(self.as_str())+ }+ }++ impl std::convert::From<$crate::Queue<'static>> for $n {+ fn from(value: $crate::Queue<'static>) -> Self {+ Self(value)+ }+ }++ impl std::convert::From<$n> for $crate::Queue<'static> {+ fn from(value: $n) -> Self {+ value.0+ }+ }++ impl std::convert::From<String> for $n {+ fn from(value: String) -> Self {+ Self::from_owned(value)+ }+ }++ impl std::convert::From<&'static str> for $n {+ fn from(value: &'static str) -> Self {+ Self::from_static(value)+ }+ }++ impl<'de> $crate::serde::Deserialize<'de> for $n {+ fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>+ where+ D: $crate::serde::Deserializer<'de>,+ {+ let value = <String as $crate::serde::Deserialize>::deserialize(deserializer)?;+ Ok(Self($crate::Queue::owned(value)))+ }+ }+ }+ };+ (+ $(#[$attr:meta])*+ $v:vis struct $n:ident {+ $(+ $(#[$field_attr:meta])*+ $field_vis:vis $field_name:ident {+ local: $field_local:literal,+ dev: $field_dev:literal,+ prod: $field_prod:literal $(,)?+ }+ ),* $(,)?+ }+ ) => {+ $crate::paste::paste! {+ $(+ $crate::queue!(+ $(#[$field_attr])*+ $field_vis struct $field_name {+ local: $field_local,+ dev: $field_dev,+ prod: $field_prod,+ }+ );+ )*++ #[doc = "A collection of typed queues."]+ $(#[$attr])*+ $v struct $n {+ $(+ #[doc = "Typed queue loaded from `OVERRIDE_" $field_name:snake:upper "` or selected from per-environment defaults."]+ $field_vis [<$field_name:snake>]: $field_name,+ )*+ }++ impl $n {+ #[doc = "Create a new instance of [`Self`] with all queues resolved for the current macro environment."]+ #[allow(dead_code, clippy::new_without_default)]+ $v fn new() -> Self {+ let environment = $crate::macro_env::Environment::new_or_prod();+ Self::new_for_environment(environment)+ }++ #[doc = "Create a new instance of [`Self`] with all queues resolved for a specific environment."]+ #[allow(dead_code)]+ $v fn new_for_environment(environment: $crate::macro_env::Environment) -> Self {+ Self {+ $(+ [<$field_name:snake>]: $field_name::new_for_environment(environment),+ )*+ }+ }++ #[doc = "Create a new instance of [`Self`] with all queues set to environment defaults without checking overrides."]+ #[allow(dead_code)]+ $v const fn default_for_environment(environment: $crate::macro_env::Environment) -> Self {+ Self {+ $(+ [<$field_name:snake>]: $field_name::default_for_environment(environment),+ )*+ }+ }+ }+ }+ };+}++queue! {+ /// Common SQS queues used by Macro services.+ ///+ /// Default values mirror what infrastructure provisions: `local` uses the+ /// bare queue names seen in `docker-compose.local-e2e.yml`, while `dev` and+ /// `prod` use the `{base}-queue-{stack}` names provisioned by Pulumi.+ pub struct Queues {+ /// Queue for document text extraction jobs.+ pub DocumentTextExtractorQueue {+ local: "document-text-extractor-lambda-queue",+ dev: "document-text-extractor-lambda-queue-dev",+ prod: "document-text-extractor-lambda-queue-prod",+ },+ /// Queue for chat delete jobs.+ pub ChatDeleteQueue {+ local: "delete-chat-handler-queue",+ dev: "delete-chat-handler-queue-dev",+ prod: "delete-chat-handler-queue-prod",+ },+ /// Queue for scheduled email sends.+ pub EmailScheduledQueue {+ local: "email-service-scheduled-queue",+ dev: "email-service-scheduled-queue-dev",+ prod: "email-service-scheduled-queue-prod",+ },+ /// Queue for async Gmail label/sync operations.+ pub GmailOpsQueue {+ local: "email-service-gmail-ops-queue",+ dev: "email-service-gmail-ops-queue-dev",+ prod: "email-service-gmail-ops-queue-prod",+ },+ /// Queue for retrying rate-limited Gmail operations.+ pub GmailOpsRetryQueue {+ local: "email-service-gmail-ops-retry-queue",+ dev: "email-service-gmail-ops-retry-queue-dev",+ prod: "email-service-gmail-ops-retry-queue-prod",+ },+ /// Queue for egress notification delivery.+ pub NotificationQueue {+ local: "notification-queue",+ dev: "notification-queue-dev",+ prod: "notification-queue-prod",+ },+ /// Queue for ingress notification creation.+ pub NotificationIngressQueue {+ local: "notification-ingress-queue",+ dev: "notification-ingress-queue-dev",+ prod: "notification-ingress-queue-prod",+ },+ /// Queue for search index events.+ pub SearchEventQueue {+ local: "search-event-queue",+ dev: "search-event-queue-dev",+ prod: "search-event-queue-prod",+ },+ /// Queue for AI projection materialization jobs.+ pub AiProjectionQueue {+ local: "ai-projection-queue",+ dev: "ai-projection-queue-dev",+ prod: "ai-projection-queue-prod",+ },+ /// Queue for document conversion jobs.+ pub ConvertQueue {+ local: "convert-service-queue",+ dev: "convert-service-queue-dev",+ prod: "convert-service-queue-prod",+ },+ /// Queue for document delete jobs.+ pub DocumentDeleteQueue {+ local: "delete-document-handler-queue",+ dev: "delete-document-handler-queue-dev",+ prod: "delete-document-handler-queue-prod",+ },+ /// Queue for static-file-service deletion messages.+ pub SfsDeleteQueue {+ local: "email-sfs-delete-queue",+ dev: "email-sfs-delete-queue-dev",+ prod: "email-sfs-delete-queue-prod",+ },+ /// Queue for static-file-service uploader jobs.+ pub SfsUploaderQueue {+ local: "email-service-sfs-mapper-queue",+ dev: "email-service-sfs-mapper-queue-dev",+ prod: "email-service-sfs-mapper-queue-prod",+ },+ /// Queue for the contacts service.+ pub ContactsQueue {+ local: "contacts-queue",+ dev: "contacts-queue-dev",+ prod: "contacts-queue-prod",+ },+ /// Queue for push notification delivery events.+ pub PushNotificationEventHandlerQueue {+ local: "push-delivery-queue",+ dev: "push-delivery-queue-dev",+ prod: "push-delivery-queue-prod",+ },+ /// Queue for static-file-service S3 upload event notifications.+ ///+ /// Note: this value is consumed as a full SQS URL in deployed+ /// environments (`queueQueue.url`), not a bare name. The bare name is+ /// baked here for consistency; see `queue-migration.md` for how the+ /// static-file-service migration must resolve the name to a URL.+ pub StaticFileServiceS3EventQueueUrl {+ local: "static-file-s3-event-notification-queue",+ dev: "static-file-s3-event-notification-queue-dev",+ prod: "static-file-s3-event-notification-queue-prod",+ },+ /// Queue for the email link manager / refresh handler.+ pub LinkManagerQueue {+ local: "email-service-refresh-queue",+ dev: "email-service-refresh-queue-dev",+ prod: "email-service-refresh-queue-prod",+ },+ /// Queue for Gmail inbox update processing.+ ///+ /// Note: the local queue name uses the `gmail-inbox-sync` base while+ /// dev/prod derive from the `gmail-webhook` base. This divergence is+ /// intentional and matches the existing infrastructure.+ pub GmailInboxSyncQueue {+ local: "email-service-gmail-inbox-sync-queue",+ dev: "email-service-gmail-webhook-queue-dev",+ prod: "email-service-gmail-webhook-queue-prod",+ },+ /// Queue for Gmail inbox update retries.+ ///+ /// Note: the local queue name uses the `gmail-inbox-retry` base while+ /// dev/prod derive from the `gmail-webhook-retry` base. This divergence+ /// is intentional and matches the existing infrastructure.+ pub GmailInboxSyncRetryQueue {+ local: "email-service-gmail-inbox-retry-queue",+ dev: "email-service-gmail-webhook-retry-queue-dev",+ prod: "email-service-gmail-webhook-retry-queue-prod",+ },+ /// Queue for the email backfill process (authentication_service+ /// `EMAIL_BACKFILL_QUEUE` and email_service `BACKFILL_QUEUE`).+ pub EmailBackfillQueue {+ local: "email-service-backfill-queue",+ dev: "email-service-backfill-queue-dev",+ prod: "email-service-backfill-queue-prod",+ },+ /// Queue for the bulk upload extractor lambda+ /// (upload_extractor_lambda_trigger `UPLOAD_EXTRACTOR_QUEUE`).+ pub UploadExtractorQueue {+ local: "bulk-upload-queue",+ dev: "bulk-upload-queue-dev",+ prod: "bulk-upload-queue-prod",+ },+ /// Queue for the organization retention handler+ /// (organization_retention_trigger `ORGANIZATION_RETENTION_QUEUE`).+ pub OrganizationRetentionQueue {+ local: "organization-retention-handler-queue",+ dev: "organization-retention-handler-queue-dev",+ prod: "organization-retention-handler-queue-prod",+ },+ }+}diff --git a/rust/cloud-storage/macro_queues/src/test.rs b/rust/cloud-storage/macro_queues/src/test.rsnew file mode 100644index 0000000000..1b04bcebd7--- /dev/null+++ b/rust/cloud-storage/macro_queues/src/test.rs@@ -0,0 +1,486 @@+use super::testing_harness::with_mock_override_env;+use super::*;+use macro_env::Environment;++crate::queue! {+ #[derive(Debug, Clone)]+ pub struct TestQueue {+ local: "test-queue",+ dev: "test-queue-dev",+ prod: "test-queue-prod",+ }+}++fn missing_override(_: &'static str) -> Result<String, std::env::VarError> {+ Err(std::env::VarError::NotPresent)+}++#[test]+fn defaults_are_selected_by_environment() {+ with_mock_override_env(missing_override, || {+ assert_eq!(+ TestQueue::new_for_environment(Environment::Local).as_ref(),+ "test-queue",+ );+ assert_eq!(+ TestQueue::new_for_environment(Environment::Develop).as_ref(),+ "test-queue-dev",+ );+ assert_eq!(+ TestQueue::new_for_environment(Environment::Production).as_ref(),+ "test-queue-prod",+ );+ });+}++#[test]+fn default_values_are_borrowed() {+ let queue = TestQueue::default_for_environment(Environment::Local);++ assert_eq!(queue.as_ref(), "test-queue");+ assert_eq!(queue.inner().borrowed_inner(), Some("test-queue"));+}++fn mock_test_queue_override(var_name: &'static str) -> Result<String, std::env::VarError> {+ (var_name == "OVERRIDE_TEST_QUEUE")+ .then(|| "override-queue".to_string())+ .ok_or(std::env::VarError::NotPresent)+}++#[test]+fn override_env_var_wins_over_environment_default() {+ let queue = with_mock_override_env(mock_test_queue_override, || {+ TestQueue::new_for_environment(Environment::Local)+ });++ assert_eq!(queue.as_ref(), "override-queue");+ assert_eq!(queue.override_env_var_name(), "OVERRIDE_TEST_QUEUE");+ assert_eq!(queue.inner().owned_inner().unwrap(), "override-queue");+}++#[test]+fn helpers_construct_expected_defaults() {+ assert_eq!(TestQueue::local().as_ref(), "test-queue");+ assert_eq!(TestQueue::dev().as_ref(), "test-queue-dev");+ assert_eq!(TestQueue::prod().as_ref(), "test-queue-prod");+}++#[test]+fn copied_returns_a_borrowed_view() {+ let queue = TestQueue::from_owned("runtime-queue");+ let copied = queue.copied();++ assert_eq!(copied.as_ref(), "runtime-queue");+ assert_eq!(copied.borrowed_inner(), Some("runtime-queue"));+}++crate::queue! {+ #[derive(Debug)]+ pub struct TestQueues {+ #[derive(Debug, Clone)]+ pub TestNotificationQueue {+ local: "test-notification-queue",+ dev: "test-notification-queue-dev",+ prod: "test-notification-queue-prod",+ },+ #[derive(Debug, Clone)]+ pub TestSearchEventQueue {+ local: "test-search-event-queue",+ dev: "test-search-event-queue-dev",+ prod: "test-search-event-queue-prod",+ },+ }+}++fn mock_group_overrides(var_name: &'static str) -> Result<String, std::env::VarError> {+ match var_name {+ "OVERRIDE_TEST_SEARCH_EVENT_QUEUE" => Ok("override-search-queue".to_string()),+ _ => Err(std::env::VarError::NotPresent),+ }+}++#[test]+fn grouped_macro_resolves_all_queues() {+ let queues = with_mock_override_env(mock_group_overrides, || {+ TestQueues::new_for_environment(Environment::Develop)+ });++ assert_eq!(+ queues.test_notification_queue.as_ref(),+ "test-notification-queue-dev",+ );+ assert_eq!(+ queues.test_search_event_queue.as_ref(),+ "override-search-queue",+ );+}++#[test]+fn grouped_defaults_do_not_check_overrides() {+ let queues = TestQueues::default_for_environment(Environment::Production);++ assert_eq!(+ queues.test_notification_queue.as_ref(),+ "test-notification-queue-prod",+ );+ assert_eq!(+ queues.test_search_event_queue.as_ref(),+ "test-search-event-queue-prod",+ );+}++#[test]+fn exported_queues_match_local_values() {+ let queues = Queues::default_for_environment(Environment::Local);++ assert_eq!(+ queues.document_text_extractor_queue.as_ref(),+ "document-text-extractor-lambda-queue",+ );+ assert_eq!(+ queues.chat_delete_queue.as_ref(),+ "delete-chat-handler-queue"+ );+ assert_eq!(+ queues.email_scheduled_queue.as_ref(),+ "email-service-scheduled-queue",+ );+ assert_eq!(+ queues.gmail_ops_queue.as_ref(),+ "email-service-gmail-ops-queue",+ );+ assert_eq!(+ queues.gmail_ops_retry_queue.as_ref(),+ "email-service-gmail-ops-retry-queue",+ );+ assert_eq!(queues.notification_queue.as_ref(), "notification-queue");+ assert_eq!(+ queues.notification_ingress_queue.as_ref(),+ "notification-ingress-queue",+ );+ assert_eq!(queues.search_event_queue.as_ref(), "search-event-queue");+ assert_eq!(queues.ai_projection_queue.as_ref(), "ai-projection-queue");+ assert_eq!(queues.convert_queue.as_ref(), "convert-service-queue");+ assert_eq!(+ queues.document_delete_queue.as_ref(),+ "delete-document-handler-queue",+ );+ assert_eq!(queues.sfs_delete_queue.as_ref(), "email-sfs-delete-queue");+ assert_eq!(+ queues.sfs_uploader_queue.as_ref(),+ "email-service-sfs-mapper-queue",+ );+ assert_eq!(queues.contacts_queue.as_ref(), "contacts-queue");+ assert_eq!(+ queues.push_notification_event_handler_queue.as_ref(),+ "push-delivery-queue",+ );+ assert_eq!(+ queues.static_file_service_s3_event_queue_url.as_ref(),+ "static-file-s3-event-notification-queue",+ );+ assert_eq!(+ queues.link_manager_queue.as_ref(),+ "email-service-refresh-queue",+ );+ assert_eq!(+ queues.gmail_inbox_sync_queue.as_ref(),+ "email-service-gmail-inbox-sync-queue",+ );+ assert_eq!(+ queues.gmail_inbox_sync_retry_queue.as_ref(),+ "email-service-gmail-inbox-retry-queue",+ );+ assert_eq!(+ queues.email_backfill_queue.as_ref(),+ "email-service-backfill-queue",+ );+ assert_eq!(queues.upload_extractor_queue.as_ref(), "bulk-upload-queue");+ assert_eq!(+ queues.organization_retention_queue.as_ref(),+ "organization-retention-handler-queue",+ );+}++#[test]+fn exported_queues_match_dev_values() {+ let queues = Queues::default_for_environment(Environment::Develop);++ assert_eq!(+ queues.document_text_extractor_queue.as_ref(),+ "document-text-extractor-lambda-queue-dev",+ );+ assert_eq!(+ queues.chat_delete_queue.as_ref(),+ "delete-chat-handler-queue-dev",+ );+ assert_eq!(+ queues.email_scheduled_queue.as_ref(),+ "email-service-scheduled-queue-dev",+ );+ assert_eq!(+ queues.gmail_ops_queue.as_ref(),+ "email-service-gmail-ops-queue-dev",+ );+ assert_eq!(+ queues.gmail_ops_retry_queue.as_ref(),+ "email-service-gmail-ops-retry-queue-dev",+ );+ assert_eq!(queues.notification_queue.as_ref(), "notification-queue-dev");+ assert_eq!(+ queues.notification_ingress_queue.as_ref(),+ "notification-ingress-queue-dev",+ );+ assert_eq!(queues.search_event_queue.as_ref(), "search-event-queue-dev");+ assert_eq!(+ queues.ai_projection_queue.as_ref(),+ "ai-projection-queue-dev",+ );+ assert_eq!(queues.convert_queue.as_ref(), "convert-service-queue-dev");+ assert_eq!(+ queues.document_delete_queue.as_ref(),+ "delete-document-handler-queue-dev",+ );+ assert_eq!(+ queues.sfs_delete_queue.as_ref(),+ "email-sfs-delete-queue-dev",+ );+ assert_eq!(+ queues.sfs_uploader_queue.as_ref(),+ "email-service-sfs-mapper-queue-dev",+ );+ assert_eq!(queues.contacts_queue.as_ref(), "contacts-queue-dev");+ assert_eq!(+ queues.push_notification_event_handler_queue.as_ref(),+ "push-delivery-queue-dev",+ );+ assert_eq!(+ queues.static_file_service_s3_event_queue_url.as_ref(),+ "static-file-s3-event-notification-queue-dev",+ );+ assert_eq!(+ queues.link_manager_queue.as_ref(),+ "email-service-refresh-queue-dev",+ );+ assert_eq!(+ queues.gmail_inbox_sync_queue.as_ref(),+ "email-service-gmail-webhook-queue-dev",+ );+ assert_eq!(+ queues.gmail_inbox_sync_retry_queue.as_ref(),+ "email-service-gmail-webhook-retry-queue-dev",+ );+ assert_eq!(+ queues.email_backfill_queue.as_ref(),+ "email-service-backfill-queue-dev",+ );+ assert_eq!(+ queues.upload_extractor_queue.as_ref(),+ "bulk-upload-queue-dev",+ );+ assert_eq!(+ queues.organization_retention_queue.as_ref(),+ "organization-retention-handler-queue-dev",+ );+}++#[test]+fn exported_queues_match_prod_values() {+ let queues = Queues::default_for_environment(Environment::Production);++ assert_eq!(+ queues.document_text_extractor_queue.as_ref(),+ "document-text-extractor-lambda-queue-prod",+ );+ assert_eq!(+ queues.chat_delete_queue.as_ref(),+ "delete-chat-handler-queue-prod",+ );+ assert_eq!(+ queues.email_scheduled_queue.as_ref(),+ "email-service-scheduled-queue-prod",+ );+ assert_eq!(+ queues.gmail_ops_queue.as_ref(),+ "email-service-gmail-ops-queue-prod",+ );+ assert_eq!(+ queues.gmail_ops_retry_queue.as_ref(),+ "email-service-gmail-ops-retry-queue-prod",+ );+ assert_eq!(+ queues.notification_queue.as_ref(),+ "notification-queue-prod"+ );+ assert_eq!(+ queues.notification_ingress_queue.as_ref(),+ "notification-ingress-queue-prod",+ );+ assert_eq!(+ queues.search_event_queue.as_ref(),+ "search-event-queue-prod"+ );+ assert_eq!(+ queues.ai_projection_queue.as_ref(),+ "ai-projection-queue-prod",+ );+ assert_eq!(queues.convert_queue.as_ref(), "convert-service-queue-prod");+ assert_eq!(+ queues.document_delete_queue.as_ref(),+ "delete-document-handler-queue-prod",+ );+ assert_eq!(+ queues.sfs_delete_queue.as_ref(),+ "email-sfs-delete-queue-prod",+ );+ assert_eq!(+ queues.sfs_uploader_queue.as_ref(),+ "email-service-sfs-mapper-queue-prod",+ );+ assert_eq!(queues.contacts_queue.as_ref(), "contacts-queue-prod");+ assert_eq!(+ queues.push_notification_event_handler_queue.as_ref(),+ "push-delivery-queue-prod",+ );+ assert_eq!(+ queues.static_file_service_s3_event_queue_url.as_ref(),+ "static-file-s3-event-notification-queue-prod",+ );+ assert_eq!(+ queues.link_manager_queue.as_ref(),+ "email-service-refresh-queue-prod",+ );+ assert_eq!(+ queues.gmail_inbox_sync_queue.as_ref(),+ "email-service-gmail-webhook-queue-prod",+ );+ assert_eq!(+ queues.gmail_inbox_sync_retry_queue.as_ref(),+ "email-service-gmail-webhook-retry-queue-prod",+ );+ assert_eq!(+ queues.email_backfill_queue.as_ref(),+ "email-service-backfill-queue-prod",+ );+ assert_eq!(+ queues.upload_extractor_queue.as_ref(),+ "bulk-upload-queue-prod",+ );+ assert_eq!(+ queues.organization_retention_queue.as_ref(),+ "organization-retention-handler-queue-prod",+ );+}++#[test]+fn exported_queue_override_names_are_derived_from_env_var_names() {+ assert_eq!(+ DocumentTextExtractorQueue::local().override_env_var_name(),+ "OVERRIDE_DOCUMENT_TEXT_EXTRACTOR_QUEUE",+ );+ assert_eq!(+ ChatDeleteQueue::local().override_env_var_name(),+ "OVERRIDE_CHAT_DELETE_QUEUE",+ );+ assert_eq!(+ EmailScheduledQueue::local().override_env_var_name(),+ "OVERRIDE_EMAIL_SCHEDULED_QUEUE",+ );+ assert_eq!(+ GmailOpsQueue::local().override_env_var_name(),+ "OVERRIDE_GMAIL_OPS_QUEUE",+ );+ assert_eq!(+ GmailOpsRetryQueue::local().override_env_var_name(),+ "OVERRIDE_GMAIL_OPS_RETRY_QUEUE",+ );+ assert_eq!(+ NotificationQueue::local().override_env_var_name(),+ "OVERRIDE_NOTIFICATION_QUEUE",+ );+ assert_eq!(+ NotificationIngressQueue::local().override_env_var_name(),+ "OVERRIDE_NOTIFICATION_INGRESS_QUEUE",+ );+ assert_eq!(+ SearchEventQueue::local().override_env_var_name(),+ "OVERRIDE_SEARCH_EVENT_QUEUE",+ );+ assert_eq!(+ AiProjectionQueue::local().override_env_var_name(),+ "OVERRIDE_AI_PROJECTION_QUEUE",+ );+ assert_eq!(+ ConvertQueue::local().override_env_var_name(),+ "OVERRIDE_CONVERT_QUEUE",+ );+ assert_eq!(+ DocumentDeleteQueue::local().override_env_var_name(),+ "OVERRIDE_DOCUMENT_DELETE_QUEUE",+ );+ assert_eq!(+ SfsDeleteQueue::local().override_env_var_name(),+ "OVERRIDE_SFS_DELETE_QUEUE",+ );+ assert_eq!(+ SfsUploaderQueue::local().override_env_var_name(),+ "OVERRIDE_SFS_UPLOADER_QUEUE",+ );+ assert_eq!(+ ContactsQueue::local().override_env_var_name(),+ "OVERRIDE_CONTACTS_QUEUE",+ );+ assert_eq!(+ PushNotificationEventHandlerQueue::local().override_env_var_name(),+ "OVERRIDE_PUSH_NOTIFICATION_EVENT_HANDLER_QUEUE",+ );+ // Pins the digit-boundary case: `S3` stays fused with a separator after it.+ assert_eq!(+ StaticFileServiceS3EventQueueUrl::local().override_env_var_name(),+ "OVERRIDE_STATIC_FILE_SERVICE_S3_EVENT_QUEUE_URL",+ );+ assert_eq!(+ LinkManagerQueue::local().override_env_var_name(),+ "OVERRIDE_LINK_MANAGER_QUEUE",+ );+ assert_eq!(+ GmailInboxSyncQueue::local().override_env_var_name(),+ "OVERRIDE_GMAIL_INBOX_SYNC_QUEUE",+ );+ assert_eq!(+ GmailInboxSyncRetryQueue::local().override_env_var_name(),+ "OVERRIDE_GMAIL_INBOX_SYNC_RETRY_QUEUE",+ );+ assert_eq!(+ EmailBackfillQueue::local().override_env_var_name(),+ "OVERRIDE_EMAIL_BACKFILL_QUEUE",+ );+ assert_eq!(+ UploadExtractorQueue::local().override_env_var_name(),+ "OVERRIDE_UPLOAD_EXTRACTOR_QUEUE",+ );+ assert_eq!(+ OrganizationRetentionQueue::local().override_env_var_name(),+ "OVERRIDE_ORGANIZATION_RETENTION_QUEUE",+ );+}++#[test]+fn queue_deserializes_from_string() {+ use serde::Deserialize;+ use serde::de::IntoDeserializer;+ use serde::de::value::{Error as DeError, StrDeserializer};++ let deserializer: StrDeserializer<DeError> = "custom-queue".into_deserializer();+ let queue = EmailScheduledQueue::deserialize(deserializer).unwrap();++ assert_eq!(queue.as_str(), "custom-queue");+}++#[test]+fn queue_converts_to_string() {+ let queue = Queue::borrowed("borrowed-queue");+ let queue_string: String = queue.into();++ assert_eq!(queue_string, "borrowed-queue");+}diff --git a/rust/cloud-storage/mcp_service/Cargo.toml b/rust/cloud-storage/mcp_service/Cargo.tomlindex 4fe77b5f42..b38e2ba3a0 100644--- a/rust/cloud-storage/mcp_service/Cargo.toml+++ b/rust/cloud-storage/mcp_service/Cargo.toml@@ -43,6 +43,7 @@ macro_entrypoint = { path = "../macro_entrypoint" }macro_config = { path = "../macro_config" }macro_env = { path = "../macro_env" }macro_env_var = { path = "../macro_env_var" }+macro_queues = { path = "../macro_queues" }database_env_vars = { path = "../macro_env_vars/database_env_vars" }doppler-config = { workspace = true }macro_middleware = { path = "../macro_middleware", default-features = false, features = [diff --git a/rust/cloud-storage/mcp_service/src/config.rs b/rust/cloud-storage/mcp_service/src/config.rsindex c80cb8c592..5ccc155d78 100644--- a/rust/cloud-storage/mcp_service/src/config.rs+++ b/rust/cloud-storage/mcp_service/src/config.rs@@ -12,11 +12,6 @@ use macro_env_var::env_vars;pub use macro_middleware::auth::internal_access::InternalApiKey;env_vars! {- /// SQS URL for the email scheduled queue, consumed by the AI tools.- pub struct EmailScheduledQueue;- /// SQS URL for the Gmail ops queue, consumed by the AI tools to enqueue- /// Gmail label/sync operations.- pub struct GmailOpsQueue;/// Auth key used by the document storage / search / lexical clients.pub struct DocumentStorageServiceAuthKey;/// Secrets Manager secret name for the sync service auth key.@@ -67,8 +62,6 @@ pub struct Config {pub port: usize,/// The connection URL for the Postgres database this application uses.pub database_url: DatabaseUrl,- pub email_scheduled_queue: EmailScheduledQueue,- pub gmail_ops_queue: GmailOpsQueue,pub document_storage_service_auth_key: DocumentStorageServiceAuthKey,pub sync_service_auth_key: SyncServiceAuthKey,pub document_storage_bucket: DocumentStorageBucket,diff --git a/rust/cloud-storage/mcp_service/src/context.rs b/rust/cloud-storage/mcp_service/src/context.rsindex 9310f18009..731bf20d7a 100644--- a/rust/cloud-storage/mcp_service/src/context.rs+++ b/rust/cloud-storage/mcp_service/src/context.rs@@ -65,9 +65,11 @@ pub async fn build_context(config: &Config) -> anyhow::Result<McpContext> {let macro_env = config.environment;let aws_config = macro_aws_config::get_macro_aws_config().await;let queue_aws_client = aws_sdk_sqs::Client::new(&aws_config);+ let email_scheduled_queue = macro_queues::EmailScheduledQueue::new();+ let gmail_ops_queue = macro_queues::GmailOpsQueue::new();let sqs_client = sqs_client::SQS::new(queue_aws_client)- .email_scheduled_queue(config.email_scheduled_queue.as_ref())- .gmail_ops_queue(config.gmail_ops_queue.as_ref());+ .email_scheduled_queue(email_scheduled_queue.as_ref())+ .gmail_ops_queue(gmail_ops_queue.as_ref());let secretsmanager_client = secretsmanager_client::SecretsManager::new(aws_sdk_secretsmanager::Client::new(&aws_config),diff --git a/rust/cloud-storage/notification_service/Cargo.toml b/rust/cloud-storage/notification_service/Cargo.tomlindex c60430a30b..9e4147842c 100644--- a/rust/cloud-storage/notification_service/Cargo.toml+++ b/rust/cloud-storage/notification_service/Cargo.toml@@ -40,6 +40,7 @@ macro_cors = { path = "../macro_cors" }macro_entrypoint = { path = "../macro_entrypoint" }macro_env = { path = "../macro_env" }macro_env_var = { path = "../macro_env_var" }+macro_queues = { path = "../macro_queues" }macro_middleware = { path = "../macro_middleware", default-features = false, features = ["auth",] }diff --git a/rust/cloud-storage/notification_service/src/config.rs b/rust/cloud-storage/notification_service/src/config.rsindex 3580c38720..cdbc22bf13 100644--- a/rust/cloud-storage/notification_service/src/config.rs+++ b/rust/cloud-storage/notification_service/src/config.rs@@ -18,10 +18,6 @@ env_vars! {#[derive(Debug, Clone)]pub(crate) struct BaseUrl;#[derive(Debug, Clone)]- pub(crate) struct NotificationQueue;- #[derive(Debug, Clone)]- pub(crate) struct NotificationIngressQueue;- #[derive(Debug, Clone)]pub(crate) struct AppleBundleId;#[derive(Debug, Clone)]pub(crate) struct SnsApnsPlatformArn;@@ -30,8 +26,6 @@ env_vars! {#[derive(Debug, Clone)]pub(crate) struct SenderBaseAddress;#[derive(Debug, Clone)]- pub(crate) struct PushNotificationEventHandlerQueue;- #[derive(Debug, Clone)]pub(crate) struct LastOnlineRedisUri;}@@ -80,12 +74,6 @@ pub struct Config {#[macro_config_default(4)]pub(crate) notification_queue_wait_time_seconds: i32,- /// The SQS queue for egress notification delivery.- pub(crate) notification_queue: NotificationQueue,-- /// The SQS queue for ingress notification creation.- pub(crate) notification_ingress_queue: NotificationIngressQueue,-/// Redis used by notification-service for digest batching, rate limiting, etc.pub(crate) redis_uri: RedisUri,@@ -103,9 +91,6 @@ pub struct Config {/// The SNS iOS VoIP platform ARN (APNS_VOIP). Optional locally.pub(crate) sns_apns_voip_platform_arn: SnsApnsVoipPlatformArn,-- /// The push notification event handler queue.- pub(crate) push_notification_event_handler_queue: PushNotificationEventHandlerQueue,}impl Config {diff --git a/rust/cloud-storage/notification_service/src/main.rs b/rust/cloud-storage/notification_service/src/main.rsindex f22aa90cfb..cfc4d3c66e 100644--- a/rust/cloud-storage/notification_service/src/main.rs+++ b/rust/cloud-storage/notification_service/src/main.rs@@ -112,7 +112,7 @@ pub async fn main() -> anyhow::Result<()> {let event_queue =::notification::outbound::push_notification_event_queue::SqsPushNotificationEventQueue::new(aws_sdk_sqs::Client::new(&aws_config),- config.push_notification_event_handler_queue.as_ref().to_string(),+ macro_queues::PushNotificationEventHandlerQueue::new().to_string(),config.notification_queue_max_messages,config.notification_queue_wait_time_seconds,);@@ -135,7 +135,7 @@ pub async fn main() -> anyhow::Result<()> {let notification_queue = ::notification::outbound::queue::SqsQueue::new(aws_sdk_sqs::Client::new(&aws_config),- config.notification_queue.as_ref().to_string(),+ macro_queues::NotificationQueue::new().to_string(),);let sns_endpoint_manager =::notification::outbound::sns_endpoint::SnsEndpointManagerAdapter::new(@@ -290,7 +290,7 @@ pub async fn main() -> anyhow::Result<()> {::notification::outbound::repository::DbNotificationRepository::new(db.clone());let ingress_delivery_queue = ::notification::outbound::queue::SqsQueue::new(aws_sdk_sqs::Client::new(&aws_config),- config.notification_queue.as_ref().to_string(),+ macro_queues::NotificationQueue::new().to_string(),);let ingress_service = ::notification::domain::service::NotificationIngressService::new(ingress_repository,@@ -300,7 +300,7 @@ pub async fn main() -> anyhow::Result<()> {let ingress_queue = ::notification::outbound::queue::SqsQueue::new(aws_sdk_sqs::Client::new(&aws_config),- config.notification_ingress_queue.as_ref().to_string(),+ macro_queues::NotificationIngressQueue::new().to_string(),);let ingress_worker =::notification::inbound::ingress_worker::IngressWorker::new(ingress_service, ingress_queue);diff --git a/rust/cloud-storage/organization_retention_handler/Cargo.toml b/rust/cloud-storage/organization_retention_handler/Cargo.tomlindex 1535257c55..f619fc80b0 100644--- a/rust/cloud-storage/organization_retention_handler/Cargo.toml+++ b/rust/cloud-storage/organization_retention_handler/Cargo.toml@@ -12,6 +12,7 @@ aws_lambda_events = { workspace = true, features = ["sqs"] }lambda_runtime = { workspace = true }macro_entrypoint = { path = "../macro_entrypoint" }macro_env_var = { path = "../macro_env_var" }+macro_queues = { path = "../macro_queues" }sqlx = { workspace = true }sqs_client = { path = "../sqs_client" }tokio = { workspace = true }diff --git a/rust/cloud-storage/organization_retention_handler/src/main.rs b/rust/cloud-storage/organization_retention_handler/src/main.rsindex 416191df5b..f78dc229a3 100644--- a/rust/cloud-storage/organization_retention_handler/src/main.rs+++ b/rust/cloud-storage/organization_retention_handler/src/main.rs@@ -13,8 +13,6 @@ use sqlx::postgres::PgPoolOptions;env_vars! {struct DatabaseUrl;- struct DocumentDeleteQueue;- struct ChatDeleteQueue;}#[tokio::main]@@ -33,9 +31,8 @@ async fn main() -> Result<(), Error> {.context("could not connect to db")?,);- let document_delete_queue =- DocumentDeleteQueue::new().context("DOCUMENT_DELETE_QUEUE must be provided")?;- let chat_delete_queue = ChatDeleteQueue::new().context("CHAT_DELETE_QUEUE must be provided")?;+ let document_delete_queue = macro_queues::DocumentDeleteQueue::new();+ let chat_delete_queue = macro_queues::ChatDeleteQueue::new();let sqs_client = sqs_client::SQS::new(aws_sdk_sqs::Client::new(¯o_aws_config::get_macro_aws_config().await,diff --git a/rust/cloud-storage/organization_retention_trigger/Cargo.toml b/rust/cloud-storage/organization_retention_trigger/Cargo.tomlindex f0fbed8ebc..3f340bc013 100644--- a/rust/cloud-storage/organization_retention_trigger/Cargo.toml+++ b/rust/cloud-storage/organization_retention_trigger/Cargo.toml@@ -12,6 +12,7 @@ aws_lambda_events = { workspace = true, features = ["eventbridge"] }lambda_runtime = { workspace = true }macro_entrypoint = { path = "../macro_entrypoint" }macro_env_var = { path = "../macro_env_var" }+macro_queues = { path = "../macro_queues" }serde_json = { workspace = true }sqlx = { workspace = true }sqs_client = { path = "../sqs_client" }diff --git a/rust/cloud-storage/organization_retention_trigger/src/main.rs b/rust/cloud-storage/organization_retention_trigger/src/main.rsindex 1203e24718..eb266e0a7c 100644--- a/rust/cloud-storage/organization_retention_trigger/src/main.rs+++ b/rust/cloud-storage/organization_retention_trigger/src/main.rs@@ -14,7 +14,6 @@ use sqlx::postgres::PgPoolOptions;env_vars! {struct DatabaseUrl;- struct OrganizationRetentionQueue;}#[tracing::instrument(skip(db, sqs_client, event))]@@ -52,8 +51,7 @@ async fn main() -> Result<(), Error> {tracing::trace!("initialized db client");- let organization_retention_queue =- OrganizationRetentionQueue::new().context("ORGANIZATION_RETENTION_QUEUE must be set")?;+ let organization_retention_queue = macro_queues::OrganizationRetentionQueue::new();let sqs_client = sqs_client::SQS::new(aws_sdk_sqs::Client::new(¯o_aws_config::get_macro_aws_config().await,))diff --git a/rust/cloud-storage/scheduled_action/Cargo.toml b/rust/cloud-storage/scheduled_action/Cargo.tomlindex f206041760..2a711072cf 100644--- a/rust/cloud-storage/scheduled_action/Cargo.toml+++ b/rust/cloud-storage/scheduled_action/Cargo.toml@@ -24,6 +24,7 @@ local_auth = ["macro_middleware/local_auth"]serde = { workspace = true }serde_json = { workspace = true }macro_env_var = { path = "../macro_env_var" }+macro_queues = { path = "../macro_queues" }macro_config = { path = "../macro_config" }database_env_vars = { path = "../macro_env_vars/database_env_vars" }doppler-config = { workspace = true }diff --git a/rust/cloud-storage/scheduled_action/src/bins/service.rs b/rust/cloud-storage/scheduled_action/src/bins/service.rsindex ba4009897b..b087f09bea 100644--- a/rust/cloud-storage/scheduled_action/src/bins/service.rs+++ b/rust/cloud-storage/scheduled_action/src/bins/service.rs@@ -48,7 +48,7 @@ async fn main() -> Result<()> {let notification_ingress = Arc::new(SqsNotificationIngress {queue: SqsQueue::new(aws_sdk_sqs::Client::new(&aws_config),- config.notification_queue.to_string(),+ macro_queues::NotificationQueue::new().to_string(),),});diff --git a/rust/cloud-storage/scheduled_action/src/config.rs b/rust/cloud-storage/scheduled_action/src/config.rsindex f564da7fc9..8d8e7bf5d9 100644--- a/rust/cloud-storage/scheduled_action/src/config.rs+++ b/rust/cloud-storage/scheduled_action/src/config.rs@@ -17,8 +17,6 @@ use macro_env_var::env_vars;use macro_middleware::auth::internal_access::InternalApiKey;env_vars! {- /// SQS URL for the notification ingress queue.- pub struct NotificationQueue;/// Auth key used by the document storage / search / lexical clients.pub struct DocumentStorageServiceAuthKey;/// Secrets Manager secret name for the sync service auth key.@@ -27,8 +25,6 @@ env_vars! {pub struct DocumentStorageBucket;/// S3 bucket for docx document uploads.pub struct DocxDocumentUploadBucket;- /// SQS URL for the email scheduled queue, consumed by the AI tools.- pub struct EmailScheduledQueue;/// CloudFront distribution URL for document storage.pub struct DocumentStorageServiceCloudfrontDistributionUrl;/// CloudFront signer public key id for document storage.@@ -49,12 +45,10 @@ pub struct Config {pub port: usize,/// The connection URL for the Postgres database this application uses.pub database_url: DatabaseUrl,- pub notification_queue: NotificationQueue,pub document_storage_service_auth_key: DocumentStorageServiceAuthKey,pub sync_service_auth_key: SyncServiceAuthKey,pub document_storage_bucket: DocumentStorageBucket,pub docx_document_upload_bucket: DocxDocumentUploadBucket,- pub email_scheduled_queue: EmailScheduledQueue,pub document_storage_service_cloudfront_distribution_url:DocumentStorageServiceCloudfrontDistributionUrl,pub document_storage_service_cloudfront_signer_public_key_id:diff --git a/rust/cloud-storage/search_processing_service/Cargo.toml b/rust/cloud-storage/search_processing_service/Cargo.tomlindex 6fd2b99c24..874ee6f925 100644--- a/rust/cloud-storage/search_processing_service/Cargo.toml+++ b/rust/cloud-storage/search_processing_service/Cargo.toml@@ -39,6 +39,7 @@ macro_db_client = { path = "../macro_db_client", optional = true } # Make this omacro_entrypoint = { path = "../macro_entrypoint" }macro_env = { path = "../macro_env" }macro_env_var = { path = "../macro_env_var" }+macro_queues = { path = "../macro_queues" }macro_middleware = { path = "../macro_middleware", default-features = false, features = ["auth",] }diff --git a/rust/cloud-storage/search_processing_service/src/config.rs b/rust/cloud-storage/search_processing_service/src/config.rsindex a46ea181f9..45cfeb3b27 100644--- a/rust/cloud-storage/search_processing_service/src/config.rs+++ b/rust/cloud-storage/search_processing_service/src/config.rs@@ -6,7 +6,6 @@ use macro_service_urls::LexicalServiceUrl;env_vars! {pub struct DatabaseUrl;- pub struct SearchEventQueue;pub struct OpensearchUrl;pub struct OpensearchUsername;pub struct OpensearchPassword;@@ -88,8 +87,6 @@ pub struct Config {#[macro_config_default(8080)]pub port: usize,- /// The search text extractor queue- pub search_event_queue: SearchEventQueue,/// The queue max messages per poll#[macro_config_default(10)]pub queue_max_messages: i32,diff --git a/rust/cloud-storage/search_processing_service/src/main.rs b/rust/cloud-storage/search_processing_service/src/main.rsindex 4c3e81b93b..0c77a7b063 100644--- a/rust/cloud-storage/search_processing_service/src/main.rs+++ b/rust/cloud-storage/search_processing_service/src/main.rs@@ -69,8 +69,9 @@ async fn main() -> anyhow::Result<()> {let aws_config = macro_aws_config::get_macro_aws_config().await;+ let search_event_queue = macro_queues::SearchEventQueue::new();let sqs_client = sqs_client::SQS::new(aws_sdk_sqs::Client::new(&aws_config))- .search_event_queue(&config.search_event_queue);+ .search_event_queue(&search_event_queue);let s3_client = s3_client::S3::new(macro_aws_config::s3_client().await);@@ -145,7 +146,7 @@ async fn main() -> anyhow::Result<()> {let worker = sqs_worker::SQSWorker::new(aws_sdk_sqs::Client::new(&aws_config),- config.search_event_queue.to_string(),+ search_event_queue.to_string(),config.queue_max_messages,config.queue_wait_time_seconds,);diff --git a/rust/cloud-storage/search_upload_handler/Cargo.toml b/rust/cloud-storage/search_upload_handler/Cargo.tomlindex 907b073fb0..474571ad30 100644--- a/rust/cloud-storage/search_upload_handler/Cargo.toml+++ b/rust/cloud-storage/search_upload_handler/Cargo.toml@@ -13,6 +13,7 @@ aws_lambda_events = { workspace = true, features = ["eventbridge"] }lambda_runtime = { workspace = true }macro_entrypoint = { path = "../macro_entrypoint" }macro_env_var = { path = "../macro_env_var" }+macro_queues = { path = "../macro_queues" }s3_key = { path = "../s3_key" }sqs_client = { path = "../sqs_client", default-features = false, features = ["search",diff --git a/rust/cloud-storage/search_upload_handler/src/main.rs b/rust/cloud-storage/search_upload_handler/src/main.rsindex a5b34f6d9f..87e91f5e87 100644--- a/rust/cloud-storage/search_upload_handler/src/main.rs+++ b/rust/cloud-storage/search_upload_handler/src/main.rs@@ -11,7 +11,6 @@ use std::sync::Arc;mod handler;env_vars! {- struct SearchEventQueue;struct DocumentStorageServiceAuthKey;}@@ -21,8 +20,7 @@ async fn main() -> Result<(), Error> {tracing::trace!("initiating lambda");- let search_event_queue =- SearchEventQueue::new().context("SEARCH_EVENT_QUEUE must be provided")?;+ let search_event_queue = macro_queues::SearchEventQueue::new();let dss_url = DocumentStorageServiceUrl::new()?.to_string();let dss_auth_key = DocumentStorageServiceAuthKey::new()diff --git a/rust/cloud-storage/static_file_service/Cargo.toml b/rust/cloud-storage/static_file_service/Cargo.tomlindex a304d7e982..cfd617648b 100644--- a/rust/cloud-storage/static_file_service/Cargo.toml+++ b/rust/cloud-storage/static_file_service/Cargo.toml@@ -37,6 +37,7 @@ macro_config = { path = "../macro_config" }macro_entrypoint = { path = "../macro_entrypoint" }macro_env = { path = "../macro_env" }macro_env_var = { path = "../macro_env_var" }+macro_queues = { path = "../macro_queues" }macro_middleware = { path = "../macro_middleware", default-features = false, features = ["auth",] }diff --git a/rust/cloud-storage/static_file_service/src/api/event/poll.rs b/rust/cloud-storage/static_file_service/src/api/event/poll.rsindex 93bb2c6ba6..a8a9b1c78d 100644--- a/rust/cloud-storage/static_file_service/src/api/event/poll.rs+++ b/rust/cloud-storage/static_file_service/src/api/event/poll.rs@@ -11,11 +11,7 @@ enum PollError {pub async fn poll_s3_events(context: AppState) {loop {if let Err(PollError::PollingError) = poll(- context- .config- .static_file_service_s3_event_queue_url- .as_ref()- .to_owned(),+ macro_queues::StaticFileServiceS3EventQueueUrl::new().to_string(),context.clone(),).awaitdiff --git a/rust/cloud-storage/static_file_service/src/config.rs b/rust/cloud-storage/static_file_service/src/config.rsindex 5a3d2a721f..d934e38e1b 100644--- a/rust/cloud-storage/static_file_service/src/config.rs+++ b/rust/cloud-storage/static_file_service/src/config.rs@@ -7,7 +7,6 @@ use macro_service_urls::StaticFileServiceUrl;env_vars! {pub struct StaticFileServiceDynamodbTableName;pub struct StaticStorageBucket;- pub struct StaticFileServiceS3EventQueueUrl;}#[derive(macro_config::MacroConfig)]@@ -26,8 +25,6 @@ pub struct Config {/// service url#[macro_config_default(StaticFileServiceUrl::unwrap_new().to_string())]pub static_file_service_url: String,- /// s3 upload notification queue- pub static_file_service_s3_event_queue_url: StaticFileServiceS3EventQueueUrl,/// Internal API keypub internal_api_key: InternalApiKey,}diff --git a/rust/cloud-storage/upload_extractor_lambda_trigger/Cargo.toml b/rust/cloud-storage/upload_extractor_lambda_trigger/Cargo.tomlindex 3aa68b6bad..cedcef1ec7 100644--- a/rust/cloud-storage/upload_extractor_lambda_trigger/Cargo.toml+++ b/rust/cloud-storage/upload_extractor_lambda_trigger/Cargo.toml@@ -21,3 +21,4 @@ tokio = { workspace = true }tracing = { workspace = true }workspace-hack = { version = "0.1", path = "../workspace-hack" }macro_env_var = { path = "../macro_env_var" }+macro_queues = { path = "../macro_queues" }diff --git a/rust/cloud-storage/upload_extractor_lambda_trigger/src/main.rs b/rust/cloud-storage/upload_extractor_lambda_trigger/src/main.rsindex 2ef20d91da..a3e96fecc0 100644--- a/rust/cloud-storage/upload_extractor_lambda_trigger/src/main.rs+++ b/rust/cloud-storage/upload_extractor_lambda_trigger/src/main.rs@@ -88,7 +88,6 @@ async fn handler(env_vars! {pub struct DynamodbTable;- pub struct UploadExtractorQueue;}#[tokio::main]@@ -97,8 +96,7 @@ async fn main() -> Result<(), Error> {tracing::info!("initiating lambda");let dynamo_table_name = DynamodbTable::new().context("DYNAMODB_TABLE must be set")?;- let upload_extract_queue =- UploadExtractorQueue::new().context("UPLOAD_EXTRACTOR_QUEUE must be set")?;+ let upload_extract_queue = macro_queues::UploadExtractorQueue::new();tracing::trace!("initialized env vars");