Skip to content

Commit

Permalink
feat: Send Event like message to the events topic
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinszuchet committed Nov 29, 2024
1 parent da636ed commit 925ab61
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/adapters/deployer/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { IDeployerComponent } from '@dcl/snapshots-fetcher/dist/types'
import { PublishCommand, SNSClient } from '@aws-sdk/client-sns'
import { AppComponents } from '../../types'
import { DeploymentToSqs } from '@dcl/schemas/dist/misc/deployments-to-sqs'
import { Events } from '@dcl/schemas/dist/platform/events'

export function createDeployerComponent(
components: Pick<AppComponents, 'logs' | 'storage' | 'downloadQueue' | 'fetch' | 'metrics' | 'sns'>
Expand Down Expand Up @@ -70,10 +71,17 @@ export function createDeployerComponent(
}

if (isSnsEventToSend) {
// TODO: this should be a CatalystDeploymentEvent
const event = {
type: Events.Type.CATALYST_DEPLOYMENT,
subType: entity.entityType as Events.SubType.CatalystDeployment,
...deploymentToSqs
} as any

const receipt = await client.send(
new PublishCommand({
TopicArn: components.sns.eventArn,
Message: JSON.stringify(deploymentToSqs)
Message: JSON.stringify(event)
})
)
logger.info('Notification sent to events SNS', {
Expand Down

0 comments on commit 925ab61

Please sign in to comment.