This is an automated email from the ASF dual-hosted git repository.
blankensteiner pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pulsar-dotpulsar.git
The following commit(s) were added to refs/heads/master by this push:
new c9f4476 Removed deprecated methods
c9f4476 is described below
commit c9f447607de594333880e5c8306c54dfb9d6ddb1
Author: Daniel Blankensteiner <[email protected]>
AuthorDate: Fri Oct 27 13:45:33 2023 +0200
Removed deprecated methods
---
CHANGELOG.md | 7 +++
src/DotPulsar/Abstractions/IConsumer.cs | 4 +-
src/DotPulsar/Abstractions/IGetLastMessageId.cs | 31 -----------
src/DotPulsar/Abstractions/IPulsarClientBuilder.cs | 6 ---
src/DotPulsar/Abstractions/IReader.cs | 4 +-
src/DotPulsar/Internal/Consumer.cs | 11 ----
src/DotPulsar/Internal/PulsarClientBuilder.cs | 6 ---
src/DotPulsar/Internal/Reader.cs | 10 ----
tests/DotPulsar.Tests/Internal/ConsumerTests.cs | 61 +---------------------
tests/DotPulsar.Tests/Internal/ProducerTests.cs | 2 +-
tests/DotPulsar.Tests/Internal/ReaderTests.cs | 61 +---------------------
11 files changed, 14 insertions(+), 189 deletions(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 77b2114..a3e9e9a 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,6 +4,13 @@ All notable changes to this project will be documented in this
file.
The format is based on [Keep a
Changelog](https://keepachangelog.com/en/1.1.0/) and this project adheres to
[Semantic Versioning](https://semver.org/spec/v2.0.0.html).
+## [Unreleased]
+
+### Removed
+
+- The 'GetLastMessageId' method on IReader and IConsumer has been removed. Use
'GetLastMessageIds' instead
+- The 'AuthenticateUsingToken' method on IPulsarClientBuilder has been
removed. Use Authentication(AuthenticationFactory.Token(...)) instead
+
## [3.0.2] - 2023-09-19
### Fixed
diff --git a/src/DotPulsar/Abstractions/IConsumer.cs
b/src/DotPulsar/Abstractions/IConsumer.cs
index 5d12051..0e939e9 100644
--- a/src/DotPulsar/Abstractions/IConsumer.cs
+++ b/src/DotPulsar/Abstractions/IConsumer.cs
@@ -1,4 +1,4 @@
-/*
+/*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -22,7 +22,7 @@ using System.Threading.Tasks;
/// <summary>
/// A consumer abstraction.
/// </summary>
-public interface IConsumer : IGetLastMessageId, IGetLastMessageIds, ISeek,
IState<ConsumerState>, IAsyncDisposable
+public interface IConsumer : IGetLastMessageIds, ISeek, IState<ConsumerState>,
IAsyncDisposable
{
/// <summary>
/// Acknowledge the consumption of a single message using the MessageId.
diff --git a/src/DotPulsar/Abstractions/IGetLastMessageId.cs
b/src/DotPulsar/Abstractions/IGetLastMessageId.cs
deleted file mode 100644
index 22f579b..0000000
--- a/src/DotPulsar/Abstractions/IGetLastMessageId.cs
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-namespace DotPulsar.Abstractions;
-
-using System;
-using System.Threading;
-using System.Threading.Tasks;
-
-/// <summary>
-/// An abstraction for getting the last message id.
-/// </summary>
-public interface IGetLastMessageId
-{
- /// <summary>
- /// Get the message id of the last message on the topic.
- /// </summary>
- [Obsolete("GetLastMessageId is obsolete. Please use GetLastMessageIds
instead.")]
- ValueTask<MessageId> GetLastMessageId(CancellationToken cancellationToken
= default);
-}
diff --git a/src/DotPulsar/Abstractions/IPulsarClientBuilder.cs
b/src/DotPulsar/Abstractions/IPulsarClientBuilder.cs
index 87be0eb..213c6c7 100644
--- a/src/DotPulsar/Abstractions/IPulsarClientBuilder.cs
+++ b/src/DotPulsar/Abstractions/IPulsarClientBuilder.cs
@@ -27,12 +27,6 @@ public interface IPulsarClientBuilder
/// </summary>
IPulsarClientBuilder AuthenticateUsingClientCertificate(X509Certificate2
clientCertificate);
- /// <summary>
- /// Authenticate using a (JSON Web) token. This is optional.
- /// </summary>
- [Obsolete("This method is obsolete. Call
Authentication(AuthenticationFactory.Token(...)) instead.", false)]
- IPulsarClientBuilder AuthenticateUsingToken(string token);
-
/// <summary>
/// Set the authentication provider. This is optional.
/// </summary>
diff --git a/src/DotPulsar/Abstractions/IReader.cs
b/src/DotPulsar/Abstractions/IReader.cs
index c7a1707..3c6f735 100644
--- a/src/DotPulsar/Abstractions/IReader.cs
+++ b/src/DotPulsar/Abstractions/IReader.cs
@@ -1,4 +1,4 @@
-/*
+/*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -19,7 +19,7 @@ using System;
/// <summary>
/// A reader abstraction.
/// </summary>
-public interface IReader : IGetLastMessageId, IGetLastMessageIds, ISeek,
IState<ReaderState>, IAsyncDisposable
+public interface IReader : IGetLastMessageIds, ISeek, IState<ReaderState>,
IAsyncDisposable
{
/// <summary>
/// The reader's service url.
diff --git a/src/DotPulsar/Internal/Consumer.cs
b/src/DotPulsar/Internal/Consumer.cs
index 20c8af7..b61f37d 100644
--- a/src/DotPulsar/Internal/Consumer.cs
+++ b/src/DotPulsar/Internal/Consumer.cs
@@ -351,17 +351,6 @@ public sealed class Consumer<TMessage> :
IConsumer<TMessage>
await Task.WhenAll(seekTasks).ConfigureAwait(false);
}
- [Obsolete("GetLastMessageId is obsolete. Please use GetLastMessageIds
instead.")]
- public async ValueTask<MessageId> GetLastMessageId(CancellationToken
cancellationToken)
- {
- await Guard(cancellationToken).ConfigureAwait(false);
-
- if (!_isPartitionedTopic)
- return await
_subConsumers[_subConsumerIndex].GetLastMessageId(cancellationToken).ConfigureAwait(false);
-
- throw new NotSupportedException("GetLastMessageId can't be used on
partitioned topics. Please use GetLastMessageIds");
- }
-
public async ValueTask<IEnumerable<MessageId>>
GetLastMessageIds(CancellationToken cancellationToken)
{
await Guard(cancellationToken).ConfigureAwait(false);
diff --git a/src/DotPulsar/Internal/PulsarClientBuilder.cs
b/src/DotPulsar/Internal/PulsarClientBuilder.cs
index 3ea8a45..bf7783e 100644
--- a/src/DotPulsar/Internal/PulsarClientBuilder.cs
+++ b/src/DotPulsar/Internal/PulsarClientBuilder.cs
@@ -68,12 +68,6 @@ public sealed class PulsarClientBuilder :
IPulsarClientBuilder
return this;
}
- public IPulsarClientBuilder AuthenticateUsingToken(string token)
- {
- _authentication = AuthenticationFactory.Token(token);
- return this;
- }
-
public IPulsarClientBuilder Authentication(IAuthentication authentication)
{
_authentication = authentication;
diff --git a/src/DotPulsar/Internal/Reader.cs b/src/DotPulsar/Internal/Reader.cs
index e10c964..d3728e7 100644
--- a/src/DotPulsar/Internal/Reader.cs
+++ b/src/DotPulsar/Internal/Reader.cs
@@ -155,16 +155,6 @@ public sealed class Reader<TMessage> : IReader<TMessage>
public bool IsFinalState(ReaderState state)
=> _state.IsFinalState(state);
- [Obsolete("GetLastMessageId is obsolete. Please use GetLastMessageIds
instead.")]
- public async ValueTask<MessageId> GetLastMessageId(CancellationToken
cancellationToken)
- {
- await Guard(cancellationToken).ConfigureAwait(false);
-
- if (!_isPartitionedTopic)
- return await
_subReaders[_subReaderIndex].GetLastMessageId(cancellationToken).ConfigureAwait(false);
- throw new NotSupportedException("GetLastMessageId can't be used on
partitioned topics. Please use GetLastMessageIds");
- }
-
public async ValueTask<IEnumerable<MessageId>>
GetLastMessageIds(CancellationToken cancellationToken)
{
await Guard(cancellationToken).ConfigureAwait(false);
diff --git a/tests/DotPulsar.Tests/Internal/ConsumerTests.cs
b/tests/DotPulsar.Tests/Internal/ConsumerTests.cs
index 5984019..6672106 100644
--- a/tests/DotPulsar.Tests/Internal/ConsumerTests.cs
+++ b/tests/DotPulsar.Tests/Internal/ConsumerTests.cs
@@ -26,7 +26,7 @@ using Xunit;
using Xunit.Abstractions;
[Collection("Integration"), Trait("Category", "Integration")]
-public class ConsumerTests : IDisposable
+public sealed class ConsumerTests : IDisposable
{
private readonly CancellationTokenSource _cts;
private readonly IntegrationFixture _fixture;
@@ -39,65 +39,6 @@ public class ConsumerTests : IDisposable
_testOutputHelper = testOutputHelper;
}
- [Fact]
- public async Task
GetLastMessageId_GivenEmptyTopic_ShouldBeEqualToMessageIdEarliest()
- {
- //Arrange
- await using var client = CreateClient();
- await using var consumer = CreateConsumer(client,
_fixture.CreateTopic());
-
- //Act
- var actual = await consumer.GetLastMessageId(_cts.Token);
-
- //Assert
- actual.Should().BeEquivalentTo(MessageId.Earliest);
- }
-
- [Fact]
- public async Task
GetLastMessageId_GivenNonPartitionedTopic_ShouldGetMessageIdFromPartition()
- {
- //Arrange
- var topicName = _fixture.CreateTopic();
- const int numberOfMessages = 6;
-
- await using var client = CreateClient();
- await using var consumer = CreateConsumer(client, topicName);
- await using var producer = CreateProducer(client, topicName);
-
- MessageId expected = null!;
- for (var i = 0; i < numberOfMessages; i++)
- {
- var messageId = await producer.Send("test-message", _cts.Token);
- if (i >= 5)
- {
- expected = messageId;
- }
- }
-
- //Act
- var actual = await consumer.GetLastMessageId(_cts.Token);
-
- //Assert
- actual.Should().BeEquivalentTo(expected);
- }
-
- [Fact]
- public async Task
GetLastMessageId_GivenPartitionedTopic_ShouldThrowException()
- {
- //Arrange
- const int partitions = 3;
- var topicName = _fixture.CreatePartitionedTopic(partitions);
-
- await using var client = CreateClient();
- await using var consumer = CreateConsumer(client, topicName);
-
- //Act
- var exception = await Record.ExceptionAsync(() =>
consumer.GetLastMessageId(_cts.Token).AsTask());
-
- //Assert
- exception.Should().BeOfType<NotSupportedException>();
- }
-
[Fact]
public async Task
GetLastMessageIds_GivenNonPartitionedTopic_ShouldGetMessageIdFromPartition()
{
diff --git a/tests/DotPulsar.Tests/Internal/ProducerTests.cs
b/tests/DotPulsar.Tests/Internal/ProducerTests.cs
index 686eb5d..5b76065 100644
--- a/tests/DotPulsar.Tests/Internal/ProducerTests.cs
+++ b/tests/DotPulsar.Tests/Internal/ProducerTests.cs
@@ -25,7 +25,7 @@ using Xunit;
using Xunit.Abstractions;
[Collection("Integration"), Trait("Category", "Integration")]
-public class ProducerTests : IDisposable
+public sealed class ProducerTests : IDisposable
{
private readonly CancellationTokenSource _cts;
private readonly IntegrationFixture _fixture;
diff --git a/tests/DotPulsar.Tests/Internal/ReaderTests.cs
b/tests/DotPulsar.Tests/Internal/ReaderTests.cs
index ed8a620..d2ec6f9 100644
--- a/tests/DotPulsar.Tests/Internal/ReaderTests.cs
+++ b/tests/DotPulsar.Tests/Internal/ReaderTests.cs
@@ -26,7 +26,7 @@ using Xunit;
using Xunit.Abstractions;
[Collection("Integration"), Trait("Category", "Integration")]
-public class ReaderTests : IDisposable
+public sealed class ReaderTests : IDisposable
{
private readonly CancellationTokenSource _cts;
private readonly IntegrationFixture _fixture;
@@ -39,65 +39,6 @@ public class ReaderTests : IDisposable
_testOutputHelper = testOutputHelper;
}
- [Fact]
- public async Task
GetLastMessageId_GivenEmptyTopic_ShouldBeEqualToMessageIdEarliest()
- {
- //Arrange
- await using var client = CreateClient();
- await using var reader = CreateReader(client, MessageId.Earliest,
_fixture.CreateTopic());
-
- //Act
- var actual = await reader.GetLastMessageId(_cts.Token);
-
- //Assert
- actual.Should().BeEquivalentTo(MessageId.Earliest);
- }
-
- [Fact]
- public async Task
GetLastMessageId_GivenNonPartitionedTopic_ShouldGetMessageId()
- {
- //Arrange
- var topicName = _fixture.CreateTopic();
- const int numberOfMessages = 6;
-
- await using var client = CreateClient();
- await using var reader = CreateReader(client, MessageId.Earliest,
topicName);
- await using var producer = CreateProducer(client, topicName);
-
- MessageId expected = null!;
- for (var i = 0; i < numberOfMessages; i++)
- {
- var messageId = await producer.Send("test-message", _cts.Token);
- if (i >= 5)
- {
- expected = messageId;
- }
- }
-
- //Act
- var actual = await reader.GetLastMessageId(_cts.Token);
-
- //Assert
- actual.Should().BeEquivalentTo(expected);
- }
-
- [Fact]
- public async Task
GetLastMessageId_GivenPartitionedTopic_ShouldThrowException()
- {
- //Arrange
- const int partitions = 3;
- var topicName = _fixture.CreatePartitionedTopic(partitions);
-
- await using var client = CreateClient();
- await using var reader = CreateReader(client, MessageId.Earliest,
topicName);
-
- //Act
- var exception = await Record.ExceptionAsync(() =>
reader.GetLastMessageId(_cts.Token).AsTask());
-
- //Assert
- exception.Should().BeOfType<NotSupportedException>();
- }
-
[Fact]
public async Task
GetLastMessageIds_GivenEmptyTopic_ShouldBeEqualToMessageIdEarliest()
{