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

请问用这个sdk 如何消费事件,有例子可以提供参考么 #12

Closed
leoliew opened this issue Oct 18, 2017 · 12 comments
Closed
Assignees
Labels

Comments

@leoliew
Copy link

leoliew commented Oct 18, 2017

看example 只看到订阅消息,没看到如何消费

@leoliew leoliew changed the title 请用用这个sdk 如何消费事件,有例子可以提供参考么 请问用这个sdk 如何消费事件,有例子可以提供参考么 Oct 18, 2017
@wilderchen
Copy link
Contributor

我也遇到同样的问题,求解。

@leoliew
Copy link
Author

leoliew commented Oct 18, 2017

@wilderchen 现在用上生产环境了么

@wilderchen
Copy link
Contributor

刚决定弃用。

@gxcsoccer
Copy link
Contributor

订阅完了,就消费了

consumer.subscribe('you-topic', '*', function*(msg) {
  // 这里放你的消费逻辑,这里不报错就认为消费完了

});

@gxcsoccer gxcsoccer self-assigned this Oct 27, 2017
@gxcsoccer
Copy link
Contributor

egg 里面可以使用 egg-ons 插件,消费更简单

@gxcsoccer
Copy link
Contributor

@wilderchen 现在阿里内部也是用的这个模块,只是不需要鉴权

@JacksonTian
Copy link

我猜他问的就是 .done() 的问题

@leoliew
Copy link
Author

leoliew commented Oct 30, 2017

对,没有 done的方法,现在转用 rabbitmq 了 ,文档比较全

@leoliew
Copy link
Author

leoliew commented Oct 30, 2017

如果要对node的用户商业化,建议提供比较完善的文档资料

@nswbmw
Copy link

nswbmw commented Nov 10, 2017

@gxcsoccer

场景:

  1. consumer 启动,发送 topicA + tagA,能收到消息
consumer.subscribe('topicA', 'tagA', function * (msg) {
  ...
})
  1. consumer 停掉,发送 topicA + tagA,启动 consumer 也能收到消息
consumer.subscribe('topicA', 'tagA', function * (msg) {
  ...
})
  1. consumer 停掉,发送 topicA + tagA,启动 consumer(如下:topicA + tagB) 收不到消息,符合预期
consumer.subscribe('topicA', 'tagB', function * (msg) {
  ...
})

改回 tagA 启动,收不到消息,改成 * 也收不到

consumer.subscribe('topicA', 'tagA', function * (msg) {
  ...
})
consumer.subscribe('topicA', '*', function * (msg) {
  ...
})

什么原理??

@gxcsoccer
Copy link
Contributor

对,没有 done的方法,现在转用 rabbitmq 了 ,文档比较全

@leoliew done 的问题参考这里的的讨论 eggjs/egg#1468

@tsui66
Copy link

tsui66 commented Mar 9, 2018

可以参考这个, https://github.com/Quinton/egg-kafkajs

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

No branches or pull requests

6 participants