minos.plugins.kong.discovery

Classes

KongDiscoveryClient

Kong Discovery Client class.

class KongDiscoveryClient[source]

Bases: DiscoveryClient, CircuitBreakerMixin

Kong Discovery Client class.

__init__(host=None, port=None, circuit_breaker_exceptions=tuple(), client=None, **kwargs)[source]
Parameters
async subscribe(host, port, name, endpoints, *args, **kwargs)[source]

Perform the subscription query.

Parameters
  • host (str) – The ip of the microservice to be subscribed.

  • port (int) – The port of the microservice to be subscribed.

  • name (str) – The name of the microservice to be subscribed.

  • endpoints (list[dict[str, str]]) – List of endpoints exposed by the microservice.

  • args – Additional positional arguments.

  • kwargs – Additional named arguments.

Returns

This method does not return anything.

Return type

Response

property already_destroyed: bool

Already Destroy getter.

Returns

A boolean value.

property already_setup: bool

Already Setup getter.

Returns

A boolean value.

property circuit_breaker: aiomisc.circuit_breaker.CircuitBreaker

Get the circuit breaker.

Returns

A CircuitBreaker instance.

property circuit_breaker_exceptions: tuple[type[Exception]]

Get the circuit breaker exceptions.

Returns

A tuple of Exception types.

async destroy()

Destroy miscellaneous repository things.

Returns

This method does not return anything.

Return type

None

classmethod from_config(config=None, **kwargs)

Build a new instance from config.

Parameters
  • config (Optional[Union[Config, Path]]) – Config instance. If None is provided, default config is chosen.

  • kwargs – Additional named arguments.

Returns

A instance of the called class.

Return type

S

property is_circuit_breaker_broken: bool

Check if circuit breaker is passing.

Returns

A bool instance.

property is_circuit_breaker_passing: bool

Check if circuit breaker is passing.

Returns

A bool instance.

property is_circuit_breaker_recovering: bool

Check if circuit breaker is passing.

Returns

A bool instance.

property route: str

Get the full http route to the discovery.

Returns

An str value.

async setup()

Setup miscellaneous repository things.

Returns

This method does not return anything.

Return type

None

async unsubscribe(name, *args, **kwargs)[source]

Perform the unsubscription query.

Parameters
  • name (str) – The name of the microservice to be unsubscribed.

  • args – Additional positional arguments.

  • kwargs – Additional named arguments.

Returns

This method does not return anything.

Return type

Response

async with_circuit_breaker(fn)

Execute the given function with circuit breaker.

Parameters

fn (Callable[[], Union[Awaitable[R], R]]) – The function to be executed.

Returns

The return of the given function.

Return type

R