Example #1
0
        static void Main()
        {
            //Create NGRIDClient object to connect to NGRID
            //Name of this application: ProducerSample
            var ngridClient = new NGRIDClient("ProducerSample");

            //Connect to NGRID server
            ngridClient.Connect();

            Console.WriteLine("Enter text to be sent to consumer sample.");

            while (true)
            {
                //Get a message from user
                var messageText = Console.ReadLine();
                if (string.IsNullOrEmpty(messageText) || messageText == "exit")
                {
                    break;
                }

                //Create a NGRID Message to send to ConsumerSample
                var message = ngridClient.CreateMessage();
                //Set destination application name
                message.DestinationApplicationName = "ConsumerSample";
                //message.DestinationServerName = "someserver";
                //Set message data
                message.MessageData = Encoding.UTF8.GetBytes(messageText);

                //Send message
                message.Send();
            }

            //Disconnect from NGRID server
            ngridClient.Disconnect();
        }
Example #2
0
            /// <summary>
            /// Creates a new IncomingDataMessage object from a NGRIDDataTransferMessage object.
            /// </summary>
            /// <param name="client">Reference to the NGRIDClient object</param>
            /// <param name="message">NGRIDDataTransferMessage object to create IncomingDataMessage</param>
            public IncomingDataMessage(NGRIDClient client, NGRIDDataTransferMessage message)
            {
                _client = client;

                DestinationApplicationName = message.DestinationApplicationName;
                DestinationCommunicatorId  = message.DestinationCommunicatorId;
                DestinationServerName      = message.DestinationServerName;
                MessageData           = message.MessageData;
                MessageId             = message.MessageId;
                PassedServers         = message.PassedServers;
                RepliedMessageId      = message.RepliedMessageId;
                SourceApplicationName = message.SourceApplicationName;
                SourceCommunicatorId  = message.SourceCommunicatorId;
                SourceServerName      = message.SourceServerName;
                TransmitRule          = message.TransmitRule;
            }
Example #3
0
        static void Main(string[] args)
        {
            //Create NGRIDClient object to connect to NGRID
            //Name of this application: ConsumerSample
            var ngridClient = new NGRIDClient("ConsumerSample");

            //Register to MessageReceived event to get messages.
            ngridClient.MessageReceived += NGRIDClient_MessageReceived;

            //Connect to NGRID server
            ngridClient.Connect();

            //Wait user to press enter to terminate application
            Console.WriteLine("hit enter to quit...");
            Console.ReadLine();

            //Disconnect from NGRID server
            ngridClient.Disconnect();
        }
Example #4
0
 /// <summary>
 /// Creates a new OutgoingDataMessage object.
 /// </summary>
 /// <param name="client">Reference to the NGRIDClient object</param>
 public OutgoingDataMessage(NGRIDClient client)
 {
     _client = client;
 }
Example #5
0
            /// <summary>
            /// Creates a new IncomingDataMessage object from a NGRIDDataTransferMessage object.
            /// </summary>
            /// <param name="client">Reference to the NGRIDClient object</param>
            /// <param name="message">NGRIDDataTransferMessage object to create IncomingDataMessage</param>
            public IncomingDataMessage(NGRIDClient client, NGRIDDataTransferMessage message)
            {
                _client = client;

                DestinationApplicationName = message.DestinationApplicationName;
                DestinationCommunicatorId = message.DestinationCommunicatorId;
                DestinationServerName = message.DestinationServerName;
                MessageData = message.MessageData;
                MessageId = message.MessageId;
                PassedServers = message.PassedServers;
                RepliedMessageId = message.RepliedMessageId;
                SourceApplicationName = message.SourceApplicationName;
                SourceCommunicatorId = message.SourceCommunicatorId;
                SourceServerName = message.SourceServerName;
                TransmitRule = message.TransmitRule;
            }
Example #6
0
 /// <summary>
 /// Creates a new OutgoingDataMessage object.
 /// </summary>
 /// <param name="client">Reference to the NGRIDClient object</param>
 public OutgoingDataMessage(NGRIDClient client)
 {
     _client = client;
 }