Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Queue decorator has require params. #70

Closed
klerick opened this issue May 5, 2019 · 7 comments
Closed

Queue decorator has require params. #70

klerick opened this issue May 5, 2019 · 7 comments
Assignees
Labels
bug Something isn't working

Comments

@klerick
Copy link

klerick commented May 5, 2019

export interface QueueDecoratorOptions {
  name?: string; // Name of the queue
}

But if use it without params we get error and wrong interface signature.

https://github.com/fwoelffel/nest-bull/blob/dev/lib/bull.explorer.ts#L30

@klerick klerick changed the title Queue has require params. Queue decorator has require params. May 5, 2019
@fwoelffel fwoelffel self-assigned this May 5, 2019
@fwoelffel
Copy link
Contributor

Hi @klerick
Could you provide some code to reproduce the bug you encounter?

@klerick
Copy link
Author

klerick commented May 5, 2019

@fwoelffel
Sorry,
I can not do it fast.
But it's easy to understand here
https://github.com/fwoelffel/nest-bull/blob/dev/lib/bull.explorer.ts#L30

@fwoelffel
Copy link
Contributor

Ok I understand your concern. However, if you look at https://github.com/fwoelffel/nest-bull/blob/dev/lib/bull.explorer.ts#L98 and https://github.com/fwoelffel/nest-bull/blob/dev/lib/bull.utils.ts#L1 you'll understand that BullExplorer.getClassMetadata(metatype).queueName being undefined is not an issue at all.

I'll wait for a few days before closing this issue and I'll take a closer look at it if you find the time to provide some reproducibility code or if someone else can confirm.

@fwoelffel fwoelffel removed their assignment May 5, 2019
@klerick
Copy link
Author

klerick commented May 5, 2019

Firstly, yes, there is a value used by default. However if the name of a queue is set during the module configuration, then we have an error for the default value. I assume that it needs to return a more detailed error of what is going on. For example,

private static getBullQueue(moduleRef: ModuleRef, queueName?: string): Queue {
    try {
      return moduleRef.get<Queue>(getQueueToken(queueName));      
    } catch (e) {
        console.log("Queue 'queueName' not found")
      throw e
    }
  
}

or add details to the documentation.
For me the best solution is to set the name of the queue during the module configuration as required.

Secondly, a decorator @Queue has an interface

export interface QueueDecoratorOptions {
  name?: string; // Name of the queue
}

but

BullExplorer.getClassMetadata(metatype).queueName

tries to get a property queueName instead of name. As a result queueName is undefined and error returns.

@fwoelffel
Copy link
Contributor

Damn! I'm so dumb. Yeah you're right. I'll fix this tonight. I'm sorry for the trouble.

@fwoelffel fwoelffel self-assigned this May 5, 2019
@fwoelffel fwoelffel added the bug Something isn't working label May 5, 2019
@klerick
Copy link
Author

klerick commented May 5, 2019

it happens. All that matters is that we’ve figured it out :)

@fwoelffel
Copy link
Contributor

New release published as 0.6.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants