public void can_submit_backgroundjob() { var client = new GearmanClient(); client.AddServer(Helpers.TestServerHost, Helpers.TestServerPort); var jobRequest = client.SubmitBackgroundJob("reverse", Encoding.ASCII.GetBytes("Hello World")); Assert.IsNotNull(jobRequest); Assert.IsNotNull(jobRequest.JobHandle); }
public void can_fetch_jobstatus() { var client = new GearmanClient(); client.AddServer(Helpers.TestServerHost, Helpers.TestServerPort); var jobRequest = client.SubmitBackgroundJob("reverse", Encoding.ASCII.GetBytes("Hello World")); var jobStatus = client.GetStatus(jobRequest); Assert.IsNotNull(jobStatus); // We can't safely assert that jobStatus.IsKnown is true, but it most likely should be. }
private static void CreateBackgroundJobs(GearmanClient client, int jobCount) { for (int i = 0; i < jobCount; i++) { var request = client.SubmitBackgroundJob("reverse_with_status", Encoding.UTF8.GetBytes(String.Format("{0}: Hello World", i))); GearmanJobStatus jobStatus; do { jobStatus = client.GetStatus(request); }while (jobStatus.IsKnown && jobStatus.IsRunning); Console.WriteLine("Submitted background job. Handle: {0}", request.JobHandle); } }
private static void CreateBackgroundJobs(GearmanClient client, int jobCount) { for (int i = 0; i < jobCount; i++) { var request = client.SubmitBackgroundJob("reverse_with_status", Encoding.UTF8.GetBytes(String.Format("{0}: Hello World", i))); GearmanJobStatus jobStatus; do { jobStatus = client.GetStatus(request); } while (jobStatus.IsKnown && jobStatus.IsRunning); Console.WriteLine("Submitted background job. Handle: {0}", request.JobHandle); } }
public void SimpleClient() { var client = new GearmanClient("gearmanCluster"); var handle = client.SubmitBackgroundJob("reverse", Encoding.ASCII.GetBytes("helloworld")); }