Socket
Socket
Sign inDemoInstall

@gojob/nest-cloud-pub-sub-transport

Package Overview
Dependencies
6
Maintainers
4
Versions
13
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @gojob/nest-cloud-pub-sub-transport

A Custom Transport strategy of the NestJS microservices pattern for Cloud Pub/Sub.


Version published
Weekly downloads
17
increased by1600%
Maintainers
4
Created
Weekly downloads
 

Changelog

Source

[1.0.0] - 2020-01-19

Added

  • chore: update packages and remove the nack delay (not available since node-pubsub 0.30.2)
  • feat(server): Initial commit, source code & tests of server side implementation

Readme

Source

Nest Cloud Pub/Sub Transport

CircleCI

A Custom Transport strategy for Cloud Pub/Sub in Nest microservices.

Getting started

yarn add @gojob/nest-cloud-pub-sub-transport
# or
npm install @gojob/nest-cloud-pub-sub-transport

Here is an example of implementation in your Nest application:

async function bootstrap() {
  const app = await NestFactory.create(AppModule);
  const configService = app.get(ConfigService);

  app.connectMicroservice({
    strategy: new CloudServerPubSub({
      // configuration passed "as is" to the Cloud PubSub client
      clientConfig: {
        keyFile: configService.get('GCP_KEY_FILE_PUBSUB'),
      },
      // custom options, specific to this package
      options: {
        logger: app.get(LOGGER),
        // useful when your app is using a single topic & subscription
        defaultTopic: configService.get('DEFAULT_PUB_SUB_TOPIC'),
        defaultSubscription: configService.get('DEFAULT_PUB_SUB_SUBSCRIPTION'),
      },
    }),
  });

  await app.startAllMicroservices();
  await app.listen(3000);
}

Then use @EventPattern from @nestjs/microservices to call your event handlers when a new message is received in Pub/Sub.

Contributing

CommandAction
yarn compileEnsure the TypeScript code can be compiled using tsc
yarn buildBuild the project (transpile the code to JavaScript)
yarn lintLint the code (ESLintà
yarn testRun unit tests
yarn integrationRun integration tests

FAQs

Last updated on 10 Jan 2020

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc