Client
Client Creation
An Infinitic Client allows you to interact with the Infinitic application. It can be used to start or cancel workflows, retry tasks, etc.
To build an Infinitic Client you need first to add the infinitic-client
dependency into your project:
dependencies {
...
implementation "io.infinitic:infinitic-client:0.16.2"
...
}
dependencies {
...
implementation("io.infinitic:infinitic-client:0.16.2")
...
}
An Infinitic client can be set up throuh builders or using YAML.
Whatever the chosen method, you'll need to pecify how to connect to the event broker.
Builder-based Configurations
Here is the configuration to create a worker connecting to a Pulsar cluster:
TransportConfig transportConfig = PulsarTransportConfig.builder()
.setBrokerServiceUrl("pulsar://localhost:6650")
.setWebServiceUrl("http://localhost:8080")
.setTenant("infinitic")
.setNamespace("dev")
.build();
InfiniticClient client = InfiniticClient.builder()
.setTransport(transportConfig)
.build();
val transportConfig = PulsarTransportConfig.builder()
.setBrokerServiceUrl("pulsar://localhost:6650")
.setWebServiceUrl("http://localhost:8080")
.setTenant("infinitic")
.setNamespace("dev")
.build()
val client = InfiniticClient.builder()
.setTransport(transportConfig)
.build()
More configuration options are available, see Pulsar reference.
YAML-based Configuration
A client can be created directly from a YAML string, a YAML file or a YAML resource:
// From a YAML string
InfiniticClient client = InfiniticClient.fromYamlString("yaml content here");
// From a YAML file
InfiniticClient client = InfiniticClient.fromYamlFile("infinitic.yml");
// From a YAML resource
InfiniticClient client = InfiniticClient.fromYamlResource("/path/to/infinitic.yml");
// From a YAML string
val client = InfiniticClient.fromYamlString("yaml content here")
// From a YAML file
val client = InfiniticClient.fromYamlFile("infinitic.yml")
// From a YAML resource
val client = InfiniticClient.fromYamlResource("/path/to/infinitic.yml")
Here is a minimal configuration to create a client connecting to a Pulsar cluster:
transport:
pulsar:
brokerServiceUrl: pulsar://localhost:6650/
webServiceUrl: http://localhost:8080
tenant: infinitic
namespace: dev
More configuration options are available, see Pulsar reference.