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

messagebus initial implementation #1

Merged
merged 1 commit into from
Aug 7, 2019

Conversation

fadhillahentino
Copy link
Contributor

@fadhillahentino fadhillahentino commented Jul 17, 2019

Features added :

@anggorodewanto
Copy link
Contributor

Write README documenting the library's usage please

@fadhillahentino
Copy link
Contributor Author

Write README documenting the library's usage please

@fadhillahentino
Copy link
Contributor Author

Write README documenting the library's usage please

Sure, because we have another priority
I delayed writing the README and will update it ASAP. thanks

kafka.go Outdated

// SetTimeout set listening timeout for publish with response
func (client *KafkaClient) SetTimeout(timeout int) {
if timeout < 10000 {

Choose a reason for hiding this comment

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

don't you think it's better to put this into a const?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sure, I will update it
thanks

topicDetails := make(map[string]*sarama.TopicDetail)
topicDetails[topicName] = topicDetail
request := sarama.CreateTopicsRequest{
Timeout: time.Second * 15,

Choose a reason for hiding this comment

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

also this one, better to put in a constant

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sure, will update it
Thanks

kafka.go Outdated
// deleteTopic delete kafka topic
func deleteTopic(broker *sarama.Broker, topicName string) error {
request := sarama.DeleteTopicsRequest{
Timeout: time.Second * 15,

Choose a reason for hiding this comment

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

also this one, better to put in a constant

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sure, I will update it
thanks

receivedMessage := unmarshal(consumerMessage)

// check the request and response message ID should be equal
if messageID != receivedMessage.MessageId {

Choose a reason for hiding this comment

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

is it possible that the receivedMessage is nil?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think its not possible because if unmarshal function get an error, it will return empty struct

kafka.go Outdated

// currently only support 1 message broker
broker := sarama.NewBroker(brokerList[0])
_ = broker.Open(config)

Choose a reason for hiding this comment

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

is this an error that you silent? or something else?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

you're right, I will update it
thanks

messagebus.go Outdated
package messagebus

const (
GDPR_DeletionAccount string = "GDPR:deletionAccount"

Choose a reason for hiding this comment

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

what is this used for?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

this is a topic name, we registered the topic name as a public constant so the client doesn't need to manually set the topic

@fadhillahentino fadhillahentino force-pushed the messagebus-initial-implementation branch from 79ec6d2 to 2ab7e53 Compare August 7, 2019 10:11
@fadhillahentino fadhillahentino merged commit 0032766 into master Aug 7, 2019
@fadhillahentino fadhillahentino deleted the messagebus-initial-implementation branch August 7, 2019 10:14
@fadhillahentino fadhillahentino restored the messagebus-initial-implementation branch August 8, 2019 08:12
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.

None yet

4 participants