public string AddItemListener(IItemListener <E> listener, bool includeValue) { var request = QueueAddListenerCodec.EncodeRequest(GetName(), includeValue, false); DistributedEventHandler handler = m => QueueAddListenerCodec.AbstractEventHandler.Handle(m, (item, uuid, type) => { HandleItemListener(item, uuid, (ItemEventType)type, listener, includeValue); }); return(Listen(request, m => QueueAddListenerCodec.DecodeResponse(m).response, GetPartitionKey(), handler)); }
public string AddItemListener(IItemListener <T> listener, bool includeValue) { var request = QueueAddListenerCodec.EncodeRequest(GetName(), includeValue, IsSmart()); DistributedEventHandler handler = m => QueueAddListenerCodec.EventHandler.HandleEvent(m, (item, uuid, type) => { HandleItemListener(item, uuid, (ItemEventType)type, listener, includeValue); }); return(RegisterListener(request, m => QueueAddListenerCodec.DecodeResponse(m).response, id => QueueRemoveListenerCodec.EncodeRequest(GetName(), id), handler)); }
/// <inheritdoc /> protected override ValueTask CodecHandleEventAsync(ClientMessage eventMessage, Func <IData, Guid, int, ValueTask> f, ILoggerFactory loggerFactory) => QueueAddListenerCodec.HandleEventAsync( eventMessage, (itemData, memberId, eventTypeData) => f(itemData, memberId, eventTypeData), LoggerFactory);
/// <inheritdoc /> protected override Guid ReadSubscribeResponse(ClientMessage responseMessage, SubscriptionState <CollectionItemEventHandlers <T> > state) => QueueAddListenerCodec.DecodeResponse(responseMessage).Response;
/// <inheritdoc /> protected override ClientMessage CreateSubscribeRequest(bool includeValue, bool isSmartRouting) => QueueAddListenerCodec.EncodeRequest(Name, includeValue, isSmartRouting);
/// <inheritdoc /> protected override ValueTask CodecHandleEventAsync(ClientMessage eventMessage, Func <IData, Guid, int, object, ValueTask> handler, object state, ILoggerFactory loggerFactory) => QueueAddListenerCodec.HandleEventAsync(eventMessage, handler, state, LoggerFactory);