Interface TaskConverter<T>

  • Type Parameters:
    T - type of objects stored.
    All Known Implementing Classes:
    RetryTaskConverter

    public interface TaskConverter<T>
    Proxy-specific interface for converting data into and from queues, this potentially allows us to support other converting mechanisms in the future.
    Author:
    [email protected]
    • Method Detail

      • fromBytes

        T fromBytes​(@Nonnull
                    byte[] bytes)
             throws IOException
        De-serializes an object from a byte array.
        Returns:
        de-serialized object.
        Throws:
        IOException
      • serializeToStream

        void serializeToStream​(@Nonnull
                               T value,
                               @Nonnull
                               OutputStream bytes)
                        throws IOException
        Serializes value to bytes written to the specified stream.
        Parameters:
        value - value to serialize.
        bytes - output stream to write a byte[] to.
        Throws:
        IOException
      • getWeight

        @Nullable
        Integer getWeight​(@Nonnull
                          byte[] bytes)
        Attempts to retrieve task weight from a byte[], without de-serializing the object, if at all possible.
        Returns:
        task weight or null if not applicable.