private static IMessageService CreateAwsMessageService() { var svc = new AwsSqsServer(new SqsClient(new Amazon.SQS.AmazonSQSClient("AKIAIZ65P5ZEGIU3X2FA", "OeGi9c0lH3791+SBZkTTuDtuIg+t5TNOE6oLjCrf"))); // TODO: Use customer registration to override default values return(RegisterMessageHandlers(svc)); /********* Custom AWS Handler Configuration ********** * svc.RegisterMessageHandlers(register => * { * register.AddPooledHandler<Hello>((m) => * { * Log.Debug("Server Says: " + m.GetBody().Text); * return null; * }, new AwsSqsHandlerConfiguration() null, null, null, null, null, null); //// Override default values. * * register.AddHandler<Hello2>((m) => * { * Log.Debug("Server Says: " + m.GetBody().Text); * * // No Response * return null; * }); * * }); * * return svc; */ }
public AwsSqsMessageFactory(ISqsClient sqsClient, AwsSqsServer mqServer, IDictionary<string, string> queueUrls) { if (sqsClient == null) throw new ArgumentNullException("sqsClient"); if (mqServer == null) throw new ArgumentNullException("mqServer"); if (queueUrls == null) throw new ArgumentNullException("queueUrls"); this.queueUrls = queueUrls; this.SqsClient = sqsClient; this.MqServer = mqServer; }
public AwsSqsMessageHandlerWorker(ISqsClient sqsClient, AwsSqsServer mqServer, IDictionary<string, string> queueUrls, IMessageHandler messageHandler, string queueName, Action<IMessageHandlerBackgroundWorker, Exception> errorHandler) : base(messageHandler, queueName, errorHandler) { if (sqsClient == null) throw new ArgumentNullException("sqsClient"); if (mqServer == null) throw new ArgumentNullException("mqServer"); if (queueUrls == null) throw new ArgumentNullException("queueUrls"); SqsClient = sqsClient; MqServer = mqServer; QueueUrls = queueUrls; }
public AwsSqsQueueHandlerWorker( ISqsClient sqsClient, // IMessageCoordinator messageCoordinator, AwsSqsServer sqsServer, Type messageType, string queueName, string queueUrl, Action<IQueueHandlerBackgroundWorker, Exception> errorHandler, int waitTimeInSeconds, decimal maxNumberOfMessages, decimal messageVisibilityTimeout) : base(queueName, errorHandler) { if (sqsClient == null) throw new ArgumentNullException("sqsClient"); if (sqsServer == null) throw new ArgumentNullException("sqsServer"); // if (messageCoordinator == null) throw new ArgumentNullException("messageCoordinator"); if (messageType == null) throw new ArgumentNullException("messageType"); if (waitTimeInSeconds > 20) { throw new ArgumentException("WaitTimeInSeconds must be a value between 0 and 20 seconds.", "waitTimeInSeconds"); } if (maxNumberOfMessages < 1) { throw new ArgumentException("MaxNumberOfMessages must be a minimum value of 1.", "maxNumberOfMessages"); } this.SqsClient = sqsClient; this.MqServer = sqsServer; this.MessageCoordinator = sqsServer; // messageCoordinator; this.MessageType = messageType; this.QueueName = queueName; // queue.Key; this.QueueUrl = queueUrl; // queue.Value; this.WaitTimeInSeconds = waitTimeInSeconds; this.MaxNumberOfMessages = maxNumberOfMessages; this.MessageVisibilityTimeout = messageVisibilityTimeout; }