Interface Entity

  • Functional Interface:
    This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

    @FunctionalInterface
    public interface Entity
    Access to message content (entity). Use cases:
    1. You do not need to access entity at all: do nothing (do not call methods on this interface)
    2. Need to process entity (no modifications): call filter(Function) method and just copy bytes you receive to your subscribers; or buffer them and publish them once finished
    3. Need to process entity (modifications): call filter(Function), process the bytes you receive and publish modified bytes

    WARNING: when buffering entity, make sure you do not run out of memory - it is strongly recommended to limit the number of bytes to be stored in memory. Once that is reached, you will need to offload to file system or other non-JVM heap storage.

    Document fully cases when entity is buffered, so developers understand that when using your security provider, and can assess impact - e.g. if we would validate signatures on uploaded video, a very big performance impact has to be expected

    • Method Detail

      • filter

        void filter​(Function<Flow.Publisher<ByteBuffer>,​Flow.Publisher<ByteBuffer>> filterFunction)
        Call this method if your security provider needs access to entity bytes. Your processor MUST provide the bytes back to us, as otherwise the entity would not be processed at all.
        Parameters:
        filterFunction - function that will get a publisher (that will publish bytes from external source for inbound request/outbound response or bytes from business logic for inbound response/outbound request) and that returns your publisher of modified/different bytes