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

Add support for ClientsModule.register #38

Closed
dPreininger opened this issue Nov 15, 2023 · 3 comments
Closed

Add support for ClientsModule.register #38

dPreininger opened this issue Nov 15, 2023 · 3 comments

Comments

@dPreininger
Copy link

When talking about ClientsModule, I mean the one exported from @nestjs/microservices package.

Currently, ClientsModule.register call does not support this package. It would be good to support it tho because it would make migrating between different message brokers very easy.

If agreed, I could make a PR that would add the support.

@dPreininger
Copy link
Author

I figured out this is already supported using customClass field in ClientsModule.register options.

@nvdnkpr
Copy link

nvdnkpr commented Feb 24, 2024

@dPreininger do you have any code example ? I am struggeling with creating a pub sub client with ClientsModule.register...

@dPreininger
Copy link
Author

dPreininger commented Feb 24, 2024

The important part is that you use the customClass property. Double check if the options are correct as I have written them by hand (didn't copy paste the actual code)

ClientsModule.register([
    	{
    	    name: 'injection-token-name',
    	    cutomClass: GCPubSubClient,
    	    options: {
    	        topic: 'your-topic',
    	        client: {
    	            projectId: 'your-id',
    	        },
    	    },
    	}
    ]);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants