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

Events stream #1855

Merged
merged 3 commits into from
Nov 25, 2022
Merged

Events stream #1855

merged 3 commits into from
Nov 25, 2022

Conversation

muhamadazmy
Copy link
Member

@muhamadazmy muhamadazmy commented Nov 25, 2022

Rewrite event distribution system

This improves on the internal delivery system of the events so instead of using zbus pub/sub streams we use redis streams which is much more powerful as follows:

  • Events are scanned from the chain. If the events subsystem is down
    during the delivery of the event, the missed blocsk will be rescanned
  • Received events are pushed to capped streams (length of 1024) event
  • Consumers groups are created one per consumer. So each group has a max
    if one group. this allows us to track pending messages, and able to
    processes un acknowledge messages
  • To prvent the node from getting stuck an event ack is sent back if
    handling failed or succeeded. other protection mechanism is
    implemented in the system to clean up.

This improves on the internal delivery system
of the events so instead of using zbus pub/sub streams
we use redis streams which is much more powerful as follows:

- Events are scanned from the chain. If the events subsystem is down
  during the delivery of the event, the missed blocsk will be rescanned
- Received events are pushed to capped streams (length of 1024) event
- Consumers groups are created one per consumer. So each group has a max
  if one group. this allows us to track pending messages, and able to
processes un acknowledge messages
- To prvent the node from getting stuck an event ack is sent back if
  handling failed or succeeded. other protection mechanism is
implemented in the system to clean up.
)

type ContractEventHandler struct {
node uint32
pool substrate.Manager
engine provision.Engine
cl zbus.Client
events *events.RedisConsumer
Copy link
Collaborator

@xmonader xmonader Nov 25, 2022

Choose a reason for hiding this comment

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

shouldn't that be redisConsumer instead of events for readability?

Copy link
Member Author

Choose a reason for hiding this comment

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

sure

xmonader
xmonader previously approved these changes Nov 25, 2022
@muhamadazmy muhamadazmy merged commit 26282a8 into main Nov 25, 2022
@muhamadazmy muhamadazmy deleted the events-stream branch November 25, 2022 15:45
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.

2 participants