Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add resource searching sample description #17615

Merged
merged 7 commits into from
Nov 19, 2020
Merged
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions sdk/spring/azure-spring-boot-starter-storage/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,21 @@ private final BlobServiceAsyncClient blobServiceAsyncClient = blobServiceClientB

```

#### Search for resources
You can use implementation class `AzureStorageResourcePatternResolver` of `ResourcePatternResolver` to search resource, it supports `blob` or `file` type.
* Create pattern resolver object, if only one storage type resource used, please call the corresponding constructor.
moarychan marked this conversation as resolved.
Show resolved Hide resolved
* Pattern search, the **searchPattern** should start with `azure-blob://` or `azure-file://`. Such as `azure-blob://*/*`, it means list all blobs in all containers; `azure-blob://demo-container/**`, it means list all blobs in the demo-container container, including any sub-folder.
* Location search, the **searchLocation** should start with `azure-blob://` or `azure-file://`, the remaining file path should exist, otherwise an exception will be thrown.

```java
AzureStorageResourcePatternResolver storageResourcePatternResolver = new AzureStorageResourcePatternResolver(blobServiceClientBuilder.buildClient());
moarychan marked this conversation as resolved.
Show resolved Hide resolved
Resource[] resources = storageResourcePatternResolver.getResources(searchPattern);
Resource resource = storageResourcePatternResolver.getResource(searchLocation);
```

#### Multipart upload
Files larger than 4 MiB will be uploaded to Azure Storage in parallel. Learn more at [Upload in parallel][storage-blob-scalable-app-upload-files].
moarychan marked this conversation as resolved.
Show resolved Hide resolved

## Troubleshooting
### Enable client logging
Azure SDKs for Java offers a consistent logging story to help aid in troubleshooting application errors and expedite their resolution. The logs produced will capture the flow of an application before reaching the terminal state to help locate the root issue. View the [logging][logging] wiki for guidance about enabling logging.
Expand Down Expand Up @@ -115,3 +130,5 @@ Please follow [instructions here][contributing_md] to build from source or contr
[other_operation]: https://docs.spring.io/spring/docs/current/spring-framework-reference/core.html#resources
[jdk_link]: https://docs.microsoft.com/java/azure/jdk/?view=azure-java-stable

[storage-blob-scalable-app-upload-files]: https://docs.microsoft.com/azure/storage/blobs/storage-blob-scalable-app-upload-files