Class FunctionRecord<T>

java.lang.Object
org.apache.pulsar.functions.api.utils.FunctionRecord<T>
All Implemented Interfaces:
Record<T>

public class FunctionRecord<T> extends Object implements Record<T>
  • Constructor Details

    • FunctionRecord

      public FunctionRecord()
  • Method Details

    • from

      public static <T> FunctionRecord.FunctionRecordBuilder<T> from(Context context, org.apache.pulsar.client.api.Schema<T> schema)
      Creates a builder for a Record from a Function Context. The builder is initialized with the output topic from the Context and with the topicName, key, eventTime, properties, partitionId, partitionIndex and recordSequence from the Context input Record. It doesn't initialize a Message at the moment.
      Type Parameters:
      T - type of Record to build
      Parameters:
      context - a Function Context
      Returns:
      a Record builder initialised with values from the Function Context
    • getValue

      public T getValue()
      Description copied from interface: Record
      Retrieves the actual data of the record.
      Specified by:
      getValue in interface Record<T>
      Returns:
      The record data
    • getTopicName

      public Optional<String> getTopicName()
      Description copied from interface: Record
      If the record originated from a topic, report the topic name.
      Specified by:
      getTopicName in interface Record<T>
    • getDestinationTopic

      public Optional<String> getDestinationTopic()
      Description copied from interface: Record
      To support message routing on a per message basis.
      Specified by:
      getDestinationTopic in interface Record<T>
      Returns:
      The topic this message should be written to
    • getProperties

      public Map<String,String> getProperties()
      Description copied from interface: Record
      Retrieves user-defined properties attached to record.
      Specified by:
      getProperties in interface Record<T>
      Returns:
      Map of user-properties
    • getKey

      public Optional<String> getKey()
      Description copied from interface: Record
      Return a key if the key has one associated.
      Specified by:
      getKey in interface Record<T>
    • getSchema

      public org.apache.pulsar.client.api.Schema<T> getSchema()
      Specified by:
      getSchema in interface Record<T>
    • getEventTime

      public Optional<Long> getEventTime()
      Description copied from interface: Record
      Retrieves the event time of the record from the source.
      Specified by:
      getEventTime in interface Record<T>
      Returns:
      millis since epoch
    • getPartitionId

      public Optional<String> getPartitionId()
      Description copied from interface: Record
      Retrieves the partition information if any of the record.
      Specified by:
      getPartitionId in interface Record<T>
      Returns:
      The partition id where the
    • getPartitionIndex

      public Optional<Integer> getPartitionIndex()
      Description copied from interface: Record
      Retrieves the partition index if any of the record.
      Specified by:
      getPartitionIndex in interface Record<T>
      Returns:
      The partition index
    • getRecordSequence

      public Optional<Long> getRecordSequence()
      Description copied from interface: Record
      Retrieves the sequence of the record from a source partition.
      Specified by:
      getRecordSequence in interface Record<T>
      Returns:
      Sequence Id associated with the record