C# Class RabbitMQ.Client.Impl.ConnectionBase

Inheritance: IConnection
Show file Open project: CSGOpenSource/rabbitmq-dotnet-client Class Usage Examples

Public Properties

Property Type Description
HandshakeTimeout int
m_appContinuation System.Threading.ManualResetEvent
m_callbackException CallbackExceptionEventHandler
m_clientProperties object>.IDictionary
m_closeReason RabbitMQ.Client.ShutdownEventArgs
m_closed bool
m_connectionBlocked ConnectionBlockedEventHandler
m_connectionShutdown ConnectionShutdownEventHandler
m_connectionUnblocked ConnectionUnblockedEventHandler
m_eventLock object
m_factory RabbitMQ.Client.ConnectionFactory
m_frameHandler IFrameHandler
m_frameMax uint
m_heartbeat ushort
m_heartbeatFrame Frame
m_heartbeatRead System.Threading.AutoResetEvent
m_heartbeatWrite System.Threading.AutoResetEvent
m_id System.Guid
m_knownHosts RabbitMQ.Client.AmqpTcpEndpoint[]
m_missedHeartbeats int
m_model0 ModelBase
m_running bool
m_serverProperties object>.IDictionary
m_session0 RabbitMQ.Client.Impl.MainSession
m_sessionManager RabbitMQ.Client.Impl.SessionManager
m_shutdownReport IList

Private Properties

Property Type Description
IDisposable void
NegotiatedMaxValue uint

Public Methods

Method Description
Abort ( ) : void

API-side invocation of connection abort.

Abort ( int timeout ) : void

API-side invocation of connection abort with timeout.

Abort ( ushort reasonCode, string reasonText ) : void

API-side invocation of connection abort.

Abort ( ushort reasonCode, string reasonText, ShutdownInitiator initiator, int timeout ) : void
Abort ( ushort reasonCode, string reasonText, int timeout ) : void

API-side invocation of connection abort with timeout.

Close ( ) : void

API-side invocation of connection.close.

Close ( RabbitMQ.Client.ShutdownEventArgs reason ) : void
Close ( RabbitMQ.Client.ShutdownEventArgs reason, bool abort, int timeout ) : void

Try to close connection in a graceful way

Shutdown reason contains code and text assigned when closing the connection, as well as the information about what initiated the close

Abort flag, if true, signals to close the ongoing connection immediately and do not report any errors if it was already closed.

Timeout determines how much time internal close operations should be given to complete. Negative or Timeout.Infinite value mean infinity.

Close ( int timeout ) : void

API-side invocation of connection.close with timeout.

Close ( ushort reasonCode, string reasonText ) : void

API-side invocation of connection.close.

Close ( ushort reasonCode, string reasonText, int timeout ) : void

API-side invocation of connection.close with timeout.

ClosingLoop ( ) : void Loop only used while quiescing. Use only to cleanly close connection
ConnectionBase ( ConnectionFactory factory, bool insist, IFrameHandler frameHandler ) : System
ConnectionCloseWrapper ( ushort reasonCode, string reasonText ) : Command
CreateModel ( ) : IModel
CreateSession ( ) : ISession
CreateSession ( int channelNumber ) : ISession
DefaultClientProperties ( ) : object>.IDictionary
FinishClose ( ) : void
HandleConnectionBlocked ( string reason ) : void
HandleConnectionUnblocked ( ) : void
HandleDomainUnload ( object sender, EventArgs ea ) : void We need to close the socket, otherwise attempting to unload the domain could cause a CannotUnloadAppDomainException
HandleMainLoopException ( RabbitMQ.Client.ShutdownEventArgs reason ) : void
HardProtocolExceptionHandler ( RabbitMQ.Client.Impl.HardProtocolException hpe ) : bool
HeartbeatReadLoop ( ) : void
HeartbeatWriteLoop ( ) : void
InternalClose ( RabbitMQ.Client.ShutdownEventArgs reason ) : void
LogCloseError ( String error, Exception ex ) : void
MainLoop ( ) : void
MainLoopIteration ( ) : void
NotifyHeartbeatThread ( ) : void
NotifyReceivedCloseOk ( ) : void
OnCallbackException ( RabbitMQ.Client.Events.CallbackExceptionEventArgs args ) : void
OnConnectionBlocked ( RabbitMQ.Client.Events.ConnectionBlockedEventArgs args ) : void
OnConnectionUnblocked ( ) : void
OnShutdown ( ) : void

