- 使用 Spring Initializr 创建 Spring Boot 应用程序
- 在Spring Boot中配置Cassandra
- 在 Spring Boot 上配置 Tomcat 连接池
- 将Camel消息路由到嵌入WildFly的Artemis上
本文整理了Java中io.zeebe.client.api.ZeebeFuture.join()
方法的一些代码示例,展示了ZeebeFuture.join()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZeebeFuture.join()
方法的具体详情如下:
包路径:io.zeebe.client.api.ZeebeFuture
类名称:ZeebeFuture
方法名:join
[英]Like #get() but throws runtime exceptions.
[中]比如#get(),但抛出运行时异常。
代码示例来源:origin: berndruecker/flowing-retail
@StreamListener(target = Sink.INPUT, condition = "(headers['messageType']?:'')=='PaymentReceivedEvent'")
@Transactional
public void paymentReceived(String messageJson) throws Exception {
Message<PaymentReceivedEventPayload> message = new ObjectMapper().readValue(messageJson, new TypeReference<Message<PaymentReceivedEventPayload>>() {});
PaymentReceivedEventPayload event = message.getPayload(); // TODO: Read something from it?
zeebe.workflowClient().newPublishMessageCommand() //
.messageName(message.getMessageType())
.correlationKey(message.getCorrelationId())
.payload("{\"paymentInfo\": \"YeahWeCouldAddSomething\"}")
.send().join();
System.out.println("Correlated " + message );
}
代码示例来源:origin: io.zeebe/zeebe-test
/**
* Deploys the given workflow to the broker. Note that the filename must have the "bpmn" file
* extension, e.g. "resource.bpmn".
*
* @param workflow workflow to deploy
* @param filename resource name, e.g. "workflow.bpmn"
*/
public void deployWorkflow(BpmnModelInstance workflow, String filename) {
clientRule.getClient().newDeployCommand().addWorkflowModel(workflow, filename).send().join();
}
代码示例来源:origin: zeebe-io/zeebe
/**
* Deploys the given workflow to the broker. Note that the filename must have the "bpmn" file
* extension, e.g. "resource.bpmn".
*
* @param workflow workflow to deploy
* @param filename resource name, e.g. "workflow.bpmn"
*/
public void deployWorkflow(BpmnModelInstance workflow, String filename) {
clientRule.getClient().newDeployCommand().addWorkflowModel(workflow, filename).send().join();
}
代码示例来源:origin: berndruecker/flowing-retail
@Bean
public ZeebeClient zeebe() {
System.out.println("Connect to Zeebe at '" + zeebeBrokerContactPoint + "'");
// Cannot yet use Spring Zeebe in current alpha
ZeebeClient zeebeClient = ZeebeClient.newClientBuilder() //
.brokerContactPoint(zeebeBrokerContactPoint) //
.build();
// Trigger deployment
zeebeClient.workflowClient().newDeployCommand() //
.addResourceFromClasspath("order-kafka.bpmn") //
.send().join();
return zeebeClient;
}
代码示例来源:origin: zeebe-io/zeebe
@Override
public void handle(final JobClient client, final ActivatedJob job) {
// here: business logic that is executed with every job
System.out.println(
String.format(
"[type: %s, key: %s, lockExpirationTime: %s]\n[headers: %s]\n[payload: %s]\n===",
job.getType(),
job.getKey(),
job.getDeadline().toString(),
job.getHeaders(),
job.getPayload()));
client.newCompleteCommand(job.getKey()).send().join();
}
}
代码示例来源:origin: berndruecker/flowing-retail
@StreamListener(target = Sink.INPUT, condition = "(headers['messageType']?:'')=='GoodsFetchedEvent'")
@Transactional
public void goodsFetchedReceived(String messageJson) throws Exception {
Message<GoodsFetchedEventPayload> message = new ObjectMapper().readValue(messageJson, new TypeReference<Message<GoodsFetchedEventPayload>>() {});
String pickId = message.getPayload().getPickId();
zeebe.workflowClient().newPublishMessageCommand() //
.messageName(message.getMessageType())
.correlationKey(message.getCorrelationId())
.payload("{\"pickId\":\"" + pickId + "\"}") //
.send().join();
System.out.println("Correlated " + message );
}
代码示例来源:origin: berndruecker/flowing-retail
@StreamListener(target = Sink.INPUT, condition = "(headers['messageType']?:'')=='GoodsShippedEvent'")
@Transactional
public void goodsShippedReceived(String messageJson) throws Exception {
Message<GoodsShippedEventPayload> message = new ObjectMapper().readValue(messageJson, new TypeReference<Message<GoodsShippedEventPayload>>() {});
String shipmentId = message.getPayload().getShipmentId();
zeebe.workflowClient().newPublishMessageCommand() //
.messageName(message.getMessageType())
.correlationKey(message.getCorrelationId())
.payload("{\"shipmentId\":\"" + shipmentId + "\"}") //
.send().join();
System.out.println("Correlated " + message );
}
}
代码示例来源:origin: zeebe-io/zeebe
public static void main(final String[] args) {
final String broker = "localhost:26500";
final ZeebeClientBuilder clientBuilder =
ZeebeClient.newClientBuilder().brokerContactPoint(broker);
try (ZeebeClient client = clientBuilder.build()) {
final DeploymentEvent deploymentEvent =
client.newDeployCommand().addResourceFromClasspath("demoProcess.bpmn").send().join();
System.out.println("Deployment created with key: " + deploymentEvent.getKey());
}
}
}
代码示例来源:origin: zeebe-io/zeebe
private void determineDefaultPartition() {
final Topology topology = client.newTopologyRequest().send().join();
defaultPartition = -1;
final List<BrokerInfo> topologyBrokers = topology.getBrokers();
for (final BrokerInfo leader : topologyBrokers) {
final List<PartitionInfo> partitions = leader.getPartitions();
for (final PartitionInfo brokerPartitionState : partitions) {
if (brokerPartitionState.isLeader()) {
defaultPartition = brokerPartitionState.getPartitionId();
break;
}
}
}
if (defaultPartition < 0) {
throw new RuntimeException("Could not detect leader for default partition");
}
}
代码示例来源:origin: io.zeebe/zeebe-test
private void determineDefaultPartition() {
final Topology topology = client.newTopologyRequest().send().join();
defaultPartition = -1;
final List<BrokerInfo> topologyBrokers = topology.getBrokers();
for (final BrokerInfo leader : topologyBrokers) {
final List<PartitionInfo> partitions = leader.getPartitions();
for (final PartitionInfo brokerPartitionState : partitions) {
if (brokerPartitionState.isLeader()) {
defaultPartition = brokerPartitionState.getPartitionId();
break;
}
}
}
if (defaultPartition < 0) {
throw new RuntimeException("Could not detect leader for default partition");
}
}
代码示例来源:origin: io.zeebe/zeebe-test
/**
* Publishes a new message to the broker.
*
* @param messageName name of the message
* @param correlationKey correlation key
*/
public void publishMessage(String messageName, String correlationKey) {
clientRule
.getClient()
.newPublishMessageCommand()
.messageName(messageName)
.correlationKey(correlationKey)
.send()
.join();
}
代码示例来源:origin: zeebe-io/zeebe
public static void main(final String[] args) {
final String broker = "127.0.0.1:26500";
final String bpmnProcessId = "demoProcess";
final ZeebeClientBuilder builder = ZeebeClient.newClientBuilder().brokerContactPoint(broker);
try (ZeebeClient client = builder.build()) {
System.out.println("Creating workflow instance");
final WorkflowInstanceEvent workflowInstanceEvent =
client
.newCreateInstanceCommand()
.bpmnProcessId(bpmnProcessId)
.latestVersion()
.send()
.join();
System.out.println(
"Workflow instance created with key: " + workflowInstanceEvent.getWorkflowInstanceKey());
}
}
}
代码示例来源:origin: zeebe-io/zeebe
/**
* Publishes a new message to the broker.
*
* @param messageName name of the message
* @param correlationKey correlation key
*/
public void publishMessage(String messageName, String correlationKey) {
clientRule
.getClient()
.newPublishMessageCommand()
.messageName(messageName)
.correlationKey(correlationKey)
.send()
.join();
}
代码示例来源:origin: berndruecker/flowing-retail
@Override
public void handle(JobClient client, ActivatedJob job) {
OrderFlowContext context = OrderFlowContext.fromJson(job.getPayload());
Order order = orderRepository.findById( context.getOrderId() ).get();
// generate an UUID for this communication
String correlationId = UUID.randomUUID().toString();
messageSender.send(new Message<FetchGoodsCommandPayload>( //
"FetchGoodsCommand", //
context.getTraceId(), //
new FetchGoodsCommandPayload() //
.setRefId(order.getId()) //
.setItems(order.getItems())) //
.setCorrelationId(correlationId));
client.newCompleteCommand(job.getKey()) //
.payload(Collections.singletonMap("CorrelationId_FetchGoods", correlationId)) //
.send().join();
}
代码示例来源:origin: zeebe-io/zeebe
/**
* Creates a workflow instance for the given process ID, with the given payload.
*
* @param processId BPMN process ID
* @param payload initial payload for the instance
* @return unique ID used to interact with the instance
*/
public long createWorkflowInstance(String processId, Map<String, Object> payload) {
return clientRule
.getClient()
.newCreateInstanceCommand()
.bpmnProcessId(processId)
.latestVersion()
.payload(payload)
.send()
.join()
.getWorkflowInstanceKey();
}
代码示例来源:origin: io.zeebe/zeebe-test
/**
* Creates a workflow instance for the given process ID, with the given payload.
*
* @param processId BPMN process ID
* @param payload initial payload for the instance
* @return unique ID used to interact with the instance
*/
public long createWorkflowInstance(String processId, Map<String, Object> payload) {
return clientRule
.getClient()
.newCreateInstanceCommand()
.bpmnProcessId(processId)
.latestVersion()
.payload(payload)
.send()
.join()
.getWorkflowInstanceKey();
}
代码示例来源:origin: berndruecker/flowing-retail
@Override
public void handle(JobClient client, ActivatedJob job) {
OrderFlowContext context = OrderFlowContext.fromJson(job.getPayload());
Order order = orderRepository.findById(context.getOrderId()).get();
// generate an UUID for this communication
String correlationId = UUID.randomUUID().toString();
messageSender.send( //
new Message<RetrievePaymentCommandPayload>( //
"RetrievePaymentCommand", //
context.getTraceId(), //
new RetrievePaymentCommandPayload() //
.setRefId(order.getId()) //
.setReason("order") //
.setAmount(order.getTotalSum())) //
.setCorrelationId(correlationId));
client.newCompleteCommand(job.getKey()) //
.payload(Collections.singletonMap("CorrelationId_RetrievePayment", correlationId)) //
.send().join();
}
代码示例来源:origin: berndruecker/flowing-retail
@Override
public void handle(JobClient client, ActivatedJob job) {
OrderFlowContext context = OrderFlowContext.fromJson(job.getPayload());
Order order = orderRepository.findById(context.getOrderId()).get();
// generate an UUID for this communication
String correlationId = UUID.randomUUID().toString();
messageSender.send(new Message<ShipGoodsCommandPayload>( //
"ShipGoodsCommand", //
context.getTraceId(), //
new ShipGoodsCommandPayload() //
.setRefId(order.getId())
.setPickId(context.getPickId()) //
.setRecipientName(order.getCustomer().getName()) //
.setRecipientAddress(order.getCustomer().getAddress())) //
.setCorrelationId(correlationId));
client.newCompleteCommand(job.getKey()) //
.payload(Collections.singletonMap("CorrelationId_ShipGoods", correlationId)) //
.send().join();
}
代码示例来源:origin: berndruecker/flowing-retail
@Override
public void handle(JobClient client, ActivatedJob job) {
OrderFlowContext context = OrderFlowContext.fromJson(job.getPayload());
messageSender.send( //
new Message<OrderCompletedEventPayload>( //
"OrderCompletedEvent", //
context.getTraceId(), //
new OrderCompletedEventPayload() //
.setOrderId(context.getOrderId())));
//TODO: Reintorduce traceId? .setCorrelationId(event.get)));
client.newCompleteCommand(job.getKey()).send().join();
}
代码示例来源:origin: zeebe-io/zeebe
public static void main(final String[] args) {
final String broker = "127.0.0.1:26500";
final ZeebeClientBuilder builder = ZeebeClient.newClientBuilder().brokerContactPoint(broker);
try (ZeebeClient client = builder.build()) {
final Order order = new Order();
order.setOrderId(31243);
client
.newCreateInstanceCommand()
.bpmnProcessId("demoProcess")
.latestVersion()
.payload(order)
.send()
.join();
client.newWorker().jobType("foo").handler(new DemoJobHandler()).open();
// run until System.in receives exit command
waitUntilSystemInput("exit");
}
}
本文整理了Java中io.zeebe.model.bpmn.instance.zeebe.ZeebeTaskDefinition类的一些代码示例,展示了ZeebeTaskDefinition类的具体用
本文整理了Java中io.zeebe.model.bpmn.instance.zeebe.ZeebeTaskDefinition.getType()方法的一些代码示例,展示了ZeebeTaskDefi
本文整理了Java中io.zeebe.client.ZeebeClient类的一些代码示例,展示了ZeebeClient类的具体用法。这些代码示例主要来源于Github/Stackoverflow/M
本文整理了Java中io.zeebe.client.ZeebeClientBuilder类的一些代码示例,展示了ZeebeClientBuilder类的具体用法。这些代码示例主要来源于Github/S
本文整理了Java中io.zeebe.db.ZeebeDb类的一些代码示例,展示了ZeebeDb类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些
本文整理了Java中io.zeebe.client.api.ZeebeFuture类的一些代码示例,展示了ZeebeFuture类的具体用法。这些代码示例主要来源于Github/Stackoverfl
我读过来自 Camunda 的 Zeebe ( https://zeebe.io/ ) 是专门为微服务编排创建的。我知道在性能方面存在一些差异。 我的问题是“我可以使用 Camunda 实现与 Zee
本文整理了Java中io.zeebe.client.ZeebeClient.newWorker()方法的一些代码示例,展示了ZeebeClient.newWorker()的具体用法。这些代码示例主要来
本文整理了Java中io.zeebe.client.ZeebeClient.newDeployCommand()方法的一些代码示例,展示了ZeebeClient.newDeployCommand()的
本文整理了Java中io.zeebe.client.ZeebeClientBuilder.build()方法的一些代码示例,展示了ZeebeClientBuilder.build()的具体用法。这些代
本文整理了Java中io.zeebe.client.ZeebeClient.newTopologyRequest()方法的一些代码示例,展示了ZeebeClient.newTopologyReques
本文整理了Java中io.zeebe.client.ZeebeClient.newClientBuilder()方法的一些代码示例,展示了ZeebeClient.newClientBuilder()的
本文整理了Java中io.zeebe.client.ZeebeClientBuilder.brokerContactPoint()方法的一些代码示例,展示了ZeebeClientBuilder.bro
本文整理了Java中io.zeebe.client.api.ZeebeFuture.join()方法的一些代码示例,展示了ZeebeFuture.join()的具体用法。这些代码示例主要来源于Gith
我是一名优秀的程序员,十分优秀!