// Collection of code snippets by Arne Vajhøj // (from articles on eksperten.dk / vajhoej.dk written sometime between 2004 and now) using System; using System.Text; using RabbitMQ.Client; namespace Send { public class Program { private const string HOST = "localhost"; private const int PORT = 5672; private const string UN = "guest"; private const string PW = "guest"; private const string QNAME = "TestQ"; private const string PAYLOAD = "\r\n 123\r\n ABC\r\n"; public static void Main(string[] args) { ConnectionFactory cf = new ConnectionFactory(); cf.HostName = HOST; cf.Port = PORT; cf.UserName = UN; cf.Password = PW; using(IConnection con = cf.CreateConnection()) { using(IModel chan = con.CreateModel()) { for(int i = 0; i < 3; i++) { chan.BasicPublish("", QNAME, false, null, Encoding.UTF8.GetBytes(PAYLOAD)); } } } } } }