@bestcodetools/message-io
v0.0.6
Published
![pipeline](https://gitlab.com/bestcodetools/nodejs/message-io/badges/master/pipeline.svg) ![coverage](https://gitlab.com/bestcodetools/nodejs/message-io/badges/master/coverage.svg)
Downloads
17
Readme
@bestcodetools/message-io
How to Install
npm install @bestcodetools/message-io
Usage with TypeScript
For publishing
import { Factory } from '@bestcodetools/message-io';
const publisher = Factory.create();
const topicArn = 'arn:aws:sns:us-east-1:000000000000:my-tpoic';
const payload = { message: 'Hello!' };
publisher.publish(topicArn, payload);
For handling published messages
import { AwsCommandFactoryAdapterHandler } from '@bestcodetools/message-io';
class Command {
execute(data: any, context: any) {
console.log('Data:',data,'Context:', context);
}
}
class CommandFactory {
create() {
return new Command();
}
}
export default AwsCommandFactoryAdapterHandler(CommandFactory);