Giter Club home page Giter Club logo

packages's Introduction

packages's People

Contributors

alexy4744 avatar dependabot[bot] avatar n-mcnally avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

packages's Issues

Changes to config not documented?

In this commit, a68da98, it appears that the streams key was removed from the transport config. However the documentation hasn't been updated.

What is the expected config at this point?
Thanks!

Microservice does not receive messages when using StringCodec

While attempting to use the NATS JetStream Transporter, the NatsClient send method does not return/receive a response from a value returned from @MessagePattern().

I would love to use this package as it would help us a ton, the consumer/event side works great! but we're stuck with the Message pattern...

The service will print the following output and no more when accessed via http://localhost:3000:

[Nest] ...
 >> jetstream functionality in nats.js is preview functionality 
[Nest] 25247   - 08/03/2021, 4:53:52 PM   [NatsServer] Subscribed to hello.> events
[Nest] 25247   - 08/03/2021, 4:53:52 PM   [NatsServer] Subscribed to {"cmd":"sayHi"} messages
[Nest] 25247   - 08/03/2021, 4:53:52 PM   [NatsServer] Connected to 127.0.0.1:4222
[Nest] 25247   - 08/03/2021, 4:53:52 PM   [RoutesResolver] AppController {}: +5ms
[Nest] 25247   - 08/03/2021, 4:53:52 PM   [RouterExplorer] Mapped {, GET} route +3ms
[Nest] 25247   - 08/03/2021, 4:53:52 PM   [NestApplication] Nest application successfully started +2ms
[Nest] 25247   - 08/03/2021, 4:53:52 PM   Listening +4ms
getHello
[Nest] 25247   - 08/03/2021, 4:55:04 PM   [NatsClient] Connected to 127.0.0.1:4222
sayHi  Leo
TAPPED undefined

The expectation is that it would also print Hi Leo - am I missing something?

import { Controller, Get } from '@nestjs/common'
import { AppService } from './app.service'
import { EventPattern, Payload, Ctx, MessagePattern } from '@nestjs/microservices'
import { NatsContext, NatsClient } from '@alexy4744/nestjs-nats-jetstream-transporter'
import { Observable } from 'rxjs'
import { tap } from 'rxjs/operators'
import { StringCodec } from 'nats'

@Controller()
export class AppController {
  private readonly client = new NatsClient({ codec: StringCodec() })

  constructor(private readonly appService: AppService) {}

  @Get()
  getHello(): Observable<string> {
    console.log('getHello')
    const value = this.client.send<string>({ cmd: 'sayHi' }, 'Leo').pipe(
      tap((obj) => {
        console.log('TAPPED', obj)
      }),
    )
    return value
  }

  @EventPattern('hello.>')
  handleHello(@Payload() data: string, @Ctx() context: NatsContext): void {
    console.log(data)
    console.log(context)
  }

  @MessagePattern({ cmd: 'sayHi' })
  sayHi(@Payload() data: string): string {
    console.log('sayHi ', data)
    return `Hi ${data}`
  }
}

QueueGroup by Event Pattern?

Is it possible to register a queue group by EventPattern instead of globally? I have a use case where i want certain messages to be Load balanced across multiple instances and another event be fan-out.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.