Example #1
0
 public EmailNotificationMessageSender(
     IAwsQueueClient awsQueueClient,
     IAwsConfiguration awsConfiguration,
     IMessageBusSerialiser serialiser,
     ILogger <EmailNotificationMessageSender> logger)
 {
     this._awsQueueClient   = awsQueueClient ?? throw new ArgumentNullException(nameof(awsQueueClient));
     this._awsConfiguration = awsConfiguration ?? throw new ArgumentNullException(nameof(awsConfiguration));
     this._serialiser       = serialiser ?? throw new ArgumentNullException(nameof(serialiser));
     this._logger           = logger ?? throw new ArgumentNullException(nameof(logger));
 }
Example #2
0
 public QueueCasePublisher(
     IMessageBusSerialiser serialiser,
     IAwsQueueClient awsQueueClient,
     IAwsConfiguration awsConfiguration,
     ILogger <QueueCasePublisher> logger)
 {
     this._serialiser       = serialiser ?? throw new ArgumentNullException(nameof(serialiser));
     this._awsQueueClient   = awsQueueClient ?? throw new ArgumentNullException(nameof(awsQueueClient));
     this._awsConfiguration = awsConfiguration ?? throw new ArgumentNullException(nameof(awsConfiguration));
     this._logger           = logger ?? throw new ArgumentNullException(nameof(logger));
 }
        public void Setup()
        {
            this.dataVerifier                  = A.Fake <IDataVerifier>();
            this.autoSchedule                  = A.Fake <IAutoSchedule>();
            this.awsQueueClient                = A.Fake <IAwsQueueClient>();
            this.awsConfiguration              = A.Fake <IAwsConfiguration>();
            this.serialiser                    = new MessageBusSerialiser();
            this.systemProcessContext          = A.Fake <ISystemProcessContext>();
            this.systemProcessOperationContext = A.Fake <ISystemProcessOperationContext>();
            this.logger = new NullLogger <QueueAutoScheduleSubscriber>();

            A.CallTo(() => this.systemProcessContext.CreateAndStartOperationContext())
            .Returns(this.systemProcessOperationContext);
        }
Example #4
0
        public AMQMessageBus(IMessageBusContainer container, IMessageBusConfiguration configuration)
        {
            _container     = container;
            _configuration = configuration;
            _serialiser    = container.ResolveType <IMessageBusSerialiser>();

            var hostName  = string.IsNullOrEmpty(configuration.HostName) ? _defaultHost : configuration.HostName;
            var brokerUri = string.Format(_brokerUriTemplate, hostName);

            _factory = new ConnectionFactory(brokerUri);

            _connection          = _factory.CreateConnection();
            _connection.ClientId = _configuration.EndpointName;
            _session             = _connection.CreateSession();
        }
