我正在尝试向 EventHub 发送一个字符串,并且我已经编写了以下代码:
private static void sendPOST(ValueChangeMessage valueChangeMessage) throws IOException {
try {
// final String namespaceName = ""; //sericebusnamespacename
// final String eventHubName = "";
// final String sasKeyName = "";
// final String sasKey = "";
// ConnectionStringBuilder connStr = new ConnectionStringBuilder(namespaceName, eventHubName, sasKeyName, sasKey);
byte[] payloadBytes = valueChangeMessage.data.get().toString().getBytes(StandardCharsets.UTF_8);
EventData sendEvent = new EventData(payloadBytes);
EventHubClient ehClient = EventHubClient.createFromConnectionStringSync(connStr.toString());
ehClient.sendSync(sendEvent);
}
catch (ServiceBusException ex) {
Logger.getLogger(CatChannel.class.getName()).log(Level.SEVERE, null, ex);
}
}
但是,每当我尝试从 netbeans 运行项目时,都会出现以下错误:
错误:无法访问消息
sendEvent = new EventData(payloadBytes);
org.apache.qpid.proton.message.Message 的类文件未找到
谁能告诉我可能是什么问题?