public void BasicTests() { Client c = new Client(_projectId, _token); Queue q = c.queue("test-queue"); ClearQueue(q); // clear_queue q.push("hello world!"); Message msg = q.get(); Assert.IsNotNull(msg.Id); Assert.IsNotNull(msg.Body); q.deleteMessage(msg.Id); msg = q.get(); Assert.IsNull(msg); q.push("hello world 2!"); msg = q.get(); Assert.IsNotNull(msg); q.deleteMessage(msg.Id); msg = q.get(); Assert.IsNull(msg); }
public void BasicTests() { var c = new Client(_credentials); var q = c.Queue("test-queue"); ClearQueue(q); // clear_queue q.Enqueue("hello world!"); var msg = q.Dequeue(); Assert.IsNotNull(msg.Id); Assert.IsNotNull(msg.Body); q.Delete(msg.Id); msg = q.Dequeue(); Assert.IsNull(msg); q.Enqueue("hello world 2!"); msg = q.Dequeue(); Assert.IsNotNull(msg); q.Delete(msg.Id); msg = q.Dequeue(); Assert.IsNull(msg); }
static void Main(string[] args) { // run the exe // pesho // kiro // rerun the exe // kiro // pesho Console.WriteLine("Enter your chanel name: "); string senderChanelName = Console.ReadLine(); Console.WriteLine("Enter chanel name for the user you want to chat with: "); string receiverChanelName = Console.ReadLine(); Client client = new Client("520f6b22cd2e16000d00000c", "oC7j96AKY9NcuPfVpLOnZm-zTzU"); Queue receiverChanel = client.queue(receiverChanelName); Queue senderChanel = client.queue(senderChanelName); Communicate communication = new Communicate(senderChanel, receiverChanel, senderChanelName); Thread sender = new Thread(new ThreadStart(communication.SendMessage)); Thread receiver = new Thread(new ThreadStart(communication.GetMessage)); sender.Start(); receiver.Start(); }
public static void Main() { var credentials = CredentialsRepository.LoadFrom("appchatten.iron.io.credentials.txt", Assembly.GetExecutingAssembly()); var client = new Client(credentials); var queue = client.Queue("spike"); var producer = new Thread(() => { while(true) { var s = Console.ReadLine(); if (s == "exit") { return; } queue.Enqueue(s); } }); var consumer = new Thread(() => { while(true) { var message = queue.Dequeue(); if (message != null) { Console.WriteLine(message.Body); queue.Delete(message); } else { Thread.Sleep(100); } } }); producer.Start(); consumer.Start(); Thread.Sleep(60000); }
public void Run() { var sut = new Client(CredentialsRepository.LoadFrom("ironmq.credentials.txt")); Console.WriteLine("1"); var q = sut.Queue("monotest"); Console.WriteLine("2"); q.Enqueue("test"); Console.WriteLine("3"); }
public Calculator() { TaskScheduler.UnobservedTaskException += (sender, e) => { e.SetObserved(); }; var _projectId = ConfigurationManager.AppSettings["IRON_MQ_PROJECT_ID"]; var _token = ConfigurationManager.AppSettings["IRON_MQ_TOKEN"]; _client = new Client(_projectId, _token); }
public void BulkGetTest() { var c = new Client(_credentials); var q = c.Queue("test-queue"); ClearQueue(q); var messages = Enumerable.Range(0, 10).Select(i => i.ToString()).ToArray(); const long timeout = 0; q.Enqueue(messages, timeout); var actual = q.Dequeue(100); Assert.IsNotNull(actual); Assert.IsTrue(actual.Count > 1); }
static void Main(string[] args) { const string QUEUE_NAME = "batch_exercise"; var cli = new Client(CredentialsRepository.LoadFrom("ironmq.credentials.txt")); var q = cli.Queue(QUEUE_NAME); q.Enqueue("hello " + DateTime.Now); var msg = q.Dequeue(); Console.WriteLine(msg.Body); q.Delete(msg); }
static void Main(string[] args) { Client client = new Client("520f706527c7200005000001", "JySHBhogfvbKpQ8I5CkUFoY-FnI"); Queue queue = client.queue("ChatQueue"); Console.WriteLine("You can start entering messages:"); while (true) { string msg = Console.ReadLine(); queue.push(msg); Console.WriteLine("Message sent to IronMQ server."); } }
static void Main(string[] args) { Client client = new Client( "520f706527c7200005000001", "JySHBhogfvbKpQ8I5CkUFoY-FnI"); Queue queue = client.queue("ChatQueue"); Console.WriteLine("Listening for new messages from IronMQ server:"); while (true) { Message msg = queue.get(); if (msg != null) { Console.WriteLine(msg.Body); queue.deleteMessage(msg); } Thread.Sleep(100); } }
public static void Main() { var client = new Client("564a0cd24aa03100090000c3", "d9eQI5ueHbRdjXLdsr8r"); var queue = client.queue("Last messages"); Console.WriteLine("Listening for messages:"); while (true) { var message = queue.get(); if (message == null) { continue; } Console.WriteLine(message.Body); queue.deleteMessage(message); } }
public static void Main() { Client client = new Client( "564191224aa03100070000c9", "SI9mlvuSEQqy6o7W5vip4SFNfx0"); Queue queue = client.queue("Today's demo"); Console.WriteLine("Listening for new messages from IronMQ server:"); while (true) { Message msg = queue.get(); if (msg != null) { Console.WriteLine(msg.Body); queue.deleteMessage(msg); } Thread.Sleep(100); } }
static void Main(string[] args) { var projectId = ConfigurationManager.AppSettings["IRON_MQ_PROJECT_ID"]; var token = ConfigurationManager.AppSettings["IRON_MQ_TOKEN"]; var client = new Client(projectId, token); Queue queue = client.queue("simpleChat"); Console.WriteLine("Listening for new messages from IronMQ server:"); while (true) { Message queueMsg = queue.get(); if (queueMsg != null) { ChatMsg msg = Newtonsoft.Json.JsonConvert.DeserializeObject<AppHarborIronMQ.Model.ChatMsg>(queueMsg.Body); Console.WriteLine("New message from {0} : {1}", msg.Sender, msg.Text); queue.deleteMessage(queueMsg); } Thread.Sleep(100); } }
static void Main(string[] args) { var projectId = ConfigurationManager.AppSettings["IRON_MQ_PROJECT_ID"]; var token = ConfigurationManager.AppSettings["IRON_MQ_TOKEN"]; var client = new Client(projectId, token); Queue queue = client.queue("simpleChat"); Console.WriteLine("Please enter your name"); string name = Console.ReadLine(); Console.WriteLine("Send messages for IronMQ server:"); while (true) { string text = Console.ReadLine(); ChatMsg newMsg = new ChatMsg() { Text = text, Sender = name }; queue.push(JsonConvert.SerializeObject(newMsg)); Console.WriteLine("Message sent to the IronMQ server."); } }
static void Main(string[] args) { Client client = new Client( "520a43c24ce3460009000006", "TWlNAHfIkmuTc-WPS32NeC9tm6c"); Queue queue = client.queue("StanChatQueue"); Console.WriteLine("Listening for new messages from IronMQ server:"); while (true) { Message msg = queue.get(); if (msg != null) { Console.WriteLine(msg.Body); queue.deleteMessage(msg); } if (Console.KeyAvailable) { string typedMsg = Console.ReadLine(); queue.push(typedMsg); } Thread.Sleep(100); } }
public IronMQOperations(string queueName, Token credentials) { _client = new Client(credentials.Key, credentials.Secret, proto:"http", port:80); _queue = _client.Queue(queueName); }
public void BasicTests() { Client c = new Client(_projectId, _token); Queue q = c.queue("test-queue"); ClearQueue(q); // clear_queue q.push("hello world!"); Message msg = q.get(); Assert.IsNotNull( msg.Id ); Assert.IsNotNull( msg.Body ); //queue = @client.queues.get(:name=>@client.queue_name) //total_messages = queue.total_messages //res = @client.messages.post("hello world!") //p res //assert res["id"] //assert res.id //assert res.msg //queue = @client.queues.get(:name=>@client.queue_name) //assert queue.size == 1 //assert queue.total_messages == (total_messages+1) // msg = q.get(); // Assert.IsNotNull( msg.Id ); //res = @client.messages.get() //p res //assert res["id"] //assert res.id q.deleteMessage( msg.Id ); msg = q.get(); Assert.IsNull( msg ); //res = @client.messages.delete(res["id"]) //p res //puts "shouldn't be any more" //res = @client.messages.get() //p res //assert res.nil? //queue = @client.queues.get(:name=>@client.queue_name) //assert queue.size == 0 q.push("hello world 2!"); //res = @client.messages.post("hello world 2!") //p res msg = q.get(); Assert.IsNotNull(msg); //msg = @client.messages.get() //p msg //assert msg q.deleteMessage(msg.Id); //res = msg.delete //p res msg = q.get(); Assert.IsNull(msg); //puts "shouldn't be any more" //res = @client.messages.get() //p res //assert res.nil? }
public Queue(Client client, string name) { this.client = client; this.name = name; }
public void BulkPushTest() { Client c = new Client(_projectId, _token); Queue q = c.queue("test-queue"); ClearQueue(q); var messages = Enumerable.Range(0, 10).Select(i => i.ToString()).ToArray(); long timeout = 0; q.push(messages, timeout); for (int i = 0; i < 10; i++) { var msg = q.get(); Assert.IsNotNull(msg); } // Assumption is that if we queued up 1000 and we got back 1000 then it worked fine. // Note: this does not verify we got back the same messages }
public void BulkPushTest() { var c = new Client(_credentials); var q = c.Queue("test-queue"); ClearQueue(q); var messages = Enumerable.Range(0, 10).Select(i => i.ToString()).ToArray(); const long timeout = 0; q.Enqueue(messages, timeout); for (var i = 0; i < 10; i++) { var msg = q.Dequeue(); Assert.IsNotNull(msg); } // Assumption is that if we queued up 1000 and we got back 1000 then it worked fine. // Note: this does not verify we got back the same messages }
public void ClearEmptyQueueTest() { Client c = new Client(_projectId, _token); Queue q = c.queue("test-queue"); ClearQueue(q); // At this point the queue should be empty q.clear(); }
public void ClearQueueTest() { Client c = new Client(_projectId, _token); Queue q = c.queue("test-queue"); ClearQueue(q); var messageBody = "This is a test of the emergency broadcasting system... Please stand by..."; q.push(messageBody); q.clear(); var msg = q.get(); Assert.IsNull(msg); }
public void TestMethod1() { var c = new Client(_credentials); var q = c.Queue("test-queue"); ClearQueue(q); var body = "Hello, IronMQ!"; q.Enqueue(body); var msg = q.Dequeue(); Assert.IsTrue(string.Compare(body, msg.Body) == 0); q.Delete(msg); }
public void ClearQueueTest() { var c = new Client(_credentials); var q = c.Queue("test-queue"); ClearQueue(q); const string messageBody = "This is a test of the emergency broadcasting system... Please stand by..."; q.Enqueue(messageBody); q.Clear(); var msg = q.Dequeue(); Assert.IsNull(msg); }
public void ClearEmptyQueueTest() { var c = new Client(_credentials); var q = c.Queue("test-queue"); ClearQueue(q); // At this point the queue should be empty q.Clear(); }
public void TestMethod1() { Client c = new Client(_projectId, _token); Queue q = c.queue("test-queue"); ClearQueue(q); string body = "Hello, IronMQ!"; q.push(body); Message msg = q.get(); Assert.IsTrue(string.Compare(body, msg.Body) == 0); q.deleteMessage(msg); }
public void BulkGetTest() { Client c = new Client(_projectId, _token); Queue q = c.queue("test-queue"); ClearQueue(q); var messages = Enumerable.Range(0, 10).Select(i => i.ToString()).ToArray(); long timeout = 0; q.push(messages, timeout); var actual = q.get(100); Assert.IsNotNull(actual); Assert.IsTrue(actual.Count > 1); }