Skip to content

Commit

Permalink
[event-hubs] doc improvements (#9342)
Browse files Browse the repository at this point in the history
* [event-hubs] explain empty events

* [event-hubs] readme update for 8798

* [event-hubs] migration-guide checkpointing 8419

* update changelog for 5.2.1

* Update sdk/eventhub/event-hubs/migrationguide.md

Co-authored-by: Richard Park <51494936+richardpark-msft@users.noreply.github.com>

* Decided to be more ambitious for the release date

Co-authored-by: Richard Park <51494936+richardpark-msft@users.noreply.github.com>
  • Loading branch information
chradek and richardpark-msft authored Jun 5, 2020
1 parent eefe610 commit b4782d1
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 2 deletions.
2 changes: 1 addition & 1 deletion sdk/eventhub/event-hubs/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Release History

## 5.2.1 (Unreleased)
## 5.2.1 (2020-06-08)

- Fixes issue [#8584](https://github.com/Azure/azure-sdk-for-js/issues/8584)
where attempting to create AMQP links when the AMQP connection was in the
Expand Down
2 changes: 1 addition & 1 deletion sdk/eventhub/event-hubs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,7 @@ hence sending events is not possible.

- Please notice that the connection string needs to be for an
[Event Hub-compatible endpoint](https://docs.microsoft.com/en-us/azure/iot-hub/iot-hub-devguide-messages-read-builtin)
e.g. "Endpoint=sb://my-iothub-namespace-[uid].servicebus.windows.net/;SharedAccessKeyName=my-SA-name;SharedAccessKey=my-SA-key;EntityPath=my-iot-hub-name"
(e.g. "Endpoint=sb://my-iothub-namespace-[uid].servicebus.windows.net/;SharedAccessKeyName=my-SA-name;SharedAccessKey=my-SA-key;EntityPath=my-iot-hub-name")

```javascript
const { EventHubConsumerClient } = require("@azure/event-hubs");
Expand Down
4 changes: 4 additions & 0 deletions sdk/eventhub/event-hubs/migrationguide.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ We've also merged the functionality from `EventProcessorHost` from the `@azure/e
`EventHubConsumerClient` in the `@azure/event-hubs` package, allowing `EventHubConsumerClient` to be the single
point of entry for receiving of any type (from single partition, all partitions, or with load balancing and checkpointing features) within Event Hubs.

Important note on checkpoints: `EventHubConsumerClient` does not support legacy checkpoint data.
In order to meet the goals set for unifying checkpoint data across languages for the new set of Event Hubs libraries and to make
improvements to the algorithm used for managing partition ownership, breaking changes were necessary.

### Granular control over retries

Retry logic and tuning has been externalized, allowing for better configuration
Expand Down
6 changes: 6 additions & 0 deletions sdk/eventhub/event-hubs/samples/javascript/receiveEvents.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,12 @@ async function main() {
{
// The callback where you add your code to process incoming events
processEvents: async (events, context) => {
// Note: It is possible for `events` to be an empty array.
// This can happen if there were no new events to receive
// in the `maxWaitTimeInSeconds`, which is defaulted to
// 60 seconds.
// The `maxWaitTimeInSeconds` can be changed by setting
// it in the `options` passed to `subscribe()`.
for (const event of events) {
console.log(
`Received event: '${event.body}' from partition: '${context.partitionId}' and consumer group: '${context.consumerGroup}'`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,12 @@ export async function main() {
{
// The callback where you add your code to process incoming events
processEvents: async (events, context) => {
// Note: It is possible for `events` to be an empty array.
// This can happen if there were no new events to receive
// in the `maxWaitTimeInSeconds`, which is defaulted to
// 60 seconds.
// The `maxWaitTimeInSeconds` can be changed by setting
// it in the `options` passed to `subscribe()`.
for (const event of events) {
console.log(
`Received event: '${event.body}' from partition: '${context.partitionId}' and consumer group: '${context.consumerGroup}'`
Expand Down
6 changes: 6 additions & 0 deletions sdk/eventhub/event-hubs/src/eventHubConsumerClientModels.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,12 @@ export interface SubscriptionEventHandlers {
* The `updateCheckpoint()` method on the context can be used to update checkpoints in the `CheckpointStore`
* (if one was provided to the client). Use this in frequent intervals to mark events that have been processed
* so that the client can restart from such checkpoints in the event of a restart or error recovery.
*
* Note: It is possible for received events to be an empty array.
* This can happen if there are no new events to receive
* in the `maxWaitTimeInSeconds`, which is defaulted to 60 seconds.
* The `maxWaitTimeInSeconds` can be changed by setting
* it in the `options` passed to `subscribe()`.
*/
processEvents: ProcessEventsHandler;
/**
Expand Down

0 comments on commit b4782d1

Please sign in to comment.