static void Main(string[] args) { BoundedBuffer boundedBuffer = new BoundedBuffer(); MyProducer prod = new MyProducer(boundedBuffer, 20); Thread producerThread = prod.CreateProducerThread(); MyConsumer cons = new MyConsumer(boundedBuffer, 20); Thread consumerThread = cons.CreateConsumerThread(); producerThread.Start(); consumerThread.Start(); Console.ReadLine(); }
protected override void OnStart(string[] args) { Task.Factory.StartNew(async() => { var dir = AppDomain.CurrentDomain.BaseDirectory; var myProducer = new MyProducer("10.0.0.6:9092", "MyTopic", $"{dir}\\kafka.log", $"{dir}\\app.log"); int i = 1; while (true) { await myProducer.SendMessage(i.ToString()); i++; await Task.Delay(5000); } }); }
static async Task Main(string[] args) { var dir = AppDomain.CurrentDomain.BaseDirectory; var myProducer = new MyProducer("10.0.0.6:9092", "MyTopic", $"{dir}\\kafka.log", $"{dir}\\app.log"); int i = 1; Console.WriteLine("Sending message, please check out the log file. Press CTRL+C to exit."); while (true) { await myProducer.SendMessage(i.ToString()); i++; await Task.Delay(5000); ; } }
public async Task GrainShouldSuccessfullyPullFromClientObject() { var myOb = new MyProducer(); this.anchor = myOb; var myRef = await((GrainFactory)GrainClient.GrainFactory).CreateObjectReference <IClientAddressableTestProducer>(myOb); var rendez = GrainClient.GrainFactory.GetGrain <IClientAddressableTestRendezvousGrain>(0); var consumer = GrainClient.GrainFactory.GetGrain <IClientAddressableTestConsumer>(0); await rendez.SetProducer(myRef); await consumer.Setup(); var n = await consumer.PollProducer(); Assert.AreEqual(1, n); await GrainReference.DeleteObjectReference(myRef); }
public ClickHub(MyProducer _myProducer) { this.myProducer = _myProducer; this.askHistorySubject = new Subject <string>(); }
public async Task GrainShouldSuccessfullyPullFromClientObject() { var myOb = new MyProducer(); this.anchor = myOb; var myRef = await ((GrainFactory)GrainClient.GrainFactory).CreateObjectReference<IClientAddressableTestProducer>(myOb); var rendez = GrainClient.GrainFactory.GetGrain<IClientAddressableTestRendezvousGrain>(0); var consumer = GrainClient.GrainFactory.GetGrain<IClientAddressableTestConsumer>(0); await rendez.SetProducer(myRef); await consumer.Setup(); var n = await consumer.PollProducer(); Assert.AreEqual(1, n); await GrainReference.DeleteObjectReference(myRef); }