-
Notifications
You must be signed in to change notification settings - Fork 135
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
[Python] data subscription pages batch [Replace C# samples] #1865
Conversation
| Member | Type | Description | | ||
|--------|:-----|-------------| | ||
| **subscription_name** | `str` | Returns the subscription name passed to the constructor. This name will be used by the server side to identify the subscription. | | ||
| **time_to_wait_before_connection_retry** | `DateTime` | Time to wait before reconnecting, in the case of non-aborting failure during the subscription processing.<br>Default: 5 seconds. | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| **time_to_wait_before_connection_retry** | `DateTime` | Time to wait before reconnecting, in the case of non-aborting failure during the subscription processing.<br>Default: 5 seconds. | | |
| **time_to_wait_before_connection_retry** | `timedelta` | Time to wait before reconnecting, in the case of non-aborting failure during the subscription processing.<br>Default: 5 seconds. | | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
After [generating](../../../client-api/data-subscriptions/consumption/api-overview#subscription-worker-generation) | ||
a subscription worker, the worker doesn't process any documents yet. | ||
Processing starts when the `run` function is called. | ||
The `run` function receives the client-side code as a delegate that will process the retrieved batches: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The `run` function receives the client-side code as a delegate that will process the retrieved batches: | |
The `run` function receives the client-side code as a function that will process the retrieved batches: | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
node is currently responsible for data subscriptions. | ||
{NOTE/} | ||
|
||
| `SubscriptionBatch[_T].item` Member | Type | Description | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| `SubscriptionBatch[_T].item` Member | Type | Description | | |
| `SubscriptionBatch[_T].Item` Member | Type | Description | | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
|
||
| Method | Return Type | Description | | ||
|--------|:-----|-------------| | ||
| `dispose` | `void` | Aborts subscription worker operation ungracefully by waiting for the task returned by the `run` function to finish running. | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| `dispose` | `void` | Aborts subscription worker operation ungracefully by waiting for the task returned by the `run` function to finish running. | | |
| `close(bool wait_for_subscription_task = True)` | `void` | Aborts subscription worker operation ungracefully by waiting for the task returned by the `run` function to finish running. | | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
| Method | Return Type | Description | | ||
|--------|:-----|-------------| | ||
| `dispose` | `void` | Aborts subscription worker operation ungracefully by waiting for the task returned by the `run` function to finish running. | | ||
| `dispose(bool waitForSubscriptionTask)` | `void` | Aborts the subscription worker, but allows deciding whether to wait for the `run` function task or not. | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| `dispose(bool waitForSubscriptionTask)` | `void` | Aborts the subscription worker, but allows deciding whether to wait for the `run` function task or not. | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
replaced with close
|--------|:-----|-------------| | ||
| `dispose` | `void` | Aborts subscription worker operation ungracefully by waiting for the task returned by the `run` function to finish running. | | ||
| `dispose(bool waitForSubscriptionTask)` | `void` | Aborts the subscription worker, but allows deciding whether to wait for the `run` function task or not. | | ||
| `run` | `Task` | Starts the subscription worker work of processing batches, receiving the batch processing delegates (see [above](../../../client-api/data-subscriptions/consumption/api-overview#running-subscription-worker)). | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| `run` | `Task` | Starts the subscription worker work of processing batches, receiving the batch processing delegates (see [above](../../../client-api/data-subscriptions/consumption/api-overview#running-subscription-worker)). | | |
| `run` | `Future[None]` | Starts the subscription worker work of processing batches, receiving the batch processing delegates (see [above](../../../client-api/data-subscriptions/consumption/api-overview#running-subscription-worker)). | | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
|
||
| Event | Type\Return type | Description | | ||
|--------|:-----|-------------| | ||
| **after\_acknowledgment** | `AfterAcknowledgmentAction` (event) | Event invoked after each time the server acknowledges batch processing progress. | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| **after\_acknowledgment** | `AfterAcknowledgmentAction` (event) | Event invoked after each time the server acknowledges batch processing progress. | | |
| **after\_acknowledgment** | `Callable[[SubscriptionBatch[_T]], None]` | Event invoked after each time the server acknowledges batch processing progress. | | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
|--------|:-----|-------------| | ||
| **after\_acknowledgment** | `AfterAcknowledgmentAction` (event) | Event invoked after each time the server acknowledges batch processing progress. | | ||
|
||
| `AfterAcknowledgmentAction` Parameters | | | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe
| `AfterAcknowledgmentAction` Parameters | | | | |
| `Callable[[SubscriptionBatch[_T]], None]` Parameters | | | | |
but better
| `AfterAcknowledgmentAction` Parameters | | | | |
| `after_acknowledgment` Parameters | | | | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done (the second one :o)
|
||
| Return value | | | ||
| ------------- | ----- | | ||
| `Task` | The worker waits for the task to finish the event processing | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| `Task` | The worker waits for the task to finish the event processing | | |
| `Future[None]` | The worker waits for the task to finish the event processing | | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
The task returned by the `run` function will be terminated with an erroneous state, throwing | ||
a `SubscriberErrorException` exception. | ||
|
||
* If `SubscriptionWorkerOptions`'s value `IgnoreSubscriberErrors` is set to True, the erroneous |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* If `SubscriptionWorkerOptions`'s value `IgnoreSubscriberErrors` is set to True, the erroneous | |
* If `SubscriptionWorkerOptions`'s value `ignore_subscriber_errors` is set to True, the erroneous |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
The above cases describe situations in which a worker tries to reconnect with the server. | ||
There are two key `SubscriptionWorkerOptions` fields controlling this state: | ||
|
||
* `TimeToWaitBeforeConnectionRetry` - Worker 'sleep' period before trying to reconnect. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* `TimeToWaitBeforeConnectionRetry` - Worker 'sleep' period before trying to reconnect. | |
* `time_to_wait_before_connection_retry` - Worker 'sleep' period before trying to reconnect. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
There are two key `SubscriptionWorkerOptions` fields controlling this state: | ||
|
||
* `TimeToWaitBeforeConnectionRetry` - Worker 'sleep' period before trying to reconnect. | ||
* `MaxErroneousPeriod` - Maximum time that the worker is allowed to be in an erroneous state. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* `MaxErroneousPeriod` - Maximum time that the worker is allowed to be in an erroneous state. | |
* `max_erroneous_period` - Maximum time that the worker is allowed to be in an erroneous state. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
{INFO/} | ||
|
||
{INFO: OnUnexpectedSubscriptionError} | ||
`OnUnexpectedSubscriptionError` is the event raised when a connection failure occurs |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
`OnUnexpectedSubscriptionError` is the event raised when a connection failure occurs | |
`on_unexpected_subscription_error` is the event raised when a connection failure occurs |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's address the comments & we're good to merge
RDoc-2925 Data subscriptions > Creation > How to create data subscription
RDoc-2917 Data subscriptions > Creation > Examples
RDoc-2918 Data subscriptions > Creation > API overview
RDoc-2919 Data subscriptions > Consumption > How to consume
RDoc-2920 Data subscriptions > Consumption > Examples
RDoc-2921 Data subscriptions > Consumption > API overview