1.0.17 • Published 2 months ago
@byteboost/nats-events v1.0.17
byteboost-nats-events
Nats events for Byteboost services
import { JsMsg } from 'nats';
import { Listener, Publisher } from './base';
import { Subjects, UserCreatedEvent } from './events';
class UserCreatedListener extends Listener<UserCreatedEvent> {
subject: Subjects.UserCreated = Subjects.UserCreated;
channelName: string = 'user';
async onMessage(data: UserCreatedEvent['data'], message: JsMsg) {
console.log(message, 23);
message.ack();
}
}
class UserCreatedPublisher extends Publisher<UserCreatedEvent> {
subject: Subjects.UserCreated = Subjects.UserCreated;
channelName: string = 'user';
}
const main = async () => {
const nats = new Nats('task');
await nats.connect('0.0.0.0:4222');
new UserCreatedListener(nats.client).listen();
new UserCreatedPublisher(nats.client).publish({
type: 'task created',
test: 'Second message!!',
});
};
main();
TODO
- Server must be able to catch up and read old messages on server start even if they have been acknowledged
1.0.17
2 months ago
1.0.16
2 months ago
1.0.15
2 months ago
1.0.14
2 months ago
1.0.13
2 months ago
1.0.12
3 months ago
1.0.9
3 months ago
1.0.8
3 months ago
1.0.7
3 months ago
1.0.6
3 months ago
1.0.11
3 months ago
1.0.10
3 months ago
1.0.5
3 months ago
1.0.2
4 months ago
1.0.1
4 months ago
1.0.0
4 months ago
1.0.4
4 months ago
1.0.3
4 months ago
0.3.1
9 months ago
0.3.0
9 months ago
0.2.6
9 months ago
0.2.5
9 months ago
0.2.4
9 months ago
0.2.3
9 months ago
0.2.2
9 months ago
0.2.1
9 months ago
0.2.0
9 months ago
0.1.11
9 months ago
0.1.10
9 months ago
0.1.9
9 months ago
0.1.8
9 months ago
0.1.6
10 months ago
0.1.5
10 months ago
0.1.4
10 months ago
0.1.3
10 months ago
0.1.2
10 months ago
0.1.1
10 months ago
0.1.0
10 months ago
0.0.6
10 months ago
0.0.5
10 months ago
0.0.4
10 months ago
0.0.3
10 months ago
0.0.2
10 months ago
0.0.1
10 months ago