Skip to content
This repository has been archived by the owner on Jun 23, 2023. It is now read-only.

Add message converters #32

Merged
merged 47 commits into from
Jan 9, 2019
Merged

Add message converters #32

merged 47 commits into from
Jan 9, 2019

Conversation

asdine
Copy link
Contributor

@asdine asdine commented Dec 27, 2018

This PR introduces the message formatters and unformatters to Felice.

Producer

  • New MessageConverter interface
  • MessageConverterV1 is the default implementation of the MessageConverter
  • Selecting a MessageConverter is mandatory when creating a producer

Consumer

  • New MessageConverter interface
  • MessageConverterV1 is the default implementation of the MessageConverter
  • Selecting a MessageConverter is mandatory when calling setting a handler per topic

Other changes

  • The message package has been removed. It was difficult to have one type for both the producer and consumer while keeping this type coherent. I created one Message for both packages which is specialized for use in its package.
  • The handlers had been removed and its code was integrated in the consumer package. With the removal of the message package, we had an import cycle between the consumer package and the handlers package, which forced me to reconsider the organization of this package.
    I think for now a Handler is strongly coupled with a Consumer and it is normal to have them in the same package. I also unexported the Collection type as I don't yet see how it can be useful to be used outside of this package. Let me know if you disagree

@asdine asdine requested review from yaziine and tealeg and removed request for yaziine December 27, 2018 10:46
@asdine asdine changed the base branch from master to export-config December 27, 2018 10:47
consumer/consumer.go Show resolved Hide resolved
consumer/consumer.go Outdated Show resolved Hide resolved
consumer/consumer.go Outdated Show resolved Hide resolved
consumer/consumer.go Outdated Show resolved Hide resolved
consumer/consumer.go Show resolved Hide resolved
producer/config.go Outdated Show resolved Hide resolved
@asdine asdine changed the title Add message formatters and unformatters Add message converters Jan 2, 2019
@asdine asdine force-pushed the message-formatter branch 2 times, most recently from 2749675 to 4c92e63 Compare January 7, 2019 16:09
@asdine asdine changed the base branch from export-config to release-v0.6.0 January 8, 2019 15:23
consumer/handler.go Outdated Show resolved Hide resolved
"github.com/stretchr/testify/require"
)

// checks if codec encodes to the proper output.
Copy link
Contributor

Choose a reason for hiding this comment

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

🌷 The "checks if" at the start of all these test descriptions is redundant. We know they're checking something. It's better to just make a plain statement. Also, this sort of case might not even need a comment at all (I often write them also, but I don't think "it does the right thing" is adding anything much).

producer/example_test.go Outdated Show resolved Hide resolved
tealeg and others added 3 commits January 9, 2019 11:07
Co-Authored-By: asdine <asdine.elhrychy@gmail.com>
@asdine
Copy link
Contributor Author

asdine commented Jan 9, 2019

🆙

@asdine
Copy link
Contributor Author

asdine commented Jan 9, 2019

🆙 @tealeg

Copy link
Contributor

@tealeg tealeg left a comment

Choose a reason for hiding this comment

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

👍 Looks good - I've made suggestions for a couple of minor fixes in the English in the doc.go, but otherwise excellent, and you can merge when they're applied.

producer/doc.go Outdated Show resolved Hide resolved
producer/doc.go Outdated Show resolved Hide resolved
producer/doc.go Outdated Show resolved Hide resolved
Co-Authored-By: asdine <asdine.elhrychy@gmail.com>
@asdine asdine merged commit fc470ba into release-v0.6.0 Jan 9, 2019
This was referenced Jan 9, 2019
@asdine asdine deleted the message-formatter branch January 9, 2019 16:31
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.

3 participants