Search in sources :

Example 1 with DefaultEndpoint

use of org.apache.camel.impl.DefaultEndpoint in project camel by apache.

the class RetryRouteScopedUntilRecipientListIssueTest method createCamelContext.

@Override
protected CamelContext createCamelContext() throws Exception {
    CamelContext context = super.createCamelContext();
    context.addEndpoint("fail", new DefaultEndpoint() {

        public Producer createProducer() throws Exception {
            return new DefaultProducer(this) {

                public void process(Exchange exchange) throws Exception {
                    exchange.setException(new IllegalArgumentException("Damn"));
                }
            };
        }

        public Consumer createConsumer(Processor processor) throws Exception {
            return null;
        }

        @Override
        protected String createEndpointUri() {
            return "fail";
        }

        public boolean isSingleton() {
            return true;
        }
    });
    context.addEndpoint("not-fail", new DefaultEndpoint() {

        public Producer createProducer() throws Exception {
            return new DefaultProducer(this) {

                public void process(Exchange exchange) throws Exception {
                // noop
                }
            };
        }

        public Consumer createConsumer(Processor processor) throws Exception {
            return null;
        }

        @Override
        protected String createEndpointUri() {
            return "not-fail";
        }

        public boolean isSingleton() {
            return true;
        }
    });
    return context;
}
Also used : CamelContext(org.apache.camel.CamelContext) Exchange(org.apache.camel.Exchange) Processor(org.apache.camel.Processor) DefaultEndpoint(org.apache.camel.impl.DefaultEndpoint) DefaultProducer(org.apache.camel.impl.DefaultProducer) Producer(org.apache.camel.Producer) Consumer(org.apache.camel.Consumer) DefaultProducer(org.apache.camel.impl.DefaultProducer) ExchangeException(org.apache.camel.ExchangeException)

Aggregations

CamelContext (org.apache.camel.CamelContext)1 Consumer (org.apache.camel.Consumer)1 Exchange (org.apache.camel.Exchange)1 ExchangeException (org.apache.camel.ExchangeException)1 Processor (org.apache.camel.Processor)1 Producer (org.apache.camel.Producer)1 DefaultEndpoint (org.apache.camel.impl.DefaultEndpoint)1 DefaultProducer (org.apache.camel.impl.DefaultProducer)1