LocationService

csw.location.api.scaladsl.LocationService

A LocationService interface to manage registrations. All operations are non-blocking.

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
Known subtypes

Members list

Value members

Abstract methods

Resolves the location for a connection from the local cache

Resolves the location for a connection from the local cache

Value parameters

connection

a connection to resolve to with its registered location

Attributes

Returns

a future which completes with the resolved location if found or None otherwise. It can fail with csw.location.api.exceptions.RegistrationListingFailed.

Lists all locations registered

Lists all locations registered

Attributes

Returns

a future which completes with a List of all registered locations or can fail with csw.location.api.exceptions.RegistrationListingFailed

Filters all locations registered based on a component type

Filters all locations registered based on a component type

Value parameters

componentType

list components of this componentType

Attributes

Returns

a future which completes with filtered locations or can fail with csw.location.api.exceptions.RegistrationListingFailed

Filters all locations registered based on a hostname

Filters all locations registered based on a hostname

Value parameters

hostname

list components running on this hostname

Attributes

Returns

a future which completes with filtered locations or can fail with csw.location.api.exceptions.RegistrationListingFailed

Filters all locations registered based on a connection type

Filters all locations registered based on a connection type

Value parameters

connectionType

list components of this connectionType

Attributes

Returns

a future which completes with filtered locations or can fail with csw.location.api.exceptions.RegistrationListingFailed

Filters all locations registered based on a prefix.

Filters all locations registered based on a prefix.

Value parameters

prefix

list components by this prefix

Attributes

Returns

a future which completes with filtered locations or can fail with csw.location.api.exceptions.RegistrationListingFailed

Note

all locations having subsystem prefix that starts with the given prefix value will be listed.

Registers a connection -> location in cluster

Registers a connection -> location in cluster

Value parameters

registration

the Registration holding connection and it's corresponding location to register with LocationService

Attributes

Returns

a future which completes with Registration result or can fail with csw.location.api.exceptions.RegistrationFailed or csw.location.api.exceptions.OtherLocationIsRegistered

Resolves the location for a connection from the local cache, if not found waits for the event to arrive within specified time limit. Returns None if both fail.

Resolves the location for a connection from the local cache, if not found waits for the event to arrive within specified time limit. Returns None if both fail.

Type parameters

L

the concrete Location type returned once the connection is resolved

Value parameters

connection

a connection to resolve to with its registered location

within

max wait time for event to arrive

Attributes

Returns

a future which completes with the resolved location if found or None otherwise. It can fail with csw.location.api.exceptions.RegistrationListingFailed.

Subscribe to tracking events for a connection by providing a callback For each event the callback is invoked. Use this method if you do not want to handle materialization and happy with a side-effecting callback instead.

Subscribe to tracking events for a connection by providing a callback For each event the callback is invoked. Use this method if you do not want to handle materialization and happy with a side-effecting callback instead.

Value parameters

callback

the callback function of type TrackingEvent => Unit which gets executed on receiving any TrackingEvent

connection

the connection that is to be tracked

Attributes

Returns

a killswitch which can be shutdown to unsubscribe the consumer

Note

Callbacks are not thread-safe on the JVM. If you are doing side effects/mutations inside the callback, you should ensure that it is done in a thread-safe way inside an actor.

Tracks the connection and send events for modification or removal of its location

Tracks the connection and send events for modification or removal of its location

Value parameters

connection

the connection that is to be tracked

Attributes

Returns

A stream that emits events related to the connection. It can be cancelled using KillSwitch. This will stop giving events for earlier tracked connection

Unregisters the connection

Unregisters the connection

Value parameters

connection

an already registered connection

Attributes

Returns

a future which completes after un-registration happens successfully and fails otherwise with csw.location.api.exceptions.UnregistrationFailed

Note

this method is idempotent, which means multiple call to unregister the same connection will be no-op once successfully unregistered from location service

Unregisters all connections

Unregisters all connections

Attributes

Returns

a future which completes after all connections are unregistered successfully or fails otherwise with csw.location.api.exceptions.RegistrationListingFailed

Note

it is highly recommended to use this method for testing purpose only