Ejemplo n.º 1
0
        public Task Send <T>(T commandMessage, SendOptions options = null)
        {
            var type = typeof(T);

            if (!busMessages.IsSendable(type))
            {
                throw BusMessages.CreateMessageNotFoundException(type);
            }
            return(busTransport.Send(commandMessage, MessageTypeToNameSendingCommandMap[type], options));
        }
Ejemplo n.º 2
0
        public Task Publish <T>(T eventMessage, PublishOptions options = null)
        {
            var type = typeof(T);

            if (!busMessages.IsPublishable(type))
            {
                throw BusMessages.CreateMessageNotFoundException(type);
            }
            return(busTransport.Publish(eventMessage, MessageTypeToNamePublishingEventMap[type], options));
        }
Ejemplo n.º 3
0
        public Task Send <T>(T commandMessage)
        {
            if (!started)
            {
                throw new InvalidOperationException("The bus has not been started.");
            }
            var type = typeof(T);

            if (!busMessages.IsACommand(type))
            {
                throw BusMessages.CreateMessageNotFoundException(type);
            }
            return(busTransport.Send(commandMessage, busMessages.GetMessageTypeNameByType(type)));
        }
Ejemplo n.º 4
0
        public Task Publish <T>(T eventMessage)
        {
            if (!started)
            {
                throw new InvalidOperationException("The bus has not been started.");
            }
            var type = typeof(T);

            if (!busMessages.IsAnEvent(type))
            {
                throw BusMessages.CreateMessageNotFoundException(type);
            }
            return(busTransport.Publish(eventMessage, busMessages.GetMessageTypeNameByType(type)));
        }
Ejemplo n.º 5
0
        public Task Send <T>(T commandMessage, SendOptions options)
        {
            if (!started)
            {
                throw new InvalidOperationException("The bus has not been started.");
            }
            var type = typeof(T);

            if (!busMessages.IsSendable(type))
            {
                throw BusMessages.CreateMessageNotFoundException(type);
            }
            return(options == null
                ? busTransport.Send(commandMessage, MessageTypeToNameSendingCommandMap[type])
                : busTransport.Send(commandMessage, MessageTypeToNameSendingCommandMap[type], options));
        }
Ejemplo n.º 6
0
        public Task Publish <T>(T eventMessage, PublishOptions options)
        {
            if (!started)
            {
                throw new InvalidOperationException("The bus has not been started.");
            }
            var type = typeof(T);

            if (!busMessages.IsPublishable(type))
            {
                throw BusMessages.CreateMessageNotFoundException(type);
            }
            return(options == null
                ? busTransport.Publish(eventMessage, MessageTypeToNamePublishingEventMap[type])
                : busTransport.Publish(eventMessage, MessageTypeToNamePublishingEventMap[type], options));
        }