Пример #1
0
    public static void Publish(string socketPath, MarshalByRefObject obj)
    {
        IChannel channel = new UnixChannel(socketPath);

        ChannelServices.RegisterChannel(channel, false);

        RemotingServices.Marshal(obj, obj.GetType().ToString());
    }
        void exposeRequestReceiver()
        {
            Console.WriteLine("Exposing Receiver");
            var receiverObjectPath = Path.Combine(Path.GetFullPath(BaseDirectory), RequestsGateway.ApplicationHostManagerDescriptorReceiverFileName);

            Console.WriteLine("Enabling Receiver at {0}", receiverObjectPath);
            UnixChannel channel = new UnixChannel(receiverObjectPath);

            RemotingServices.Marshal(this.inner, RequestsGateway.ApplicationHostManagerDescriptorReceiverObjectName);
        }
        protected override void OnInitialize()
        {
            UnixChannel channel = new UnixChannel();

            ChannelServices.RegisterChannel(channel, false);
            string listenerObjectPath = RequestsGateway.GetApplicationUnixChannelAbsoluteUri(Path.GetFullPath(this.BaseDirectory));

            Console.WriteLine("Connecting to Unix Pipe {0}", listenerObjectPath);
            gateway = (RequestsGateway)Activator.GetObject(typeof(RequestsGateway), listenerObjectPath);
            Console.WriteLine("Connected to Gateway = {0}", gateway != null);
            //gateway.Receiver = this.inner;
            Console.WriteLine("Gateway Host has Initialized Connection with Nginx Server");

            exposeRequestReceiver();
        }
Пример #4
0
    public T Get <T>()
    {
        Hashtable props = new Hashtable();

        props ["name"] = "unix_" + Path.GetFileName(SocketPath);
        IChannel channel = new UnixChannel(props, null, null);

        ChannelServices.RegisterChannel(channel, false);

        T obj = (T)Activator.GetObject(
            typeof(T),
            String.Format("unix://{0}?/{1}", SocketPath, typeof(T)));

        return(obj);
    }
Пример #5
0
 public void EnsureInitializeApp()
 {
     Console.Error.WriteLine("Ensure Initialize App");
     if (requestsGateway == null)
     {
         string unixChannelPipePath = Path.GetFullPath(Path.Combine(appFolder, RequestsGateway.ApplicationHostManagerDescriptorFileName));
         if (File.Exists(unixChannelPipePath))
         {
             File.Delete(unixChannelPipePath);
         }
         UnixChannel devChannel = new UnixChannel(unixChannelPipePath);
         ChannelServices.RegisterChannel(devChannel, false);
         requestsGateway = new NginxRequestsGateway(this.appFolder);
         string objName = RequestsGateway.ApplicationHostManagerDescriptorObjectName;
         requestsGatewayRef = RemotingServices.Marshal(requestsGateway, objName);
         Console.Error.WriteLine("Requests Gateway ({0}) Exposed at {1}", objName, unixChannelPipePath);
     }
 }