當前位置: 首頁>>代碼示例>>Java>>正文


Java DefaultProducer類代碼示例

本文整理匯總了Java中org.apache.camel.impl.DefaultProducer的典型用法代碼示例。如果您正苦於以下問題:Java DefaultProducer類的具體用法?Java DefaultProducer怎麽用?Java DefaultProducer使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


DefaultProducer類屬於org.apache.camel.impl包,在下文中一共展示了DefaultProducer類的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: createProducer

import org.apache.camel.impl.DefaultProducer; //導入依賴的package包/類
@Override
public Producer createProducer() throws Exception {
    return new DefaultProducer(this) {
        @Override
        public void process(final Exchange exchange) throws Exception {
            executor.execute(new Runnable() {
                @Override
                public void run() {
                    try {
                        tradeExecutor.execute(exchange.getIn().getMandatoryBody(Message.class));
                    } catch (Exception e) {
                        log.error("Error during trade execution", e);
                    }
                }
            });
        }
    };
}
 
開發者ID:HydAu,項目名稱:Camel,代碼行數:19,代碼來源:TradeExecutorComponent.java

示例2: createProducer

import org.apache.camel.impl.DefaultProducer; //導入依賴的package包/類
public Producer createProducer() throws Exception {
    return new DefaultProducer(this) {
        public void process(Exchange exchange) throws Exception {
            onExchange(exchange);
        }
    };
}
 
開發者ID:HydAu,項目名稱:Camel,代碼行數:8,代碼來源:BrowseEndpoint.java

示例3: createProducer

import org.apache.camel.impl.DefaultProducer; //導入依賴的package包/類
@Override
public Producer createProducer() throws Exception {
    return new DefaultProducer(this) {
        @Override
        public void process(Exchange exchange) throws Exception {
            exchange.getIn().setHeader("username", getUsername());
            exchange.getIn().setHeader("password", getPassword());
            exchange.getIn().setHeader("lines", getLines());
        }
    };
}
 
開發者ID:HydAu,項目名稱:Camel,代碼行數:12,代碼來源:EndpointWithRawUriParameterTest.java

示例4: createProducer

import org.apache.camel.impl.DefaultProducer; //導入依賴的package包/類
@Override
public Producer createProducer() throws Exception {
    return new DefaultProducer(this) {
        @Override
        public void process(Exchange exchange) throws Exception {
            throw new IllegalArgumentException("Forced");
        }
    };
}
 
開發者ID:HydAu,項目名稱:Camel,代碼行數:10,代碼來源:WireTapOnExceptionTest.java

示例5: createProducer

import org.apache.camel.impl.DefaultProducer; //導入依賴的package包/類
public Producer createProducer() throws Exception {
    ObjectHelper.notNull(applicationContext, "applicationContext");
    return new DefaultProducer(this) {
        public void process(Exchange exchange) throws Exception {
            ApplicationEvent event = toApplicationEvent(exchange);
            applicationContext.publishEvent(event);
        }
    };
}
 
開發者ID:HydAu,項目名稱:Camel,代碼行數:10,代碼來源:EventEndpoint.java

示例6: createEndpoint

import org.apache.camel.impl.DefaultProducer; //導入依賴的package包/類
@Override
protected Endpoint createEndpoint(final String uri, final String remaining, final Map<String, Object> parameters) throws Exception {
    final String value = String.class.cast(parameters.remove("value"));
    return new DefaultEndpoint() {
        @Override
        protected String createEndpointUri() {
            return uri;
        }

        @Override
        public Producer createProducer() throws Exception {
            return new DefaultProducer(this) {
                @Override
                public void process(final Exchange exchange) throws Exception {
                    exchange.getIn().setBody(exchange.getIn().getBody(String.class) + value);
                }
            };
        }

        @Override
        public Consumer createConsumer(final Processor processor) throws Exception {
            throw new UnsupportedOperationException();
        }

        @Override
        public boolean isSingleton() {
            return true;
        }
    };
}
 
開發者ID:apache,項目名稱:incubator-batchee,代碼行數:31,代碼來源:TestComponent.java


注:本文中的org.apache.camel.impl.DefaultProducer類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。