예제 #1
0
        public long Add(T item)
        {
            ValidationUtil.ThrowExceptionIfNull(item, "Item cannot be null");

            var request = RingbufferAddCodec.EncodeRequest(GetName(), (int)OverflowPolicy.Overwrite, ToData(item));

            return(Invoke(request, m => RingbufferAddCodec.DecodeResponse(m).response));
        }
예제 #2
0
        public Task <long> AddAsync(T item, OverflowPolicy overflowPolicy)
        {
            ValidationUtil.ThrowExceptionIfNull(item, "Item cannot be null");

            var request = RingbufferAddCodec.EncodeRequest(GetName(), (int)OverflowPolicy.Overwrite, ToData(item));

            return(InvokeAsync(request, GetPartitionKey(), m => RingbufferAddCodec.DecodeResponse(m).response));
        }
예제 #3
0
        /// <inheritdoc />
        public async Task <long> AddAsync(TItem item, OverflowPolicy overflowPolicy)
        {
            var itemData        = ToSafeData(item);
            var requestMessage  = RingbufferAddCodec.EncodeRequest(Name, (int)overflowPolicy, itemData);
            var responseMessage = await Cluster.Messaging.SendToPartitionOwnerAsync(requestMessage, PartitionId).CfAwait();

            return(RingbufferAddCodec.DecodeResponse(responseMessage).Response);
        }