Azure Core provides shared primitives, abstractions, and helpers for modern Java Azure SDK client libraries. These libraries follow the Azure SDK Design Guidelines for Java and can be easily identified by package names starting with com.azure
and module names starting with azure-
, e.g. com.azure.storage.blobs
would be found within the /sdk/storage/azure-storage-blob
directory. A more complete list of client libraries using Azure Core can be found here.
Azure Core allows client libraries to expose common functionality in a consistent fashion, so that once you learn how to use these APIs in one client library, you will know how to use them in other client libraries.
Getting started
Prerequisites
- Java Development Kit (JDK) with version 8 or above
Include the package
Typically, you won't need to install or depend on Azure Core, instead it will be transitively downloaded by your build tool when you depend on client libraries using it.
<dependency> <groupId>com.azure</groupId> <artifactId>azure-core</artifactId> <version>1.7.0</version> </dependency>
Key concepts
The key concepts of Azure Core (and therefore all Azure client libraries using Azure Core) include:
- Configuring service clients, e.g. configuring retries, logging, etc.
- Accessing HTTP response details (
Response<T>
). - Calling long running operations (
PollerFlux<T>
). - Paging and asynchronous streams (
ContinuablePagedFlux<T>
). - Exceptions for reporting errors from service requests in a consistent fashion.
- Abstractions for representing Azure SDK credentials.
These will be introduced by way of the examples presented below.
Examples
Accessing HTTP Response Details Using Response<T>
Service clients have methods that call Azure services, we refer call these methods service methods.
Service methods can return a shared Azure Core type Response<T>
. This type provides access to both the deserialized result of the service call and to the details of the HTTP response returned from the server.
HTTP pipelines with HttpPipeline
HttpPipeline
is a construct that contains a list of HttpPipelinePolicy
which are applied to a request sequentially to prepare it being sent by an HttpClient
.
Exception Hierarchy with AzureException
AzureException
is the root exception in the hierarchy used in Azure Core. Additional exceptions such as HttpRequestException
and HttpResponseException
are used to reduce the scope of exception reasons.
ContinuablePageFlux
manages sending an initial page request to a service and retrieving additional pages as the consumer requests more data until the consumer is done processing or all pages have been consumed.
Long Running Operations with PollerFlux<T>
PollerFlux
manages sending an initial service request and requesting processing updates on a fix interval until polling is cancelled or reaches a terminal state.
Next steps
Get started with some of the Azure libraries that are built using Azure Core.
Troubleshooting
If you encounter any bugs, please file issues via GitHub Issues or checkout StackOverflow for Azure Java SDK.
Enabling Logging
Azure SDKs for Java offer 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 wiki for guidance about enabling logging.
Contributing
If you would like to become an active contributor to this project please follow the instructions provided in Microsoft Azure Projects Contribution Guidelines.
git checkout -b my-new-feature
)git commit -am 'Add some feature'
)git push origin my-new-feature
)ncG1vNJzZmiZqqq%2Fpr%2FDpJuom6Njr627wWeaqKqVY8SqusOorqxmnprBcHDWnploopGrrnCt2a6pnmWTpL%2Bme5BnbmdoX6TDpr7VopywZaOquq6t0bJloaydoQ%3D%3D