Broadcasts notification of the final shutdown of the connection.

Open ( bool insist ) : void
PrettyPrintShutdownReport ( ) : void
QuiesceChannel ( RabbitMQ.Client.Impl.SoftProtocolException pe ) : void

Sets the channel named in the SoftProtocolException into "quiescing mode", where we issue a channel.close and ignore everything except for subsequent channel.close messages and the channel.close-ok reply that should eventually arrive.

Since a well-behaved peer will not wait indefinitely before issuing the close-ok, we don't bother with a timeout here; compare this to the case of a connection.close-ok, where a timeout is necessary.

We need to send the close method and politely wait for a reply before marking the channel as available for reuse.

As soon as SoftProtocolException is detected, we should stop servicing ordinary application work, and should concentrate on bringing down the channel as quickly and gracefully as possible. The way this is done, as per the close-protocol, is to signal closure up the stack *before* sending the channel.close, by invoking ISession.Close. Once the upper layers have been signalled, we are free to do what we need to do to clean up and shut down the channel.

SetCloseReason ( RabbitMQ.Client.ShutdownEventArgs reason ) : bool
StartHeartbeatLoop ( ThreadStart loop, string name, bool useBackgroundThread ) : void
StartHeartbeatLoops ( bool useBackgroundThread ) : void
StartMainLoop ( bool useBackgroundThread ) : void
TerminateMainloop ( ) : void May be called more than once. Should therefore be idempotent.
ToString ( ) : string
WriteFrame ( Frame f ) : void

Protected Methods

Method Description
ChannelCloseWrapper ( ushort reasonCode, string reasonText ) : Command
StartAndTune ( ) : void

Private Methods

Method Description
IDisposable ( ) : void
NegotiatedMaxValue ( uint clientValue, uint serverValue ) : uint

Method Details

Abort() public method

API-side invocation of connection abort.
public Abort ( ) : void
return void

Abort() public method

API-side invocation of connection abort with timeout.
public Abort ( int timeout ) : void
timeout int
return void

Abort() public method

API-side invocation of connection abort.
public Abort ( ushort reasonCode, string reasonText ) : void
reasonCode ushort
reasonText string
return void

Abort() public method

public Abort ( ushort reasonCode, string reasonText, ShutdownInitiator initiator, int timeout ) : void
reasonCode ushort
reasonText string
initiator ShutdownInitiator
timeout int
return void

Abort() public method

API-side invocation of connection abort with timeout.
public Abort ( ushort reasonCode, string reasonText, int timeout ) : void
reasonCode ushort
reasonText string
timeout int
return void

ChannelCloseWrapper() protected method

protected ChannelCloseWrapper ( ushort reasonCode, string reasonText ) : Command
reasonCode ushort
reasonText string
return Command

Close() public method

API-side invocation of connection.close.
public Close ( ) : void
return void

Close() public method

public Close ( RabbitMQ.Client.ShutdownEventArgs reason ) : void
reason RabbitMQ.Client.ShutdownEventArgs
return void

Close() public method

Try to close connection in a graceful way

Shutdown reason contains code and text assigned when closing the connection, as well as the information about what initiated the close

Abort flag, if true, signals to close the ongoing connection immediately and do not report any errors if it was already closed.

Timeout determines how much time internal close operations should be given to complete. Negative or Timeout.Infinite value mean infinity.

public Close ( RabbitMQ.Client.ShutdownEventArgs reason, bool abort, int timeout ) : void
reason RabbitMQ.Client.ShutdownEventArgs
abort bool
timeout int
return void

Close() public method

API-side invocation of connection.close with timeout.
public Close ( int timeout ) : void
timeout int
return void

Close() public method

API-side invocation of connection.close.
public Close ( ushort reasonCode, string reasonText ) : void
reasonCode ushort
reasonText string
return void

Close() public method

API-side invocation of connection.close with timeout.
public Close ( ushort reasonCode, string reasonText, int timeout ) : void
reasonCode ushort
reasonText string
timeout int
return void

