コード例 #1
0
        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));
        }
コード例 #2
0
        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));
        }
コード例 #3
0
 /// <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);
コード例 #4
0
 /// <inheritdoc />
 protected override Guid ReadSubscribeResponse(ClientMessage responseMessage, SubscriptionState <CollectionItemEventHandlers <T> > state)
 => QueueAddListenerCodec.DecodeResponse(responseMessage).Response;
コード例 #5
0
 /// <inheritdoc />
 protected override ClientMessage CreateSubscribeRequest(bool includeValue, bool isSmartRouting)
 => QueueAddListenerCodec.EncodeRequest(Name, includeValue, isSmartRouting);
コード例 #6
0
 /// <inheritdoc />
 protected override ValueTask CodecHandleEventAsync(ClientMessage eventMessage, Func <IData, Guid, int, object, ValueTask> handler, object state, ILoggerFactory loggerFactory)
 => QueueAddListenerCodec.HandleEventAsync(eventMessage, handler, state, LoggerFactory);