本文整理汇总了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"));
}
示例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();
}
示例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"));
}
示例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"));
}
示例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"));
}
示例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"));
}
示例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"));
}