ClosingLoop() public method

Loop only used while quiescing. Use only to cleanly close connection
public ClosingLoop ( ) : void
return void

ConnectionBase() public method

public ConnectionBase ( ConnectionFactory factory, bool insist, IFrameHandler frameHandler ) : System
factory RabbitMQ.Client.ConnectionFactory
insist bool
frameHandler IFrameHandler
return System

ConnectionCloseWrapper() public method

public ConnectionCloseWrapper ( ushort reasonCode, string reasonText ) : Command
reasonCode ushort
reasonText string
return Command

CreateModel() public method

public CreateModel ( ) : IModel
return IModel

CreateSession() public method

public CreateSession ( ) : ISession
return ISession

CreateSession() public method

public CreateSession ( int channelNumber ) : ISession
channelNumber int
return ISession

DefaultClientProperties() public static method

public static DefaultClientProperties ( ) : object>.IDictionary
return object>.IDictionary

FinishClose() public method

public FinishClose ( ) : void
return void

HandleConnectionBlocked() public method

public HandleConnectionBlocked ( string reason ) : void
reason string
return void

HandleConnectionUnblocked() public method

public HandleConnectionUnblocked ( ) : void
return void

HandleDomainUnload() public method

We need to close the socket, otherwise attempting to unload the domain could cause a CannotUnloadAppDomainException
public HandleDomainUnload ( object sender, EventArgs ea ) : void
sender object
ea System.EventArgs
return void

HandleMainLoopException() public method

public HandleMainLoopException ( RabbitMQ.Client.ShutdownEventArgs reason ) : void
reason RabbitMQ.Client.ShutdownEventArgs
return void

HardProtocolExceptionHandler() public method

public HardProtocolExceptionHandler ( RabbitMQ.Client.Impl.HardProtocolException hpe ) : bool
hpe RabbitMQ.Client.Impl.HardProtocolException
return bool

HeartbeatReadLoop() public method

public HeartbeatReadLoop ( ) : void
return void

HeartbeatWriteLoop() public method

public HeartbeatWriteLoop ( ) : void
return void

InternalClose() public method

public InternalClose ( RabbitMQ.Client.ShutdownEventArgs reason ) : void
reason RabbitMQ.Client.ShutdownEventArgs
return void

LogCloseError() public method

public LogCloseError ( String error, Exception ex ) : void
error String
ex System.Exception
return void

MainLoop() public method

public MainLoop ( ) : void
return void

MainLoopIteration() public method

public MainLoopIteration ( ) : void
return void

NotifyHeartbeatThread() public method

public NotifyHeartbeatThread ( ) : void
return void

NotifyReceivedCloseOk() public method

public NotifyReceivedCloseOk ( ) : void
return void

OnCallbackException() public method

public OnCallbackException ( RabbitMQ.Client.Events.CallbackExceptionEventArgs args ) : void
args RabbitMQ.Client.Events.CallbackExceptionEventArgs
return void

OnConnectionBlocked() public method

public OnConnectionBlocked ( RabbitMQ.Client.Events.ConnectionBlockedEventArgs args ) : void
args RabbitMQ.Client.Events.ConnectionBlockedEventArgs
return void

OnConnectionUnblocked() public method

public OnConnectionUnblocked ( ) : void
return void

OnShutdown() public method

Broadcasts notification of the final shutdown of the connection.
public OnShutdown ( ) : void
return void

Open() public method

public Open ( bool insist ) : void
insist bool
return void

PrettyPrintShutdownReport() public method

public PrettyPrintShutdownReport ( ) : void
return void

QuiesceChannel() public method

Sets the channel named in the SoftProtocolException into "quiescing mode", where we issue a channel.close and ignore everything except for subsequent channel.close messages and the channel.close-ok reply that should eventually arrive.

Since a well-behaved peer will not wait indefinitely before issuing the close-ok, we don't bother with a timeout here; compare this to the case of a connection.close-ok, where a timeout is necessary.

We need to send the close method and politely wait for a reply before marking the channel as available for reuse.

