Exemplo n.º 1
0
        public override object ServiceMessage(IMessage message)
        {
            RemotingMessage     remotingMessage = message as RemotingMessage;
            RemotingDestination destination     = GetDestination(message) as RemotingDestination;
            ServiceAdapter      adapter         = destination.ServiceAdapter;
            object result = adapter.Invoke(message);

            return(result);
        }
Exemplo n.º 2
0
 internal void Init(AdapterSettings adapterSettings)
 {
     if (adapterSettings != null)
     {
         Type type = ObjectFactory.Locate(adapterSettings.Class);
         if (type != null)
         {
             this._adapter = ObjectFactory.CreateInstance(type) as FluorineFx.Messaging.Services.ServiceAdapter;
             this._adapter.SetDestination(this);
             this._adapter.SetAdapterSettings(adapterSettings);
             this._adapter.SetDestinationSettings(this._settings);
             this._adapter.Init();
         }
         else
         {
             log.Error(__Res.GetString("Type_InitError", new object[] { adapterSettings.Class }));
         }
     }
     this.Service.GetMessageBroker().RegisterDestination(this, this._service);
     if (this.Scope == "application")
     {
         object obj2 = this.GetFactoryInstance().Lookup();
     }
 }
Exemplo n.º 3
0
        /// <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();
            }
        }