/// <summary> /// This function will create the dictionary. /// </summary> private void createDictionary() { if (m_downloadDictionary) { using (MamaSource dictionarySource = new MamaSource()) { /* If a dictionary transport has been specified then a new one must be created otherwise * the main transport will be re-used. */ MamaTransport dictionaryTransport = null; try { if ((m_dictionaryTransportName == null) || (m_dictionaryTransportName == string.Empty)) { dictionarySource.transport = m_transport; } else { dictionaryTransport = new MamaTransport(); dictionaryTransport.create(m_dictionaryTransportName, m_bridge); dictionarySource.transport = dictionaryTransport; } // The symbol namespace must also be set dictionarySource.symbolNamespace = m_dictionarySourceName; // Instantiate a callback class ListenerDictionaryCallback dictionaryCallback = new ListenerDictionaryCallback(m_bridge); // Create the actual dictionary object using the default queue m_dictionary = new MamaDictionary(); m_dictionary.create(m_defaultQueue, dictionaryCallback, dictionarySource, 3, 10.0); // Start the bridge, this will block until the dictionary is downloaded or something goes wrong Mama.start(m_bridge); // If something went wrong then throw an exception if (!dictionaryCallback.DictionaryComplete) { throw new ApplicationException("Can't create dictionary."); } } finally { if (dictionaryTransport != null) { dictionaryTransport.destroy(); } } } } }
/// <summary> /// This function will create the dictionary. /// </summary> private void createDictionary() { if (m_downloadDictionary) { using (MamaSource dictionarySource = new MamaSource()) { /* If a dictionary transport has been specified then a new one must be created otherwise * the main transport will be re-used. */ MamaTransport dictionaryTransport = null; try { if((m_dictionaryTransportName == null) || (m_dictionaryTransportName == string.Empty)) { dictionarySource.transport = m_transport; } else { dictionaryTransport = new MamaTransport(); dictionaryTransport.create(m_dictionaryTransportName, m_bridge); dictionarySource.transport = dictionaryTransport; } // The symbol namespace must also be set dictionarySource.symbolNamespace = m_dictionarySourceName; // Instantiate a callback class ListenerDictionaryCallback dictionaryCallback = new ListenerDictionaryCallback(m_bridge); // Create the actual dictionary object using the default queue m_dictionary = new MamaDictionary(); m_dictionary.create(m_defaultQueue, dictionaryCallback, dictionarySource, 3, 10.0); // Start the bridge, this will block until the dictionary is downloaded or something goes wrong Mama.start(m_bridge); // If something went wrong then throw an exception if (!dictionaryCallback.DictionaryComplete) { throw new ApplicationException("Can't create dictionary."); } } finally { if (dictionaryTransport != null) { dictionaryTransport.destroy(); } } } } }