/* Requester */
        static void cMain(string[] args)
        {
            // create the cient
            LightrailClient client = new LightrailClient("name", "description");

            // start the client
            client.StartDeliveries();

            // register the requester terminal
            client.RegisterTerminal(TerminalStandpoint.Requester, "ReqTerminal", "ReqDesc",
                                    "[Global>Company>Region>Domain>App>Instance>Request]");

            // create a request message
            Delivery request = new Delivery("This is a string message that will be encoded as UTF-8");

            // send the request and get the response with a 30 second timeout
            DetailedDelivery response = client.Request("ReqTerminal", request, 30000);

            // parse the response
            string responseString = response.MessageString();

            // send more and more and more requests

            // close the instance
            client.StopDeliveries();
        }
        /* Responder */
        static void dMain(string[] args)
        {
            // create the cient
            LightrailClient client = new LightrailClient("name", "description");

            // set up callback
            client.OnRequestReceived += new RequestReceived(client_OnRequestReceived);

            // start the client
            client.StartDeliveries();

            // register the responder terminal
            client.RegisterTerminal(TerminalStandpoint.Responder, "RespTerminal", "RespDesc",
                                    "[Global>Company>Region>Domain>App>Instance>Request]");

            // wait for any and all messages to be requests to be delivered

            // close the instance
            client.StopDeliveries();
        }
        /* Publisher */
        static void aMain(string[] args)
        {
            // create the cient
            LightrailClient client = new LightrailClient("name", "description");

            // start the client
            client.StartDeliveries();

            // register the publisher terminal
            client.RegisterTerminal(TerminalStandpoint.Publisher, "PubTerminal", "PubDesc",
                                    "[Global>Company>Region>Domain>App>Instance>Publish]");

            // create a message
            Delivery message = new Delivery("This is a string message that will be encoded as UTF-8");

            // send the message
            client.Publish("PubTerminal", message);

            // send more and more and more messages

            // close the instance
            client.StopDeliveries();
        }
Пример #4
0
 public static void MyClassInitialize(TestContext testContext)
 {
     m_client1 = new LightrailClient("Client1", "Desc");
     m_client1.StartDeliveries();
 }