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); }
public virtual bool RemoveMessageListener(string registrationId) { return(StopListening(s => TopicRemoveMessageListenerCodec.EncodeRequest(GetName(), s), m => TopicRemoveMessageListenerCodec.DecodeResponse(m).response, registrationId)); }
private static bool ReadUnsubscribeResponse(ClientMessage message, object state) => TopicRemoveMessageListenerCodec.DecodeResponse(message).Response;
public virtual bool RemoveMessageListener(string registrationId) { return(DeregisterListener(registrationId, id => TopicRemoveMessageListenerCodec.EncodeRequest(GetName(), id))); }
private ClientMessage CreateUnsubscribeRequest(Guid subscriptionId, object state) => TopicRemoveMessageListenerCodec.EncodeRequest(Name, subscriptionId);