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