As soon as SoftProtocolException is detected, we should stop servicing ordinary application work, and should concentrate on bringing down the channel as quickly and gracefully as possible. The way this is done, as per the close-protocol, is to signal closure up the stack *before* sending the channel.close, by invoking ISession.Close. Once the upper layers have been signalled, we are free to do what we need to do to clean up and shut down the channel.

public QuiesceChannel ( RabbitMQ.Client.Impl.SoftProtocolException pe ) : void
pe RabbitMQ.Client.Impl.SoftProtocolException
return void

SetCloseReason() public method

public SetCloseReason ( RabbitMQ.Client.ShutdownEventArgs reason ) : bool
reason RabbitMQ.Client.ShutdownEventArgs
return bool

StartAndTune() protected method

protected StartAndTune ( ) : void
return void

StartHeartbeatLoop() public method

public StartHeartbeatLoop ( ThreadStart loop, string name, bool useBackgroundThread ) : void
loop ThreadStart
name string
useBackgroundThread bool
return void

StartHeartbeatLoops() public method

public StartHeartbeatLoops ( bool useBackgroundThread ) : void
useBackgroundThread bool
return void

StartMainLoop() public method

public StartMainLoop ( bool useBackgroundThread ) : void
useBackgroundThread bool
return void

TerminateMainloop() public method

May be called more than once. Should therefore be idempotent.
public TerminateMainloop ( ) : void
return void

ToString() public method

public ToString ( ) : string
return string

WriteFrame() public method

public WriteFrame ( Frame f ) : void
f Frame
return void

Property Details

HandshakeTimeout public static property

Timeout used while waiting for AMQP handshaking to complete (milliseconds)
public static int HandshakeTimeout
return int

m_appContinuation public property

public ManualResetEvent,System.Threading m_appContinuation
return System.Threading.ManualResetEvent

m_callbackException public property

public CallbackExceptionEventHandler m_callbackException
return CallbackExceptionEventHandler

m_clientProperties public property

public IDictionary m_clientProperties
return object>.IDictionary

m_closeReason public property

public ShutdownEventArgs,RabbitMQ.Client m_closeReason
return RabbitMQ.Client.ShutdownEventArgs

m_closed public property

public bool m_closed
return bool

m_connectionBlocked public property

public ConnectionBlockedEventHandler m_connectionBlocked
return ConnectionBlockedEventHandler

m_connectionShutdown public property

public ConnectionShutdownEventHandler m_connectionShutdown
return ConnectionShutdownEventHandler

m_connectionUnblocked public property

public ConnectionUnblockedEventHandler m_connectionUnblocked
return ConnectionUnblockedEventHandler

m_eventLock public property

public object m_eventLock
return object

m_factory public property

public ConnectionFactory,RabbitMQ.Client m_factory
return RabbitMQ.Client.ConnectionFactory

m_frameHandler public property

public IFrameHandler m_frameHandler
return IFrameHandler

m_frameMax public property

public uint m_frameMax
return uint

m_heartbeat public property

public ushort m_heartbeat
return ushort

m_heartbeatFrame public property

Heartbeat frame for transmission. Reusable across connections.
public Frame,RabbitMQ.Client.Impl m_heartbeatFrame
return Frame

m_heartbeatRead public property

public AutoResetEvent,System.Threading m_heartbeatRead
return System.Threading.AutoResetEvent

m_heartbeatWrite public property

public AutoResetEvent,System.Threading m_heartbeatWrite
return System.Threading.AutoResetEvent

m_id public property

public Guid,System m_id
return System.Guid

m_knownHosts public property

public AmqpTcpEndpoint[],RabbitMQ.Client m_knownHosts
return RabbitMQ.Client.AmqpTcpEndpoint[]

m_missedHeartbeats public property

public int m_missedHeartbeats
return int

m_model0 public property

public ModelBase,RabbitMQ.Client.Impl m_model0
return ModelBase

m_running public property

public bool m_running
return bool

m_serverProperties public property

public IDictionary m_serverProperties
return object>.IDictionary

m_session0 public property

public MainSession,RabbitMQ.Client.Impl m_session0
return RabbitMQ.Client.Impl.MainSession

m_sessionManager public property

public SessionManager,RabbitMQ.Client.Impl m_sessionManager
return RabbitMQ.Client.Impl.SessionManager

m_shutdownReport public property

public IList m_shutdownReport
return IList