コード例 #1
0
        private Type GetProducedMessageQueueType(MailboxType mailboxType)
        {
            var queueType = mailboxType.GetType().GetTypeInfo().GetInterfaces()
                            .Where(i => i.GetTypeInfo().IsGenericType)
                            .Where(i => i.GetGenericTypeDefinition() == ProducesMessageQueueGenericType)
                            .Select(i => i.GetTypeInfo().GetGenericArguments().First())
                            .FirstOrDefault();

            if (queueType == null)
            {
                throw new ArgumentException(nameof(mailboxType), $"No IProducesMessageQueue<TQueue> supplied for {mailboxType}; illegal mailbox type definition.");
            }
            return(queueType);
        }
コード例 #2
0
ファイル: Mailboxes.cs プロジェクト: yesh-nadella/akka.net
        private Type GetProducedMessageQueueType(MailboxType mailboxType)
        {
            var interfaces = mailboxType.GetType().GetTypeInfo().GetInterfaces();

            for (int i = 0; i < interfaces.Length; i++)
            {
                var element = interfaces[i];
                if (element.GetTypeInfo().IsGenericType&& element.GetGenericTypeDefinition() == ProducesMessageQueueGenericType)
                {
                    return(element.GetGenericArguments()[0]);
                }
            }

            throw new ArgumentException(nameof(mailboxType), $"No IProducesMessageQueue<TQueue> supplied for {mailboxType}; illegal mailbox type definition.");
        }
コード例 #3
0
 /// <summary>
 /// Creates and returns a <see cref="Mailbox"/> for the given actor.
 /// </summary>
 /// <param name="cell">Cell of the actor.</param>
 /// <param name="mailboxType">The mailbox configurator.</param>
 /// <returns>The configured <see cref="Mailbox"/> for this actor.</returns>
 internal Mailbox CreateMailbox(ActorCell cell, MailboxType mailboxType)
 {
     return(new Mailbox(mailboxType.Create(cell.Self, cell.System)));
 }