示例#1
0
        static async Task Main(string[] args)
        {
            using var channel = GrpcChannel.ForAddress("https://localhost:5001");
            var client = new Gateway.GatewayClient(channel);

            Console.Write("Type in your desired date: ");
            var input = Console.ReadLine();
            var date  = IsDateValid(input);

            if (date == null)
            {
                throw new ArgumentException("The date must be valid.");
            }

            var dateToBeSent = new ZodiacSignsService.Date()
            {
                Month = date.Month,
                Day   = date.Day,
                Year  = date.Year
            };

            var reply = await client.ProcessRequestAsync(
                new GatewayRequest
            {
                Date = dateToBeSent
            });;

            Console.WriteLine("The zodiac sign associated with that date is " + reply.ZodiacSign);
            Console.WriteLine("Press any key to exit...");
            Console.ReadKey();
        }
示例#2
0
        internal ZeebeClient(string address,
                             ChannelCredentials credentials,
                             TimeSpan?keepAlive,
                             Func <int, TimeSpan> sleepDurationProvider,
                             ILoggerFactory loggerFactory = null)
        {
            this.loggerFactory = loggerFactory;

            var channelOptions  = new List <ChannelOption>();
            var userAgentString = "client: csharp, version: " + typeof(ZeebeClient).Assembly.GetName().Version;
            var userAgentOption = new ChannelOption(ChannelOptions.PrimaryUserAgentString, userAgentString);

            channelOptions.Add(userAgentOption);

            AddKeepAliveToChannelOptions(channelOptions, keepAlive);

            channelToGateway =
                new Channel(address, credentials, channelOptions);
            gatewayClient = new Gateway.GatewayClient(channelToGateway);


            asyncRetryStrategy =
                new TransientGrpcErrorRetryStrategy(sleepDurationProvider ??
                                                    DefaultWaitTimeProvider);
        }
 public CreateProcessInstanceCommandWithResult(Gateway.GatewayClient client, CreateProcessInstanceRequest createRequest)
 {
     this.client             = client;
     createWithResultRequest = new CreateProcessInstanceWithResultRequest {
         Request = createRequest
     };
 }
 public ResolveIncidentCommand(Gateway.GatewayClient client, long incidentKey)
 {
     request = new ResolveIncidentRequest
     {
         IncidentKey = incidentKey
     };
     this.client = client;
 }
 public CancelWorkflowInstanceCommand(Gateway.GatewayClient client, long workflowInstanceKey)
 {
     request = new CancelWorkflowInstanceRequest
     {
         WorkflowInstanceKey = workflowInstanceKey
     };
     this.client = client;
 }
 public SetVariablesCommand(Gateway.GatewayClient client, long elementInstanceKey)
 {
     request = new SetVariablesRequest
     {
         ElementInstanceKey = elementInstanceKey
     };
     this.client = client;
 }
 public UpdatePayloadCommand(Gateway.GatewayClient client, long elementInstanceKey)
 {
     request = new UpdateWorkflowInstancePayloadRequest
     {
         ElementInstanceKey = elementInstanceKey
     };
     this.client = client;
 }
 public CreateProcessInstanceCommandWithResult(Gateway.GatewayClient client, IAsyncRetryStrategy asyncRetryStrategy, CreateProcessInstanceRequest createRequest)
 {
     this.client             = client;
     createWithResultRequest = new CreateProcessInstanceWithResultRequest {
         Request = createRequest
     };
     this.asyncRetryStrategy = asyncRetryStrategy;
 }
示例#9
0
 public UpdateRetriesCommand(Gateway.GatewayClient client, long jobKey)
 {
     request = new UpdateJobRetriesRequest
     {
         JobKey = jobKey
     };
     this.client = client;
 }
示例#10
0
 public CancelProcessInstanceCommand(Gateway.GatewayClient client, IAsyncRetryStrategy asyncRetryStrategy, long processInstanceKey)
 {
     request = new CancelProcessInstanceRequest
     {
         ProcessInstanceKey = processInstanceKey
     };
     this.client             = client;
     this.asyncRetryStrategy = asyncRetryStrategy;
 }
 public JobWorkerBuilder(
     Gateway.GatewayClient client,
     IJobClient jobClient,
     ILoggerFactory loggerFactory = null)
 {
     LoggerFactory = loggerFactory;
     Client        = client;
     JobClient     = jobClient;
 }
示例#12
0
 public ResolveIncidentCommand(Gateway.GatewayClient client, IAsyncRetryStrategy asyncRetryStrategy, long incidentKey)
 {
     request = new ResolveIncidentRequest
     {
         IncidentKey = incidentKey
     };
     this.client             = client;
     this.asyncRetryStrategy = asyncRetryStrategy;
 }
示例#13
0
 public SetVariablesCommand(Gateway.GatewayClient client, IAsyncRetryStrategy asyncRetryStrategy, long elementInstanceKey)
 {
     request = new SetVariablesRequest
     {
         ElementInstanceKey = elementInstanceKey
     };
     this.client             = client;
     this.asyncRetryStrategy = asyncRetryStrategy;
 }
示例#14
0
 public CancelWorkflowInstanceCommand(Gateway.GatewayClient client, IAsyncRetryStrategy asyncRetryStrategy, long workflowInstanceKey)
 {
     request = new CancelWorkflowInstanceRequest
     {
         WorkflowInstanceKey = workflowInstanceKey
     };
     this.client             = client;
     this.asyncRetryStrategy = asyncRetryStrategy;
 }
