Skip to content
This repository has been archived by the owner on Oct 17, 2018. It is now read-only.

Add consumer server #21

Merged
merged 3 commits into from
May 30, 2018
Merged

Add consumer server #21

merged 3 commits into from
May 30, 2018

Conversation

cw9
Copy link
Contributor

@cw9 cw9 commented May 25, 2018

Originally I was planning to add a MessageFn like Kafka's interface, so users just need to pass in a lambda for processing messages, but in order to work with msgpack, it's better for us to reuse the iterator for the whole lifecycle of the consumer/connection so I changed the interface to take a ConsumeFn, maybe I can change the interface to use MessageFn once we migrated everything from msgpack to protobuf.

@xichen2020

@cw9 cw9 changed the title Add metrics to consumer [WIP] Add metrics to consumer May 25, 2018
@cw9 cw9 changed the title [WIP] Add metrics to consumer Add consumer server May 28, 2018
@@ -51,6 +54,7 @@ func NewListener(addr string, opts Options) (Listener, error) {
Listener: lis,
opts: opts,
msgPool: mPool,
m: newConsumerMetrics(opts.InstrumentOptions().MetricsScope()),
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: newListenerMetrics?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

it's actually consumer metrics, just created at listener level so that it can be shared by all consumers

addr,
newHandler(opts.ConsumeFn(), opts.ConsumerOptions()),
opts.ServerOptions(),
), nil
Copy link
Contributor

Choose a reason for hiding this comment

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

If this always returns nil, perhaps don't return an error?

Copy link
Contributor

@xichen2020 xichen2020 left a comment

Choose a reason for hiding this comment

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

LGTM

@cw9 cw9 merged commit 5789f7e into master May 30, 2018
@cw9 cw9 deleted the chao-metrics branch May 30, 2018 03:15
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants