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


Java ProducerTemplate.sendBodyAndProperty方法代码示例

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


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

示例1: testRunProcess

import org.apache.camel.ProducerTemplate; //导入方法依赖的package包/类
@Deployment(resources = { "process/example.bpmn20.xml" })
public void testRunProcess() throws Exception {
    CamelContext ctx = applicationContext.getBean(CamelContext.class);
    ProducerTemplate tpl = ctx.createProducerTemplate();
    service1.expectedBodiesReceived("ala");

    Exchange exchange = ctx.getEndpoint("direct:start").createExchange();
    exchange.getIn().setBody(Collections.singletonMap("var1", "ala"));
    tpl.send("direct:start", exchange);
    String instanceId = (String) exchange.getProperty("PROCESS_ID_PROPERTY");

    tpl.sendBodyAndProperty("direct:receive", null, FlowableProducer.PROCESS_ID_PROPERTY, instanceId);

    assertProcessEnded(instanceId);

    service1.assertIsSatisfied();
    Map<?, ?> m = service2.getExchanges().get(0).getIn().getBody(Map.class);
    assertEquals("ala", m.get("var1"));
    assertEquals("var2", m.get("var2"));
}
 
开发者ID:flowable,项目名称:flowable-engine,代码行数:21,代码来源:SimpleProcessTest.java

示例2: testRunProcessByKey

import org.apache.camel.ProducerTemplate; //导入方法依赖的package包/类
@Deployment(resources = { "process/example.bpmn20.xml" })
public void testRunProcessByKey() throws Exception {
    CamelContext ctx = applicationContext.getBean(CamelContext.class);
    ProducerTemplate tpl = ctx.createProducerTemplate();
    MockEndpoint me = (MockEndpoint) ctx.getEndpoint("mock:service1");
    me.expectedBodiesReceived("ala");

    tpl.sendBodyAndProperty("direct:start", Collections.singletonMap("var1", "ala"), FlowableProducer.PROCESS_KEY_PROPERTY, "key1");

    String instanceId = runtimeService.createProcessInstanceQuery().processInstanceBusinessKey("key1").singleResult().getProcessInstanceId();
    tpl.sendBodyAndProperty("direct:receive", null, FlowableProducer.PROCESS_KEY_PROPERTY, "key1");

    assertProcessEnded(instanceId);

    me.assertIsSatisfied();
}
 
开发者ID:flowable,项目名称:flowable-engine,代码行数:17,代码来源:SimpleProcessTest.java

示例3: testRunProcess

import org.apache.camel.ProducerTemplate; //导入方法依赖的package包/类
@Deployment(resources = { "process/custom.bpmn20.xml" })
public void testRunProcess() throws Exception {
    CamelContext ctx = applicationContext.getBean(CamelContext.class);
    ProducerTemplate tpl = ctx.createProducerTemplate();
    service1.expectedBodiesReceived("ala");

    Exchange exchange = ctx.getEndpoint("direct:start").createExchange();
    exchange.getIn().setBody(Collections.singletonMap("var1", "ala"));
    tpl.send("direct:start", exchange);

    String instanceId = (String) exchange.getProperty("PROCESS_ID_PROPERTY");

    tpl.sendBodyAndProperty("direct:receive", null, FlowableProducer.PROCESS_ID_PROPERTY, instanceId);

    assertProcessEnded(instanceId);

    service1.assertIsSatisfied();

    @SuppressWarnings("rawtypes")
    Map m = service2.getExchanges().get(0).getIn().getBody(Map.class);
    assertEquals("ala", m.get("var1"));
    assertEquals("var2", m.get("var2"));
}
 
开发者ID:flowable,项目名称:flowable-engine,代码行数:24,代码来源:CustomContextTest.java

示例4: testRunProcess

import org.apache.camel.ProducerTemplate; //导入方法依赖的package包/类
@Deployment(resources = { "process/example.bpmn20.xml" })
public void testRunProcess() throws Exception {
    CamelContext ctx = applicationContext.getBean(CamelContext.class);
    ProducerTemplate tpl = ctx.createProducerTemplate();
    service1.expectedBodiesReceived("ala");

    Exchange exchange = ctx.getEndpoint("direct:start").createExchange();
    exchange.getIn().setBody(Collections.singletonMap("var1", "ala"));
    tpl.send("direct:start", exchange);

    String instanceId = (String) exchange.getProperty("PROCESS_ID_PROPERTY");
    tpl.sendBodyAndProperty("direct:receive", null, FlowableProducer.PROCESS_ID_PROPERTY, instanceId);

    assertProcessEnded(instanceId);

    service1.assertIsSatisfied();
    Map<?, ?> m = service2.getExchanges().get(0).getIn().getBody(Map.class);
    assertEquals("ala", m.get("var1"));
    assertEquals("var2", m.get("var2"));

}
 
开发者ID:flowable,项目名称:flowable-engine,代码行数:22,代码来源:SimpleSpringProcessTest.java

示例5: testRunProcess

import org.apache.camel.ProducerTemplate; //导入方法依赖的package包/类
@Test
@Deployment(resources = { "process/example.bpmn20.xml" })
public void testRunProcess() throws Exception {
    CamelContext ctx = ProgrammaticBeanLookup.lookup(CamelContext.class);
    ProducerTemplate tpl = ctx.createProducerTemplate();
    service1.expectedBodiesReceived("ala");

    Exchange exchange = ctx.getEndpoint("direct:start").createExchange();
    exchange.getIn().setBody(Collections.singletonMap("var1", "ala"));
    tpl.send("direct:start", exchange);
    String instanceId = (String) exchange.getProperty("PROCESS_ID_PROPERTY");

    ProcessInstance processInstance = processEngine.getRuntimeService().createProcessInstanceQuery().processInstanceId(instanceId).singleResult();
    assertEquals(false,processInstance.isEnded());

    tpl.sendBodyAndProperty("direct:receive", null, FlowableProducer.PROCESS_ID_PROPERTY, instanceId);

    // check process ended
    processInstance = processEngine.getRuntimeService().createProcessInstanceQuery().processInstanceId(instanceId).singleResult();
    assertNull(processInstance);

    service1.assertIsSatisfied();
    Map<?, ?> m = service2.getExchanges().get(0).getIn().getBody(Map.class);
    assertEquals("ala", m.get("var1"));
    assertEquals("var2", m.get("var2"));
}
 
开发者ID:flowable,项目名称:flowable-engine,代码行数:27,代码来源:CdiSimpleProcessTest.java

示例6: testRunProcess

import org.apache.camel.ProducerTemplate; //导入方法依赖的package包/类
@Test
@Deployment(resources = { "process/customNonDefaultName.bpmn20.xml" })
public void testRunProcess() throws Exception {
    CamelContext ctx = (CamelContext) ProgrammaticBeanLookup.lookup("myContext");
    ProducerTemplate tpl = ctx.createProducerTemplate();
    service1.expectedBodiesReceived("ala");

    Exchange exchange = ctx.getEndpoint("direct:start").createExchange();
    exchange.getIn().setBody(Collections.singletonMap("var1", "ala"));
    tpl.send("direct:start", exchange);

    String instanceId = (String) exchange.getProperty("PROCESS_ID_PROPERTY");

    ProcessInstance processInstance = processEngine.getRuntimeService().createProcessInstanceQuery().processInstanceId(instanceId).singleResult();
    assertEquals(false, processInstance.isEnded());

    tpl.sendBodyAndProperty("direct:receive", null, FlowableProducer.PROCESS_ID_PROPERTY, instanceId);

    // check process ended
    processInstance = processEngine.getRuntimeService().createProcessInstanceQuery().processInstanceId(instanceId).singleResult();
    assertNull(processInstance);

    service1.assertIsSatisfied();

    @SuppressWarnings("rawtypes")
    Map m = service2.getExchanges().get(0).getIn().getBody(Map.class);
    assertEquals("ala", m.get("var1"));
    assertEquals("var2", m.get("var2"));
}
 
开发者ID:flowable,项目名称:flowable-engine,代码行数:30,代码来源:CdiCustomNonDefaultNamedContextTest.java

示例7: testRunProcess

import org.apache.camel.ProducerTemplate; //导入方法依赖的package包/类
@Test
@Deployment(resources = { "process/custom.bpmn20.xml" })
public void testRunProcess() throws Exception {
    CamelContext ctx = (CamelContext) ProgrammaticBeanLookup.lookup("camelContext");
    ProducerTemplate tpl = ctx.createProducerTemplate();
    service1.expectedBodiesReceived("ala");

    Exchange exchange = ctx.getEndpoint("direct:start").createExchange();
    exchange.getIn().setBody(Collections.singletonMap("var1", "ala"));
    tpl.send("direct:start", exchange);

    String instanceId = (String) exchange.getProperty("PROCESS_ID_PROPERTY");
    List<ProcessInstance> processInstances = processEngine.getRuntimeService().createProcessInstanceQuery().list();
    ProcessInstance processInstance = processEngine.getRuntimeService().createProcessInstanceQuery().processInstanceId(instanceId).singleResult();
    assertEquals(false, processInstance.isEnded());

    tpl.sendBodyAndProperty("direct:receive", null, FlowableProducer.PROCESS_ID_PROPERTY, instanceId);

    // check process ended
    processInstance = processEngine.getRuntimeService().createProcessInstanceQuery().processInstanceId(instanceId).singleResult();
    assertNull(processInstance);

    service1.assertIsSatisfied();

    @SuppressWarnings("rawtypes")
    Map m = service2.getExchanges().get(0).getIn().getBody(Map.class);
    assertEquals("ala", m.get("var1"));
    assertEquals("var2", m.get("var2"));
}
 
开发者ID:flowable,项目名称:flowable-engine,代码行数:30,代码来源:CdiCustomContextTest.java


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