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)); }
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); }
private static Guid ReadSubscribeResponse(ClientMessage responseMessage, object state) => TopicAddMessageListenerCodec.DecodeResponse(responseMessage).Response;