예제 #1
0
        public void EnqueueCqrsEvent(CqrsEvent cqrsEvent)
        {
            if (Config.SystemBehaviorConfig.ServiceBusType == Config.ServiceBusTypes.Rabbit)
            {
                _rabbitOutboundQueueProvider.EnqueueCqrsEvent(cqrsEvent);
                return;
            }

            var             serializedObject = ObjectSerialization.Serialize(cqrsEvent);
            BrokeredMessage message          = new BrokeredMessage(serializedObject);

            message.MessageId = string.Format("{0}", cqrsEvent.EventId);

            SendMessage(_systemClient, message);
        }
예제 #2
0
        public async Task <bool> EnqueueCqrsEventAsync(CqrsEvent cqrsEvent)
        {
            if (Config.SystemBehaviorConfig.ServiceBusType == Config.ServiceBusTypes.Rabbit)
            {
                _rabbitOutboundQueueProvider.EnqueueCqrsEvent(cqrsEvent);
                return(true);
            }

            var     serializedObject = ObjectSerialization.Serialize(cqrsEvent);
            Message message          = new Message(Encoding.UTF8.GetBytes(serializedObject));

            message.MessageId = string.Format("{0}", cqrsEvent.EventId);

            return(await SendMessageAsync(_systemClient, message));
        }