Last active
May 18, 2019 10:33
-
-
Save regevbr/3c9968123281be0dfc747b5f22fb61f8 to your computer and use it in GitHub Desktop.
squiss-ts hello world
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
import {Squiss, Message} from 'squiss-ts'; | |
const awsConfig = { | |
accessKeyId: '<accessKeyId>', | |
secretAccessKey: '<secretAccessKey>', | |
region: '<region>', | |
}; | |
const squiss = new Squiss({ | |
awsConfig, | |
queueName: 'my-sqs-queue', | |
bodyFormat: 'json', | |
maxInFlight: 15 | |
}); | |
squiss.on('message', (msg: Message) => { | |
console.log('%s says: %s', msg.body.name, JSON.stringify(msg.body.message), msg.attributes.p1); | |
msg.del(); | |
}); | |
squiss.start(); | |
const messageToSend = { | |
name: 'messageName', | |
message: { | |
a: 1, | |
b: 2, | |
}, | |
} | |
const propsToSend = { | |
p1: 1, | |
p2: 2, | |
} | |
squiss.sendMessage(messageToSend, 0, propsToSend); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment