Interface WindowContext


  • @Public
    @Stable
    public interface WindowContext
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      long getCounter​(java.lang.String key)
      Retrieve the counter value for the key.
      java.lang.String getFunctionId()
      The id of the function that we are executing.
      java.lang.String getFunctionName()
      The name of the function that we are executing.
      java.lang.String getFunctionVersion()
      The version of the function that we are executing.
      java.util.Collection<java.lang.String> getInputTopics()
      Get a list of all input topics.
      int getInstanceId()
      The id of the instance that invokes this function.
      org.slf4j.Logger getLogger()
      The logger object that can be used to log in a function.
      java.lang.String getNamespace()
      The namespace this function belongs to.
      int getNumInstances()
      Get the number of instances that invoke this function.
      java.lang.String getOutputSchemaType()
      Get output schema builtin type or custom class name.
      java.lang.String getOutputTopic()
      Get the output topic of the function.
      java.nio.ByteBuffer getState​(java.lang.String key)
      Retrieve the state value for the key.
      java.lang.String getTenant()
      The tenant this function belongs to.
      java.util.Map<java.lang.String,​java.lang.Object> getUserConfigMap()
      Get a map of all user-defined key/value configs for the function.
      java.util.Optional<java.lang.Object> getUserConfigValue​(java.lang.String key)
      Get any user-defined key/value.
      java.lang.Object getUserConfigValueOrDefault​(java.lang.String key, java.lang.Object defaultValue)
      Get any user-defined key/value or a default value if none is present.
      void incrCounter​(java.lang.String key, long amount)
      Increment the builtin distributed counter referred by key.
      <O> java.util.concurrent.CompletableFuture<java.lang.Void> publish​(java.lang.String topicName, O object)
      Publish an object to the topic using default schemas.
      <O> java.util.concurrent.CompletableFuture<java.lang.Void> publish​(java.lang.String topicName, O object, java.lang.String schemaOrSerdeClassName)
      Publish an object using serDe for serializing to the topic.
      void putState​(java.lang.String key, java.nio.ByteBuffer value)
      Update the state value for the key.
      void recordMetric​(java.lang.String metricName, double value)
      Record a user defined metric.
    • Method Detail

      • getTenant

        java.lang.String getTenant()
        The tenant this function belongs to.
        Returns:
        the tenant this function belongs to
      • getNamespace

        java.lang.String getNamespace()
        The namespace this function belongs to.
        Returns:
        the namespace this function belongs to
      • getFunctionName

        java.lang.String getFunctionName()
        The name of the function that we are executing.
        Returns:
        The Function name
      • getFunctionId

        java.lang.String getFunctionId()
        The id of the function that we are executing.
        Returns:
        The function id
      • getInstanceId

        int getInstanceId()
        The id of the instance that invokes this function.
        Returns:
        the instance id
      • getNumInstances

        int getNumInstances()
        Get the number of instances that invoke this function.
        Returns:
        the number of instances that invoke this function.
      • getFunctionVersion

        java.lang.String getFunctionVersion()
        The version of the function that we are executing.
        Returns:
        The version id
      • getInputTopics

        java.util.Collection<java.lang.String> getInputTopics()
        Get a list of all input topics.
        Returns:
        a list of all input topics
      • getOutputTopic

        java.lang.String getOutputTopic()
        Get the output topic of the function.
        Returns:
        output topic name
      • getOutputSchemaType

        java.lang.String getOutputSchemaType()
        Get output schema builtin type or custom class name.
        Returns:
        output schema builtin type or custom class name
      • getLogger

        org.slf4j.Logger getLogger()
        The logger object that can be used to log in a function.
        Returns:
        the logger object
      • incrCounter

        void incrCounter​(java.lang.String key,
                         long amount)
        Increment the builtin distributed counter referred by key.
        Parameters:
        key - The name of the key
        amount - The amount to be incremented
      • getCounter

        long getCounter​(java.lang.String key)
        Retrieve the counter value for the key.
        Parameters:
        key - name of the key
        Returns:
        the amount of the counter value for this key
      • putState

        void putState​(java.lang.String key,
                      java.nio.ByteBuffer value)
        Update the state value for the key.
        Parameters:
        key - name of the key
        value - state value of the key
      • getState

        java.nio.ByteBuffer getState​(java.lang.String key)
        Retrieve the state value for the key.
        Parameters:
        key - name of the key
        Returns:
        the state value for the key.
      • getUserConfigMap

        java.util.Map<java.lang.String,​java.lang.Object> getUserConfigMap()
        Get a map of all user-defined key/value configs for the function.
        Returns:
        The full map of user-defined config values
      • getUserConfigValue

        java.util.Optional<java.lang.Object> getUserConfigValue​(java.lang.String key)
        Get any user-defined key/value.
        Parameters:
        key - The key
        Returns:
        The Optional value specified by the user for that key.
      • getUserConfigValueOrDefault

        java.lang.Object getUserConfigValueOrDefault​(java.lang.String key,
                                                     java.lang.Object defaultValue)
        Get any user-defined key/value or a default value if none is present.
        Parameters:
        key -
        defaultValue -
        Returns:
        Either the user config value associated with a given key or a supplied default value
      • recordMetric

        void recordMetric​(java.lang.String metricName,
                          double value)
        Record a user defined metric.
        Parameters:
        metricName - The name of the metric
        value - The value of the metric
      • publish

        <O> java.util.concurrent.CompletableFuture<java.lang.Void> publish​(java.lang.String topicName,
                                                                           O object,
                                                                           java.lang.String schemaOrSerdeClassName)
        Publish an object using serDe for serializing to the topic.
        Parameters:
        topicName - The name of the topic for publishing
        object - The object that needs to be published
        schemaOrSerdeClassName - Either a builtin schema type (eg: "avro", "json", "protobuf") or the class name of the custom schema class
        Returns:
        A future that completes when the framework is done publishing the message
      • publish

        <O> java.util.concurrent.CompletableFuture<java.lang.Void> publish​(java.lang.String topicName,
                                                                           O object)
        Publish an object to the topic using default schemas.
        Parameters:
        topicName - The name of the topic for publishing
        object - The object that needs to be published
        Returns:
        A future that completes when the framework is done publishing the message