Quantcast
Channel: User Lalit Kale - Stack Overflow
Viewing all articles
Browse latest Browse all 30

Answer by Lalit Kale for Microservices: Service discovery/ circuit breaker for Event-driven architecture

$
0
0

I. circuit breaker and service discovery are patterns. When we say Pattern they can be implemented with any programming language. 'HTTP' protocol is for transfer of data.

circuit breaker can be implemented within Java. You can find many implementations (of course, with varying capabilities and interpretation of pattern) on github.

Some of the well-known, built for purpose implementations are :

  1. Hysterix from NetflixOSS For using Hysterix: You can follow Spring Guide - Spring Circuit Breaker

  2. Apache Polygene - which has example of JMX circuit breaker

  3. Resilience4j

II. About,

Given this event-driven nature, how can service-discovery and circuit breakers be achieved/ implemented, given that these are commonly applicable for services communicating via HTTP?

It seems you need bit more research on topic of Microservices interactions.There are two ways to which microservices interactions are possible. You have to choose one over the other. You can/should not mix both.

  1. Orchestration: An interaction style that has an intelligent controller that dispatches events to processes. Please note the word 'processes' which is representing business processes here. Orchestration style was preferred in old SOA implementations as well.

  2. Choreography: An interaction style that allows processes to subscribe to events and handle them independently or through integration with other processes without the need for a central controller.

These topics are greatly covered under Orchestration vs. Choreography

Need of Service Discovery:

With choreography, two or more microservices can coordinate their activities and processes to share information and value.

But, these microservices may not be aware of each other's existence i.e. There are no hard-coded or service references of dependency endpoints configured or coded into them. Why we do this, is for avoiding any kind of coupling between services. So, the question remains is how one service, if required will find another services' endpoint? This is where service discovery mechanism is used.

Another perspective is, with microservices deployment with containers etc, microservices endpoints will not be even tied to any hosts etc. [due to spin-up and spin-down of containers]. So, for this case as well, we need 'service discovery' mechanism.

So, In service discovery mechanism, a centralized service discovery tool helps services to register themselves and to discover other services via a DNS or HTTP interface.

Service discovery can be implemented with1. Server-side service discovery2. Client Side service discovery

Consul,etcd, zookeeper are some of the key-tools names within service discovery space.


Viewing all articles
Browse latest Browse all 30

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>