Skip to content

Commit c75087f

Browse files
authored
Mark @azure/event-processor-host as deprecated (Azure#13261)
1 parent 3273d72 commit c75087f

File tree

11 files changed

+97
-96
lines changed

11 files changed

+97
-96
lines changed

sdk/eventhub/event-processor-host/README.md

Lines changed: 58 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,56 +1,72 @@
1-
@azure/event-processor-host
2-
================
1+
# @azure/event-processor-host
2+
3+
> Please note, a newer package [@azure/event-hubs](https://www.npmjs.com/package/@azure/event-hubs) is available as of January, 2020. While this package will continue to receive critical bug fixes, we strongly encourage you to upgrade. See the [migration guide](https://github.com/Azure/azure-sdk-for-js/blob/master/sdk/eventhub/event-hubs/migrationguide.md) for more details.
34
45
Azure Event Processor Host helps you efficiently receive events from an EventHub. It will create EventHub Receivers
56
across all the partitions in the provided consumer group of an EventHub and provide you messages received across
67
all the partitions. It will checkpoint metadata about the received messages at regular interval in an
78
Azure Storage Blob. This makes it easy to continue receiving messages from where you left at a later time.
89

910
#### Conceptual Overview
11+
1012
![overview](https://raw.githubusercontent.com/Azure/azure-sdk-for-js/master/sdk/eventhub/event-processor-host/eph.png)
1113

1214
- More information about Azure Event Processor Host can be found over [here](https://docs.microsoft.com/azure/event-hubs/event-hubs-event-processor-host).
1315
- General overview of how the Event Processor Host SDK works internally can be found over [here](https://github.com/Azure/azure-sdk-for-js/blob/master/sdk/eventhub/event-processor-host/overview.md).
1416

15-
## Pre-requisite ##
16-
- **Node.js version: 6.x or higher.**
17+
## Pre-requisite
18+
19+
- **Node.js version: 6.x or higher.**
1720
- We would **still encourage you** to install the latest available LTS version at any given time from https://nodejs.org. **It is a good practice to always install the latest available LTS version of node.js.**
1821
- Installing node.js on **Windows or macOS** is very simple with available installers on the [node.js website](https://nodejs.org). If you are using a **linux based OS**, then you can find easy to follow, one step installation instructions over [here](https://nodejs.org/en/download/package-manager/).
1922

20-
## Installation ##
23+
## Installation
24+
2125
```bash
2226
npm install @azure/event-processor-host
2327
```
24-
## IDE ##
25-
This sdk has been developed in [TypeScript](https://typescriptlang.org) and has good source code documentation. It is highly recommended to use [vscode](https://code.visualstudio.com)
28+
29+
## IDE
30+
31+
This sdk has been developed in [TypeScript](https://typescriptlang.org) and has good source code documentation. It is highly recommended to use [vscode](https://code.visualstudio.com)
2632
or any other IDE that provides better intellisense and exposes the full power of source code documentation.
2733

28-
## Debug logs ##
34+
## Debug logs
2935

3036
You can set the following environment variable to get the debug logs.
3137

3238
- Getting debug logs **only** from the Event Processor Host SDK
39+
3340
```bash
3441
export DEBUG=azure:eph*
3542
```
43+
3644
- Getting debug logs from the Event Processor Host SDK **and** the protocol level library.
45+
3746
```bash
3847
export DEBUG=azure:eph*,rhea*
3948
```
49+
4050
- Getting debug logs from the **Event Processor Host SDK, the Event Hub SDK and the protocol level library.**
51+
4152
```bash
4253
export DEBUG=azure*,rhea*
4354
```
55+
4456
- If you are **not interested in viewing the message transformation** (which consumes lot of console/disk space) then you can set the `DEBUG` environment variable as follows:
57+
4558
```bash
4659
export DEBUG=azure*,rhea*,-rhea:raw,-rhea:message,-azure:amqp-common:datatransformer
4760
```
61+
4862
- If you are interested only in **errors**, then you can set the `DEBUG` environment variable as follows:
63+
4964
```bash
5065
export DEBUG=azure:eph:error,azure:event-hubs:error,azure-amqp-common:error,rhea-promise:error,rhea:events,rhea:frames,rhea:io,rhea:flow
5166
```
5267

5368
#### Logging to a file
69+
5470
- Set the `DEBUG` environment variable as shown above and then run your test script as follows:
5571
- Logging statements from your test script go to `out.log` and logging statements from the sdk go to `debug.log`.
5672
```bash
@@ -64,19 +80,23 @@ export DEBUG=azure:eph:error,azure:event-hubs:error,azure-amqp-common:error,rhea
6480
```bash
6581
node your-test-script.js &> out.log
6682
```
83+
6784
## Recommendation
68-
- You will find the sample provided below demonstrates a multi eph instance in the same process. Since node.js is single threaded, it has to load balance between managing(renew, steal, acquire, update) leases and receive messages across all the partitions. It is better to
69-
create each instance in a separate process or a separate machine. This should provide better results.
85+
86+
- You will find the sample provided below demonstrates a multi eph instance in the same process. Since node.js is single threaded, it has to load balance between managing(renew, steal, acquire, update) leases and receive messages across all the partitions. It is better to
87+
create each instance in a separate process or a separate machine. This should provide better results.
7088

7189
## Examples
90+
7291
- Examples can be found over
73-
[here](https://github.com/Azure/azure-sdk-for-js/tree/master/sdk/eventhub/event-processor-host/samples).
92+
[here](https://github.com/Azure/azure-sdk-for-js/tree/master/sdk/eventhub/event-processor-host/samples).
7493

7594
## Usage
7695

7796
### NOTE
97+
7898
The following samples focus on EPH (Event Processor Host) which is responsible for receiving messages.
79-
For sending messages to the EventHub, please use the `azure-event-hubs` package from npm. More
99+
For sending messages to the EventHub, please use the `@azure/event-hubs` package from npm. More
80100
information about the event hub client can be found over [here](https://github.com/Azure/azure-sdk-for-js/blob/master/sdk/eventhub/event-hubs).
81101
You can also use [this example](https://github.com/Azure/azure-sdk-for-js/blob/master/sdk/eventhub/event-processor-host/samples/typescript/src/sendBatch.ts) that sends
82102
multiple messages batched together. You should be able to run the `send` example from one terminal window and see those messages
@@ -135,6 +155,7 @@ main().catch((err) => {
135155
```
136156
137157
### Multiple EPH instances in the same process.
158+
138159
This example creates 2 instances of EPH in the same process. It is also perfectly fine to create
139160
multiple EPH instances in different processes on the same or different machine.
140161
@@ -206,20 +227,35 @@ async function startEph(ephName /**string**/) {
206227
);
207228
// Message handler
208229
let count = 0;
209-
const onMessage /**OnReceivedMessage**/ = async (context /**PartitionContext**/, data /**EventData**/) => {
230+
const onMessage /**OnReceivedMessage**/ = async (
231+
context /**PartitionContext**/,
232+
data /**EventData**/
233+
) => {
210234
count++;
211-
console.log("##### [%s] %d - Rx message from '%s': '%s'", ephName, count, context.partitionId,
212-
data.body);
235+
console.log(
236+
"##### [%s] %d - Rx message from '%s': '%s'",
237+
ephName,
238+
count,
239+
context.partitionId,
240+
data.body
241+
);
213242
// Checkpointing every 200th event that is received acrosss all the partitions.
214243
if (count % 200 === 0) {
215244
try {
216-
console.log("***** [%s] EPH is currently receiving messages from partitions: %O", ephName,
217-
eph.receivingFromPartitions);
245+
console.log(
246+
"***** [%s] EPH is currently receiving messages from partitions: %O",
247+
ephName,
248+
eph.receivingFromPartitions
249+
);
218250
await context.checkpoint();
219251
console.log("$$$$ [%s] Successfully checkpointed message number %d", ephName, count);
220252
} catch (err) {
221-
console.log(">>>>>>> [%s] An error occurred while checkpointing msg number %d: %O",
222-
ephName, count, err);
253+
console.log(
254+
">>>>>>> [%s] An error occurred while checkpointing msg number %d: %O",
255+
ephName,
256+
count,
257+
err
258+
);
223259
}
224260
}
225261
};
@@ -267,7 +303,7 @@ async function main() {
267303
);
268304
let count = 0;
269305
// Message event handler
270-
const onMessage = async (context/*PartitionContext*/, data /*EventData*/) => {
306+
const onMessage = async (context /*PartitionContext*/, data /*EventData*/) => {
271307
console.log(">>>>> Rx message from '%s': '%s'", context.partitionId, data.body);
272308
count++;
273309
// let us checkpoint every 100th message that is received across all the partitions.
@@ -292,8 +328,8 @@ main().catch((err) => {
292328
});
293329
```
294330
295-
## AMQP Dependencies ##
296-
It depends on [rhea](https://github.com/amqp/rhea) library for managing connections, sending and receiving events over the [AMQP](https://docs.oasis-open.org/amqp/core/v1.0/os/amqp-core-complete-v1.0-os.pdf) protocol.
331+
## AMQP Dependencies
297332
333+
It depends on [rhea](https://github.com/amqp/rhea) library for managing connections, sending and receiving events over the [AMQP](https://docs.oasis-open.org/amqp/core/v1.0/os/amqp-core-complete-v1.0-os.pdf) protocol.
298334
299335
![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-js%2Fsdk%2Feventhub%2Fevent-processor-host%2FREADME.png)

sdk/eventhub/event-processor-host/samples/javascript/iothubEph.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@
77
intervals in an Azure Storage Blob.
88
*/
99

10+
console.warn(
11+
"The package @azure/event-processor-host is deprecated in favor of @azure/event-hubs and @azure/eventhubs-checkpointstore-blob"
12+
);
13+
1014
const { EventProcessorHost, delay } = require("@azure/event-processor-host");
1115

1216
// Define IoT Hub and storage connection strings here

sdk/eventhub/event-processor-host/samples/javascript/multiEph.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@
1313
to learn about Event Processor Host.
1414
*/
1515

16+
console.warn(
17+
"The package @azure/event-processor-host is deprecated in favor of @azure/event-hubs and @azure/eventhubs-checkpointstore-blob"
18+
);
19+
1620
const { EventProcessorHost, delay } = require("@azure/event-processor-host");
1721

1822
// Define Storage and Event Hubs connection strings and related Event Hubs entity name here

sdk/eventhub/event-processor-host/samples/javascript/sendBatch.js

Lines changed: 3 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -2,41 +2,7 @@
22
Copyright (c) Microsoft Corporation. All rights reserved.
33
Licensed under the MIT Licence.
44
5-
This sample is to populate your Event Hubs instance (in case it is empty) with events before you try
6-
any of the other samples that show how to receive the events from Even
5+
The sample to populate your Event Hubs instance with events before you try
6+
any of the other samples that show how to receive the events from Event Hubs is moved to
7+
https://github.com/Azure/azure-sdk-for-js/blob/master/sdk/eventhub/event-hubs/samples/javascript/sendEvents.js
78
*/
8-
9-
const { EventHubClient } = require("@azure/event-hubs");
10-
11-
// Define connection string and related Event Hub entity name here
12-
const connectionString = "";
13-
const eventHubName = "";
14-
15-
async function main() {
16-
const client = EventHubClient.createFromConnectionString(connectionString, eventHubName);
17-
const partitionIds = await client.getPartitionIds();
18-
const messageCount = 300;
19-
20-
const events = [];
21-
// NOTE: For receiving events from Azure Stream Analytics, please send Events to an EventHub
22-
// where the body is a JSON object/array.
23-
// const events = [
24-
// { body: { "message": "Hello World 1" }, applicationProperties: { id: "Some id" }, partitionKey: "pk786" },
25-
// { body: { "message": "Hello World 2" } },
26-
// { body: { "message": "Hello World 3" } }
27-
// ];
28-
for (let i = 0; i < messageCount; i++) {
29-
events.push({ body: `Hello foo ${i}` });
30-
}
31-
console.log("Sending batch events...");
32-
33-
// Will concurrently send batched events to all the partitions.
34-
const sendPromises = partitionIds.map((id) => client.sendBatch(events, id));
35-
36-
await Promise.all(sendPromises);
37-
await client.close();
38-
}
39-
40-
main().catch((err) => {
41-
console.log("Error occurred: ", err);
42-
});

sdk/eventhub/event-processor-host/samples/javascript/singleEph.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@
1313
to learn about Event Processor Host.
1414
*/
1515

16+
console.warn(
17+
"The package @azure/event-processor-host is deprecated in favor of @azure/event-hubs and @azure/eventhubs-checkpointstore-blob"
18+
);
19+
1620
const { EventProcessorHost, delay } = require("@azure/event-processor-host");
1721

1822
// Define storage connection string and Event Hubs connection string and related entity name here

sdk/eventhub/event-processor-host/samples/javascript/websockets.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@
1010
- The `https-proxy-agent` to enable the `ws` library to work with a proxy server.
1111
*/
1212

13+
console.warn(
14+
"The package @azure/event-processor-host is deprecated in favor of @azure/event-hubs and @azure/eventhubs-checkpointstore-blob"
15+
);
16+
1317
const { EventProcessorHost } = require("@azure/event-processor-host");
1418
const WebSocket = require("ws");
1519
const url = require("url");

sdk/eventhub/event-processor-host/samples/typescript/src/iothubEph.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ import {
1616
delay
1717
} from "@azure/event-processor-host";
1818

19+
console.warn(
20+
"The package @azure/event-processor-host is deprecated in favor of @azure/event-hubs and @azure/eventhubs-checkpointstore-blob"
21+
);
22+
1923
// Define IoT Hub and storage connection strings here
2024
const iotConnectionString = "";
2125
const storageConnectionString = "";

sdk/eventhub/event-processor-host/samples/typescript/src/multiEph.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@ import {
2222
delay
2323
} from "@azure/event-processor-host";
2424

25+
console.warn(
26+
"The package @azure/event-processor-host is deprecated in favor of @azure/event-hubs and @azure/eventhubs-checkpointstore-blob"
27+
);
28+
2529
// Define Storage and Event Hubs connection strings and related Event Hubs entity name here
2630
const ehConnectionString = "";
2731
const eventHubsName = "";

sdk/eventhub/event-processor-host/samples/typescript/src/sendBatch.ts

Lines changed: 3 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -2,41 +2,7 @@
22
Copyright (c) Microsoft Corporation. All rights reserved.
33
Licensed under the MIT Licence.
44
5-
This sample is to populate your Event Hubs instance (in case it is empty) with events before you try
6-
any of the other samples that show how to receive the events from Even
5+
The sample to populate your Event Hubs instance with events before you try
6+
any of the other samples that show how to receive the events from Event Hubs is moved to
7+
https://github.com/Azure/azure-sdk-for-js/blob/master/sdk/eventhub/event-hubs/samples/typescript/src/sendEvents.ts
78
*/
8-
9-
import { EventHubClient, EventData } from "@azure/event-hubs";
10-
11-
// Define connection string and related Event Hub entity name here
12-
const connectionString = "";
13-
const eventHubName = "";
14-
15-
export async function main(): Promise<void> {
16-
const client = EventHubClient.createFromConnectionString(connectionString, eventHubName);
17-
const partitionIds = await client.getPartitionIds();
18-
const messageCount = 300;
19-
20-
const events: EventData[] = [];
21-
// NOTE: For receiving events from Azure Stream Analytics, please send Events to an EventHub
22-
// where the body is a JSON object/array.
23-
// const events = [
24-
// { body: { "message": "Hello World 1" }, applicationProperties: { id: "Some id" }, partitionKey: "pk786" },
25-
// { body: { "message": "Hello World 2" } },
26-
// { body: { "message": "Hello World 3" } }
27-
// ];
28-
for (let i = 0; i < messageCount; i++) {
29-
events.push({ body: `Hello foo ${i}` });
30-
}
31-
console.log("Sending batch events...");
32-
33-
// Will concurrently send batched events to all the partitions.
34-
const sendPromises = partitionIds.map((id) => client.sendBatch(events, id));
35-
36-
await Promise.all(sendPromises);
37-
await client.close();
38-
}
39-
40-
main().catch((err) => {
41-
console.log("Error occurred: ", err);
42-
});

sdk/eventhub/event-processor-host/samples/typescript/src/singleEph.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@ import {
2222
delay
2323
} from "@azure/event-processor-host";
2424

25+
console.warn(
26+
"The package @azure/event-processor-host is deprecated in favor of @azure/event-hubs and @azure/eventhubs-checkpointstore-blob"
27+
);
28+
2529
// Define storage connection string and Event Hubs connection string and related entity name here
2630
const ehConnectionString = "";
2731
const eventHubsName = "";

0 commit comments

Comments
 (0)