ark::pipeline::Envelope

Defined in header “ark/pipeline/envelope.hh”.


An envelope wraps messages that are published, recording a publish time, and supporting an abstraction to make it easier to serialize messages without knowing their type.

These are typically created automatically by the publisher.

Methods

  • Envelope(std::shared_ptr< const Type > payload, TimeType publish_time, uint64_t sequence_number, uint64_t publisher_identifier)
    Constructor. Initializes a new message against the given payload and with the specified capture time. Uses the default publisher identifier(0) if none is provided.

  • ~Envelope()
    Virtual destructor, for cleanup.

  • std::shared_ptr< const Type > payload()
    Returns the payload (raw message type).

  • const TimeType & publish_time()
    Returns the time that this object was published.

  • uint64_t publisher_sequence_number()
    Returns the sequence number of this message with respect to messages published from a single publisher. In other words, if publisher ID is identical between envelopes, you should see this number increment monotnically.

  • uint64_t publisher_identifier()
    Returns the identifier of the publisher that constructed this envelope. You should not depend on this value to be unique or consistent across executions.

  • serialization::JsonBlob to_json()
    Deserializes the given internal type as a JSON object. This will throw if the type isn’t serializable.

  • core::ByteBuffer to_bytes()
    Deserializes the internal type as a byte buffer, using binary serialization.

  • const std::type_info & message_type()
    Returns type identification information about the payload inside this envelope.

  • std::string message_type_name()
    Returns a string-form of the type identification information about the payload inside the envelope.

  • bool is_serializable()
    Returns true if the type that this envelopes contains identifies as being serializable.