Search code examples
typescriptamazon-sqsloopback4

Loopback 4, SQS integration


Was trying to find information online, is there an example on how to setup SQS in loopback 4? would appreciate if you can point me in the right direction.


Solution

  • There's several ways to go about it. Since LoopBack 4 is a TypeScript/Node.js application at its core, it is possible to simply import an Amazon SQS compatible library into a controller and then calling the library directly.

    A recommended way is to refactor the SQS interfacing logic into a Service, and then bind it into the Application. This would allow the SQS module to be dependency-injected into the controllers, where its methods can be called.

    Since LoopBack 4 Services do not define a strict interface, the implementation design can be tuned to your specific user requirements.