我正在尝试为文件上传设置Alpakka S3。这是我的配置:
alpakka s3依赖项:
...
"com.lightbend.akka" %% "akka-stream-alpakka-s3" % "0.20"
...
这里是application.conf
:
akka.stream.alpakka.s3 {
buffer = "memory"
proxy {
host = ""
port = 8000
secure = true
}
aws {
credentials {
provider = default
}
}
path-style-access = false
list-bucket-api-version = 2
}
文件上传代码示例:
private val awsCredentials = new BasicAWSCredentials("my_key", "my_secret_key")
private val awsCredentialsProvider = new AWSStaticCredentialsProvider(awsCredentials)
private val regionProvider = new AwsRegionProvider { def getRegion: String = "us-east-1" }
private val settings = new S3Settings(MemoryBufferType, None, awsCredentialsProvider, regionProvider, false, None, ListBucketVersion2)
private val s3Client = new S3Client(settings)(system, materializer)
val fileSource = Source.fromFuture(ByteString("ololo blabla bla"))
val fileName = UUID.randomUUID().toString
val s3Sink: Sink[ByteString, Future[MultipartUploadResult]] = s3Client.multipartUpload("my_basket", fileName)
fileSource.runWith(s3Sink)
.map {
result => println(s"${result.location}")
} recover {
case ex: Exception => println(s"$ex")
}
运行此代码时,我得到:
javax.net.ssl.SSLHandshakeException: General SSLEngine problem
可能是什么原因?
答案 0 :(得分:1)
对于包含点的存储桶名称,出现证书问题。
您可以切换到
akka.stream.alpakka.s3.path-style-access = true
摆脱这一点。
我们正在考虑将其设置为默认值:https://github.com/akka/alpakka/issues/1152