예제 #1
0
 public Publish(string topic, AloxiMessageOperation operation, string payload, string responseTopic = null)
 {
     this.Topic         = topic;
     this.Operation     = operation;
     this.Payload       = payload;
     this.ResponseTopic = responseTopic;
 }
예제 #2
0
        public static AloxiMessage Build(AloxiMessageOperation operation, JObject payload, string responseTopic = null)
        {
            var msg = new AloxiMessage()
            {
                Type          = AloxiMessageType.AloxiComm,
                Operation     = operation,
                Data          = payload,
                ResponseTopic = responseTopic,
            };

            return(msg);
        }
예제 #3
0
        public Task <TResponsePayload> RequestBridge <TResponsePayload>(AloxiMessageOperation operation, object requestPayload) where TResponsePayload : class
        {
            var requestMessage = AloxiMessage.Build(operation, Pack(requestPayload), this.configuration.TopicResponse);

            return(PublishAndAwaitResponse(configuration.TopicBridge, requestMessage)
                   .ContinueWith <TResponsePayload>((publishTask) =>
            {
                var responseMessage = publishTask.Result;
                if (responseMessage == null)
                {
                    return null;
                }
                return UnpackTo <TResponsePayload>(responseMessage.Data);
            }));
        }
예제 #4
0
        public Task <JObject> RequestBridgePassthrough(AloxiMessageOperation operation, JObject payload)
        {
            var requestMessage = AloxiMessage.Build(operation, payload, this.configuration.TopicResponse);

            Log.Debug(this.lambdaContext, $"PSC/RBP: Publishing AloxiMessage '{operation}' and waiting for response");
            return(PublishAndAwaitResponse(configuration.TopicBridge, requestMessage)
                   .ContinueWith <JObject>((publishTask) =>
            {
                if (publishTask.Result == null)
                {
                    Log.Warn(this.lambdaContext, $"PSC/RBP: Passing NULL through (we did not get a response?)");
                    return null;
                }
                Log.Debug(this.lambdaContext, $"PSC/RBP: Continueing with {publishTask?.Result?.Data?.Count} datanodes");
                return publishTask.Result.Data;
            }));
        }
예제 #5
0
 public Process(AloxiMessageOperation operation, string payload, string responseTopic)
 {
     this.Operation     = operation;
     this.Payload       = payload;
     this.ResponseTopic = responseTopic;
 }
예제 #6
0
 public RegisterProcessor(AloxiMessageOperation operation, IActorRef processor)
 {
     this.Operation = operation;
     this.Processor = processor;
 }