private void ConfigureMessageQueueProvider(ConfigurationContext context) { var serializer = new MessagingSerializer(typeof(AdoNetMessageDto)); _messageQueueProvider = new AdoNetMessageQueueProvider(() => context.ConnectionFactory(_systemPrincipal), serializer); }
private AdoNetMessageQueueProvider CreateQueueProvider() { Func <IDbConnection> dbFactory = () => DbConnectionFactory.Open(true); var serializer = new MessagingSerializer(typeof(AdoNetMessageDto)); var provider = new AdoNetMessageQueueProvider(dbFactory, serializer); return(provider); }
private AdoNetMessageQueueProvider CreateQueueProvider(ConfigurationContext context) { if (_queueProvider != null) { return(_queueProvider); } IDbConnection Factory() => context.ConnectionFactory(_systemPrincipal); var serializer = new MessagingSerializer(typeof(AdoNetMessageDto)); //serializer.ThrowExceptionOnDeserialziationFailure = false; _queueProvider = new AdoNetMessageQueueProvider(Factory, serializer); return(_queueProvider); }
public async Task <HttpResponseMessage> SupplyFeedback(string appKey, string sig) { var json = await UnpackContent(); try { var ser = new MessagingSerializer(); var model = (FeedbackDTO)ser.Deserialize(typeof(FeedbackDTO), json); var app = await _applicationRepository.GetByKeyAsync(appKey); using (var session = _queue.BeginSession()) { var dto = new ProcessFeedback { ApplicationId = app.Id, Description = model.Description, EmailAddress = model.EmailAddress, ReceivedAtUtc = DateTime.UtcNow, RemoteAddress = Request.GetClientIpAddress(), ReportId = model.ReportId, ReportVersion = "1" }; await session.EnqueueAsync(ReportController.CreateReporterPrincipal(), new Message(dto)); await session.SaveChanges(); } } catch (Exception ex) { _logger.Warn( "Failed to submit feedback: " + JsonConvert.SerializeObject(new { appKey, json }), ex); } return(new HttpResponseMessage(HttpStatusCode.NoContent)); }