Interface ConsumerResult


public interface ConsumerResult
Represents the result of a Consumer handling a message when run through the testkit.

Not for user extension, returned by the testkit.

Async effects are automatically resolved before results are returned.

  • Method Details

    • isConsumed

      boolean isConsumed()
      Returns:
      true if the effect was consumed (resulting from done() or ignore()), false otherwise
    • isProduced

      boolean isProduced()
      Returns:
      true if the effect produced a message, false otherwise
    • getProducedMessage

      Object getProducedMessage()
      Returns:
      The produced message payload, or throws if the effect was not a produce effect
    • getProducedMessage

      <T> T getProducedMessage(Class<T> messageClass)
      Returns the produced message payload, verifying its type.
      Type Parameters:
      T - the expected message type
      Parameters:
      messageClass - the expected message class
      Returns:
      the produced message cast to the expected type
      Throws:
      IllegalStateException - if the effect was not a produce effect or the message type does not match
    • hasMetadata

      boolean hasMetadata()
      Returns:
      true if the produce effect includes metadata, false otherwise. Throws if the effect was not a produce effect.
    • getMetadata

      akka.javasdk.Metadata getMetadata()
      Returns:
      The metadata from the produce effect, or throws if the effect was not a produce effect or has no metadata