Skip to content

Commit

Permalink
Add segment id to automation processing (#1068)
Browse files Browse the repository at this point in the history
  • Loading branch information
gaspergrom authored Jul 4, 2023
1 parent 6182517 commit 21caf52
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,7 @@ export default class ActivityService extends LoggerBase {

return id
})

await this.nodejsWorkerEmitter.processAutomationForNewActivity(tenantId, id)
await this.nodejsWorkerEmitter.processAutomationForNewActivity(tenantId, id, segmentId)
const affectedIds = await this.conversationService.processActivity(tenantId, id)

if (fireSync) {
Expand Down
6 changes: 5 additions & 1 deletion services/libs/sqs/src/instances/nodejsWorker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,12 @@ export class NodejsWorkerEmitter extends SqsQueueEmitter {
public async processAutomationForNewActivity(
tenantId: string,
activityId: string,
segmentId: string,
): Promise<void> {
await this.sendMessage(tenantId, new NewActivityAutomationQueueMessage(tenantId, activityId))
await this.sendMessage(
tenantId,
new NewActivityAutomationQueueMessage(tenantId, activityId, segmentId),
)
}

public async processAutomationForNewMember(tenantId: string, memberId: string): Promise<void> {
Expand Down
6 changes: 5 additions & 1 deletion services/libs/types/src/queue/nodejs_worker/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@ export class NewActivityAutomationQueueMessage implements IQueueMessage {
public readonly trigger = 'new_activity'
public readonly service = 'automation'

constructor(public readonly tenant: string, public readonly activityId: unknown) {}
constructor(
public readonly tenant: string,
public readonly activityId: unknown,
public readonly segmentId: string,
) {}
}

export class NewMemberAutomationQueueMessage implements IQueueMessage {
Expand Down

0 comments on commit 21caf52

Please sign in to comment.