Example #5
0
 public QueueRuleCancellationSubscriber(
     IRuleCancellation ruleCancellation,
     IAwsQueueClient awsQueueClient,
     IAwsConfiguration awsConfiguration,
     ISystemProcessContext systemProcessContext,
     IMessageBusSerialiser messageBusSerialiser,
     ILogger <QueueRuleCancellationSubscriber> logger)
 {
     this._ruleCancellation     = ruleCancellation ?? throw new ArgumentNullException(nameof(ruleCancellation));
     this._awsQueueClient       = awsQueueClient ?? throw new ArgumentNullException(nameof(awsQueueClient));
     this._awsConfiguration     = awsConfiguration ?? throw new ArgumentNullException(nameof(awsConfiguration));
     this._systemProcessContext =
         systemProcessContext ?? throw new ArgumentNullException(nameof(systemProcessContext));
     this._messageBusSerialiser =
         messageBusSerialiser ?? throw new ArgumentNullException(nameof(messageBusSerialiser));
     this._logger = logger ?? throw new ArgumentNullException(nameof(logger));
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="QueueAutoScheduleSubscriber"/> class.
 /// </summary>
 /// <param name="dataVerifier">
 /// The data verifier.
 /// </param>
 /// <param name="autoSchedule">
 /// The auto schedule.
 /// </param>
 /// <param name="awsQueueClient">
 /// The aws queue client.
 /// </param>
 /// <param name="awsConfiguration">
 /// The aws configuration.
 /// </param>
 /// <param name="serialiser">
 /// The serializer.
 /// </param>
 /// <param name="systemProcessContext">
 /// The system process context.
 /// </param>
 /// <param name="logger">
 /// The logger.
 /// </param>
 public QueueAutoScheduleSubscriber(
     IDataVerifier dataVerifier,
     IAutoSchedule autoSchedule,
     IAwsQueueClient awsQueueClient,
     IAwsConfiguration awsConfiguration,
     IMessageBusSerialiser serialiser,
     ISystemProcessContext systemProcessContext,
     ILogger <QueueAutoScheduleSubscriber> logger)
 {
     this.dataVerifier         = dataVerifier ?? throw new ArgumentNullException(nameof(dataVerifier));
     this.autoSchedule         = autoSchedule ?? throw new ArgumentNullException(nameof(autoSchedule));
     this.awsQueueClient       = awsQueueClient ?? throw new ArgumentNullException(nameof(awsQueueClient));
     this.awsConfiguration     = awsConfiguration ?? throw new ArgumentNullException(nameof(awsConfiguration));
     this.serializer           = serialiser ?? throw new ArgumentNullException(nameof(serialiser));
     this.systemProcessContext = systemProcessContext ?? throw new ArgumentNullException(nameof(systemProcessContext));
     this.logger = logger ?? throw new ArgumentNullException(nameof(logger));
 }
Example #7
0
        public RMQMessageBus(IMessageBusContainer container, IMessageBusConfiguration configuration)
        {
            _container     = container;
            _configuration = configuration;
            _serialiser    = container.ResolveType <IMessageBusSerialiser>();

            _factory = new ConnectionFactory()
            {
                HostName = string.IsNullOrEmpty(configuration.HostName) ? _defaultHost : configuration.HostName
            };

            _connection = _factory.CreateConnection();
            _channel    = _connection.CreateModel();

            foreach (var exchange in _configuration.MessageDefinitions.Where(md => md.MessageAction == Core.MessageAction.Event).Select(md => md.QueueName).Distinct())
            {
                _channel.ExchangeDeclare(exchange, "fanout", true);
            }
        }
Example #8
0
        public WSBMessageBus(IMessageBusContainer container, IMessageBusConfiguration configuration)
        {
            _container     = container;
            _configuration = configuration;
            _serialiser    = container.ResolveType <IMessageBusSerialiser>();

            var extendedConfig = configuration.ExtendedConfiguration as WSBExtendedConfiguration;

            if (extendedConfig == null)
            {
                extendedConfig = new WSBExtendedConfiguration();
            }

            var connectStringBuilder = new ServiceBusConnectionStringBuilder();
            var hostName             = string.IsNullOrEmpty(_configuration.HostName) ? _defaultHost : _configuration.HostName;
            var managementPort       = extendedConfig.HttpPort == 0 ? _defaultManagementPort : extendedConfig.HttpPort;
            var runtimePort          = extendedConfig.TcpPort == 0 ? _defaultRuntimePort : extendedConfig.TcpPort;

            connectStringBuilder.ManagementPort = managementPort;
            connectStringBuilder.RuntimePort    = runtimePort;
            connectStringBuilder.Endpoints.Add((new UriBuilder()
            {
                Scheme = "sb", Host = hostName, Path = extendedConfig.ServiceNamespace
            }).Uri);
            connectStringBuilder.StsEndpoints.Add((new UriBuilder()
            {
                Scheme = "https", Host = hostName, Port = managementPort, Path = extendedConfig.ServiceNamespace
            }).Uri);

            var connectionString = connectStringBuilder.ToString();

            _messageFactory   = MessagingFactory.CreateFromConnectionString(connectionString);
            _namespaceManager = NamespaceManager.CreateFromConnectionString(connectionString);

            foreach (var queueName in _configuration.MessageDefinitions.Where(md => md.MessageAction == Core.MessageAction.Event).Select(md => md.QueueName).Distinct())
            {
                CreateTopic(queueName);
            }
        }
        public static Stream ToStream <T_message>(this T_message message, IMessageBusSerialiser serialiser)
        {
            var bytes = serialiser.Serialise(message);

            return(new MemoryStream(bytes, false));
        }
Example #10
0
        //public NSBSerialiser()
        //{ }

        public NSBSerialiser(IMessageBusSerialiser serialiser)
        {
            _serialiser = serialiser;
        }