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

EX-115: add kafka publisher with protobuf #105

Merged
merged 15 commits into from
Jan 24, 2024

Conversation

lehainam-dev
Copy link
Member

@lehainam-dev lehainam-dev commented Jan 16, 2024

TDD: https://www.notion.so/kybernetwork/TDD-Longer-retention-message-broker-for-EVM-Listener-2da22223cd5d41ac897d73ea244ad65f

This PR is based on the idea of running EVM Listener + Kafka in a separate instance vs EVM Listener + Redis stream.

Although this PR is backward-compatible, we still need to discuss if we want to merge this PR into main branch.

@lehainam-dev lehainam-dev force-pushed the EX-115/kafka-publisher branch from 27e56f9 to 6223770 Compare January 16, 2024 07:12
@lehainam-dev lehainam-dev changed the title EX-115: add kafka publisher WIP: EX-115: add kafka publisher Jan 16, 2024
listener.WithEventLogs(nil, nil))

return listener.New(l, wsEVMClient, httpEVMClient, handler, sanityEVMClient, sanityCheckInterval,
listener.WithEventLogs(nil, nil)), nil
}

func getPublisher(c *cli.Context, redisClient *redis.Client, topic string) (publisherpkg.Publisher, error) {
Copy link
Member Author

Choose a reason for hiding this comment

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

Review note: At first I put the logic below into NewListener function, however, it causes cyclomatic complexity error when linting. So I separate this logic into its own function.

The parameters passed into this function seem quite counterintuitive to me, though.

@lehainam-dev lehainam-dev force-pushed the EX-115/kafka-publisher branch from f993069 to c495538 Compare January 16, 2024 08:13
@lehainam-dev lehainam-dev force-pushed the EX-115/kafka-publisher branch from c495538 to e3dfc52 Compare January 16, 2024 08:14
@lehainam-dev lehainam-dev requested a review from hiepnv90 January 16, 2024 10:27
@lehainam-dev lehainam-dev changed the title WIP: EX-115: add kafka publisher EX-115: add kafka publisher Jan 17, 2024
pkg/publisher/iface.go Outdated Show resolved Hide resolved
@lehainam-dev lehainam-dev changed the title EX-115: add kafka publisher WIP: EX-115: add kafka publisher with protobuf Jan 19, 2024
@lehainam-dev lehainam-dev force-pushed the EX-115/kafka-publisher branch 2 times, most recently from 710bd29 to 8dba19c Compare January 22, 2024 03:04
@lehainam-dev lehainam-dev force-pushed the EX-115/kafka-publisher branch from 8dba19c to 6cb2463 Compare January 22, 2024 06:12
@lehainam-dev lehainam-dev changed the title WIP: EX-115: add kafka publisher with protobuf EX-115: add kafka publisher with protobuf Jan 22, 2024
Comment on lines +12 to +14
bytes hash = 2;
bytes parent_hash = 3;
bytes reorged_hash = 4;
Copy link
Member Author

@lehainam-dev lehainam-dev Jan 22, 2024

Choose a reason for hiding this comment

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

Review note: Previously in Go struct, these fields are defined as string. I updated them to bytes to save data size.

@lehainam-dev lehainam-dev requested a review from hiepnv90 January 22, 2024 08:04
internal/app/app.go Outdated Show resolved Hide resolved
Copy link
Member

@hiepnv90 hiepnv90 left a comment

Choose a reason for hiding this comment

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

LGTM! 👍

@lehainam-dev lehainam-dev changed the base branch from main to main-kafka January 24, 2024 02:58
@lehainam-dev lehainam-dev force-pushed the EX-115/kafka-publisher branch from 0bd891e to b9b06f3 Compare January 24, 2024 03:21
@lehainam-dev lehainam-dev merged commit 919a173 into main-kafka Jan 24, 2024
4 checks passed
@lehainam-dev lehainam-dev deleted the EX-115/kafka-publisher branch January 24, 2024 03:24
lehainam-dev added a commit that referenced this pull request Mar 14, 2024
* feat: add kafka publisher

* feat: handler config publisher type

* chore: remove cleanup producer

* feat: add producer wait acks

* chore: refactor function name

* refactor: reduce cyclomatic complexity to pass linter

* chore: add kafka topic name validation

* fix: check topic name match regex

* test: add validate topic name test

* test: add kafka publisher test

* feat: change interface of publisher to publish byte

* feat: add protobuf support

* feat: add encoder

* feat: add protobuf encoder

* chore: separate encoder type
lehainam-dev added a commit that referenced this pull request May 13, 2024
* feat: add kafka publisher

* feat: handler config publisher type

* chore: remove cleanup producer

* feat: add producer wait acks

* chore: refactor function name

* refactor: reduce cyclomatic complexity to pass linter

* chore: add kafka topic name validation

* fix: check topic name match regex

* test: add validate topic name test

* test: add kafka publisher test

* feat: change interface of publisher to publish byte

* feat: add protobuf support

* feat: add encoder

* feat: add protobuf encoder

* chore: separate encoder type
lehainam-dev added a commit that referenced this pull request Nov 12, 2024
* feat: add kafka publisher

* feat: handler config publisher type

* chore: remove cleanup producer

* feat: add producer wait acks

* chore: refactor function name

* refactor: reduce cyclomatic complexity to pass linter

* chore: add kafka topic name validation

* fix: check topic name match regex

* test: add validate topic name test

* test: add kafka publisher test

* feat: change interface of publisher to publish byte

* feat: add protobuf support

* feat: add encoder

* feat: add protobuf encoder

* chore: separate encoder type
lehainam-dev added a commit that referenced this pull request Nov 13, 2024
* feat: add kafka publisher

* feat: handler config publisher type

* chore: remove cleanup producer

* feat: add producer wait acks

* chore: refactor function name

* refactor: reduce cyclomatic complexity to pass linter

* chore: add kafka topic name validation

* fix: check topic name match regex

* test: add validate topic name test

* test: add kafka publisher test

* feat: change interface of publisher to publish byte

* feat: add protobuf support

* feat: add encoder

* feat: add protobuf encoder

* chore: separate encoder type
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.

3 participants