You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- HTTP2 support for higher performance connections to IBM Cloudant.
101
101
- Perform requests either synchronously or asynchronously.
102
102
- Instances of the client are unconditionally thread-safe.
@@ -763,13 +763,13 @@ Expand them to see examples of:
763
763
-[Cloudant blog](https://blog.cloudant.com/):
764
764
Many useful articles about how to optimize Cloudant for common problems.
765
765
766
-
### Changes feed follower (beta)
766
+
### Changes feed follower
767
767
768
768
#### Introduction
769
769
770
-
The SDK provides a changes feed follower utility (currently beta).
770
+
The SDK provides a changes feed follower utility.
771
771
This helper utility connects to the `_changes` endpoint and returns the individual change items.
772
-
It removes some of the complexity of using the `_changes` endpoint by setting some options automatically
772
+
It removes some complexity of using the `_changes` endpoint by setting some options automatically
773
773
and providing error suppression and retries.
774
774
775
775
*Tip: the changes feed often does not meet user expectations or assumptions.*
@@ -781,52 +781,52 @@ to get a better understanding of the limitations and suitable use-cases before u
781
781
782
782
There are two modes of operation:
783
783
* Start mode
784
-
* Fetches the changes from the supplied `since` sequence (by default the feed will start from `now`).
784
+
* Fetches the changes from the supplied `since` sequence (in this mode follower defaults to reading the feed from `now`).
785
785
* Fetches all available changes and then continues listening for new changes indefinitely unless encountering an end condition.
786
786
* An example use case for this mode is event driven workloads.
787
787
* Start one-off mode
788
-
* Fetches the changes from the supplied `since` sequence (by default the feed will start from the beginning).
788
+
* Fetches the changes from the supplied `since` sequence (in this mode follower defaults to reading the feed from the beginning).
789
789
* Fetches all available changes and then stops when either there are no further changes pending or encountering an end condition.
790
790
* An example use case for this mode is ETL style workloads.
791
791
792
792
#### Configuring the changes follower
793
793
794
794
The SDK's model of changes feed options is also used to configure the follower.
795
-
However, a subset of the options are invalid as they are configured internally by the implementation.
795
+
However, a subset of the options used internally by the follower implementation are invalid.
796
796
Supplying these options when instantiating the follower causes an error.
797
797
The invalid options are:
798
798
*`descending`
799
799
*`feed`
800
800
*`heartbeat`
801
801
*`lastEventId` - use `since` instead
802
802
*`timeout`
803
-
*Only the value of `_selector` is permitted for the `filter` option. This restriction is because selector
804
-
based filters perform better than JavaScript backed filters. Configuring a non-selector based filter will
805
-
cause the follower to error.
803
+
*Follower permits only the value `_selector` for the `filter` option. This restriction is because selector
804
+
based filters perform better than JavaScript backed filters. Configuring a non-selector based filter
805
+
causes the follower to error.
806
806
807
-
Note that the `limit` parameter will terminate the follower at the given number of changes in either
807
+
Note that the `limit` parameter terminates the follower at the given number of changes in either
808
808
operating mode.
809
809
810
-
The changes follower requires the client to have HTTP timeouts of at least 1 minute and will error during
810
+
The changes follower requires the client to have HTTP timeouts of at least 1 minute and errors during
811
811
instantiation if it is insufficient. The default client configuration has sufficiently long timeouts.
812
812
813
-
For use-cases where these configuration limitations are deemed too restrictive then it is recommended to
814
-
write code to use the SDK's [POST `_changes` API](https://github.com/IBM/cloudant-java-sdk/tree/v0.10.4/examples#postchanges) instead of the follower.
813
+
For use-cases where these configuration limitations are too restrictive then write code to use the SDK's
814
+
[POST `_changes` API](https://github.com/IBM/cloudant-java-sdk/tree/v0.10.4/examples#postchanges) instead of the follower.
815
815
816
816
#### Error suppression
817
817
818
-
By default, the changes follower will suppress transient errors indefinitely and attempt to run to completion or listen forever as
818
+
By default, the changes follower suppresses transient errors indefinitely and attempts to run to completion or listen forever as
819
819
dictated by the operating mode.
820
-
For applications where that is not desirable an optional error tolerance duration may be specified to control the time since
821
-
the last successful response that transient errors will be suppressed. This can be used, for example, by applications as a grace period
820
+
For applications where that is not desirable configure the optional error tolerance duration. This controls the time since
821
+
the last successful response that the follower suppresses transient errors. An example usage is an application grace period
822
822
before reporting an error and requiring intervention.
823
823
824
824
There are some additional points to consider for error suppression:
825
-
* Errors considered terminal, for example, the database not existing or invalid credentials are never suppressed and will error immediately.
826
-
* The error suppression duration is not guaranteed to fire immediately after lapsing and should be considered a minimum suppression time.
827
-
* The changes follower will back-off between retries and as such may remain paused for a short while after the transient errors have resolved.
828
-
* If the underlying SDK client used to initialize the follower also has retries configured then errors could be suppressed for significantly
829
-
longer than the follower's configured error tolerance duration depending on the configuration options.
825
+
* Errors considered terminal, for example, the database not existing or invalid credentials are never suppressed and error immediately.
826
+
* The error suppression duration is not guaranteed to fire immediately after lapsing and is a minimum suppression time.
827
+
* The changes follower backs-off between retries and as such may remain paused for a short while after the transient errors have resolved.
828
+
* If the underlying SDK client used to initialize the follower also has retries configured then suppression of errors may last
829
+
significantly longer than the follower's configured error tolerance duration depending on the specific options.
830
830
831
831
#### Follower operation
832
832
@@ -835,41 +835,41 @@ For both modes:
835
835
* A terminal error (HTTP codes `400`, `401`, `403``404`).
836
836
* Transient errors occur for longer than the error tolerance duration. Transient errors are all other HTTP status codes and connection errors.
837
837
* The number of changes received reaches the configured `limit`.
838
-
* The feed is terminated early by calling stop.
838
+
* The application calls stop to terminate the feed early.
839
839
840
-
As is true for the `_changes` endpoint change items have *at least once* delivery and an individual item
841
-
may be received multiple times. When using the follower change items may be repeated even within a limited
842
-
number of changes (i.e. using the `limit` option) this is a minor difference from using `limit` on the HTTP native API.
840
+
As is true for the `_changes` endpoint change items have *at least once* delivery and callers may receive
841
+
an individual item multiple times. When using the follower change items may repeat even within a limited
842
+
number of changes (that is using the `limit` option) this is a minor difference from using `limit` on the HTTP native API.
843
843
844
844
The follower is not optimized for some use cases and it is not recommended to use it in cases where:
845
845
* Setting `include_docs` and larger document sizes (for example > 10 kiB).
846
-
* The volume of changes is very high (if the rate of changes in the database exceeds the follower's rate of pulling them it will never catch-up).
846
+
* The volume of changes is very high (if the rate of changes in the database exceeds the follower's rate of pulling them it can never catch-up).
847
847
848
-
In these cases use-case specific control over the number of change requests made and the content size of the responses
849
-
may be achieved by using the SDK's [POST `_changes` API](https://github.com/IBM/cloudant-java-sdk/tree/v0.10.4/examples#postchanges).
848
+
In these use-cases usethe SDK's [POST `_changes` API](https://github.com/IBM/cloudant-java-sdk/tree/v0.10.4/examples#postchanges)
849
+
for specific control over the number of change requests made and the content size of the responses.
850
850
851
-
#### Checkpointing
851
+
#### Checkpoints
852
852
853
-
The changes follower does not checkpoint since it has no information about whether a change item has been
854
-
processed by the consuming application after being received. It is the application developer's responsibility
853
+
The changes follower does not checkpoint since it has no information about whether the consuming application
854
+
has processed a change item after delivery. It is the application developer's responsibility
855
855
to store the sequence IDs to have appropriate checkpoints and to re-initialize the follower with the required
856
856
`since` value after, for example, the application restarts.
857
857
858
-
The frequency and conditions for checkpointing are application specific and some applications may be tolerant
859
-
of dropped changes. This section is intended only to provide general guidance on how to avoid missing changes.
858
+
The frequency and conditions for checkpoints are application specific and some applications may be tolerant
859
+
of dropped changes. This section provides only general guidance on how to avoid missing changes.
860
860
861
-
To guarantee processing of all changes the sequence ID from a change item must not be persisted until *after*
862
-
the processing of the change item by the application has completed. As indicated previously change items are
863
-
delivered *at least once* so application code must be able to handle repeated changes already and it is
861
+
To guarantee processing of all changes do not persist the sequence ID from a change item until *after*
862
+
the processing of the change item by the application has completed. As indicated previously change item
863
+
delivery is *at least once* so application code must be able to handle repeated changes already. It is
864
864
preferable to restart from an older `since` value and receive changes again than risk missing them.
865
865
866
-
The sequence IDs are available on each change item by default, but may be omitted from some change items when
867
-
using the `seq_interval` configuration option. Infrequent sequence IDs may improve performance by reducing
868
-
the amount of data that needs to be transferred, but the trade-off is that more changes will be repeated if
869
-
it is necessary to resume the changes follower.
866
+
The sequence IDs are available on each change item by default. However, the server omits sequence IDs from
867
+
some change items when using the `seq_interval` configuration option.
868
+
Infrequent sequence IDs may improve performance by reducing the amount of data transfer and server load,
869
+
but the tradeoff is repeating more changes if it is necessary to resume the changes follower.
870
870
871
-
Extreme care should be taken with persisting sequences if choosing to process change items in parallel as there
872
-
is a considerable risk of missing changes on a restart if the sequence is recorded out of order.
871
+
Take extreme care persisting sequences if choosing to process change items in parallel as there
872
+
is a considerable risk of missing changes on a restart if the recorded sequence is out of order.
0 commit comments