简体   繁体   中英

npm install azure-event-hubs node.js

I tried to set up a node.js to simulate inputs to an azure Event Hub.

A) when i tried to install thru: 》npm install azure-event-hubs I got the warning message:

npm WARN deprecated crypto@0.0.3: This package is no longer supported. It's now a built-in Node module. If you've depended on crypto, you should switch to the one that's built-in.

Does this mean it is still working? just a warningmessage?

B) As my susbequent node.js script failed to accept the connection string i copied from my Azure Event Hub:

Code: var EventHubClient = require('azure-event-hubs').Client;

var connStr = 'Endpoint=sb://abrstrial.servicebus.windows.net/;SharedAccessKeyName=DeviceAccess;SharedAccessKey=Npb.....................

(errors)

E:\\Azure ML\\LAB04\\fitness_device\\node_modules\\azure-event-hubs\\lib\\client.js:92 throw new ArgumentError('Connection string doesn\\'t have EntityPath, or missing argument path'); ^ ArgumentError: Connection string doesn't have EntityPath, or missing argument path at Function.EventHubClient.fromConnectionString (E:\\Azure ML\\LAB04\\fitness_device\\node_modules\\azure-event-hubs\\lib\\client.js:92:11) at Object. (E:\\Azure ML\\LAB04\\fitness_device\\exercise.js:5:29) at Module._compile (module.js:570:32) at Object.Module._extensions..js (module.js:579:10) at Module.load (module.js:487:32) at tryModuleLoad (module.js:446:12) at Function.Module._load (module.js:438:3) at Module.runMain (module.js:604:10) at run (bootstrap_node.js:389:7) at startup (bootstrap_node.js:149:9) at bootstrap_node.js:504:3

Would it be due to different access method to Azure classic vs ARM portal? or it is a node.js compilation problem?

npm WARN deprecated crypto@0.0.3: This package is no longer supported. It's now a built-in Node module. If you've depended on crypto, you should switch to the one that's built-in.

This SDK is currently in preview, and is maintained by Microsoft employees and external contributors in their free time. For offical SDKs please see:

  • Event Hubs .NET SDK
  • Event Hubs Java SDK

E:\\Azure ML\\LAB04\\fitness_device\\node_modules\\azure-event-hubs\\lib\\client.js:92 throw new ArgumentError('Connection string doesn\\'t have EntityPath, or missing argument path');

The connection string will have the following format:

Endpoint=sb://[your event hub namespace].servicebus.windows.net/;SharedAccessKeyName=[your policy name];SharedAccessKey=[key];EntityPath=[your event hub entity name]

You can add an entity like this:

在此处输入图片说明

And then use this entity's connection string.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM