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

EventHubs migration guide (start) #2

Closed
wants to merge 37 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
29858fe
starting the migration guide
richardpark-msft Dec 4, 2019
45065e3
Update event hubs migration guide.md
richardpark-msft Dec 5, 2019
a1c6ebd
Change wording to 'receiving'
richardpark-msft Dec 6, 2019
e7b1def
AAD line
richardpark-msft Dec 6, 2019
7ca4971
* Checked against code - casing for AAD was incorrect (should have be…
richardpark-msft Dec 6, 2019
c1855a0
Merge branch 'richardpark-eh-migration-guide' of https://github.com/r…
richardpark-msft Dec 6, 2019
5d7dceb
Applying Ramya's changes
richardpark-msft Dec 6, 2019
686dc6a
Took part of a description from our REST documentation and tailored i…
richardpark-msft Dec 6, 2019
e6e89bd
Merge branch 'richardpark-eh-migration-guide' of https://github.com/r…
richardpark-msft Dec 6, 2019
8edaf44
Updating migration guide sample for sending.
richardpark-msft Dec 6, 2019
52bce99
Add in a description of EventProcessorHost
richardpark-msft Dec 6, 2019
79fdac1
Removed the 'as well'
richardpark-msft Dec 6, 2019
a46af7a
Unlink dependencies if tests fail (#6483)
mikeharder Dec 10, 2019
1ff3be6
[Storage] Add more tests covering progress events (#6428)
jeremymeng Dec 10, 2019
3a81099
[event-hubs] Better error handling and reporting (#6465)
richardpark-msft Dec 10, 2019
94b5d23
[Core-http] Move getDefaultProxySettings into proxyPolicy (#6478)
jeremymeng Dec 10, 2019
27d9cb1
[core-amqp] adds support for idle timeout and additional logging (#6492)
chradek Dec 10, 2019
887e83a
[event-hubs] Updating samples folder to make it a standalone project …
richardpark-msft Dec 10, 2019
39f6a44
Adding example for EventProcessorHost => EventHubConsumerClient migra…
richardpark-msft Dec 10, 2019
339ba8c
* Don't use $Default anywhere if we can avoid it. Guide the user choo…
richardpark-msft Dec 10, 2019
7fe7dea
There were two packages, not one.
richardpark-msft Dec 11, 2019
20492ab
Document the multiple types of message receiving we can handle.
richardpark-msft Dec 11, 2019
78138d4
We only construct clients, not empires.
richardpark-msft Dec 11, 2019
8992aee
It's a function. Be proud of it and call it theoretically in the table.
richardpark-msft Dec 11, 2019
58bdcb1
Parens.
richardpark-msft Dec 11, 2019
07fb17c
Removed!
richardpark-msft Dec 11, 2019
b6286da
Updated with in-person feedback
Dec 11, 2019
de2de90
Remove backtick from the toc links
Dec 11, 2019
55e8480
send example was incorrect (should have been sendBatch)
Dec 11, 2019
de034b9
The user is in control of the batch size...
richardpark-msft Dec 11, 2019
93e8259
Merge branch 'richardpark-eh-migration-guide' of https://github.com/r…
Dec 11, 2019
8e74f24
Let's assume they're already full events and not just data.
richardpark-msft Dec 11, 2019
bb92f68
Tenatitively fixing sample
Dec 11, 2019
9b37716
Merge branch 'richardpark-eh-migration-guide' of https://github.com/r…
Dec 11, 2019
2c25e0e
Merge remote-tracking branch 'upstream/master' into richardpark-eh-mi…
Dec 11, 2019
96d7a5b
Advertise the goodness that was EPH and that is now part of the Event…
richardpark-msft Dec 11, 2019
0db9b43
* Make sample a bit more interesting by allowing them to specify the …
richardpark-msft Dec 11, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
631 changes: 330 additions & 301 deletions common/config/rush/pnpm-lock.yaml

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions eng/pipelines/templates/jobs/archetype-sdk-client.yml
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,7 @@ jobs:
# which need to walk the directory tree (and are hardcoded to follow symlinks).
- script: |
node eng/tools/rush-runner.js unlink
condition: succeededOrFailed()
displayName: "Unlink dependencies"

# It's important for performance to pass "sdk" as "searchFolder" to avoid looking under root "node_modules".
Expand Down
1 change: 1 addition & 0 deletions eng/pipelines/templates/jobs/archetype-sdk-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ jobs:
# which need to walk the directory tree (and are hardcoded to follow symlinks).
- script: |
node eng/tools/rush-runner.js unlink
condition: succeededOrFailed()
displayName: "Unlink dependencies"

# It's important for performance to pass "sdk" as "searchFolder" to avoid looking under root "node_modules".
Expand Down
7 changes: 6 additions & 1 deletion sdk/core/core-amqp/changelog.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
## 1.0.0-preview.7 - TBD

- Improved detection of when an established socket is no longer receiving data from the service.
- Added logging around the network connectivity check.

## 1.0.0-preview.6 - 3rd December, 2019

* Treat ETIMEOUT error from dns.resolve as network disconnected.
- Treat ETIMEOUT error from dns.resolve as network disconnected.

## 1.0.0-preview.5 - 29th October, 2019

Expand Down
10 changes: 4 additions & 6 deletions sdk/core/core-amqp/package.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
{
"name": "@azure/core-amqp",
"sdk-type": "client",
"version": "1.0.0-preview.6",
"version": "1.0.0-preview.7",
"description": "Common library for amqp based azure sdks like @azure/event-hubs.",
"author": "Microsoft Corporation",
"license": "MIT",
"main": "./dist/index.js",
"module": "./dist-esm/src/index.js",
"types": "./typings/src/index.d.ts",
"browser": {
"./dist-esm/src/util/checkNetworkConnection.js": "./dist-esm/src/util/checkNetworkConnection.browser.js",
"./dist/index.js": "./browser/index.js",
"buffer": "buffer",
"stream": "stream-browserify"
Expand Down Expand Up @@ -66,14 +67,13 @@
"is-buffer": "^2.0.3",
"jssha": "^2.3.1",
"process": "^0.11.10",
"rhea": "^1.0.15",
"rhea-promise": "^1.0.0",
"stream-browserify": "^2.0.2",
"tslib": "^1.9.3",
"url": "^0.11.0",
"util": "^0.12.1"
},
"peerDependencies": {
"rhea-promise": "^1.0.0"
},
"devDependencies": {
"@azure/eslint-plugin-azure-sdk": "^2.0.1",
"@azure/identity": "^1.0.0",
Expand Down Expand Up @@ -107,8 +107,6 @@
"nyc": "^14.0.0",
"prettier": "^1.16.4",
"puppeteer": "^2.0.0",
"rhea": "^1.0.4",
"rhea-promise": "^1.0.0",
"rimraf": "^3.0.0",
"rollup": "^1.16.3",
"rollup-plugin-commonjs": "^10.0.0",
Expand Down
2 changes: 1 addition & 1 deletion sdk/core/core-amqp/rollup.base.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import shim from "rollup-plugin-shim";
import json from "@rollup/plugin-json";

const pkg = require("./package.json");
const depNames = Object.keys(pkg.dependencies).concat(Object.keys(pkg.peerDependencies));
const depNames = Object.keys(pkg.dependencies);

const input = "dist-esm/src/index.js";
const production = process.env.NODE_ENV === "production";
Expand Down
1 change: 1 addition & 0 deletions sdk/core/core-amqp/src/ConnectionContextBase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ export module ConnectionContextBase {
platform: `(${os.arch()}-${os.type()}-${os.release()})`,
framework: `Node/${process.version}`
},
idle_time_out: Constants.defaultConnectionIdleTimeoutInMs,
operationTimeoutInSeconds: parameters.operationTimeoutInMs
? parameters.operationTimeoutInMs / 1000
: undefined
Expand Down
21 changes: 2 additions & 19 deletions sdk/core/core-amqp/src/retry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
// Licensed under the MIT License.

import { translate, MessagingError } from "./errors";
import { delay, isNode } from "./util/utils";
import { delay } from "./util/utils";
import * as log from "./log";
import {
defaultMaxRetries,
defaultDelayBetweenOperationRetriesInMs,
defaultMaxDelayForExponentialRetryInMs
} from "./util/constants";
import { resolve } from "dns";
import { AbortSignalLike } from "@azure/abort-controller";
import { checkNetworkConnection } from "./util/checkNetworkConnection";

/**
* Determines whether the object is a Delivery object.
Expand Down Expand Up @@ -139,23 +139,6 @@ function validateRetryConfig<T>(config: RetryConfig<T>): void {
}
}

async function checkNetworkConnection(host: string): Promise<boolean> {
if (isNode) {
return new Promise((res) => {
resolve(host, function(err: any): void {
// List of possible DNS error codes: https://nodejs.org/dist/latest-v12.x/docs/api/dns.html#dns_error_codes
if (err && (err.code === "ECONNREFUSED" || err.code === "ETIMEOUT")) {
res(false);
} else {
res(true);
}
});
});
} else {
return window.navigator.onLine;
}
}

/**
* Every operation is attempted at least once. Additional attempts are made if the previous attempt failed
* with a retryable error. The number of additional attempts is governed by the `maxRetries` property provided
Expand Down
11 changes: 11 additions & 0 deletions sdk/core/core-amqp/src/util/checkNetworkConnection.browser.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

/**
* Checks whether a network connection is detected.
* @ignore
* @internal
*/
export function checkNetworkConnection(): Promise<boolean> {
return Promise.resolve(window.navigator.onLine);
}
34 changes: 34 additions & 0 deletions sdk/core/core-amqp/src/util/checkNetworkConnection.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

import { resolve, CONNREFUSED, TIMEOUT } from "dns";
import { retry as logRetry } from "../log";

/**
* Checks whether a network connection is detected.
* @ignore
* @internal
*/
export function checkNetworkConnection(host: string): Promise<boolean> {
return new Promise((res) => {
logRetry("Calling dns.resolve to determine network connection status.");
resolve(host, function(err: any): void {
if (err) {
logRetry(
"Error thrown from dns.resolve in network connection check: '%s', %O",
err.code || err.name,
err
);
// List of possible DNS error codes: https://nodejs.org/dist/latest-v12.x/docs/api/dns.html#dns_error_codes
// Only when dns.resolve returns an error we expect to see when the network is down, resolve as 'false'.
if (err.code === CONNREFUSED || err.code === TIMEOUT) {
return res(false);
}
} else {
logRetry("Successfully resolved host via dns.resolve in network connection check.");
}

return res(true);
});
});
}
1 change: 1 addition & 0 deletions sdk/core/core-amqp/src/util/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ export const senderError = "sender_error";
export const sessionError = "session_error";
export const connectionError = "connection_error";
export const defaultOperationTimeoutInMs = 60000;
export const defaultConnectionIdleTimeoutInMs = 60000;
export const managementRequestKey = "managementRequest";
export const negotiateCbsKey = "negotiateCbs";
export const negotiateClaim = "negotiateClaim";
Expand Down
3 changes: 3 additions & 0 deletions sdk/core/core-http/lib/policies/proxyPolicy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ export function getDefaultProxySettings(proxyUrl?: string): ProxySettings | unde
}

export function proxyPolicy(proxySettings?: ProxySettings): RequestPolicyFactory {
if (!proxySettings) {
proxySettings = getDefaultProxySettings();
}
return {
create: (nextPolicy: RequestPolicy, options: RequestPolicyOptions) => {
return new ProxyPolicy(nextPolicy, options, proxySettings!);
Expand Down
12 changes: 5 additions & 7 deletions sdk/core/core-http/lib/serviceClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ import { stringifyXML } from "./util/xml";
import { RequestOptionsBase, RequestPrepareOptions, WebResource } from "./webResource";
import { OperationResponse } from "./operationResponse";
import { ServiceCallback, isNode } from "./util/utils";
import { proxyPolicy, getDefaultProxySettings } from "./policies/proxyPolicy";
import { proxyPolicy } from "./policies/proxyPolicy";
import { throttlingRetryPolicy } from "./policies/throttlingRetryPolicy";
import { ServiceClientCredentials } from "./credentials/serviceClientCredentials";
import { signingPolicy } from "./policies/signingPolicy";
Expand Down Expand Up @@ -618,9 +618,8 @@ function createDefaultRequestPolicyFactories(

factories.push(deserializationPolicy(options.deserializationContentTypes));

const proxySettings = options.proxySettings || getDefaultProxySettings();
if (proxySettings) {
factories.push(proxyPolicy(proxySettings));
if (isNode) {
factories.push(proxyPolicy(options.proxySettings));
}

factories.push(logPolicy({ logger: logger.info }));
Expand Down Expand Up @@ -664,9 +663,8 @@ export function createPipelineFromOptions(
...pipelineOptions.redirectOptions
};

const proxySettings = pipelineOptions.proxyOptions || getDefaultProxySettings();
if (isNode && proxySettings) {
requestPolicyFactories.push(proxyPolicy(proxySettings));
if (isNode) {
requestPolicyFactories.push(proxyPolicy(pipelineOptions.proxyOptions));
}

const deserializationOptions = {
Expand Down
5 changes: 5 additions & 0 deletions sdk/eventhub/event-hubs/changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
### 5.0.0-preview.8

- Fixed potential issues with claims being mismanaged when subscriptions terminate.
- Improved reporting of errors that occur when attempting to claim partitions from CheckpointStores.

### 2019-12-03 5.0.0-preview.7

- Improves load-balancing capabilities to reduce the frequency that partitions are claimed by other running
Expand Down
Loading