-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Loading status checks…
feat: publish AssetBundleConverted event to notify about textures rea…
…dy (#179)
Showing
7 changed files
with
937 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import { PublishCommand, SNSClient } from '@aws-sdk/client-sns' | ||
import { AppComponents, PublisherComponent } from '../types' | ||
|
||
export async function createSnsComponent({ config }: Pick<AppComponents, 'config'>): Promise<PublisherComponent> { | ||
const snsArn = await config.requireString('AWS_SNS_ARN') | ||
const optionalEndpoint = await config.getString('AWS_SNS_ENDPOINT') | ||
|
||
const client = new SNSClient({ | ||
endpoint: optionalEndpoint ? optionalEndpoint : undefined | ||
}) | ||
|
||
async function publishMessage(event: any, attributes: { type: string; subType: string }): Promise<void> { | ||
const command = new PublishCommand({ | ||
TopicArn: snsArn, | ||
Message: JSON.stringify(event), | ||
MessageAttributes: { | ||
type: { | ||
DataType: 'String', | ||
StringValue: attributes.type | ||
}, | ||
subType: { | ||
DataType: 'String', | ||
StringValue: attributes.subType | ||
} | ||
} | ||
}) | ||
|
||
await client.send(command) | ||
} | ||
|
||
return { publishMessage } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.