Search in sources :

Example 6 with IWorkflowService

use of com.uber.cadence.serviceclient.IWorkflowService in project cadence-client by uber-java.

the class RegisterTestDomain method main.

public static void main(String[] args) throws InterruptedException {
    if (!useDockerService) {
        return;
    }
    IWorkflowService service = new WorkflowServiceTChannel(ClientOptions.defaultInstance());
    RegisterDomainRequest request = new RegisterDomainRequest().setName(DOMAIN).setWorkflowExecutionRetentionPeriodInDays(1);
    while (true) {
        try {
            service.RegisterDomain(request);
            break;
        } catch (DomainAlreadyExistsError e) {
            break;
        } catch (TException e) {
            String message = e.getMessage();
            if (message != null && !message.contains("Failed to connect to the host") && !message.contains("Connection timeout on identification")) {
                e.printStackTrace();
            }
            Thread.sleep(500);
            continue;
        } catch (Throwable e) {
            e.printStackTrace();
            System.exit(1);
        }
    }
    System.exit(0);
}
Also used : TException(org.apache.thrift.TException) IWorkflowService(com.uber.cadence.serviceclient.IWorkflowService) WorkflowServiceTChannel(com.uber.cadence.serviceclient.WorkflowServiceTChannel)

Aggregations

IWorkflowService (com.uber.cadence.serviceclient.IWorkflowService)6 Test (org.junit.Test)4 RecordActivityTaskHeartbeatResponse (com.uber.cadence.RecordActivityTaskHeartbeatResponse)3 TException (org.apache.thrift.TException)2 Level (ch.qos.logback.classic.Level)1 LoggerContext (ch.qos.logback.classic.LoggerContext)1 ILoggingEvent (ch.qos.logback.classic.spi.ILoggingEvent)1 ListAppender (ch.qos.logback.core.read.ListAppender)1 PollForDecisionTaskResponse (com.uber.cadence.PollForDecisionTaskResponse)1 TaskList (com.uber.cadence.TaskList)1 TestWorkflowService (com.uber.cadence.internal.testservice.TestWorkflowService)1 WorkflowServiceTChannel (com.uber.cadence.serviceclient.WorkflowServiceTChannel)1 AtomicBoolean (java.util.concurrent.atomic.AtomicBoolean)1 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)1 Consumer (java.util.function.Consumer)1 TestCase (junit.framework.TestCase)1 Matchers.any (org.mockito.Matchers.any)1 Mockito (org.mockito.Mockito)1 Logger (org.slf4j.Logger)1 LoggerFactory (org.slf4j.LoggerFactory)1