Search in sources :

Example 1 with JettyRouteCondition

use of com.adaptris.core.http.jetty.JettyRouteCondition in project interlok by adaptris.

the class RetryFromJetty method prepare.

@Override
public void prepare() throws CoreException {
    if (!prepared) {
        Args.notNull(getReportBuilder(), "report-builder");
        Args.notNull(getRetryStore(), "retry-store");
        String retryServletPath = retryEndpointPrefix() + "*";
        String retryServletRegexp = "^" + retryEndpointPrefix() + "(.*)";
        String deleteServletPath = deleteEndpointPrefix() + "*";
        String deleteServletRegexp = "^" + deleteEndpointPrefix() + "(.*)";
        retryRouting = new JettyRouteCondition().withUrlPattern(retryServletRegexp).withMetadataKeys(MSG_ID_KEY).withMethod(retryHttpMethod());
        deleteRouting = new JettyRouteCondition().withUrlPattern(deleteServletRegexp).withMetadataKeys(MSG_ID_KEY).withMethod(deleteHttpMethod());
        reporter = new ReportListener();
        retrier = new RetryListener();
        deleter = new DeleteListener();
        // By not dictating the method in the consumer; we accept all methods in jetty, but we use the
        // jetty route filter to filter it out.
        retrying = new StandaloneConsumer(getConnection(), new JettyMessageConsumer().withPath(retryServletPath));
        deleting = new StandaloneConsumer(getConnection(), new JettyMessageConsumer().withPath(deleteServletPath));
        reporting = new StandaloneConsumer(getConnection(), new JettyMessageConsumer().withPath(reportingEndpoint()));
        retrying.registerAdaptrisMessageListener(retrier);
        reporting.registerAdaptrisMessageListener(reporter);
        deleting.registerAdaptrisMessageListener(deleter);
        LifecycleHelper.prepare(getRetryStore(), getReportBuilder());
        LifecycleHelper.prepare(deleteRouting, deleter, deleting);
        LifecycleHelper.prepare(retryRouting, retrier, retrying);
        LifecycleHelper.prepare(reporter, reporting);
        prepared = true;
    }
}
Also used : JettyRouteCondition(com.adaptris.core.http.jetty.JettyRouteCondition) JettyMessageConsumer(com.adaptris.core.http.jetty.JettyMessageConsumer) StandaloneConsumer(com.adaptris.core.StandaloneConsumer)

Aggregations

StandaloneConsumer (com.adaptris.core.StandaloneConsumer)1 JettyMessageConsumer (com.adaptris.core.http.jetty.JettyMessageConsumer)1 JettyRouteCondition (com.adaptris.core.http.jetty.JettyRouteCondition)1