我的JbossFuse中有一个activemq:queue inQueue。如何使用已排队的JMS消息,以便在与Camunda集成的Spring Boot应用程序中触发我的流程实例?是否有任何参考文献或样品的链接会有所帮助?
当前,我能够使用来自activemq的消息,但是我不确定如何使用来自Jboss Fuse ActiveMQ的消息?
@Component
public class ActiveMQConsumer {
@Autowired
CamelContext camelContext;
@Autowired
ProducerTemplate producerTemplate;
@SuppressWarnings("unchecked")
@JmsListener(destination = "inQueue")
public void consumeMessage(JSONObject employeeRecord) throws Exception {
if (employeeRecord instanceof JSONObject) {
HashMap<String, Object> employeeRecordMap = (HashMap<String, Object>) employeeRecord.toMap();
Exchange exchange = ExchangeBuilder.anExchange(camelContext).withBody(employeeRecordMap).build();
HashMap<String, Object> employeeDetails = (HashMap<String, Object>) employeeRecordMap.get("employeeDetails");
exchange.setProperty("CamundaBpmBusinessKey", employeeDetails.get("employeeADId"));
producerTemplate.send("camunda-bpm:start?processDefinitionKey=camunda-camel-activeMQ", exchange);
}
}
}
application.properties
# activeMQ config
spring.activemq.broker-url=tcp://localhost:61616
spring.activemq.user=admin
spring.activemq.password=admin
预计将使用来自JbossFuse的消息。
答案 0 :(得分:0)
我建议使用Maven原型io.fabric8.archetypes spring-boot-camel-amq-archetype 2.2.197版本。可以找到:
Spring Boot example running a Camel route connecting to ActiveMQ
http://repo1.maven.org/maven2/
这将为您提供一个不错的示例项目,该项目具有所有Camel和Spring依赖项以及一些不错的示例。