Esempio n. 1
0
        public void OnCreate(Connection.IConnection connection)
        {
            _logger?.LogDebug("OnCreate for connection: {connection}", connection?.ToString());

            if (Interlocked.CompareExchange(ref _initializing, 1, 0) != 0)
            {
                return;
            }

            try
            {
                /*
                 * ...but it is possible for this to happen twice in the same ConnectionFactory (if more than
                 * one concurrent Connection is allowed). It's idempotent, so no big deal (a bit of network
                 * chatter). In fact it might even be a good thing: exclusive queues only make sense if they are
                 * declared for every connection. If anyone has a problem with it: use auto-startup="false".
                 */
                if (RetryTemplate != null && !RetryDisabled)
                {
                    RetryTemplate.Execute(
                        c =>
                    {
                        Initialize();
                    });
                }
                else
                {
                    Initialize();
                }
            }
            finally
            {
                Interlocked.CompareExchange(ref _initializing, 0, 1);
            }
        }
Esempio n. 2
0
 public void OnClose(Connection.IConnection connection)
 {
     _logger?.LogDebug("OnClose for connection: {connection}", connection?.ToString());
 }