Example #1
0
  /**
   * Wraps the original starting point of the consumer route into a set of PIX/PDQ-specific
   * interceptors.
   *
   * @param originalProcessor The original consumer processor.
   */
  @Override
  public Consumer createConsumer(Processor originalProcessor) throws Exception {
    if (sslContext != null) {
      DefaultIoFilterChainBuilder filterChain =
          wrappedEndpoint.getAcceptorConfig().getFilterChain();
      if (!filterChain.contains("ssl")) {
        HandshakeCallbackSSLFilter filter = new HandshakeCallbackSSLFilter(sslContext);
        filter.setNeedClientAuth(clientAuthType == ClientAuthType.MUST);
        filter.setWantClientAuth(clientAuthType == ClientAuthType.WANT);
        filter.setHandshakeExceptionCallback(new HandshakeFailureCallback());
        filter.setEnabledProtocols(sslProtocols);
        filter.setEnabledCipherSuites(sslCiphers);
        filterChain.addFirst("ssl", filter);
      }
    }

    // configure interceptor chain
    List<Hl7v2Interceptor> chain = getConsumerInterceptorChain();
    Processor processor = originalProcessor;
    for (int i = chain.size() - 1; i >= 0; --i) {
      Hl7v2Interceptor interceptor = chain.get(i);
      interceptor.setConfigurationHolder(this);
      interceptor.setWrappedProcessor(processor);
      processor = interceptor;
    }

    return wrappedEndpoint.createConsumer(processor);
  }