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(kafka): update kafka framework & add test demo #2236

Merged
merged 2 commits into from
Aug 16, 2022

Conversation

chenzhaozheng
Copy link
Contributor

@chenzhaozheng chenzhaozheng commented Aug 13, 2022

Checklist
  • npm test passes
  • tests and/or benchmarks are included
  • documentation is changed or added
  • commit message follows commit guidelines
Affected core subsystem(s)

kafka组件

Description of change
  • 增加kafka的framework支持runConfig和subscription配置设置,方便用户修改自动提交和手动提交。
  • 修改默认kafka客户端的提交方式,提交方式默认为自动提交。
增加测试用例

增加kafka测试用例

  • 测试1个消息,发布后是否能消费
  • 测试2个消息,同个分组同个topic的消费情况
  • 测试2个消息,同个分组不同topic的消费情况
  • 自动提交的测试用例
  • 手动操作偏移量的测试用例

未来规划的kafka组件功能

  • 高级点的eachMessage,也就是eachBatch的使用方式
  • Consumer的pause和resume的使用场景和测试
  • mock使用的时候和没使用的时候,暂未想到测试的方式
  • sockerFactory能否在这里有什么使用场景?
  • 不同分组的消息消费,需要改写事件循环适配多个Consumer的连接,
测试不同分组的消费情况

@gitpod-io
Copy link

gitpod-io bot commented Aug 13, 2022

@codecov-commenter
Copy link

codecov-commenter commented Aug 13, 2022

Codecov Report

Merging #2236 (e9c79f8) into main (ff7506a) will decrease coverage by 0.03%.
The diff coverage is 90.47%.

@@            Coverage Diff             @@
##             main    #2236      +/-   ##
==========================================
- Coverage   82.42%   82.38%   -0.04%     
==========================================
  Files         434      434              
  Lines       15217    15240      +23     
  Branches     3598     3606       +8     
==========================================
+ Hits        12542    12556      +14     
- Misses       2447     2454       +7     
- Partials      228      230       +2     
Impacted Files Coverage Δ
...orator/src/decorator/microservice/kafkaListener.ts 100.00% <ø> (ø)
packages/mock/src/client/kafka.ts 18.18% <0.00%> (ø)
packages/kafka/src/framework.ts 92.64% <92.50%> (+28.20%) ⬆️
packages/kafka/src/kafka.ts 86.66% <100.00%> (ø)
packages/oss/src/manager.ts 38.88% <0.00%> (-50.00%) ⬇️
packages/oss/src/configuration.ts 60.00% <0.00%> (-40.00%) ⬇️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@czy88840616 czy88840616 merged commit 5eae117 into midwayjs:main Aug 16, 2022
@@ -1,52 +1,29 @@
import { MS_CONSUMER_KEY, attachPropertyDataToClass } from '../..';

/**
* @deprecated Replaced by ConsumerSubscribeTopics
*/
Copy link
Member

@czy88840616 czy88840616 Aug 16, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

后面会把逐步把decorator 包和 core 合一,除了核心的框架装饰器,组件的无法复用的装饰器会收回到各个组件中,下一步可以做这个计划。

趁着 kafka 组件社区还没有写文档,直接改了也行。

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

Successfully merging this pull request may close these issues.

None yet

3 participants