微服务2

1.introduction to springboot

sping beans, rest apis using springflux,  the swagger, Open-Api-based documentation, Springfox, data persistance, sql and nosql database

no-blocking synchronous api(Spring WebFlux) and message-based asynchronous srvices(spring cloud stream)

docker: start or stop our microservice landscape with a single command.

2.learning about Springboot

* spring, j2ee, springboot

3.convention for configuration and fat jar files

*convention over configuration

*war, fat jar

4.the magic @SpringbootApplication annotation:

* it enables the convention-based auto-configuration mechanism

* it enables component scanning

* it enables Application class isself to become a configuration class

5.component scanning

*autowiring

6.java-based configuration

* @configuration

7.begin with spring webflux

* springframework 5.0

* project reactor

* Spring WebFlux, which supports development of active, that is, non-blocking, http-clients and serivces.

* two different programming models:

  1. annotation-based imperative style

  2. a new function-based model by routers and handlers

* a fully http reactive client

* servlet 3.1 or higher

* netty

8.Code example of setting up rest service with Spring WebFlux

* starter dependencies that bring in specific features, togethre with the dependencies each feature requires

9.starter dependencies

* Gradle, implementation(org.springframework.root:spring-boot-starter-webflux)

* microservices started, springwebflux detected and configed

* netty, change to tomcat, exclude

10.property files

* .properties or yaml

11. sample Rest Controller

12.exploring SpringFox

* swagger inspects webflux and swagger-based annotation

13, Understanding Spring Data

* persisting data in various Database engine, ranging from relational(mysql), documental(MongoDB), key-value(Redis) and graphic database(Neo4j)

* Spring Data project is divided into different sub projects

* entity and repositories generalize how data is persisted and accessed from all varities of database.

Entity:

14. repositores

* ReactiveCRUDRepository, which enables reactive repositories and returns mono or flux.

* Mono and Flux are reactive streams that are capable of returning 0...1 or 0...n entities as they become available in the stream.

Understanding Spring Cloud Stream

* support for Apache Kafka and rabbitMQ

* the core concepts:message, publisher, subscriber, channel, binder

* the actual messaging system to be used is determined at the runtime. conventions can be overwritten, such as consumer groups, paritioning, persistance, durability, and error handling, such as retries and dead letter queue handling.

15. learning about docker

* build, dockerfile, Docker Compose, Docker image, Docker container

* users, processes, file systems, networking

* cgroup limits the amount of cpu and memory  that container is allowed to consume.\

* isolation

16. Summary

* WebFlux reactive, non-blocking REST services; netty and servlet 3.1;

* spring Data, Entities, and Repositories

* Spring cloud stream, streaming abstraction, RabbitMQ, Apache Kafka, Binder

* Docker, linux namespacies, cgroup, kubernates

发布了35 篇原创文章 · 获赞 0 · 访问量 2519

猜你喜欢

转载自blog.csdn.net/greywolf5/article/details/102872053
今日推荐