我有一个azure函数,该函数根据诺言发出http请求,并得到响应;现在,我想将此响应发送到服务总线和其他事件中心(天蓝色功能由其他事件中心触发)。
函数说它在事件中心的情况下已经成功执行,但是没有事件被发送。
对于服务总线,我收到此错误apply(as.matrix(data[ , .SD, .SDcols = subset_of_columns]), 1, sd, na.rm = TRUE)
NamespaceConnectionString should not contain EntityPath.
预期的输出:成功执行;服务总线和事件中心上可用的数据可以接收。
实际输出:module.exports = async function (context, eventHubMessages) {
context.log(`JavaScript eventhub trigger function called for message array ${eventHubMessages}`);
var completeData = '';
eventHubMessages.forEach((message, index) => {
context.log(`Processed message ${message}`);
completeData = message;
});
var output = '';
const axios = require('axios');
try {
const response = await axios.post('http://fake-endpoint',
{ data-json : completeData
})
context.log(`statusCode: ${response.statusCode}`);
context.log(response.data);
output += response.data;
var time = new Date().toString();
context.log('Event Hub message created at: ', time);
context.bindings.outputEventHubMessage = out;
context.bindings.outputSbMsg = out;
context.done()
return response.data; // or return a custom object using properties from response
} catch (error) {
// If the promise rejects, an error will be thrown and caught here
context.done(error);
}
};
答案 0 :(得分:0)
如错误消息所述,您需要查看连接字符串并删除EntityPath变量。 This is included(如果您在查看特定主题或队列时复制连接字符串,而不是从主服务总线刀片复制它)。
Endpoint = sb:// {servicebus-name} .servicebus.windows.net /; SharedAccessKeyName = test-queue-sender; SharedAccessKey = {SharedAccessKey} =; EntityPath = test-queue ;
vs
Endpoint = sb:// {servicebus-name} .servicebus.windows.net /; SharedAccessKeyName = test-queue-sender; SharedAccessKey = {SharedAccessKey};