public async void PullMessagesSync() { string topicId = "testTopicForMessageSyncAck" + _pubsubFixture.RandomName(); string subscriptionId = "testSubscriptionForMessageSyncAck" + _pubsubFixture.RandomName(); var message = _pubsubFixture.RandomName(); _pubsubFixture.CreateTopic(topicId); _pubsubFixture.CreateSubscription(topicId, subscriptionId); await _publishMessagesAsyncSample.PublishMessagesAsync(_pubsubFixture.ProjectId, topicId, new string[] { message }); // Pull and acknowledge the messages var result = _pullMessagesSyncSample.PullMessagesSync(_pubsubFixture.ProjectId, subscriptionId, true); // sometimes UNAVAILABLE response from service. Assert.True(result <= 1); //Pull the Message to confirm it's gone after it's acknowledged result = _pullMessagesSyncSample.PullMessagesSync(_pubsubFixture.ProjectId, subscriptionId, true); Assert.True(result <= 1); }
public async Task PullMessagesSync() { string randomName = _pubsubFixture.RandomName(); string topicId = $"testTopicForMessageSyncAck{randomName}"; string subscriptionId = $"testSubscriptionForMessageSyncAck{randomName}"; var message = _pubsubFixture.RandomName(); _pubsubFixture.CreateTopic(topicId); _pubsubFixture.CreateSubscription(topicId, subscriptionId); await _publishMessagesAsyncSample.PublishMessagesAsync(_pubsubFixture.ProjectId, topicId, new string[] { message }); _pubsubFixture.Pull.Eventually(() => { // Pull and acknowledge the messages var result = _pullMessagesSyncSample.PullMessagesSync(_pubsubFixture.ProjectId, subscriptionId, true); Assert.Equal(1, result); }); //Pull the Message to confirm it's gone after it's acknowledged var result = _pullMessagesSyncSample.PullMessagesSync(_pubsubFixture.ProjectId, subscriptionId, true); Assert.Equal(0, result); }