Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@nestjs-plugins/nestjs-nats-jetstream-transport

Package Overview
Dependencies
Maintainers
1
Versions
45
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@nestjs-plugins/nestjs-nats-jetstream-transport - npm Package Compare versions

Comparing version 1.3.5 to 1.3.6

6

package.json
{
"name": "@nestjs-plugins/nestjs-nats-jetstream-transport",
"version": "1.3.5",
"version": "1.3.6",
"description": "Nats JetStream Transport for NestJS",

@@ -35,3 +35,3 @@ "main": "dist/index.js",

"dependencies": {
"@nestjs-plugins/nestjs-nats-jetstream-transport": "^1.3.5",
"@nestjs-plugins/nestjs-nats-jetstream-transport": "^1.3.6",
"nats": "^2.6.1",

@@ -52,3 +52,3 @@ "reflect-metadata": "^0.1.13",

},
"gitHead": "497a92c6837b5b7012a591f2ca6468af4780c957"
"gitHead": "2ea2c8d8b205fd7b7ef59d409eb4fdde246e0c05"
}
# 🚀 Nats JetStream Transport Module for NestJS
> Breakable changes in v1.3..x
>
>
> Replace NatsJetStreamClientProxy with NatsJetStreamClient
Build Event Driven Microservices Architecture with Nats JetStream Server and NestJS.

@@ -49,3 +47,3 @@

```bash
nats stream add
nats stream add
```

@@ -57,5 +55,5 @@

> You can also automatically create a stream by defining a streamConfig object to the NatsJestStreamOptions object.
> This will create a new stream or update existing.
> The code example bellow has this object defined so there is not really necessary to add this stream through nats cli.
> You can also automatically create a stream by defining a streamConfig object to the NatsJestStreamOptions object.
> This will create a new stream or update existing.
> The code example bellow has this object defined so there is not really necessary to add this stream through nats cli.

@@ -68,4 +66,4 @@ You are now ready to publish and consume events on the stream. See the [code example](#Code-example) below for a test drive.

- **connectionOptions**: NatsConnectionOptions
- **serverConsumerOptions**: ServerConsumerOptions
- **connectionOptions**: NatsConnectionOptions
- **serverConsumerOptions**: ServerConsumerOptions
- **jetStreamOptions**: JetStreamOption

@@ -112,2 +110,3 @@ - **streamConfig**: NatsStreamConfig - Stream configuration. If defined, create stream if not exist.

- **name**: string - Connections can be assigned a name which will appear in some of the server monitoring data. This name is not required, but is **highly recommended** as a friendly connection name will help in monitoring, error reporting, debugging, and testing.
- **connectedHook**: function(nc: NatsConnection): void - A hook function that is run after connection is established.
- **ignoreClusterUpdates**: boolean - If `true` the client will ignore any cluster updates provided by the server.

@@ -120,3 +119,3 @@ - **inboxPrefix**: string - Sets de prefix for automatically created inboxes - `createInbox(prefix)`

- **pass**: string - Sets the password for a connection.
- **noRandomize**: boolean (default: false) - In order to prevent [*thundering herd*](/developing-with-nats/reconnect/random), most NATS client libraries randomize the servers they attempt to connect to. To disable the randomization process for connect and reconnect, set this to true.
- **noRandomize**: boolean (default: false) - In order to prevent [_thundering herd_](/developing-with-nats/reconnect/random), most NATS client libraries randomize the servers they attempt to connect to. To disable the randomization process for connect and reconnect, set this to true.
- **pedantic**: boolean (default: false) - mode that performs extra checks on the protocol.

@@ -128,7 +127,7 @@ - **pingInterval**: number (default: 5) - Number of milliseconds between client-sent pings.

- **reconnectJitterTLS**: number - control how long before the NATS client attempts to reconnect to a server it has previously connected.
- **reconnectTimeWait**: number - prevents wasting client resources and alleviates a [*thundering herd*](/developing-with-nats/reconnect/random) situation when additional servers are not available.
- **reconnectTimeWait**: number - prevents wasting client resources and alleviates a [_thundering herd_](/developing-with-nats/reconnect/random) situation when additional servers are not available.
- reconnectDelayHandler: Generated function - A function that returns the number of milliseconds to wait before the next connection to a server it connected to `()=>number`.
- **timeout**: number (default: 20000) - Number of milliseconds the client will wait for a connection to be established. If it fails it will emit a `connection_timeout` event with a NatsError that provides the hostport of the server where the connection was attempted.
- **token**: string - Sets a authorization token for a connection.
- **authenticator:** Authenticator (default: none) - Specifies the authenticator function that sets the client credentials.
- **authenticator:** Authenticator (default: none) - Specifies the authenticator function that sets the client credentials.
- **user**: string - Sets the username for a connection.

@@ -140,3 +139,3 @@ - **verbose**: boolean (default: false) - Turns on `+OK` protocol acknowledgements.

- **apiPrefix**: string - *Not documented!*
- **apiPrefix**: string - _Not documented!_
- **domain**: string - Sets the domain for JetStream subjects, creating a standard prefix from that domain.

@@ -182,4 +181,4 @@ - **timeout**: number - Sets the request timeout for JetStream API calls.

servers: 'localhost:4222',
name: 'myservice-publisher'
}
name: 'myservice-publisher',
},
}),

@@ -196,5 +195,3 @@ ],

import {
NatsJetStreamClient,
} from '@nestjs-plugins/nestjs-nats-jetstream-transport';
import { NatsJetStreamClient } from '@nestjs-plugins/nestjs-nats-jetstream-transport';
import { Injectable } from '@nestjs/common';

@@ -267,3 +264,8 @@ import { PubAck } from 'nats';

import { Controller, Get } from '@nestjs/common';
import { Ctx, EventPattern, MessagePattern, Payload } from '@nestjs/microservices';
import {
Ctx,
EventPattern,
MessagePattern,
Payload,
} from '@nestjs/microservices';
import { AppService } from './app.service';

@@ -277,3 +279,3 @@

home(): string {
return 'Welcome to webshop'
return 'Welcome to webshop';
}

@@ -299,4 +301,4 @@

calc() {
console.log('sum controller')
return this.appService.accumulate([1,2,3])
console.log('sum controller');
return this.appService.accumulate([1, 2, 3]);
}

@@ -324,3 +326,3 @@

public async orderDeletedHandler(
@Payload() data:any,
@Payload() data: any,
@Ctx() context: NatsJetStreamContext,

@@ -335,3 +337,3 @@ ) {

async accumulate(data: number[]): Promise<number> {
console.log('message conroller', data)
console.log('message conroller', data);
return (data || []).reduce((a, b) => a + b);

@@ -355,3 +357,3 @@ }

servers: 'localhost:4222',
name: 'myservice-listener'
name: 'myservice-listener',
},

@@ -366,4 +368,4 @@ consumerOptions: {

name: 'mystream',
subjects: ['order.*']
}
subjects: ['order.*'],
},
}),

@@ -370,0 +372,0 @@ };

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc