Пример #1
0
        protected virtual void CreateDefaultMetadataCache()
        {
            if (metadataCache == null)
            {
                if (applicationContext.ContainsObject(METADATA_CACHE_NAME))
                {
                    metadataCache = applicationContext.GetObject(METADATA_CACHE_NAME) as MessageQueueMetadataCache;
                }
                else
                {
                    metadataCache = new MessageQueueMetadataCache();
                    if (ApplicationContext != null)
                    {
                        metadataCache.ApplicationContext = ApplicationContext;
                        metadataCache.AfterPropertiesSet();
                        metadataCache.Initialize();
                        applicationContext.ObjectFactory.RegisterSingleton("__MessageQueueMetadataCache__",
                                                                           metadataCache);
                    }
                    else
                    {
                        #region Logging

                        if (LOG.IsWarnEnabled)
                        {
                            LOG.Warn(
                                "The ApplicationContext property has not been set, so the MessageQueueMetadataCache can not be automatically generated.  " +
                                "Please explictly set the MessageQueueMetadataCache using the property MetadataCache or set the ApplicationContext property.  " +
                                "This will only effect the use of MessageQueueTemplate when publishing to remote queues.");
                        }

                        #endregion
                    }
                }
            }
        }
 /// <summary>
 /// Determines whether the application context contains the message queue object definition.
 /// </summary>
 /// <param name="messageQueueObjectName">Name of the message queue object.</param>
 /// <returns>
 ///     <c>true</c> if the application context contains the specified message queue object name; otherwise, <c>false</c>.
 /// </returns>
 public bool ContainsMessageQueue(string messageQueueObjectName)
 {
     return(applicationContext.ContainsObject(messageQueueObjectName));
 }