Skip to content

[EPH] adds support for processing multiple partitions#4535

Merged
chradek merged 4 commits intoAzure:masterfrom
chradek:eph-pump-manager
Jul 30, 2019
Merged

[EPH] adds support for processing multiple partitions#4535
chradek merged 4 commits intoAzure:masterfrom
chradek:eph-pump-manager

Conversation

@chradek
Copy link
Contributor

@chradek chradek commented Jul 30, 2019

Fixes #4464

This change does a couple things:

  1. Adds a PumpManager class that can create and remove PartitionPumps.

  2. Updates the EventProcessor to have a loop. The loop is started when calling eventProcessor.start().
    Within the loop, the EventProcessor checks which partitions it is processing and starts processing any partitions it isn't already. Right now it does this check every 30 seconds but this could be configurable/based on some partition ownership rule in the future.

  3. Updates start to no longer return a promise, since it just kicks off the loop.

I also temporarily removed the type validation that was being done on the PartitionProcessor because there isn't a way for the user to catch the error today. #4534 will address this.

import { cancellableDelay } from "./util/cancellableDelay";

/**
* Reason for closing an EventProcessor.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
* Reason for closing an EventProcessor.
* Reason for closing an PartitionProcessor.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated!

});

try {
await pump.start();
Copy link
Member

Choose a reason for hiding this comment

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

If I have 3 partitions then it will call my initialize() method 3 times?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, there is one PartitionProcessor per partition :)

try {
await this._partitionProcessor.initialize();
} catch {
this._isReceiving = false;
Copy link
Contributor

Choose a reason for hiding this comment

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

What is the expectation for when initialize fails?
Here we swallow the error and move on.
If so, then why is _isReceiving set to false if we call recieveEvents in the next line

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah, I think I meant to close the partitionPump, but I'm not sure what the right thing to do here is...expect the user to handle all errors in their own code and keep going or treat a thrown error as meaning STOP.

Either way what I have now isn't right, I'll reach out to other teams to see how they plan to handle errors thrown by PartitionProcessor.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

For now I decided to swallow the error but we can revisit.

@chradek chradek merged commit 6bc44fa into Azure:master Jul 30, 2019
@chradek chradek deleted the eph-pump-manager branch July 30, 2019 23:06
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.

[EPH] handle processing multiple partitions

3 participants