public async Task <bool> Enqueue(string queueName, [FromBody] object message, string callback = null) { await QueueSender.SendAsync(queueName, new SimpleMessage { Message = JsonConvert.SerializeObject(message), Callback = callback }); return(true); }
public async Task <IActionResult> Post(string token) { var decrypted = TokenEncryption.Decrypt(token, DocumentsAPIConfiguration.APITokenKey); var callback = JsonConvert.DeserializeObject <CallbackModel>(decrypted); if (callback.FileIdentifier != null && Request.ContentLength.HasValue && Request.ContentLength.Value > 0 ) { SecurityContext.AssumeToken(callback.Token); var file = await FileStore.GetOneAsync(callback.FileIdentifier) ?? new FileModel(callback.FileIdentifier); file.Length = Request.ContentLength.Value; file.MimeType = Request.ContentType ?? "application/octet-stream"; file.Name = "callback"; file = await FileContentsService.UploadEntireFileAsync(file, Request.Body); } await QueueSender.SendAsync(callback.Queue, JsonConvert.SerializeObject(callback)); SuppressWrapper = true; return(Ok()); }
private void SendTestMessageToInboundQueue(object sender, RoutedEventArgs e) { var queueSender = new QueueSender( NamespaceTextBox.Text, InboundQueueNameTextBox.Text, InboundQueueSendSasTokenTextBox.Text); var systemProperties = new JObject { ["CorrelationId"] = Guid.NewGuid().ToString() }; var body = new JObject { ["CallType"] = "Command", ["Uri"] = "/api/component/Office.CombinedCeilingLights/status" }; var content = new JObject { ["action"] = "nextState" }; body["Content"] = content; Task.Run(async() => await queueSender.SendAsync(systemProperties, body)); }
private void SendTestMessageToOutboundQueue(object sender, RoutedEventArgs e) { var queueSender = new QueueSender( NamespaceTextBox.Text, OutboundQueueNameTextBox.Text, OutboundQueueSendSasTokenTextBox.Text); var properties = new JsonObject(); var body = new JsonObject(); Task.Run(async() => await queueSender.SendAsync(properties, body)); }
private void SendTestMessageToInboundQueue(object sender, RoutedEventArgs e) { var queueSender = new QueueSender( NamespaceTextBox.Text, InboundQueueNameTextBox.Text, InboundQueueSendSasTokenTextBox.Text); var systemProperties = new JsonObject(); systemProperties.SetNamedValue("CorrelationId", JsonValue.CreateStringValue(Guid.NewGuid().ToString())); var body = new JsonObject(); body.SetNamedValue("CallType", JsonValue.CreateStringValue("Command")); body.SetNamedValue("Uri", JsonValue.CreateStringValue("/api/component/Office.CombinedCeilingLights/status")); var content = new JsonObject(); content.SetNamedValue("action", JsonValue.CreateStringValue("nextState")); body.SetNamedValue("Content", content); Task.Run(async() => await queueSender.SendAsync(systemProperties, body)); }