示例#15
0
 public UpdateRetriesCommand(Gateway.GatewayClient client, IAsyncRetryStrategy asyncRetryStrategy, long jobKey)
 {
     request = new UpdateJobRetriesRequest
     {
         JobKey = jobKey
     };
     this.client             = client;
     this.asyncRetryStrategy = asyncRetryStrategy;
 }
示例#16
0
 public JobWorkerBuilder(IZeebeClient zeebeClient,
                         Gateway.GatewayClient gatewayClient,
                         ILoggerFactory loggerFactory = null)
 {
     LoggerFactory = loggerFactory;
     Activator     = new JobActivator(gatewayClient);
     Request       = new ActivateJobsRequest();
     JobClient     = zeebeClient;
     ThreadCount   = 1;
 }
示例#17
0
 internal JobWorker(Gateway.GatewayClient client, ActivateJobsRequest request, TimeSpan pollInterval,
                    IJobClient jobClient, JobHandler jobHandler)
 {
     source            = new CancellationTokenSource();
     this.client       = client;
     activeRequest     = request;
     this.pollInterval = pollInterval;
     this.jobClient    = jobClient;
     this.jobHandler   = jobHandler;
 }
示例#18
0
        public void Dispose()
        {
            if (gatewayClient is ClosedGatewayClient)
            {
                return;
            }

            gatewayClient = new ClosedGatewayClient();
            channelToGateway.ShutdownAsync().Wait();
        }
示例#19
0
 internal JobWorker(Gateway.GatewayClient client, ActivateJobsRequest request, TimeSpan pollInterval,
                    IJobClient jobClient, JobHandler jobHandler)
 {
     this.source        = new CancellationTokenSource();
     this.client        = client;
     this.activator     = new JobActivator(client);
     this.activeRequest = request;
     this.maxJobsActive = request.MaxJobsToActivate;
     this.pollInterval  = pollInterval;
     this.jobClient     = jobClient;
     this.jobHandler    = jobHandler;
 }
示例#20
0
        public async Task Connect()
        {
            Console.WriteLine("Successfully connected to server.");

            _messageClient = GrpcServiceProvider.Instance.MessageClient;
            _gatewayClient = GrpcServiceProvider.Instance.GatewayClient;

            _clientsUpdatesResponseStream = _gatewayClient.GetClientsUpdates(new Empty()).ResponseStream;
            _messagesResponseStream       = _messageClient.SendMessage().ResponseStream;

            await Task.WhenAll(ListenToMessages(), ListenToClientsUpdates());
        }
示例#21
0
        internal ZeebeClient(string address,
                             ChannelCredentials credentials,
                             TimeSpan?keepAlive,
                             ILoggerFactory loggerFactory = null)
        {
            this.loggerFactory = loggerFactory;

            var channelOptions  = new List <ChannelOption>();
            var userAgentString = "client: csharp, version: " + typeof(ZeebeClient).Assembly.GetName().Version;
            var userAgentOption = new ChannelOption(ChannelOptions.PrimaryUserAgentString, userAgentString);

            channelOptions.Add(userAgentOption);

            AddKeepAliveToChannelOptions(channelOptions, keepAlive);

            channelToGateway =
                new Channel(address, credentials, channelOptions);
            gatewayClient = new Gateway.GatewayClient(channelToGateway);
        }
示例#22
0
 public JobWorkerBuilder(Gateway.GatewayClient client, IJobClient jobClient)
 {
     Client    = client;
     JobClient = jobClient;
 }
 public DeployWorkflowCommand(Gateway.GatewayClient client)
 {
     gatewayClient = client;
     request       = new DeployWorkflowRequest();
 }
示例#24
0
 public DeployProcessCommand(Gateway.GatewayClient client, IAsyncRetryStrategy asyncRetryStrategy)
 {
     gatewayClient           = client;
     this.asyncRetryStrategy = asyncRetryStrategy;
     request = new DeployProcessRequest();
 }
示例#25
0
 public CreateProcessInstanceCommand(Gateway.GatewayClient client)
 {
     this.client = client;
     request     = new CreateProcessInstanceRequest();
 }
 public DeployProcessCommand(Gateway.GatewayClient client)
 {
     gatewayClient = client;
     request       = new DeployProcessRequest();
 }
 public CreateWorkflowInstanceCommand(Gateway.GatewayClient client)
 {
     this.client = client;
     request     = new CreateWorkflowInstanceRequest();
 }
示例#28
0
 private ZeebeClient(string address)
 {
     channelToGateway = new Channel(address, ChannelCredentials.Insecure);
     gatewayClient    = new Gateway.GatewayClient(channelToGateway);
 }
示例#29
0
 public ListWorkflowRequest(Gateway.GatewayClient client)
 {
     this.client = client;
     request     = new ListWorkflowsRequest();
 }
 internal ZeebeClient(string address, ChannelCredentials credentials, ILoggerFactory loggerFactory = null)
 {
     this.loggerFactory = loggerFactory;
     channelToGateway   = new Channel(address, credentials);
     gatewayClient      = new Gateway.GatewayClient(channelToGateway);
 }