I’m trying to use 2 pools and generate a new instance of my process, the following image shows whatmy process currently is
To send the message, I’m using this code in Java
package io.camunda.getstarted.tutorial;
import java.util.HashMap;
import java.util.Map;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import io.camunda.zeebe.client.api.response.ActivatedJob;
import io.camunda.zeebe.client.impl.ZeebeClientBuilderImpl;
import io.camunda.zeebe.client.impl.oauth.OAuthCredentialsProvider;
import io.camunda.zeebe.client.impl.oauth.OAuthCredentialsProviderBuilder;
import io.camunda.zeebe.client.ZeebeClient;
import io.camunda.zeebe.spring.client.EnableZeebeClient;
import io.camunda.zeebe.spring.client.annotation.ZeebeWorker;
@SpringBootApplication
@EnableZeebeClient
public class Worker {
private static final String zeebeAPI = "fbe78958-209f-4daa-8278-3d81bf161e06.bru-2.zeebe.camunda.io";
private static final String clientId = "z5jW~eX.ShwRx7G1S5pBmUEZW-a4wMdk";
private static final String clientSecret = "ClientSecret";
private static final String oAuthAPI = "https://login.cloud.camunda.io/oauth/token";
ZeebeClient client;
public static void main(String[] args) {
SpringApplication.run(Worker.class, args);
}
@ZeebeWorker(type = "orchestrate-something", autoComplete = true)
public Map<String, Object> orchestrateSomething(final ActivatedJob job) {
// Do the business logic
System.out.println("Yeah, now you can orchestrate something :-) You could use data from the process variables: " + job.getVariables());
// Probably add some process variables
HashMap<String, Object> variables = new HashMap<>();
variables.put("orderId", 42);
OAuthCredentialsProvider credentialsProvider =
new OAuthCredentialsProviderBuilder()
.authorizationServerUrl(oAuthAPI)
.audience(zeebeAPI)
.clientId(clientId)
.clientSecret(clientSecret)
.build();
ZeebeClient client =
new ZeebeClientBuilderImpl()
.gatewayAddress(zeebeAPI)
.credentialsProvider(credentialsProvider)
.build();
client.newTopologyRequest().send().join();
client
.newPublishMessageCommand()
.messageName("Money-collcted")
.correlationKey("123")
.send()
.join();
return variables;
}
}
Both processes are checked as executable, but for some reason the token that should be generated in the second process is not generated =(
Can somebody help me with this?