Class LocalAzkarraStreamsService
- java.lang.Object
-
- io.streamthoughts.azkarra.runtime.service.LocalAzkarraStreamsService
-
- All Implemented Interfaces:
AzkarraStreamsService
public class LocalAzkarraStreamsService extends Object implements AzkarraStreamsService
The defaultAzkarraStreamsService
implementations.
-
-
Constructor Summary
Constructors Constructor Description LocalAzkarraStreamsService(AzkarraContext context, RemoteQueryClient remoteQueryClient)
Creates a newLocalAzkarraStreamsService
instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addNewEnvironment(String name, Conf conf)
Adds a new environment to this application.void
deleteStreams(String applicationId)
Deletes the streams instance for the specified streams application.Set<Environment>
getAllEnvironments()
Gets all existing streams environments.Collection<String>
getAllStreams()
Returns the list of all running streams applications.Conf
getContextConfig()
KafkaStreamsContainer
getStreamsById(String applicationId)
Returns theKafkaStreamsContainer
for the specified streams application.Conf
getStreamsConfigById(String applicationId)
Returns theConf
for the specified streams application.ConsumerGroupOffsets
getStreamsConsumerOffsetsById(String applicationId)
Gets the topic/partitions offsets for the specified streams application.Set<StreamsServerInfo>
getStreamsInstancesById(String applicationId)
Gets all local and remote streams instances for the specified streams application.Set<MetricGroup>
getStreamsMetricsById(String applicationId)
Gets all metrics for the specified streams application.Set<MetricGroup>
getStreamsMetricsById(String applicationId, Predicate<Tuple<String,Metric>> filter)
Gets metrics for the specified streams application matching a predicate.StreamsStatus
getStreamsStatusById(String applicationId)
Returns the status for the specified streams application.StreamsTopologyGraph
getStreamsTopologyById(String applicationId)
Returns theStreamsTopologyGraph
for the specified streams application.Set<TopologyDescriptor>
getTopologyProviders()
Gets all topologies available locally.<K,V>
QueryResult<K,V>query(String applicationId, Query<K,V> query, QueryParams parameters, Queried options)
Executes an interactive query for the specified streams application.void
restartStreams(String applicationId)
Restarts the streams instance for the specified streams application.ApplicationId
startStreamsTopology(String topologyType, String topologyVersion, String env, Executed executed)
Creates and starts a new streams job for the specified topology into the specified environment.void
stopStreams(String applicationId, boolean cleanUp)
Stops the streams instance for the specified streams application.
-
-
-
Constructor Detail
-
LocalAzkarraStreamsService
public LocalAzkarraStreamsService(AzkarraContext context, RemoteQueryClient remoteQueryClient)
Creates a newLocalAzkarraStreamsService
instance.- Parameters:
context
- theAzkarraContext
instance.context
- theRemoteQueryClient
instance.
-
-
Method Detail
-
getAllStreams
public Collection<String> getAllStreams()
Returns the list of all running streams applications.- Specified by:
getAllStreams
in interfaceAzkarraStreamsService
- Returns:
- a list of string ids.
- See Also:
StreamsConfig.APPLICATION_ID_CONFIG
-
getStreamsConfigById
public Conf getStreamsConfigById(String applicationId)
Returns theConf
for the specified streams application.- Specified by:
getStreamsConfigById
in interfaceAzkarraStreamsService
- Parameters:
applicationId
- the streams application id.- Returns:
- a
Optional
ofConf
.
-
getStreamsById
public KafkaStreamsContainer getStreamsById(String applicationId)
Returns theKafkaStreamsContainer
for the specified streams application.- Specified by:
getStreamsById
in interfaceAzkarraStreamsService
- Parameters:
applicationId
- the streams application id.- Returns:
- a
KafkaStreamsContainer
instance.
-
getStreamsStatusById
public StreamsStatus getStreamsStatusById(String applicationId)
Returns the status for the specified streams application.- Specified by:
getStreamsStatusById
in interfaceAzkarraStreamsService
- Parameters:
applicationId
- the streams application id.- Returns:
- a
StreamsStatus
instance.
-
getStreamsTopologyById
public StreamsTopologyGraph getStreamsTopologyById(String applicationId)
Returns theStreamsTopologyGraph
for the specified streams application.- Specified by:
getStreamsTopologyById
in interfaceAzkarraStreamsService
- Parameters:
applicationId
- the streams application id.- Returns:
- a
StreamsTopologyGraph
instance.
-
startStreamsTopology
public ApplicationId startStreamsTopology(String topologyType, String topologyVersion, String env, Executed executed)
Creates and starts a new streams job for the specified topology into the specified environment.- Specified by:
startStreamsTopology
in interfaceAzkarraStreamsService
- Parameters:
topologyType
- the topology type.topologyVersion
- the topology topologyVersion.env
- the environment name.executed
- theExecuted
instance.- Returns:
- the streams application.id
-
getTopologyProviders
public Set<TopologyDescriptor> getTopologyProviders()
Gets all topologies available locally.- Specified by:
getTopologyProviders
in interfaceAzkarraStreamsService
- Returns:
- a set of
TopologyDescriptor
instance.
-
getStreamsMetricsById
public Set<MetricGroup> getStreamsMetricsById(String applicationId)
Gets all metrics for the specified streams application.- Specified by:
getStreamsMetricsById
in interfaceAzkarraStreamsService
- Parameters:
applicationId
- the streams application id.- Returns:
- a set of
MetricGroup
instance.
-
getStreamsMetricsById
public Set<MetricGroup> getStreamsMetricsById(String applicationId, Predicate<Tuple<String,Metric>> filter)
Gets metrics for the specified streams application matching a predicate.- Specified by:
getStreamsMetricsById
in interfaceAzkarraStreamsService
- Parameters:
applicationId
- the streams application id.filter
- thePredicate
to be used for filteringMetric
.- Returns:
- a set of
MetricGroup
instance.
-
getStreamsConsumerOffsetsById
public ConsumerGroupOffsets getStreamsConsumerOffsetsById(String applicationId)
Gets the topic/partitions offsets for the specified streams application.- Specified by:
getStreamsConsumerOffsetsById
in interfaceAzkarraStreamsService
- Parameters:
applicationId
- the streams application id.- Returns:
- the
ConsumerGroupOffsets
.
-
getContextConfig
public Conf getContextConfig()
- Specified by:
getContextConfig
in interfaceAzkarraStreamsService
-
getAllEnvironments
public Set<Environment> getAllEnvironments()
Gets all existing streams environments.- Specified by:
getAllEnvironments
in interfaceAzkarraStreamsService
- Returns:
- a set of
Environment
instance.
-
addNewEnvironment
public void addNewEnvironment(String name, Conf conf)
Adds a new environment to this application.- Specified by:
addNewEnvironment
in interfaceAzkarraStreamsService
- Parameters:
name
- the environment name.conf
- the environment configuration.
-
getStreamsInstancesById
public Set<StreamsServerInfo> getStreamsInstancesById(String applicationId)
Gets all local and remote streams instances for the specified streams application.- Specified by:
getStreamsInstancesById
in interfaceAzkarraStreamsService
- Parameters:
applicationId
- the streams application id.- Returns:
- the set of
StreamsServerInfo
instances.
-
stopStreams
public void stopStreams(String applicationId, boolean cleanUp)
Stops the streams instance for the specified streams application.- Specified by:
stopStreams
in interfaceAzkarraStreamsService
- Parameters:
applicationId
- the streams application id.cleanUp
- the flag to indicate if the local streams states should be cleaned up.
-
restartStreams
public void restartStreams(String applicationId)
Restarts the streams instance for the specified streams application.- Specified by:
restartStreams
in interfaceAzkarraStreamsService
- Parameters:
applicationId
- the streams application id.
-
deleteStreams
public void deleteStreams(String applicationId)
Deletes the streams instance for the specified streams application.- Specified by:
deleteStreams
in interfaceAzkarraStreamsService
- Parameters:
applicationId
- the streams application id.
-
query
public <K,V> QueryResult<K,V> query(String applicationId, Query<K,V> query, QueryParams parameters, Queried options)
Executes an interactive query for the specified streams application.- Specified by:
query
in interfaceAzkarraStreamsService
- Parameters:
applicationId
- the streams application id.query
- theQuery
instance.parameters
- the query parameters.options
- the query execution options.- Returns:
- the
QueryResult
instance.
-
-