-
Notifications
You must be signed in to change notification settings - Fork 135
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1912 from Danielle9897/RDoc-3005-subscription-con…
…sumption-API-for-pr RDoc-3005 [Node.js] Subscriptions > Consumption > API overview
- Loading branch information
Showing
9 changed files
with
660 additions
and
473 deletions.
There are no files selected for viewing
218 changes: 117 additions & 101 deletions
218
...on.Pages/client-api/data-subscriptions/consumption/api-overview.dotnet.markdown
Large diffs are not rendered by default.
Oops, something went wrong.
142 changes: 71 additions & 71 deletions
142
...tion.Pages/client-api/data-subscriptions/consumption/api-overview.java.markdown
Large diffs are not rendered by default.
Oops, something went wrong.
163 changes: 163 additions & 0 deletions
163
...tation.Pages/client-api/data-subscriptions/consumption/api-overview.js.markdown
Large diffs are not rendered by default.
Oops, something went wrong.
144 changes: 79 additions & 65 deletions
144
...on.Pages/client-api/data-subscriptions/consumption/api-overview.python.markdown
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
73 changes: 73 additions & 0 deletions
73
Documentation/5.4/Samples/nodejs/client-api/dataSubscriptions/consumption/consumptionApi.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
import * as assert from "assert"; | ||
import { DocumentStore } from "ravendb"; | ||
|
||
const documentStore = new DocumentStore(); | ||
const session = store.openSession(); | ||
|
||
async function consumptionApi() { | ||
|
||
{ | ||
//region consume_syntax_1 | ||
await documentStore.subscriptions.getSubscriptionWorker(subscriptionName); | ||
await documentStore.subscriptions.getSubscriptionWorker(subscriptionName, database); | ||
|
||
await documentStore.subscriptions.getSubscriptionWorker(options); | ||
await documentStore.subscriptions.getSubscriptionWorker(options, database); | ||
//endregion | ||
} | ||
{ | ||
//region consume_syntax_2 | ||
// The SubscriptionWorkerOptions object: | ||
// ===================================== | ||
{ | ||
subscriptionName; | ||
documentType; | ||
ignoreSubscriberErrors; | ||
closeWhenNoDocsLeft; | ||
maxDocsPerBatch; | ||
timeToWaitBeforeConnectionRetry; | ||
maxErroneousPeriod; | ||
strategy; | ||
} | ||
//endregion | ||
} | ||
{ | ||
let subscriptionWorker; | ||
//region consume_syntax_3 | ||
subscriptionWorker.on("batch", (batch, callback) => { | ||
// Process incoming items: | ||
// ======================= | ||
|
||
// 'batch': | ||
// Contains the documents to be processed. | ||
|
||
// callback(): | ||
// Needs to be called after processing the batch | ||
// to notify the worker that you're done processing. | ||
}); | ||
//endregion | ||
} | ||
{ | ||
//region consume_syntax_4 | ||
class Item | ||
{ | ||
result; | ||
exceptionMessage; | ||
id; | ||
changeVector; | ||
projection; | ||
revision; | ||
rawResult; | ||
rawMetadata; | ||
metadata; | ||
} | ||
//endregion | ||
} | ||
|
||
{ | ||
// for later | ||
subscriptionWorker.on("error", (error) => {}); | ||
subscriptionWorker.on("end", () => {}); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.