我正在尝试向队列发送消息。我创建了以下功能来创建SAS连接
def configureSASAuthentication (namespace: String, sasKeyName: String, sasKey: String, serviceBusRootUri: String): ServiceBusContract = {
val config = ServiceBusConfiguration.configureWithSASAuthentication(namespace, sasKeyName, sasKey, serviceBusRootUri)
val service: ServiceBusContract = ServiceBusService.create(config)
return service
}
我不确定我需要导入哪些包。我得到以下错误:
error: not found: type ServiceBusContract
error: not found: value ServiceBusConfiguration
error: not found: type ServiceBusContract
error: not found: value ServiceBusService
您需要导入Azure服务总线类。假设你已经将库添加到你的项目中,你应该通过以下方式获得它们:
import com.azure.messaging.servicebus.*;
当然,您应该导入Azure消息服务总线和Azure核心。如果你还没有,你可以在你的build.sbt中添加以下依赖项:
"com.azure" % "azure-core" % "1.13.0",
"com.azure" % "azure-messaging-servicebus" % "7.0.2"