t

cloudflow.streamlets

ConfigParameter

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:

Each of these pre-defined parameters uses one of the following validation types:

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))
  }
}
Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. ConfigParameter
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Abstract Value Members

  1. abstract def key: String

    The key that can be used to get a value for this configuration parameter from the streamletConfig

  2. 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

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  5. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... ) @native()
  6. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  7. def equals(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  8. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  9. final def getClass(): Class[_]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  10. def getKey(): String
  11. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  12. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  13. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  14. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  15. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  16. final def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
    AnyRef
  17. def toString(): String
    Definition Classes
    AnyRef → Any
  18. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  19. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  20. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... ) @native()

Inherited from AnyRef

Inherited from Any

Ungrouped