public override void SetResult(Metadata metadata, ILetter letter, IReceivedEventArgs receivedEventArgs)
        {
            var result = _socket.Serializer.Deserialize <TResult>(letter.Parts[1], Type.GetType(metadata.Type));

            Result = new Answerable <TResult>(_socket, result, receivedEventArgs.RemoteNodeId, metadata.ConversationId);
            _waitLock.Set();
        }
Exemple #2
0
        private void TriggerOutstanding(Metadata metadata, ILetter letter, IReceivedEventArgs receivedEventArgs)
        {
            Outstanding outstanding;

            if (_outstandings.TryGetValue(metadata.ConversationId, out outstanding))
            {
                outstanding.SetResult(metadata, letter, receivedEventArgs);
                _outstandings.Remove(metadata.ConversationId);
            }
        }
Exemple #3
0
        private void SocketOnReceived(ILetter letter, IReceivedEventArgs receivedEventArgs)
        {
            if (letter.Parts.Length != 2)
            {
                return;
            }

            var  metadata    = Serializer.Deserialize <Metadata>(letter.Parts[0]);
            Type messageType = Type.GetType(metadata.Type);

            if (messageType == null)
            {
                return;
            }

            TriggerOutstanding(metadata, letter, receivedEventArgs);
            TriggerRegistrations(messageType, metadata, letter, receivedEventArgs);
        }
Exemple #4
0
        private void TriggerRegistrations(Type type, Metadata metadata, ILetter letter, IReceivedEventArgs receivedEventArgs)
        {
            IEnumerable <Registration> registrations = GetMatchingRegistrations(type);

            foreach (Registration registration in registrations)
            {
                registration.Invoke(this, letter, metadata, type, receivedEventArgs);
            }
        }
Exemple #5
0
 public abstract void Invoke(TypedHyperSocket socket, ILetter letter, Metadata metadata, Type concreteType, IReceivedEventArgs receivedEventArgs);
 public abstract void SetResult(Metadata metadata, ILetter letter, IReceivedEventArgs receivedEventArgs);
Exemple #7
0
        public override void Invoke(TypedHyperSocket socket, ILetter letter, Metadata metadata, Type concreteType, IReceivedEventArgs receivedEventArgs)
        {
            var message    = _serializer.Deserialize <TMessage>(letter.Parts[1], concreteType);
            var answerable = new Answerable <TMessage>(_socket, message, receivedEventArgs.RemoteNodeId, metadata.ConversationId);

            _callback(socket, answerable);
        }
        public override void Invoke(TypedHyperSocket socket, ILetter letter, Metadata metadata, Type concreteType, IReceivedEventArgs receivedEventArgs)
        {
            var message    = _serializer.Deserialize <TMessage>(letter.Parts[1], concreteType);
            var answerable = new Answerable <TMessage>(_socket, message, receivedEventArgs.RemoteNodeId, metadata.ConversationId);
            ITypedHandler <TMessage> handler = _handlerFactory.CreateHandler <THandler, TMessage>(message);

            handler.Execute(_socket, answerable);
        }
Exemple #9
0
 public abstract void SetResult(Metadata metadata, ILetter letter, IReceivedEventArgs receivedEventArgs);