Skip to content

Commit

Permalink
clean for short presentation
Browse files Browse the repository at this point in the history
  • Loading branch information
szimano committed Jun 21, 2015
1 parent 7f64cda commit b50827e
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 69 deletions.
45 changes: 21 additions & 24 deletions plan.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,32 +2,29 @@ https://gist.github.com/wybczu/45cd669120566083cb6a

0) welcome and slides

1) ingredients
1) ingredients/order

* We got accurest API
* Implement ORDER
* show wiremocks for słodeo/wodeo/chmieleo/drożdżeo
* make calls to via ServiceRestClient ^^
* hystrix
* return state
>> show prezentatr http://apps.devoxx:9093/
* show API with swagger
* start calling
* show changes in bars
* show hystrix console http://apps.devoxx:8090/hystrix-dashboard/
* Show accurest API
* Show model
* Show IngredientsProperties
* Show ExternalServicesStub
* Show Controller
* Show IngredientsWarehouse
* Code IngredientsAggregator
* Show on przentatr
* show hystrix dashboard
* show grafana with metrics
* show seyrene
* show slack #alerts
* show API swagger
* show alerts on phone

2) dojrzewatr

* Show dojrzewatr accurest API
* Add dependency to microservice.json
* tell about automagical stubs in DEV/tests
* call with ServiceRestClient
* hystrix async retry
* dojrzewatr accurest API
* show/tell? about stubs from repo
* add to microservices.json
* call dojrzewatr (code)
* call from prezentatr
* show logstash -> CorrelationID sequence

3) metrics

* gauge for ingredients
* show grafana http://grafana.devoxx/#/dashboard/elasticsearch/Brewery
* add alert on Seyrene (water > 5000)
* show full path
* show kibana with correlation id
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,8 @@
import com.nurkiewicz.asyncretry.RetryExecutor;
import com.ofg.infrastructure.web.resttemplate.fluent.ServiceRestClient;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import pl.devoxx.aggregatr.aggregation.model.IngredientType;
import pl.devoxx.aggregatr.aggregation.model.Ingredients;
import pl.devoxx.aggregatr.aggregation.model.Version;

import static com.netflix.hystrix.HystrixCommand.Setter.withGroupKey;
import static com.netflix.hystrix.HystrixCommandGroupKey.Factory.asKey;

@Slf4j
class DojrzewatrUpdater {
Expand Down Expand Up @@ -47,14 +42,6 @@ private boolean ingredientsMatchTheThreshold(Ingredients ingredients) {
}

private void notifyDojrzewatr(Ingredients ingredients) {
serviceRestClient.forService("dojrzewatr")
.retryUsing(retryExecutor)
.post()
.withCircuitBreaker(withGroupKey(asKey("dojrzewatr_notification")))
.onUrl("/brew")
.body(ingredients)
.withHeaders().contentType(Version.DOJRZEWATR_V1)
.andExecuteFor()
.ignoringResponseAsync();
//TODO fill me in
}
}
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
package pl.devoxx.aggregatr.aggregation;

import com.google.common.cache.Cache;
import com.google.common.cache.CacheBuilder;
import org.springframework.stereotype.Service;
import pl.devoxx.aggregatr.aggregation.model.Ingredient;
import pl.devoxx.aggregatr.aggregation.model.IngredientType;
import pl.devoxx.aggregatr.aggregation.model.Ingredients;

import java.util.Arrays;
import java.util.Map;
import java.util.Optional;
import java.util.concurrent.ConcurrentHashMap;
import java.util.stream.Collectors;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,31 +63,12 @@ private String getMetricName(IngredientType ingredientType) {
}

Ingredients fetchIngredients(Order order) {
List<ListenableFuture<Ingredient>> futures = ingredientsProperties
.getListOfServiceNames(order)
.stream()
.map(this::harvest)
.collect(Collectors.toList());
ListenableFuture<List<Ingredient>> allDoneFuture = Futures.allAsList(futures);
List<Ingredient> allIngredients = Futures.getUnchecked(allDoneFuture);
allIngredients.stream()
.filter((ingredient -> ingredient != null))
.forEach(ingredientWarehouse::addIngredient);
Ingredients ingredients = ingredientWarehouse.getCurrentState();
return dojrzewatrUpdater.updateIfLimitReached(ingredients);
// TODO fill me
return new Ingredients();
}

ListenableFuture<Ingredient> harvest(String service) {
return serviceRestClient.forExternalService()
.retryUsing(retryExecutor)
.get()
.withCircuitBreaker(withGroupKey(asKey(service)), () -> {
log.error("Can't connect to {}", service);
return null;
})
.onUrl(ingredientsProperties.getRootUrl() + "/" + service)
.andExecuteFor()
.anObject()
.ofTypeAsync(Ingredient.class);
// TODO fill me
return null;
}
}
8 changes: 7 additions & 1 deletion src/main/resources/application.yaml
Original file line number Diff line number Diff line change
@@ -1,2 +1,8 @@
metrics.path.app: aggregatr
rest.api.urls.to.list: .*ingredients.*
rest.api.urls.to.list: .*ingredients.*
stubrunner:
#skip-local-repo: false
#work-offline: true
use-microservice-definitions: true
stubs:
repository.root: "http://54.171.73.213:8081/nexus/content/repositories/releases/"
3 changes: 0 additions & 3 deletions src/main/resources/microservice.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@
"pl": {
"this": "pl/devoxx/aggregatr",
"dependencies" : {
"dojrzewatr" : {
"path" : "pl/devoxx/dojrzewatr"
}
}
}
}

0 comments on commit b50827e

Please sign in to comment.