示例#1
0
        public async Task StartListening(Func <EventMessage, Task> onMessageCallback)
        {
            _subscriberEventMessage = MakeSubscriberEventMessage(MessageBrokerSettings.MessageBrokerType);
            await _subscriberEventMessage.Initialize(MessageBrokerSettings.MessageBrokerConnectionString, EventMessageTopicName, EventMessageQueueName + "." + Environment.MachineName);

            _subscriberEventMessage.Subscribe(OnEventMessageReceived, onMessageCallback);
        }
示例#2
0
        private async Task OnEventMessageReceived(SubscriberBase subscriberEventMessage, MessageReceivedEventArgs messageReceivedEventArgs, Func <EventMessage, Task> onMessageCallback)
        {
            var message      = messageReceivedEventArgs.Message;
            var eventMessage = MessageProcessor.DeserializeMessage(message);

            await onMessageCallback(eventMessage);

            await subscriberEventMessage.Acknowledge(messageReceivedEventArgs.AcknowledgeToken);
        }