Example #1
0
        private async Task ExecuteAsync(CancellationToken stoppingToken)
        {
            while (!stoppingToken.IsCancellationRequested)
            {
                var receiveData = await _busSubscriber.SubscribeEvent <T>();

                if (receiveData.IsSuccess)
                {
                    await _dispatcher.SendEventAsync(receiveData.Data);
                }
            }

            await Task.CompletedTask;
        }
Example #2
0
        protected virtual void SubscribeEventAndMessageBus(IBusSubscriber bus)
        {
            if (UseSignalR)
            {
                bus.SubscribeEvent <OperationPending>(@namespace: "operations")
                .SubscribeEvent <OperationCompleted>(@namespace: "operations")
                .SubscribeEvent <OperationRejected>(@namespace: "operations");
            }

            if (DomainType != null)
            {
                bus.SubscribeAllMessages(true, DomainType.Assembly);
                // bus.SubscribeOnRejected(DomainType.Assembly);
            }
        }