public virtual string AddMessageListener(Action <Message <T> > listener)
        {
            var request = TopicAddMessageListenerCodec.EncodeRequest(GetName(), false);
            DistributedEventHandler handler = m => TopicAddMessageListenerCodec.AbstractEventHandler.Handle(m,
                                                                                                            (item, time, uuid) => HandleMessageListener(item, time, uuid, listener));

            return(Listen(request, m => TopicAddMessageListenerCodec.DecodeResponse(m).response,
                          GetKey(), handler));
        }
Beispiel #2
0
 public virtual string AddMessageListener(Action<Message<T>> listener)
 {
     var request = TopicAddMessageListenerCodec.EncodeRequest(GetName(), IsSmart());
     DistributedEventHandler handler = m =>
         TopicAddMessageListenerCodec.EventHandler.HandleEvent(m,
             (item, time, uuid) =>
             {
                 HandleMessageListener(item, time, uuid, listener);
             });
     return RegisterListener(request, m => TopicAddMessageListenerCodec.DecodeResponse(m).response,
         id => TopicRemoveMessageListenerCodec.EncodeRequest(GetName(), id), handler);
 }
Beispiel #3
0
 private static Guid ReadSubscribeResponse(ClientMessage responseMessage, object state)
 => TopicAddMessageListenerCodec.DecodeResponse(responseMessage).Response;