private static void CreateJobs(GearmanClient client, int jobCount) { for (int i = 0; i < jobCount; i++) { var result = client.SubmitJob <string, string>("reverse", String.Format("{0}: Hello World", i), Serializers.UTF8StringSerialize, Serializers.UTF8StringDeserialize); Console.WriteLine("Job result: {0}", result); } }
private static void CreateJobs(GearmanClient client, int jobCount) { for (int i = 0; i < jobCount; i++) { var result = client.SubmitJob<string, string>("reverse", String.Format("{0}: Hello World", i), Serializers.UTF8StringSerialize, Serializers.UTF8StringDeserialize); Console.WriteLine("Job result: {0}", result); } }
public void AdvancedClient() { var client = new GearmanClient(); client.AddServer("gearman.example.com"); client.AddServer("10.0.0.2", 4730); var urls = new List<string> { "http://www.youtube.com/watch?v=abc123456", "http://www.youtube.com/watch?v=xyz9876" }; var oembeds = client.SubmitJob<IList<string>, IList<OEmbed>>("GetOEmbeds", urls, Serializers.JsonSerialize<IList<string>>, Serializers.JsonDeserialize<IList<OEmbed>>); }
public void AdvancedClient() { var client = new GearmanClient(); client.AddServer("gearman.example.com"); client.AddServer("10.0.0.2", 4730); var urls = new List <string> { "http://www.youtube.com/watch?v=abc123456", "http://www.youtube.com/watch?v=xyz9876" }; var oembeds = client.SubmitJob <IList <string>, IList <OEmbed> >("GetOEmbeds", urls, Serializers.JsonSerialize <IList <string> >, Serializers.JsonDeserialize <IList <OEmbed> >); }
public void can_get_job_event() { bool createFired = false; bool completeFired = false; bool completeData = false; var client = new GearmanClient(); client.JobCreated += (o, e) => createFired = true; client.JobCompleted += (o, e) => completeFired = true; client.JobCompleted += (o, e) => completeData = (e.Data.SequenceEqual(Encoding.ASCII.GetBytes("dlroW olleH"))); client.AddServer(Helpers.TestServerHost, Helpers.TestServerPort); var jobRequest = client.SubmitJob("reverse", Encoding.ASCII.GetBytes("Hello World")); Assert.IsTrue(createFired); Assert.IsTrue(completeFired); Assert.IsTrue(completeData); }