Interface MessageObserver

All Known Implementing Classes:
AbstractMessageObserver, BodyCollectingMessageObserver, Connection

public interface MessageObserver
A MessageObserver may be registered on a HTTP Message and will be called, when the message's body becomes fully known to Membrane.

A typical example of an interceptor using MessageObserver is the ExchangeStoreInterceptor, whose primary purpose is to write the message's body into permanent storage. As this requires reading the body, directly "streaming" the body from the HTTP client to the HTTP server (as described in AbstractBody) would not be possible. Instead, ExchangeStoreInterceptor registers a MessageObserver on the message. This MessageObserver will be called back once streaming has been completed and the messages' body is fully known. The MessageObserver will then write the body into permanent storage.

  • Method Summary

    Modifier and Type
    Method
    Description
    void
    bodyChunk(byte[] buffer, int offset, int length)
    Observes a piece of the body.
    void
    Observes a piece of the body.
    void
    Notification that the body has fully been received.
    void
     
  • Method Details

    • bodyRequested

      void bodyRequested(AbstractBody body)
    • bodyChunk

      void bodyChunk(Chunk chunk)
      Observes a piece of the body.
      Parameters:
      chunk -
    • bodyChunk

      void bodyChunk(byte[] buffer, int offset, int length)
      Observes a piece of the body. Note that the buffer content may change after the method completes.
    • bodyComplete

      void bodyComplete(AbstractBody body)
      Notification that the body has fully been received.

      Note that this event may run instantaneously (during the call to Message.addObserver(MessageObserver)), as the body may have already been fully received when registering the observer.

      This is the last event that will be fired on any MessageObserver.