public Message reply(string content, string message_type="response") { if (!this.received) throw new MessageException("Can only reply to received " + "messages"); if (Convert.ToBoolean(this.acked) && this.replyTo!="" && this.replyTo!=null) { Message msg = new Message(channel, exchange, this.replyTo, content, redelivered, deliveryTag); msg.send(); return msg; } else { if (this.replyTo!="" ) throw new MessageException("Cannot reply to message. A reply was " + "requested but the message was not " + "acknowledged."); else throw new MessageException("Cannot reply to message. The " + "message did not include a reply-to " + "property"); } }
public void publish(string message) { /* Publishes a message to configured exchanges with the configured routing key @param message: The message to be published */ Console.WriteLine(message); foreach (KeyValuePair<string, string> exchange in exchanges) { Message msg = new Message(channel, exchange.Key, exchange.Value, message, false, 0); msg.send(); } }