src/Miles.MassTransit/MessageDispatch/MessageDispatchProcess.cs
/// <summary>
/// Initiates the dispatch of messages to the message queue
/// </summary>
/// <param name="messages">The messages.</param>
/// <returns></returns>
Initiates the dispatch of messages to the message queue
Initiates the dispatch of messages to the message queue
public async Task ExecuteAsync(IEnumerable<OutgoingMessageForDispatch> messages)
        {
            foreach (var message in messages)
            {
                Task task;
                switch (message.DispatchType)
                {
                    case DispatchType.Publish:
                        task = bus.Publish(message.MessageObject, c => message.Apply(c));
                        break;
                    case DispatchType.RoutingSlip:
                        var slip = (RoutingSlip)message.MessageObject;
                        task = bus.Execute(slip);
                        break;
                    default: throw new System.Exception("Unexpected dispatch type");    
                }
                await task.ConfigureAwait(false);
            }
        }
public async Task ExecuteAsync ( IEnumerable < OutgoingMessageForDispatch > messages ) { foreach ( var message in messages ) { Task task ; switch ( message . DispatchType ) { case DispatchType . Publish : task = bus . Publish ( message . MessageObject , c => message . Apply ( c ) ) ; break ; case DispatchType . RoutingSlip : var slip = ( RoutingSlip ) message . MessageObject ; task = bus . Execute ( slip ) ; break ; default : throw new System . Exception ( " " ) ; } await task . ConfigureAwait ( false ) ; } }
Initiates the dispatch of messages to the message queue
Initiates the dispatch of messages to the message queue
// TODO: Better exception type
None
messages
IEnumerable<OutgoingMessageForDispatch>
None