src/main/java/com/hedera/hashgraph/identity/hcs/MessageListener.java
/**
   * Handles incoming messages from the topic on a mirror node.
   *
   * @param response Response message coming from the mirror node for the topic.
   * @param receiver Consumer of the result message.
   */
Handles incoming messages from the topic on a mirror node.
@param response Response message coming from the mirror node for the topic.
@param receiver Consumer of the result message.
Handles incoming messages from the topic on a mirror node . @param response Response message coming from the mirror node for the topic . @param receiver Consumer of the result message .
protected void handleResponse(final TopicMessage response,
                                final Consumer<MessageEnvelope<T>> receiver) {
    if (filters != null) {
      for (Predicate<TopicMessage> filter : filters) {
        if (!filter.test(response)) {
          reportInvalidMessage(response, "Message was rejected by external filter");
          return;
        }
      }
    }
    MessageEnvelope<T> envelope = extractMessage(response);
    if (envelope == null) {
      reportInvalidMessage(response, "Extracting envelope from the mirror response failed");
      return;
    }
    if (MessageMode.ENCRYPTED.equals(envelope.getMode()) && decrypter == null) {
      reportInvalidMessage(response, "Message is encrypted and no decryption function was provided");
      return;
    }
    if (isMessageValid(envelope, response)) {
      receiver.accept(envelope);
    }
  }
protected void handleResponse ( final TopicMessage response , final Consumer < MessageEnvelope < T > > receiver ) { if ( filters != null ) { for ( Predicate < TopicMessage > filter : filters ) { if ( ! filter . test ( response ) ) { reportInvalidMessage ( response , "Message was rejected by external filter" ) ; return ; } } } MessageEnvelope < T > envelope = extractMessage ( response ) ; if ( envelope == null ) { reportInvalidMessage ( response , "Extracting envelope from the mirror response failed" ) ; return ; } if ( MessageMode . ENCRYPTED . equals ( envelope . getMode ( ) ) && decrypter == null ) { reportInvalidMessage ( response , "Message is encrypted and no decryption function was provided" ) ; return ; } if ( isMessageValid ( envelope , response ) ) { receiver . accept ( envelope ) ; } }
Handles incoming messages from the topic on a mirror node.
Handles incoming messages from the topic on a mirror node .
// Run external filters first // Extract and parse message from the response. // Skip encrypted messages if decrypter was not provided // Check if message inside the envelope is valid and only accept it if it is.