trait ConfigParameter extends AnyRef
Describes arguments that have to be supplied when deploying a Cloudflow application. Each streamlet in an application can require zero or more arguments. The configuration parameter contains information for the end user entering the values and logic to validate those values so they are entered correctly.
Streamlet developers can create their own configuration parameters by deriving from ConfigParameter, the parameter can use validation logic from a fixed set of types derived from ValidationType.
The developer can also re-use any of the following predefined configuration parameter types:
- IntegerConfigParameter
- StringConfigParameter
- DoubleConfigParameter
- BooleanConfigParameter
- RegExpConfigParameter
- DurationConfigParameter
- MemorySizeConfigParameter
Each of these pre-defined parameters uses one of the following validation types:
- BooleanValidationType
- IntegerValidationType
- DoubleValidationType
- RegexpValidationType
- DurationValidationType
- MemorySizeValidationType
Example of how to create a custom configuration parameter:
final case class MilitaryTimeParameter(key: String, defaultValue: Option[String] = None) extends ConfigParameter[String] { val description: String = "This parameter validates that the users enter the time in 24h format." val validation = RegexpValidation("^(0[0-9]|1[0-9]|2[0-3]|[0-9]):[0-5][0-9]$") def toDescriptor = ConfigParameterDescriptor(key,description,validation,defaultValue) }
Example on how to use a configuration parameter in a streamlet:
class RecordSumFlow extends AkkaStreamlet { val recordsInWindowParameter = IntegerConfigParameter("records-in-window","This value describes how many records of data should be processed together, default 65 KB", Some(64 * 1024)) override def configParameters = Set(recordsInWindowParameter) val inlet = AvroInlet[Metric]("metric") val outlet = AvroOutlet[SummedMetric]("summed-metric") val shape = StreamletShape.withInlets(inlet).withOutlets(outlet) def createLogic = new RunnableGraphStreamletLogic() { val recordsInWindow = streamletConfig.getInt(recordsInWindowParameter.key) def sumRecords(records: Seq[Metric]) : SummedMetric {....} def flow = FlowWithOffsetContext[Metric].grouped(recordsInWindow).map(sumRecords) def runnableGraph() = atLeastOnceSource(inlet).via(flow).to(atLeastOnceSink(outlet)) } }
- Alphabetic
- By Inheritance
- ConfigParameter
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Abstract Value Members
- abstract def key: String
The key that can be used to get a value for this configuration parameter from the streamletConfig
- abstract def toDescriptor: ConfigParameterDescriptor
Translates the parameter to a ConfigParameterDescriptor, it's included in the application descriptor to describe configuration parameter at application deployment time.
Concrete Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native()
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable])
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- def getKey(): String
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toString(): String
- Definition Classes
- AnyRef → Any
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()