Beispiel #1
0
        public void RawApi()
        {
            string host = "localhost";
            int    port = 5672;

            org.apache.qpid.client.Client client = new org.apache.qpid.client.Client();
            try
            {
                client.Connect(host, port, "dev-only", "guest", "guest");
                org.apache.qpid.client.IClientSession session = client.CreateSession(50000);

                //
                org.apache.qpid.client.IMessage message = new org.apache.qpid.client.Message();
                message.DeliveryProperties.SetRoutingKey("routing_key");
                for (int i = 0; i < 10; i++)
                {
                    message.ClearData();
                    message.AppendData(Encoding.UTF8.GetBytes("Message " + i));
                    session.MessageTransfer("amq.direct", message);
                }
                message.ClearData();
                message.AppendData(Encoding.UTF8.GetBytes("That's all, folks!"));
                session.MessageTransfer("amq.direct", "routing_key", message);
                session.Sync();


                //
                client.Close();
            }
            catch (Exception e)
            {
                Console.WriteLine("Error: \n" + e.StackTrace);
            }
        }
        public void RawApi()
        {
            string host = "localhost";
            int port = 5672;
            org.apache.qpid.client.Client client = new org.apache.qpid.client.Client();
            try
            {                
                client.Connect(host, port, "dev-only", "guest", "guest");
                org.apache.qpid.client.IClientSession session = client.CreateSession(50000);

                //
                org.apache.qpid.client.IMessage message = new org.apache.qpid.client.Message();
                message.DeliveryProperties.SetRoutingKey("routing_key");
                for (int i = 0; i < 10; i++)
                {
                    message.ClearData();
                    message.AppendData(Encoding.UTF8.GetBytes("Message " + i));
                    session.MessageTransfer("amq.direct", message);
                }
                message.ClearData();
                message.AppendData(Encoding.UTF8.GetBytes("That's all, folks!"));
                session.MessageTransfer("amq.direct", "routing_key", message);
                session.Sync();
                

                //
                client.Close();
            }
            catch (Exception e)
            {
                Console.WriteLine("Error: \n" + e.StackTrace);
            }

        }