Skip to content

Instantly share code, notes, and snippets.

@regevbr
Last active May 18, 2019 10:33
Show Gist options
  • Save regevbr/3c9968123281be0dfc747b5f22fb61f8 to your computer and use it in GitHub Desktop.
Save regevbr/3c9968123281be0dfc747b5f22fb61f8 to your computer and use it in GitHub Desktop.
squiss-ts hello world
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