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

Extract recovery events into a dedicated interface #758

Merged
merged 1 commit into from
Mar 17, 2020
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
@@ -0,0 +1,59 @@
// This source code is dual-licensed under the Apache License, version
// 2.0, and the Mozilla Public License, version 1.1.
//
// The APL v2.0:
//
//---------------------------------------------------------------------------
// Copyright (c) 2007-2020 VMware, Inc.
//
// 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
//
// https://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.
//---------------------------------------------------------------------------
//
// The MPL v1.1:
//
//---------------------------------------------------------------------------
// The contents of this file are subject to the Mozilla Public License
// Version 1.1 (the "License"); you may not use this file except in
// compliance with the License. You may obtain a copy of the License
// at https://www.mozilla.org/MPL/
//
// Software distributed under the License is distributed on an "AS IS"
// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
// the License for the specific language governing rights and
// limitations under the License.
//
// The Original Code is RabbitMQ.
//
// The Initial Developer of the Original Code is Pivotal Software, Inc.
// Copyright (c) 2007-2020 VMware, Inc. All rights reserved.
//---------------------------------------------------------------------------

using System;
using System.Collections.Generic;
using System.IO;
using System.Threading;

using RabbitMQ.Client.Events;
using RabbitMQ.Client.Exceptions;

namespace RabbitMQ.Client
{
/// <summary>
/// Interface to an auto-recovering AMQP connection.
/// </summary>
public interface IAutorecoveringConnection : IConnection
{
event EventHandler<EventArgs> RecoverySucceeded;
event EventHandler<ConnectionRecoveryErrorEventArgs> ConnectionRecoveryError;
}
}
3 changes: 0 additions & 3 deletions projects/client/RabbitMQ.Client/src/client/api/IConnection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -161,9 +161,6 @@ public interface IConnection : NetworkConnection, IDisposable
/// of those event handlers throws an exception, as well.
/// </remarks>
event EventHandler<CallbackExceptionEventArgs> CallbackException;
event EventHandler<EventArgs> RecoverySucceeded;
event EventHandler<ConnectionRecoveryErrorEventArgs> ConnectionRecoveryError;


event EventHandler<ConnectionBlockedEventArgs> ConnectionBlocked;

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

namespace RabbitMQ.Client.Framing.Impl
{
internal sealed class AutorecoveringConnection : IConnection
internal sealed class AutorecoveringConnection : IAutorecoveringConnection
{
private readonly object _eventLock = new object();

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

namespace RabbitMQ.Client.Framing.Impl
{
class Connection : IConnection
internal sealed class Connection : IConnection
{
private readonly object _eventLock = new object();

Expand Down Expand Up @@ -128,11 +128,6 @@ public Connection(IConnectionFactory factory, bool insist, IFrameHandler frameHa

public Guid Id { get { return _id; } }

#pragma warning disable 67
public event EventHandler<EventArgs> RecoverySucceeded;
public event EventHandler<ConnectionRecoveryErrorEventArgs> ConnectionRecoveryError;
#pragma warning restore 67

public event EventHandler<CallbackExceptionEventArgs> CallbackException;

public event EventHandler<ConnectionBlockedEventArgs> ConnectionBlocked;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,11 @@ namespace RabbitMQ.Client
{
bool DispatchConsumersAsync { get; set; }
}
public interface IAutorecoveringConnection : RabbitMQ.Client.IConnection, RabbitMQ.Client.NetworkConnection, System.IDisposable
{
event System.EventHandler<RabbitMQ.Client.Events.ConnectionRecoveryErrorEventArgs> ConnectionRecoveryError;
event System.EventHandler<System.EventArgs> RecoverySucceeded;
}
public interface IBasicConsumer
{
RabbitMQ.Client.IModel Model { get; }
Expand Down Expand Up @@ -295,10 +300,8 @@ namespace RabbitMQ.Client
System.Collections.Generic.IList<RabbitMQ.Client.ShutdownReportEntry> ShutdownReport { get; }
event System.EventHandler<RabbitMQ.Client.Events.CallbackExceptionEventArgs> CallbackException;
event System.EventHandler<RabbitMQ.Client.Events.ConnectionBlockedEventArgs> ConnectionBlocked;
event System.EventHandler<RabbitMQ.Client.Events.ConnectionRecoveryErrorEventArgs> ConnectionRecoveryError;
event System.EventHandler<RabbitMQ.Client.ShutdownEventArgs> ConnectionShutdown;
event System.EventHandler<System.EventArgs> ConnectionUnblocked;
event System.EventHandler<System.EventArgs> RecoverySucceeded;
void Abort();
void Abort(System.TimeSpan timeout);
void Abort(ushort reasonCode, string reasonText);
Expand Down