Java 类org.apache.camel.impl.DefaultAsyncProducer 实例源码

项目:Camel    文件:DataFormatEndpoint.java   
@Override
public Producer createProducer() throws Exception {
    return new DefaultAsyncProducer(this) {
        @Override
        public boolean process(Exchange exchange, AsyncCallback callback) {
            if (marshal != null) {
                return marshal.process(exchange, callback);
            } else {
                return unmarshal.process(exchange, callback);
            }
        }

        @Override
        public String toString() {
            return "DataFormatProducer[" + dataFormat + "]";
        }
    };
}
项目:Camel    文件:MockEndpoint.java   
public Producer createProducer() throws Exception {
    return new DefaultAsyncProducer(this) {
        public boolean process(Exchange exchange, AsyncCallback callback) {
            onExchange(exchange);
            callback.done(true);
            return true;
        }
    };
}