Beispiel #1
0
        public Task Publish(string messageTypeIdenfifier, byte[] @event, IOutboxSession outbox, MessageMetaData metaData = null)
        {
            metaData = metaData ?? new MessageMetaData();
            var endpoint = MessagingMap.FindEndpoint(messageTypeIdenfifier);

            return(Dispatch(new WrappedCommand(messageTypeIdenfifier, @event), metaData, endpoint, outbox));
        }
Beispiel #2
0
        public Task Dispatch(IIntegrationMessage message, MessageMetaData metaData = null, IOutboxSession outbox = null)
        {
            var endpoint = MessagingMap.FindEndpoint(message) ??
                           throw new ApplicationException($"Unable to dispatch message. Type: {message.GetType()} Message Type: {message.MessageType}");

            return(Dispatch(message, metaData, endpoint, outbox));
        }
Beispiel #3
0
        public Task SendSynchronously(string messageTypeIdenfifier, byte[] command, MessageMetaData metaData = null)
        {
            metaData = metaData ?? new MessageMetaData();
            var endpoint = MessagingMap.FindEndpoint(messageTypeIdenfifier);

            _setReplyTo(endpoint, null, metaData);
            return(Dispatch(new WrappedCommand(messageTypeIdenfifier, command), metaData, endpoint));
        }
Beispiel #4
0
        public Task SendSynchronously(IIntegrationCommand command, MessageMetaData metaData = null)
        {
            metaData = metaData ?? new MessageMetaData();
            var endpoint = MessagingMap.FindEndpoint(command);

            _setReplyTo(endpoint, command, metaData);
            return(Dispatch(command, metaData));
        }
Beispiel #5
0
        /************ Message Dispatching ***********/

        public Task Send(IIntegrationCommand command, IOutboxSession outbox, MessageMetaData metaData = null)
        {
            metaData = metaData ?? new MessageMetaData();
            var endpoint = MessagingMap.FindEndpoint(command);

            _setReplyTo(endpoint, command, metaData);
            return(Dispatch(command, metaData, outbox));
        }
Beispiel #6
0
        /// <summary>
        /// Send a serialized message to an endpoint bypassing the outbound pipeline
        /// useful for services relay messages like the outbox
        /// </summary>
        /// <param name="messageTypeIdentifier"></param>
        /// <param name="message"></param>
        /// <param name="metaData"></param>
        /// <param name="endpointName"></param>
        /// <returns></returns>
        public Task DispatchCore(string messageTypeIdentifier, byte[] message, MessageMetaData metaData, string endpointName, bool isTransient = false)
        {
            var endpoint = endpointName != null?MessagingMap.FindEndpointByName(endpointName) : MessagingMap.FindEndpoint(messageTypeIdentifier);

            if (endpoint == null)
            {
                throw new ApplicationException($"Unable to dispatch message. Endpoint not found. MessageTypeIdentifier: {messageTypeIdentifier}. Endpoint: {endpointName}");
            }

            if (isTransient && metaData != null)
            {
                if (metaData.SkipTransientDispatch)
                {
                    throw new ApplicationException($"Unable to dispatch transient message.  SkipTransient was set to True. MessageTypeIdentifier: {messageTypeIdentifier}. Endpoint: {endpointName}");
                }

                if (metaData.DispatchDelay.HasValue && !endpoint.SupportsDelayedDispatch)
                {
                    throw new ApplicationException($"Unable to dispatch transient message.  Delay not supported by transport. MessageTypeIdentifier: {messageTypeIdentifier}. Endpoint: {endpointName}");
                }
            }
            return(DispatchCore(messageTypeIdentifier, message, metaData, endpoint));
        }
Beispiel #7
0
        public Task PublishSynchronously(IIntegrationEvent @event, MessageMetaData metaData = null)
        {
            var endpoint = MessagingMap.FindEndpoint(@event);

            return(Dispatch(@event, metaData));
        }
Beispiel #8
0
        public Task Publish(IIntegrationEvent @event, IOutboxSession outbox, MessageMetaData metaData = null)
        {
            var endpoint = MessagingMap.FindEndpoint(@event);

            return(Dispatch(@event, metaData, outbox));
        }