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): Allow RegExps in Patterns for Kafka #13514

Closed
wants to merge 1 commit into from

Conversation

edeesis
Copy link
Contributor

@edeesis edeesis commented May 1, 2024

closes #3083

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?

RegExps could be added and the Typescript would compile, but at runtime, you'd get an error:

The request attempted to perform an operation on an invalid topic
KafkaJSProtocolError: The request attempted to perform an operation on an invalid topic

because normalizePattern in Server.ts would map a RegExp to the string "{}"

Issue Number: #3083

What is the new behavior?

Now RegExp is allowed for Kafka, and the same handler can be used for multiple topics that match the pattern.

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

N/A

@edeesis edeesis marked this pull request as ready for review May 1, 2024 01:55
@coveralls
Copy link

Pull Request Test Coverage Report for Build 1655e549-2fd5-4751-b8c6-c46ec218cd58

Details

  • 2 of 4 (50.0%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.03%) to 92.098%

Changes Missing Coverage Covered Lines Changed/Added Lines %
packages/microservices/server/server-kafka.ts 2 4 50.0%
Totals Coverage Status
Change from base Build 5c503562-0bb3-4aab-98b2-462ef8204cb2: -0.03%
Covered Lines: 6737
Relevant Lines: 7315

💛 - Coveralls

@edeesis
Copy link
Contributor Author

edeesis commented May 2, 2024

Closing for rework

@edeesis edeesis closed this May 2, 2024
@nhomble
Copy link

nhomble commented Aug 5, 2024

hi @edeesis

Did you get offline feedback on this change? Can I help out?

@edeesis
Copy link
Contributor Author

edeesis commented Aug 5, 2024

I was unable to get this to pass all tests and such, and ended up going with another approach in my project that didn't need this feature.

@edeesis
Copy link
Contributor Author

edeesis commented Aug 5, 2024

I remember now that the problem comes down to how the message patterns are matched to the controller methods.

It wasn't immediately apparent how you can relate it in both directions.

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.

It is not possible to use RegEx for event matching on the @EventPattern() adn @MessagePattern()
3 participants