public class UriConfigurationProvider extends AbstractConfigurationProvider implements LifecycleAware
A configuration provider that uses properties for specifying
configuration. The configurations follow the Java properties file syntax
rules specified at Properties.load(java.io.Reader)
. Every
configuration value specified in the properties is prefixed by an
Agent Name which helps isolate an individual agent's namespace.
Valid configurations must observe the following rules for every agent namespace.
Apart from the above required configuration values, each source, sink or channel can have its own set of arbitrary configuration as required by the implementation. Each of these configuration values are expressed by fully namespace qualified configuration keys. For example, the configuration property called capacity for a channel called ch1 for the agent named host1 with value 1000 will be expressed as: host1.channels.ch1.capacity = 1000.
Any information contained in the configuration file other than what pertains to the configured agents, sources, sinks and channels via the explicitly enumerated list of sources, sinks and channels per agent name are ignored by this provider. Moreover, if any of the required configuration values are not present in the configuration file for the configured entities, that entity and anything that depends upon it is considered invalid and consequently not configured. For example, if a channel is missing its type attribute, it is considered misconfigured. Also, any sources or sinks that depend upon this channel are also considered misconfigured and not initialized.
Example configuration file:
# # Flume Configuration # This file contains configuration for one Agent identified as host1. # host1.sources = avroSource thriftSource host1.channels = jdbcChannel host1.sinks = hdfsSink # avroSource configuration host1.sources.avroSource.type = org.apache.flume.source.AvroSource host1.sources.avroSource.runner.type = avro host1.sources.avroSource.runner.port = 11001 host1.sources.avroSource.channels = jdbcChannel host1.sources.avroSource.selector.type = replicating # thriftSource configuration host1.sources.thriftSource.type = org.apache.flume.source.ThriftSource host1.sources.thriftSource.runner.type = thrift host1.sources.thriftSource.runner.port = 12001 host1.sources.thriftSource.channels = jdbcChannel # jdbcChannel configuration host1.channels.jdbcChannel.type = jdbc host1.channels.jdbcChannel.jdbc.driver = com.mysql.jdbc.Driver host1.channels.jdbcChannel.jdbc.connect.url = http://localhost/flumedb host1.channels.jdbcChannel.jdbc.username = flume host1.channels.jdbcChannel.jdbc.password = flume # hdfsSink configuration host1.sinks.hdfsSink.type = hdfs host1.sinks.hdfsSink.hdfs.path = hdfs://localhost/ host1.sinks.hdfsSink.batchsize = 1000 host1.sinks.hdfsSink.runner.type = polling host1.sinks.hdfsSink.runner.polling.interval = 60
Properties.load(java.io.Reader)
Constructor and Description |
---|
UriConfigurationProvider(String agentName,
List<ConfigurationSource> sourceList,
String backupDirectory,
com.google.common.eventbus.EventBus eventBus,
int pollInterval) |
Modifier and Type | Method and Description |
---|---|
protected List<ConfigurationSource> |
getConfigurationSources() |
FlumeConfiguration |
getFlumeConfiguration() |
LifecycleState |
getLifecycleState()
Return the current state of the service or component.
|
void |
start()
Starts a service or component.
|
void |
stop()
Stops a service or component.
|
getAgentName, getConfiguration, toMap
public UriConfigurationProvider(String agentName, List<ConfigurationSource> sourceList, String backupDirectory, com.google.common.eventbus.EventBus eventBus, int pollInterval)
public void start()
LifecycleAware
Starts a service or component.
Implementations should determine the result of any start logic and effect
the return value of LifecycleAware.getLifecycleState()
accordingly.
start
in interface LifecycleAware
public void stop()
LifecycleAware
Stops a service or component.
Implementations should determine the result of any stop logic and effect
the return value of LifecycleAware.getLifecycleState()
accordingly.
stop
in interface LifecycleAware
public LifecycleState getLifecycleState()
LifecycleAware
Return the current state of the service or component.
getLifecycleState
in interface LifecycleAware
protected List<ConfigurationSource> getConfigurationSources()
public FlumeConfiguration getFlumeConfiguration()
getFlumeConfiguration
in class AbstractConfigurationProvider
Copyright © 2009-2022 Apache Software Foundation. All Rights Reserved.