当前位置: 首页>>代码示例>>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;未经允许,请勿转载。