Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
6 changes: 5 additions & 1 deletion sdk/eventhub/event-hubs/changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
### 2019-07-15 2.1.1

- Added event handlers for `error` and `protocolError` events on the connection object to avoid the case of unhandled exceptions. This is related to the [bug 4136](https://github.com/Azure/azure-sdk-for-js/issues/4136)

### 2019-06-10 2.1.0

- Added support for WebSockets. WebSockets enable Event Hubs to work over an HTTP proxy and in environments where the standard AMQP port 5671 is blocked.
Expand Down Expand Up @@ -161,4 +165,4 @@ const client = await EventHubClient.createFromIotHubConnectionString(process.env
- Special thanks to @kurtb and @ali92hm for their contributions!

## 2017-01-13 0.0.6
- Added support for message properties in the EventData structure.
- Added support for message properties in the EventData structure.
2 changes: 1 addition & 1 deletion sdk/eventhub/event-hubs/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@azure/event-hubs",
"version": "2.1.0",
"version": "2.1.1",
"description": "Azure Event Hubs SDK for JS.",
"author": "Microsoft Corporation",
"license": "MIT",
Expand Down
36 changes: 36 additions & 0 deletions sdk/eventhub/event-hubs/src/connectionContext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -217,9 +217,45 @@ export namespace ConnectionContext {
}
};

const protocolError: OnAmqpEvent = async (context: EventContext) => {
if (context.connection && context.connection.error) {
log.error(
"[%s] Error (context.connection.error) occurred on the amqp connection: %O",
connectionContext.connection.id,
context.connection && context.connection.error
);
}
if (context.error) {
log.error(
"[%s] Error (context.error) occurred on the amqp connection: %O",
connectionContext.connection.id,
context.error
);
}
};

const error: OnAmqpEvent = async (context: EventContext) => {
if (context.connection && context.connection.error) {
log.error(
"[%s] Error (context.connection.error) occurred on the amqp connection: %O",
connectionContext.connection.id,
context.connection && context.connection.error
);
}
if (context.error) {
log.error(
"[%s] Error (context.error) occurred on the amqp connection: %O",
connectionContext.connection.id,
context.error
);
}
};

// Add listeners on the connection object.
connectionContext.connection.on(ConnectionEvents.connectionOpen, onConnectionOpen);
connectionContext.connection.on(ConnectionEvents.disconnected, disconnected);
connectionContext.connection.on(ConnectionEvents.protocolError, protocolError);
connectionContext.connection.on(ConnectionEvents.error, error);

log.context("[%s] Created connection context successfully.", connectionContext.connectionId);
return connectionContext;
Expand Down