Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
@gojob/nest-cloud-pub-sub-transport
Advanced tools
Readme
A Custom Transport strategy for Cloud Pub/Sub in Nest microservices.
TODO: in order to open-source it for NestJs, we must use
loadPackage
(fromServer
) to load@google-cloud/pubsub
dynamically instead of having it installed in the dependenices of the project. Also, all types used from this package should be duplicated into local types/interfaces.
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({
// "clientConfig": configuration passed "as is" to the Cloud PubSub client
clientConfig: {
keyFile: configService.get('GCP_KEY_FILE_PUBSUB'),
},
// "options": 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 decorate the event handlers which will be called when a new Pub/Sub message is received in your target topic(s).
Command | Action |
---|---|
yarn compile | Ensure the TypeScript code can be compiled using tsc |
yarn build | Build the project (transpile the code to JavaScript) |
yarn lint | Lint the code (ESLint ) |
yarn test | Run unit tests |
yarn integration | Run integration tests |
FAQs
A Custom Transport strategy of the NestJS microservices pattern for Cloud Pub/Sub.
The npm package @gojob/nest-cloud-pub-sub-transport receives a total of 26 weekly downloads. As such, @gojob/nest-cloud-pub-sub-transport popularity was classified as not popular.
We found that @gojob/nest-cloud-pub-sub-transport demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 10 open source maintainers collaborating on the project.
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.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.