Time out when i access Azure Data Lake Gen2 in Azure Function with ADLS java sdk V12
@amamounelsayed đang làm issue này rồi.
Từ ngày 2/9/2020.
Đánh giá
Issue này chưa được đánh giá.
Mô tả
My function code as below:
package org.example;
import com.azure.core.http.rest.PagedIterable;
import com.azure.storage.common.StorageSharedKeyCredential;
import com.azure.storage.file.datalake.DataLakeFileSystemClient;
import com.azure.storage.file.datalake.DataLakeServiceClient;
import com.azure.storage.file.datalake.DataLakeServiceClientBuilder;
import com.azure.storage.file.datalake.models.ListPathsOptions;
import com.azure.storage.file.datalake.models.PathItem;
import com.microsoft.azure.functions.*;
import com.microsoft.azure.functions.annotation.AuthorizationLevel;
import com.microsoft.azure.functions.annotation.FunctionName;
import com.microsoft.azure.functions.annotation.HttpTrigger;
import java.util.Iterator;
import java.util.Optional;
/**
* Azure Functions with HTTP Trigger.
*/
public class Function {
public static String accountName = "***";
public static String accountKey = "***";
@FunctionName("HttpExample")
public HttpResponseMessage run(
@HttpTrigger(name = "req", methods = {HttpMethod.GET, HttpMethod.POST}, authLevel = AuthorizationLevel.ANONYMOUS) HttpRequestMessage<Optional<String>> request,
final ExecutionContext context) {
context.getLogger().info("Java HTTP trigger processed a request.+++++");
DataLakeServiceClient dataLakeServiceClient = GetDataLakeServiceClient(accountName, accountKey);
DataLakeFileSystemClient dataLakeFileSystemClient = GetFileSystem(dataLakeServiceClient);
String name = ListFilesInDirectory(dataLakeFileSystemClient, context);
if (name == null) {
return request.createResponseBuilder(HttpStatus.BAD_REQUEST).body("Please pass a name on the query string or in the request body").build();
} else {
return request.createResponseBuilder(HttpStatus.OK).body("List File Names:, " + name).build();
}
}
static public DataLakeServiceClient GetDataLakeServiceClient
(String accountName, String accountKey) {
StorageSharedKeyCredential sharedKeyCredential =
new StorageSharedKeyCredential(accountName, accountKey);
DataLakeServiceClientBuilder builder = new DataLakeServiceClientBuilder();
builder.credential(sharedKeyCredential);
builder.endpoint("https://" + accountName + ".dfs.core.windows.net");
return builder.buildClient();
}
static public DataLakeFileSystemClient GetFileSystem
(DataLakeServiceClient serviceClient) {
return serviceClient.getFileSystemClient("test");
}
static public String ListFilesInDirectory(DataLakeFileSystemClient fileSystemClient, ExecutionContext context) {
ListPathsOptions options = new ListPathsOptions();
options.setPath("");
fileSystemClient.listPaths().forEach( path -> context.getLogger().info(path.getName()));
return "ABC";
}
}
The java sdk link: https://azuresdkdocs.blob.core.windows.net/$web/java/azure-storage-file-datalake/12.0.0-preview.6/index.html
Based on my own troubleshooting, the code always hangs on the line :
fileSystemClient.listPaths().forEach( path -> context.getLogger().info(path.getName()));
No any responses here. I tested above code outside Azure function, let's say the Main method,everything works. So i think the code is fine. Anyone met the same issue as same as me. Is there any restrictions in the Azure Function to access ADLS gen2 with java sdk? Please help.
- Ngôn ngữ chính
- Java
- Star
- 46
- Fork
- 49
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Chuẩn bị môi trường
Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của Azure/azure-functions-java-library
-
[KafkaTrigger] Errors while retrieving function metadata using BindingName in cardinality=Cardinality.MANY modeCó thể đã có người làm @arnabnandy7 đã nhận 72 ngày trước. Đang mởarea:java-functions
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 48/100
Azure/azure-functions-java-library#229 · 1 bình luận ·
-
[BUG] Duplicated field "client" in BlockBlobClient, raises gson IllegalArgumentExceptionCó thể đã có người làm @arnabnandy7 đã nhận 72 ngày trước. Đang mởarea:java-functions
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
Azure/azure-functions-java-library#222 · 1 reaction ·
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
-
EventGridOutput missing 'connection' attribute to use Managed IdentitiesCó thể đã có người làm @arnabnandy7 đã nhận 72 ngày trước. Đang mởarea:java-functions
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 45/100
-
area:java-functions
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 25/100
Tất cả issue của Azure/azure-functions-java-library
Issue tương tự
-
status: waiting-for-triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 79/100
spring-projects/spring-ai#7206 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
area/cli
Độ khó 2/5 Nửa ngày Mức phù hợp với người mới 78/100
quarkusio/quarkus#57623 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
jhipster/prettier-java#1113 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
bug follow-up lane:backlog
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
Sanne/incus-spawn#1576 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Pasting code into a comment adds imports for the pasted codeCó thể đã có người làm @ravnskjaer đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 79/100
eclipse-jdt/eclipse.jdt.ui#3275 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày