Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DEV-47 - Retain callback-based subscription APIs alongside AsyncEnumerable APIs #297

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -24,19 +24,20 @@ public async Task<PersistentSubscription> SubscribeAsync(
) {
if (autoAck) {
throw new InvalidOperationException(
$"AutoAck is no longer supported. Please use {nameof(SubscribeToStreamAsync)} with manual acks instead."
$"AutoAck is no longer supported. Please use {nameof(SubscribeToStream)} with manual acks instead."
);
}

return await SubscribeToStreamAsync(
streamName,
groupName,
eventAppeared,
subscriptionDropped,
userCredentials,
bufferSize,
cancellationToken
).ConfigureAwait(false);
return await PersistentSubscription
.Confirm(
SubscribeToStream(streamName, groupName, bufferSize, userCredentials, cancellationToken),
eventAppeared,
subscriptionDropped ?? delegate { },
_log,
userCredentials,
cancellationToken
)
.ConfigureAwait(false);
}

/// <summary>
Expand All @@ -45,7 +46,6 @@ public async Task<PersistentSubscription> SubscribeAsync(
/// <exception cref="ArgumentNullException"></exception>
/// <exception cref="ArgumentException"></exception>
/// <exception cref="ArgumentOutOfRangeException"></exception>
[Obsolete("SubscribeToStreamAsync is no longer supported. Use SubscribeToStream with manual acks instead.", false)]
public async Task<PersistentSubscription> SubscribeToStreamAsync(
string streamName, string groupName,
Func<PersistentSubscription, ResolvedEvent, int?, CancellationToken, Task> eventAppeared,
Expand Down Expand Up @@ -135,7 +135,6 @@ public PersistentSubscriptionResult SubscribeToStream(
/// <summary>
/// Subscribes to a persistent subscription to $all. Messages must be manually acknowledged
/// </summary>
[Obsolete("SubscribeToAllAsync is no longer supported. Use SubscribeToAll with manual acks instead.", false)]
public async Task<PersistentSubscription> SubscribeToAllAsync(
string groupName,
Func<PersistentSubscription, ResolvedEvent, int?, CancellationToken, Task> eventAppeared,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ namespace EventStore.Client {
/// <summary>
/// Represents a persistent subscription connection.
/// </summary>
[Obsolete]
public class PersistentSubscription : IDisposable {
private readonly EventStorePersistentSubscriptionsClient.PersistentSubscriptionResult _persistentSubscriptionResult;
private readonly IAsyncEnumerator<PersistentSubscriptionMessage> _enumerator;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ public partial class EventStoreClient {
/// <param name="userCredentials">The optional user credentials to perform operation with.</param>
/// <param name="cancellationToken">The optional <see cref="System.Threading.CancellationToken"/>.</param>
/// <returns></returns>
[Obsolete("SubscribeToAllAsync is no longer supported. Use SubscribeToAll instead.", false)]
public Task<StreamSubscription> SubscribeToAllAsync(
FromAll start,
Func<StreamSubscription, ResolvedEvent, CancellationToken, Task> eventAppeared,
Expand Down Expand Up @@ -79,7 +78,6 @@ public StreamSubscriptionResult SubscribeToAll(
/// <param name="userCredentials">The optional user credentials to perform operation with.</param>
/// <param name="cancellationToken">The optional <see cref="System.Threading.CancellationToken"/>.</param>
/// <returns></returns>
[Obsolete("SubscribeToStreamAsync is no longer supported. Use SubscribeToStream instead.", false)]
public Task<StreamSubscription> SubscribeToStreamAsync(
string streamName,
FromStream start,
Expand Down
1 change: 0 additions & 1 deletion src/EventStore.Client.Streams/StreamSubscription.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ namespace EventStore.Client {
/// <summary>
/// A class representing a <see cref="StreamSubscription"/>.
/// </summary>
[Obsolete]
public class StreamSubscription : IDisposable {
private readonly EventStoreClient.StreamSubscriptionResult _subscription;
private readonly IAsyncEnumerator<StreamMessage> _messages;
Expand Down
2 changes: 0 additions & 2 deletions src/EventStore.Client.Streams/SubscriptionFilterOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ public class SubscriptionFilterOptions {
/// A Task invoked and await when a checkpoint is reached.
/// Set the checkpointInterval to define how often this method is called.
/// </summary>
[Obsolete]
public Func<StreamSubscription, Position, CancellationToken, Task> CheckpointReached { get; } = null!;

/// <summary>
Expand All @@ -30,7 +29,6 @@ public class SubscriptionFilterOptions {
/// Set the checkpointInterval to define how often this method is called.
/// </param>
/// <exception cref="ArgumentNullException"></exception>
[Obsolete]
public SubscriptionFilterOptions(IEventFilter filter, uint checkpointInterval,
Func<StreamSubscription, Position, CancellationToken, Task>? checkpointReached)
: this(filter, checkpointInterval) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
namespace EventStore.Client.PersistentSubscriptions.Tests.SubscriptionToAll;
namespace EventStore.Client.PersistentSubscriptions.Tests.SubscriptionToAll.Obsolete;

[Obsolete]
[Obsolete("Will be removed in future release when older subscriptions APIs are removed from the client")]
public class connect_to_existing_with_max_one_client_obsolete : IClassFixture<connect_to_existing_with_max_one_client_obsolete.Fixture> {
const string Group = "maxoneclient";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
namespace EventStore.Client.PersistentSubscriptions.Tests.SubscriptionToAll;
namespace EventStore.Client.PersistentSubscriptions.Tests.SubscriptionToAll.Obsolete;

[Obsolete]
[Obsolete("Will be removed in future release when older subscriptions APIs are removed from the client")]
public class connect_to_existing_with_permissions_obsolete
: IClassFixture<connect_to_existing_with_permissions_obsolete.Fixture> {
const string Group = "connectwithpermissions";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
namespace EventStore.Client.PersistentSubscriptions.Tests.SubscriptionToAll;
namespace EventStore.Client.PersistentSubscriptions.Tests.SubscriptionToAll.Obsolete;

[Obsolete]
[Obsolete("Will be removed in future release when older subscriptions APIs are removed from the client")]
public class connect_to_existing_with_start_from_beginning_obsolete : IClassFixture<connect_to_existing_with_start_from_beginning_obsolete.Fixture> {
const string Group = "startfrombeginning";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

namespace EventStore.Client.PersistentSubscriptions.Tests.SubscriptionToAll;
namespace EventStore.Client.PersistentSubscriptions.Tests.SubscriptionToAll.Obsolete;

[Obsolete]
[Obsolete("Will be removed in future release when older subscriptions APIs are removed from the client")]
public class connect_to_existing_with_start_from_not_set_obsolete : IClassFixture<connect_to_existing_with_start_from_not_set_obsolete.Fixture> {
const string Group = "startfromend1";
readonly Fixture _fixture;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
namespace EventStore.Client.PersistentSubscriptions.Tests.SubscriptionToAll;
namespace EventStore.Client.PersistentSubscriptions.Tests.SubscriptionToAll.Obsolete;

[Obsolete]
[Obsolete("Will be removed in future release when older subscriptions APIs are removed from the client")]
public class connect_to_existing_with_start_from_not_set_then_event_written_obsolete
: IClassFixture<connect_to_existing_with_start_from_not_set_then_event_written_obsolete.Fixture> {
const string Group = "startfromnotset2";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
namespace EventStore.Client.PersistentSubscriptions.Tests.SubscriptionToAll;
namespace EventStore.Client.PersistentSubscriptions.Tests.SubscriptionToAll.Obsolete;

[Obsolete]
[Obsolete("Will be removed in future release when older subscriptions APIs are removed from the client")]
public class connect_to_existing_with_start_from_set_to_end_position_obsolete: IClassFixture<connect_to_existing_with_start_from_set_to_end_position_obsolete.Fixture> {
const string Group = "startfromend1";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
namespace EventStore.Client.PersistentSubscriptions.Tests.SubscriptionToAll;
namespace EventStore.Client.PersistentSubscriptions.Tests.SubscriptionToAll.Obsolete;

[Obsolete]
[Obsolete("Will be removed in future release when older subscriptions APIs are removed from the client")]
public class
connect_to_existing_with_start_from_set_to_end_position_then_event_written_obsolete
: IClassFixture<connect_to_existing_with_start_from_set_to_end_position_then_event_written_obsolete.Fixture> {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
namespace EventStore.Client.PersistentSubscriptions.Tests.SubscriptionToAll;
namespace EventStore.Client.PersistentSubscriptions.Tests.SubscriptionToAll.Obsolete;

[Obsolete]
[Obsolete("Will be removed in future release when older subscriptions APIs are removed from the client")]
public class connect_to_existing_with_start_from_set_to_invalid_middle_position_obsolete
: IClassFixture<connect_to_existing_with_start_from_set_to_invalid_middle_position_obsolete.Fixture> {
const string Group = "startfrominvalid1";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
namespace EventStore.Client.PersistentSubscriptions.Tests.SubscriptionToAll;
namespace EventStore.Client.PersistentSubscriptions.Tests.SubscriptionToAll.Obsolete;

[Obsolete]
[Obsolete("Will be removed in future release when older subscriptions APIs are removed from the client")]
public class connect_to_existing_with_start_from_set_to_valid_middle_position_obsolete
: IClassFixture<connect_to_existing_with_start_from_set_to_valid_middle_position_obsolete.Fixture> {
const string Group = "startfromvalid";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
namespace EventStore.Client.PersistentSubscriptions.Tests.SubscriptionToAll;
namespace EventStore.Client.PersistentSubscriptions.Tests.SubscriptionToAll.Obsolete;

[Obsolete]
[Obsolete("Will be removed in future release when older subscriptions APIs are removed from the client")]
public class connect_to_existing_without_permissions_obsolete
: IClassFixture<connect_to_existing_without_permissions_obsolete.Fixture> {
readonly Fixture _fixture;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
namespace EventStore.Client.PersistentSubscriptions.Tests.SubscriptionToAll;
namespace EventStore.Client.PersistentSubscriptions.Tests.SubscriptionToAll.Obsolete;

[Obsolete]
[Obsolete("Will be removed in future release when older subscriptions APIs are removed from the client")]
public class connect_to_existing_without_read_all_permissions_obsolete
: IClassFixture<connect_to_existing_without_read_all_permissions_obsolete.Fixture> {
readonly Fixture _fixture;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
namespace EventStore.Client.PersistentSubscriptions.Tests.SubscriptionToAll;
namespace EventStore.Client.PersistentSubscriptions.Tests.SubscriptionToAll.Obsolete;

[Obsolete]
[Obsolete("Will be removed in future release when older subscriptions APIs are removed from the client")]
public class connect_to_non_existing_with_permissions_obsolete
: IClassFixture<connect_to_non_existing_with_permissions_obsolete.Fixture> {
const string Group = "foo";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
namespace EventStore.Client.PersistentSubscriptions.Tests.SubscriptionToAll;
namespace EventStore.Client.PersistentSubscriptions.Tests.SubscriptionToAll.Obsolete;

[Obsolete]
[Obsolete("Will be removed in future release when older subscriptions APIs are removed from the client")]
public class connect_with_retries_obsolete
: IClassFixture<connect_with_retries_obsolete.Fixture> {
const string Group = "retries";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
namespace EventStore.Client.PersistentSubscriptions.Tests.SubscriptionToAll;
namespace EventStore.Client.PersistentSubscriptions.Tests.SubscriptionToAll.Obsolete;

[Obsolete]
[Obsolete("Will be removed in future release when older subscriptions APIs are removed from the client")]
public class deleting_existing_with_subscriber_obsolete
: IClassFixture<deleting_existing_with_subscriber_obsolete.Fixture> {
readonly Fixture _fixture;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
namespace EventStore.Client.PersistentSubscriptions.Tests.SubscriptionToAll;
namespace EventStore.Client.PersistentSubscriptions.Tests.SubscriptionToAll.Obsolete;

[Obsolete]
[Obsolete("Will be removed in future release when older subscriptions APIs are removed from the client")]
public class get_info_obsolete : IClassFixture<get_info_obsolete.Fixture> {
const string GroupName = nameof(get_info_obsolete);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
using System.Text;

namespace EventStore.Client.PersistentSubscriptions.Tests.SubscriptionToAll;
namespace EventStore.Client.PersistentSubscriptions.Tests.SubscriptionToAll.Obsolete;

[Obsolete]
[Obsolete("Will be removed in future release when older subscriptions APIs are removed from the client")]
public class happy_case_catching_up_to_link_to_events_manual_ack_obsolete
: IClassFixture<happy_case_catching_up_to_link_to_events_manual_ack_obsolete.Fixture> {
const string Group = nameof(Group);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
namespace EventStore.Client.PersistentSubscriptions.Tests.SubscriptionToAll;
namespace EventStore.Client.PersistentSubscriptions.Tests.SubscriptionToAll.Obsolete;

[Obsolete]
[Obsolete("Will be removed in future release when older subscriptions APIs are removed from the client")]
public class happy_case_catching_up_to_normal_events_manual_ack_obsolete : IClassFixture<happy_case_catching_up_to_normal_events_manual_ack_obsolete.Fixture> {
const string Group = nameof(Group);
const int BufferCount = 10;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
namespace EventStore.Client.PersistentSubscriptions.Tests.SubscriptionToAll;
namespace EventStore.Client.PersistentSubscriptions.Tests.SubscriptionToAll.Obsolete;

[Obsolete]
[Obsolete("Will be removed in future release when older subscriptions APIs are removed from the client")]
public class happy_case_filtered_obsolete : IClassFixture<happy_case_filtered_obsolete.Fixture> {
readonly Fixture _fixture;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
namespace EventStore.Client.PersistentSubscriptions.Tests.SubscriptionToAll;
namespace EventStore.Client.PersistentSubscriptions.Tests.SubscriptionToAll.Obsolete;

[Obsolete]
[Obsolete("Will be removed in future release when older subscriptions APIs are removed from the client")]
public class happy_case_filtered_with_start_from_set_obsolete : IClassFixture<happy_case_filtered_with_start_from_set_obsolete.Fixture> {
readonly Fixture _fixture;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
namespace EventStore.Client.PersistentSubscriptions.Tests.SubscriptionToAll;
namespace EventStore.Client.PersistentSubscriptions.Tests.SubscriptionToAll.Obsolete;

[Obsolete]
[Obsolete("Will be removed in future release when older subscriptions APIs are removed from the client")]
public class happy_case_writing_and_subscribing_to_normal_events_manual_ack_obsolete
: IClassFixture<happy_case_writing_and_subscribing_to_normal_events_manual_ack_obsolete.Fixture> {
const string Group = nameof(Group);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
namespace EventStore.Client.PersistentSubscriptions.Tests.SubscriptionToAll;
namespace EventStore.Client.PersistentSubscriptions.Tests.SubscriptionToAll.Obsolete;

[Obsolete]
[Obsolete("Will be removed in future release when older subscriptions APIs are removed from the client")]
public class update_existing_with_check_point_filtered_obsolete
: IClassFixture<update_existing_with_check_point_filtered_obsolete.Fixture> {
const string Group = "existing-with-check-point-filtered";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
namespace EventStore.Client.PersistentSubscriptions.Tests.SubscriptionToAll;
namespace EventStore.Client.PersistentSubscriptions.Tests.SubscriptionToAll.Obsolete;

[Obsolete]
[Obsolete("Will be removed in future release when older subscriptions APIs are removed from the client")]
public class update_existing_with_subscribers_obsolete
: IClassFixture<update_existing_with_subscribers_obsolete.Fixture> {
const string Group = "existing";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
namespace EventStore.Client.PersistentSubscriptions.Tests.SubscriptionToAll;
namespace EventStore.Client.PersistentSubscriptions.Tests.SubscriptionToAll.Obsolete;

[Obsolete]
[Obsolete("Will be removed in future release when older subscriptions APIs are removed from the client")]
public class when_writing_and_filtering_out_events_obsolete
: IClassFixture<when_writing_and_filtering_out_events_obsolete.Fixture> {
const string Group = "filtering-out-events";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
namespace EventStore.Client.PersistentSubscriptions.Tests.SubscriptionToAll;
namespace EventStore.Client.PersistentSubscriptions.Tests.SubscriptionToAll.Obsolete;

[Obsolete]
[Obsolete("Will be removed in future release when older subscriptions APIs are removed from the client")]
public class when_writing_and_subscribing_to_normal_events_manual_nack_obsolete
: IClassFixture<when_writing_and_subscribing_to_normal_events_manual_nack_obsolete.Fixture> {
const string Group = nameof(Group);
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
namespace EventStore.Client.PersistentSubscriptions.Tests.SubscriptionToStream;
namespace EventStore.Client.PersistentSubscriptions.Tests.SubscriptionToStream.Obsolete;

[Obsolete]
[Obsolete("Will be removed in future release when older subscriptions APIs are removed from the client")]
public class connect_to_existing_with_max_one_client_obsolete
: IClassFixture<connect_to_existing_with_max_one_client_obsolete.Fixture> {
const string Group = "startinbeginning1";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
namespace EventStore.Client.PersistentSubscriptions.Tests.SubscriptionToStream;
namespace EventStore.Client.PersistentSubscriptions.Tests.SubscriptionToStream.Obsolete;

[Obsolete]
[Obsolete("Will be removed in future release when older subscriptions APIs are removed from the client")]
public class connect_to_existing_with_permissions_obsolete
: IClassFixture<connect_to_existing_with_permissions_obsolete.Fixture> {
const string Stream = nameof(connect_to_existing_with_permissions_obsolete);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
namespace EventStore.Client.PersistentSubscriptions.Tests.SubscriptionToStream;
namespace EventStore.Client.PersistentSubscriptions.Tests.SubscriptionToStream.Obsolete;

[Obsolete]
[Obsolete("Will be removed in future release when older subscriptions APIs are removed from the client")]
public class connect_to_existing_with_start_from_beginning_and_events_in_it_obsolete
: IClassFixture<connect_to_existing_with_start_from_beginning_and_events_in_it_obsolete.Fixture
> {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
namespace EventStore.Client.PersistentSubscriptions.Tests.SubscriptionToStream;
namespace EventStore.Client.PersistentSubscriptions.Tests.SubscriptionToStream.Obsolete;

[Obsolete]
[Obsolete("Will be removed in future release when older subscriptions APIs are removed from the client")]
public class connect_to_existing_with_start_from_beginning_and_no_stream_obsolete
: IClassFixture<connect_to_existing_with_start_from_beginning_and_no_stream_obsolete.Fixture> {
const string Group = "startinbeginning1";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
namespace EventStore.Client.PersistentSubscriptions.Tests.SubscriptionToStream;
namespace EventStore.Client.PersistentSubscriptions.Tests.SubscriptionToStream.Obsolete;

[Obsolete]
[Obsolete("Will be removed in future release when older subscriptions APIs are removed from the client")]
public class connect_to_existing_with_start_from_not_set_and_events_in_it_obsolete
: IClassFixture<connect_to_existing_with_start_from_not_set_and_events_in_it_obsolete.
Fixture> {
Expand Down
Loading
Loading