private async Task Handle(ProcessEventArgs e) { if ((string)e.Data.Properties["event"] == _event) { await _handler.Handle(e.Data.FromEvent <T>()); } await e.UpdateCheckpointAsync(); }
public static ServiceBusProcessor Hookup <T>(this ServiceBusProcessor processor, ISubscribe <T> service) { processor.ProcessMessageAsync += e => service.Handle(e.Message.FromEvent <T>()); processor.ProcessErrorAsync += _ => Task.CompletedTask; return(processor); }
public IActionResult Subscribe([FromBody] SubscribeDto subscription) { var request = new SubscribeRequest() { CommunityId = subscription.CommunityTag, PhoneNumber = subscription.PhoneNumber }; _subscribe.Handle(request); return(Ok()); }
public TwiMLResult Index() { var smsSid = Request.Form["SmsSid"]; var fromPhoneNumber = Request.Form["From"]; var body = Request.Form["Body"]; var communityId = "fmdc"; var response = new MessagingResponse(); if (body.ToString().ToLower() == "follow") { var request = new SubscribeRequest() { CommunityId = communityId, PhoneNumber = fromPhoneNumber }; _subscribe.Handle(request); response.Message($"You're following 'fmdc'. \n\nText 'unfollow' to stop getting texts."); } else if (body.ToString().ToLower() == "unfollow") { var request = new UnsubscribeRequest() { CommunityId = communityId, PhoneNumber = fromPhoneNumber }; _unsubscribe.Handle(request); response.Message("You've unfollowed 'fmdc'."); } else { response.Message("Text 'fmdc' to subscribe. Text 'unsubscribe' to unsubscribe"); } return(TwiML(response)); }
public void CallSubscriberHandle(ISubscribe subscr) { subscr.Handle(this); }