当前位置: 首页>>代码示例>>Java>>正文


Java ProducerTemplate.request方法代码示例

本文整理汇总了Java中org.apache.camel.ProducerTemplate.request方法的典型用法代码示例。如果您正苦于以下问题:Java ProducerTemplate.request方法的具体用法?Java ProducerTemplate.request怎么用?Java ProducerTemplate.request使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.camel.ProducerTemplate的用法示例。


在下文中一共展示了ProducerTemplate.request方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testCxfBusConfiguration

import org.apache.camel.ProducerTemplate; //导入方法依赖的package包/类
@Test
public void testCxfBusConfiguration() throws Exception {
    // get the camelContext from application context
    ProducerTemplate template = context.createProducerTemplate();

    Exchange reply = template.request("cxf:bean:serviceEndpoint", new Processor() {
        public void process(final Exchange exchange) {
            final List<String> params = new ArrayList<String>();
            params.add("hello");
            exchange.getIn().setBody(params);
            exchange.getIn().setHeader(CxfConstants.OPERATION_NAME, "echo");
        }
    });

    Exception ex = reply.getException();
    assertTrue("Should get the fault here", 
               ex instanceof org.apache.cxf.interceptor.Fault
               || ex instanceof HTTPException);
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:20,代码来源:CxfEndpointBeansTest.java

示例2: testCxfBusConfiguration

import org.apache.camel.ProducerTemplate; //导入方法依赖的package包/类
@Test
public void testCxfBusConfiguration() throws Exception {
    // get the camelContext from application context
    CamelContext camelContext = ctx.getBean("camel", CamelContext.class);
    ProducerTemplate template = camelContext.createProducerTemplate();

    Exchange reply = template.request("cxf:bean:serviceEndpoint", new Processor() {
        public void process(final Exchange exchange) {
            final List<String> params = new ArrayList<String>();
            params.add("hello");
            exchange.getIn().setBody(params);
            exchange.getIn().setHeader(CxfConstants.OPERATION_NAME, "echo");
        }
    });

    Exception ex = reply.getException();
    assertTrue("Should get the fault here", 
               ex instanceof org.apache.cxf.interceptor.Fault
               || ex instanceof HTTPException);
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:21,代码来源:CxfEndpointBeansRouterTest.java

示例3: main

import org.apache.camel.ProducerTemplate; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception {
    LOG.info("About to run splunk-camel integration...");

    CamelContext camelContext = new DefaultCamelContext();
    camelContext.addRoutes(new SplunkPublishEventRouteBuilder());
    ProducerTemplate eventProducer = camelContext.createProducerTemplate();
    camelContext.start();
    eventProducer.request("direct:start", new SplunkEventProcessor());

    LOG.info("Successfully published event to Splunk.");

    camelContext.stop();
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:14,代码来源:SplunkPublishEventClient.java


注:本文中的org.apache.camel.ProducerTemplate.request方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。