Interface JsonInputSource


public interface JsonInputSource
Provide data as a stream of JSON data

Shesmu will automatically use the standard streaming JSON unmarshalling protocol to simplify data extraction

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final JsonInputSource
    An input source that contains no values (while being valid JSON)
  • Method Summary

    Modifier and Type
    Method
    Description
    Get the stream.
    default Optional<Integer>
    ttl()
    Allow dynamically changing the TTL for this cache.
  • Field Details

    • EMPTY

      static final JsonInputSource EMPTY
      An input source that contains no values (while being valid JSON)
  • Method Details

    • fetch

      InputStream fetch() throws Exception
      Get the stream.

      Shesmu will manage caching the output, so this method will only be called when the cache needs to be refreshed.

      Returns:
      a stream of JSON data in the expected input format
      Throws:
      Exception - if an error accessing the data occurred the cache will serve stale data if an exception is thrown
    • ttl

      default Optional<Integer> ttl()
      Allow dynamically changing the TTL for this cache.

      This is only read when the cache has already expired and will be in effect until it expires.

      Returns:
      the new TTL, in minutes, or an empty optional to keep using the existing time