Skip to content

Instantly share code, notes, and snippets.

//
// Rest client for Foo service
//
public interface FooClient {
/**
* @return a {@link Mono} upon subscription it sends request to retrieve Foo and once response
* is received it emits the retrieved Foo.
*/
Mono<Foo> getFoo();

Long Running Operations

PollerFlux Design

PollerFlux is the client side abstraction to interact with server side Long Running Operations (LRO). It is a Flux to which multiple subscribers interested in the LRO events can subscribe.

This page describes internals of PollerFlux and how to create PollerFlux for an LRO.

The work that PollerFlux doing is two stage execution. First stage is LRO initiation and second stage is LRO Poll Loop. Following figure shows PollerFlux instance with 3 subscriptions.

// ---------------------------------------------------------------------------------------------
// PublicMethod
@Override
public Mono<ResourceResponse<Database>> deleteDatabase(String databaseLink, RequestOptions options) {
    return Mono.defer(new Supplier<Mono<ResourceResponse<Database>>>() {
        @Override
        public Mono<ResourceResponse<Database>> get() {
            DocumentClientRetryPolicy retryPolicyInstance = resetSessionTokenRetryPolicy.getRequestPolicy();
package com.azure.core.http.okhttp;
import com.azure.core.http.HttpClient;
import com.azure.core.http.HttpHeader;
import com.azure.core.http.HttpHeaders;
import com.azure.core.http.HttpMethod;
import com.azure.core.http.HttpRequest;
import com.azure.core.http.HttpResponse;
import com.azure.core.util.logging.ClientLogger;

@JonathanGiles, @srnagar, @alzimmermsft, and I were having some discussion on restricting users from instantiating a category of model classes. This writeup summarizes the discussion so far and the proposal.

The general pattern we follow across client SDK is:

  1. The client classes are in com.azure.<service> package.
  2. The model classes are in com.azure.<service>.models package.

There are cases wherein we want to hide specific methods in models from the user, for example,

  1. Hiding constructor and certain setters of the model.

The general pattern we follow across client SDK is:

  1. The client classes are in com.azure.<service> package.
  2. The model classes are in com.azure.<service>.models package.

There are cases wherein we want to hide specific methods in models from the user, for example,

  1. Hiding constructor and certain setters of the model.
  2. Entirely immutable models.
  3. Hiding a subset of getters.

Task_1: metric, anomalies and anomaly detection tuning

concept:

Screen Shot 2020-10-18 at 3 35 39 PM

action:

  1. Get the metric with the name "cost" from the data feed and - print its id.
  2. For the "cost" metric, gets the anomaly detection configuration with the name "Default" - print its name, id, and existing condition applied for the whole time-series.

HttpClient usage:

HttpClient httpClient = HttpClient.createDefault();

CancellationToken cancellationToken = new CancellationToken();

// request_1
HttpRequest getRequest = new HttpRequest(HttpMethod.GET, "https://httpbin.org/get");

Pipeline execution callstack and Chains

final HttpPipelineBuilder pipelineBuilder = new HttpPipelineBuilder();
// Set Policies
pipelineBuilder.policies(
    new HttpPipelinePolicy() { // policy0
         @Override
         public void process(HttpPipelinePolicyChain chain0) {
            chain0.processNextPolicy(chain0.getRequest(), new HttpCallback() {

azure-core-rest and core modules:

azure-core-modules

azure-core azure-core-types