Beispiel #1
0
 public void RegisterMessageProcessor(IMessageProcessor messageProcessor)
 {
     if (!MessageProcessors.Contains(messageProcessor))
     {
         MessageProcessors.Add(messageProcessor);
     }
 }
Beispiel #2
0
        public string Execute(RemoteExecutionContext executionContext)
        {
            Log($"\nMessage received at {DateTime.Now}");
            var rv = new Response {
                Message = "Unknown Error", Result = "0", Status = 500
            };
            var operation = "Unknown";

            try
            {
                operation = (string)executionContext.SharedVariables["Operation"];
                Log($"processing Operation: {operation}");

                if (MessageProcessors.ContainsKey(operation))
                {
                    rv = MessageProcessors[operation].ProcessMessage(executionContext);
                }
                else
                {
                    Log($"Unknown operation request {operation}");
                    rv.Message = $"unknown operation: {operation}";
                    rv.Status  = 501;
                }
            }
            catch (Exception ex)
            {
                Log($"Error processing operation {operation}");
                rv.Message = $"Error processing: {operation} {ex.Message}";
            }

            Log($"\nMessage processing completed received at {DateTime.Now}");
            return(rv.ToJson());
        }
Beispiel #3
0
 public void UnregisterMessageProcessor(IMessageProcessor messageProcessor)
 {
     if (MessageProcessors.Contains(messageProcessor))
     {
         MessageProcessors.Remove(messageProcessor);
     }
 }