適用於 Node.js 的 Azure 事件中樞模組Azure Event Hub modules for Node.js

Azure 事件中樞是可高度調整的資料串流平台,以及每秒能夠接收和處理數百萬個事件的事件內嵌服務。Azure Event Hubs is a highly scalable data streaming platform and event ingestion service capable of receiving and processing millions of events per second. 事件中樞可以處理及儲存分散式軟體和裝置所產生的事件、資料或遙測。Event Hubs can process and store events, data, or telemetry produced by distributed software and devices. 傳送至事件中樞的資料可以透過任何即時分析提供者或批次/儲存體配接器來轉換和儲存。Data sent to an event hub can be transformed and stored using any real-time analytics provider or batching/storage adapters. 藉由提供大規模的低延遲發佈訂閱功能,事件中樞能成為引進巨量資料的途徑。With the ability to provide publish-subscribe capabilities with low latency and at massive scale, Event Hubs serves as the "on ramp" for Big Data.

管理套件Management Package

安裝 npm 模組Install the npm module

使用 npm 來安裝適用於 Node.js 的 Azure 事件中樞模組Use npm to install the Azure Event Hub modules for Node.js

npm install azure-arm-eventhub

範例Example

此範例會擷取現有事件中樞的相關資訊。This example retrieves information about an existing event hub.

const msRestAzure = require('ms-rest-azure');
const EventHubManagement = require('azure-arm-eventhub');

const resourceGroupName = 'testRG';
const namespaceName = 'testNS';
const eventHubName = 'testEH';
const subscriptionId = 'your-subscription-id';

msRestAzure
  .interactiveLogin()
  .then(credentials => {
    const client = new EventHubManagement(credentials, subscriptionId);
    return client.eventHubs.get(resourceGroupName, namespaceName, eventHubName);
  })
  .then(zones => console.dir(zones, { depth: null, colors: true }))
  .catch(err => console.log(err));

範例Samples

深入探索可在應用程式中使用的 Node.js 程式碼範例Explore more sample Node.js code you can use in your apps.