public async Task SendMessage(MyPayload payload) { string data = JsonConvert.SerializeObject(payload); Message message = new Message(Encoding.UTF8.GetBytes(data)); await _queueClient.SendAsync(message); }
public void Process(MyPayload myPayload) { DataServiceSimi.Data.Add(new Payload { Name = myPayload.Name, Goals = myPayload.Goals }); }
public async Task <IActionResult> Create([FromBody][Required] MyPayload request) { // Send this to the bus for the other services await _serviceBusTopic.SendMessage(request); await _eventHubSender.PublishAsync(request); return(Ok(request)); }
public async Task <IActionResult> InitiateOrder(MyPayload message) { // TO DO: var payload = new MyPayload { Message = message.Message, CreatedDate = DateTime.Now }; await _sender.SendMessage(payload); return(Ok()); }
public HttpResponseMessage Post([FromBody] MyPayload value) { if (!ModelState.IsValid) { HttpError error = GetErrors(ModelState, true); return(Request.CreateResponse(HttpStatusCode.BadRequest, error)); } return(new HttpResponseMessage(HttpStatusCode.Created)); }
public IEnumerable <MyPayload> Get() { var myPayLoad = new MyPayload { Description = Resources.AmazingResource.Description, Timestamp = DateTime.UtcNow, Name = Resources.AmazingResource.Name }; return(new [] { myPayLoad }); }
public async Task SendMessage(MyPayload payload) { string data = JsonConvert.SerializeObject(payload); Message message = new Message(Encoding.UTF8.GetBytes(data)); try { await _topicClient.SendAsync(message); } catch (Exception e) { throw e; } }
public async Task Process(MyPayload myPayload) { using (var payloadMessageContext = new PayloadMessageContext( _configuration.GetConnectionString("DefaultConnection"))) { await payloadMessageContext.AddAsync(new Payload { Name = myPayload.Name, Goals = myPayload.Goals, Created = DateTime.UtcNow }); await payloadMessageContext.SaveChangesAsync(); } }
public async System.Threading.Tasks.Task <IEnumerable <Products> > ListAllProductsAsync([FromHeader] string authorization) { try { string Token = authorization.Replace("Bearer ", ""); MyPayload pl = await GoogleJsonWebSignatureHelper.VerifyIdTokenAsync(Token); Console.WriteLine("VerifyIdToken Sucess"); return(products); } catch (InvalidJwtException e) { Console.WriteLine("InvalidJwtException: " + e.Message); return(null); } }
public async System.Threading.Tasks.Task <IEnumerable <Products> > ListProductsByCodeAsync([FromHeader] string authorization, [FromRoute] string codart) { try { string Token = authorization.Replace("Bearer ", ""); MyPayload pl = await GoogleJsonWebSignatureHelper.VerifyIdTokenAsync(Token); IEnumerable <Products> retVal = from g in products where g.Code.Equals(codart) select g; return(retVal); } catch (InvalidJwtException e) { Console.WriteLine(e.Message); return(null); } }
public Task Process(MyPayload myPayload) { //TO DO: throw new NotImplementedException(); }