Example #1
0
        public async Task <Option <string> > TryGetNameAsync(EventStreamReaderId eventStreamReaderId)
        {
            Require.NotNull(eventStreamReaderId, nameof(eventStreamReaderId));

            var query = m_consumerMetadataTable.PrepareEntityPointQuery(
                Constants.StorageEntities.MetadataTable.EVENT_STREAM_CONSUMERS_IDS_PK,
                eventStreamReaderId.ToString());

            var result = await query.ExecuteAsync();

            return(result
                   .MayBe()
                   .Select(row => row[Constants.StorageEntities.MetadataTableProperties.EVENT_STREAM_CONSUMER_NAME].ToString()));
        }
Example #2
0
        private async Task InsertConsumerId(string consumerName, EventStreamReaderId consumerId)
        {
            var operation = m_consumerMetadataTable.PrepareBatchOperation();

            operation.Insert(
                partitionKey: Constants.StorageEntities.MetadataTable.EVENT_STREAM_CONSUMERS_IDS_PK,
                rowKey: consumerName,
                properties: new Dictionary <string, object>
            {
                { Constants.StorageEntities.MetadataTableProperties.EVENT_STREAM_READER_ID, consumerId.ToString() }
            });

            operation.Insert(
                partitionKey: Constants.StorageEntities.MetadataTable.EVENT_STREAM_CONSUMERS_IDS_PK,
                rowKey: consumerId.ToString(),
                properties: new Dictionary <string, object>
            {
                {
                    Constants.StorageEntities.MetadataTableProperties.EVENT_STREAM_CONSUMER_NAME, consumerName
                }
            });

            await operation.ExecuteAsync();
        }