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

Reporting using kafka #18

Merged
merged 15 commits into from
Apr 4, 2017
Merged

Reporting using kafka #18

merged 15 commits into from
Apr 4, 2017

Conversation

cosminrentea
Copy link
Owner

@cosminrentea cosminrentea commented Apr 4, 2017

More Tests will follow in another PR
@bogh @marian-craciunescu

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.4%) to 67.428% when pulling 6f39216 on feature/reporting-kafka into 1741c20 on master.

@@ -188,6 +196,9 @@ func assertArguments(a *assert.Assertions) {
a.Equal("dev", *Config.EnvName)
a.Equal("mem", *Config.Profile)

a.Equal("[ 127.0.0.1:9092 127.0.0.1:9091]", (*Config.KafkaProducer.Brokers).String())
Copy link
Collaborator

Choose a reason for hiding this comment

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

There is a space at the beginning in this string. Is this correct?

Copy link
Owner Author

Choose a reason for hiding this comment

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

took the implementation from another project; will fix it in the next PR.

type Producer interface {
service.Startable
service.Stopable
Report(topic string, bytes []byte, key string)
Copy link
Collaborator

Choose a reason for hiding this comment

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

👍

Copy link
Collaborator

Choose a reason for hiding this comment

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

As a suggestion here. Wouldn't it be nice if we use a io.ReadCloser as the body? If possible 💃

Copy link
Owner Author

Choose a reason for hiding this comment

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

interesting, I will take a look and try to change the func signature in the next PR, which will contain also more tests

Copy link
Collaborator

Choose a reason for hiding this comment

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

This would allow a streaming mechanism any time 🗡️ For example you can pass a json.Encoder which accepts an io.writer. And this way you can connect the writer to a reader and encode the data and save memory. All this is theory btw :D not completely sure

@@ -150,39 +202,52 @@ func (ns *NexmoSender) Send(msg *protocol.Message) error {
Jitter: true,
},
}

err = withRetry.executeAndCheck(sendSms)
if err != nil && err == ErrRetryFailed {
Copy link
Owner Author

Choose a reason for hiding this comment

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

I guess it's fine that I removed the first condition err != nil, it was redundant

Copy link
Collaborator

Choose a reason for hiding this comment

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

of course.

@cosminrentea cosminrentea merged commit 334d2e6 into master Apr 4, 2017
@cosminrentea cosminrentea deleted the feature/reporting-kafka branch April 4, 2017 13:37
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.

4 participants