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

feat(microservices): add specific transport id to microservices #14606

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

maxbronnikov10
Copy link

@maxbronnikov10 maxbronnikov10 commented Feb 10, 2025

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Other... Please describe:

What is the current behavior?

transportId field is hardcoded in specific server classes.
If users need more concurrency on same server or many servers need to extends from base server classes and override server id
Sample:

import { CustomTransportStrategy, KafkaOptions, ServerKafka } from '@nestjs/microservices';

export const NEW_KAFKA_TRANSPORT = Symbol('NEW_KAFKA_TRANSPORT');

export class NewKafkaServer extends ServerKafka implements CustomTransportStrategy {
  //@ts-expect-error In Nest.js ServerKafka can not override transportId
  transportId = NEW_KAFKA_TRANSPORT;

  constructor(config: KafkaOptions['options']) {
    super(config);
  }
}

Issue Number:
#14590
#11298

What is the new behavior?

Add new property to microservice options interface that overrides default transportId field in specific server classes

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

@maxbronnikov10 maxbronnikov10 changed the title feat: add specific transport id to microservices feat(microservices): add specific transport id to microservices Feb 10, 2025
@coveralls
Copy link

Pull Request Test Coverage Report for Build bbe08a95-cdcd-4217-a5fc-b8d7fa9a8356

Details

  • 30 of 30 (100.0%) changed or added relevant lines in 8 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.01%) to 89.305%

Totals Coverage Status
Change from base Build 13cb620b-7c16-4b2b-9f8a-bf481bbda76e: 0.01%
Covered Lines: 7131
Relevant Lines: 7985

💛 - Coveralls

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

Successfully merging this pull request may close these issues.

2 participants