private void ReceivedPublish(MqttMessage.Publish message) { JObject payload = StringToJObject(message.Payload); var aloxiMessage = AloxiMessage.Build(message.Operation, payload, message.ResponseTopic); PublishAloxiMessage(aloxiMessage, message.Topic); }
private void ReceivedPublishAlexaResponse(MqttMessage.PublishAlexaResponse message) { JObject payload = StringToJObject(message.SerializedResponse); var aloxiMessage = AloxiMessage.Build(AloxiMessageOperation.PipeAlexaResponse, payload); PublishAloxiMessage(aloxiMessage, this.alexaResponseTopic); }
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); })); }
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; })); }