Skip to content

Commit 9a8bccb

Browse files
committed
removed hardcoded creator contact_id, added configuration for defining salesforce platform event batch size, add new configuration for sending a platform event
1 parent 3f38e5d commit 9a8bccb

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

src/server/pub_sub/salesforce_message_publisher.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,12 @@
1717
ISSUER = os.getenv("SALESFORCE_CONSUMER_KEY")
1818
DOMAIN = os.getenv("SALESFORCE_DOMAIN")
1919
SUBJECT = os.getenv("SALESFORCE_USERNAME")
20+
CREATOR_CONTACT_ID = os.getenv("CREATOR_CONTACT_ID")
2021
INSTANCE_URL = os.getenv("INSTANCE_URL")
2122
TENANT_ID = os.getenv("TENANT_ID")
22-
PLATFORM_MESSAGE_AUTHOR = os.getenv("PLATFORM_MESSAGE_AUTHOR_RECORD_ID")
23+
BATCH_SIZE = os.getenv("BATCH_SIZE", 400)
2324

2425
UPDATE_TOPIC = "/event/updated_contacts_batched__e"
25-
BATCH_SIZE = 200
26-
2726

2827
def send_pipeline_update_messages(contacts_list):
2928
pem_file = 'bin/connected-app-secrets.pem'
@@ -71,9 +70,8 @@ def send_pipeline_update_messages(contacts_list):
7170
root_object = {
7271
"updatedContactsJson" : current_batch
7372
}
74-
7573
message = {
76-
"CreatedById": "0052g000003G926AAC",
74+
"CreatedById": CREATOR_CONTACT_ID,
7775
"CreatedDate": int(datetime.now().timestamp()),
7876
"updated_contacts_json__c": json.dumps(root_object)
7977
}

src/server/secrets_dict.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,10 @@
66
BASEEDITOR_PW="editorpw"
77
BASEADMIN_PW="basepw"
88
DROPBOX_APP="DBAPPPW"
9+
10+
SALESFORCE_USERNAME=''
11+
SALESFORCE_CONSUMER_KEY=''
12+
SALESFORCE_DOMAIN=''
13+
TENANT_ID=''
14+
INSTANCE_URL=''
15+
CREATOR_CONTACT_ID=''

0 commit comments

Comments
 (0)