internal void Init(AdapterSettings adapterSettings) { if (adapterSettings != null) { string typeName = adapterSettings.Class; Type type = ObjectFactory.Locate(typeName); if (type != null) { _adapter = ObjectFactory.CreateInstance(type) as ServiceAdapter; _adapter.SetDestination(this); _adapter.SetAdapterSettings(adapterSettings); _adapter.SetDestinationSettings(_settings); _adapter.Init(); } } MessageBroker messageBroker = this.Service.GetMessageBroker(); messageBroker.RegisterDestination(this, _service); //If the source has application scope create an instance here, so the service can listen for SessionCreated events for the first request if (this.Scope == "application") { FactoryInstance factoryInstance = GetFactoryInstance(); object inst = factoryInstance.Lookup(); } }
/// <summary> /// Initializes the current Destination. /// </summary> /// <param name="adapterDefinition">Adapter definition.</param> public virtual void Init(AdapterDefinition adapterDefinition) { if (_initialized) { throw new NotSupportedException(__Res.GetString(__Res.Destination_Reinit, this.Id, this.GetType().Name)); } _initialized = true; if (adapterDefinition != null) { string typeName = adapterDefinition.Class; Type type = ObjectFactory.Locate(typeName); if (type != null) { _adapter = ObjectFactory.CreateInstance(type) as ServiceAdapter; _adapter.SetDestination(this); _adapter.SetAdapterSettings(adapterDefinition); _adapter.SetDestinationSettings(_destinationDefinition); _adapter.Init(); } else { log.Error(__Res.GetString(__Res.Type_InitError, adapterDefinition.Class)); } } else { log.Error(__Res.GetString(__Res.MessageServer_MissingAdapter, this.Id, this.GetType().Name)); } MessageBroker messageBroker = this.Service.GetMessageBroker(); messageBroker.RegisterDestination(this, _service); //If the source has application scope create an instance here, so the service can listen for SessionCreated events for the first request if (this.Scope == "application") { FactoryInstance factoryInstance = GetFactoryInstance(); object inst = factoryInstance.Lookup(); } }