Esempio n. 1
0
        /// <summary>
        /// Initializes a new instance of the BrokerEntry class
        /// </summary>
        /// <param name="startInfo">indicating the start info</param>
        /// <param name="brokerInfo">indicating the broker info</param>
        public BrokerEntry(SessionStartInfoContract startInfo, BrokerStartInfo brokerInfo, BrokerManagementService serviceInstance)
        {
            if (startInfo.TransportScheme != TransportScheme.NetTcp)
            {
                throw new NotSupportedException("Sample broker does not support transport scheme other than NetTcp.");
            }

            if (brokerInfo.Durable)
            {
                throw new NotSupportedException("Sample broker does not support durable session.");
            }

            this.clientManager = new ServiceClientManager(brokerInfo.SessionId, brokerInfo.Headnode, serviceInstance);

            Frontend       frontend = new Frontend(this.clientManager);
            WebHttpBinding binding  = new WebHttpBinding();

            binding.MaxBufferPoolSize      = 5000000;
            binding.MaxBufferSize          = 5000000;
            binding.MaxReceivedMessageSize = 5000000;

            binding.ReaderQuotas.MaxArrayLength         = 5000000;
            binding.ReaderQuotas.MaxBytesPerRead        = 5000000;
            binding.ReaderQuotas.MaxDepth               = 5000000;
            binding.ReaderQuotas.MaxNameTableCharCount  = 5000000;
            binding.ReaderQuotas.MaxStringContentLength = 5000000;

            this.frontendServiceHost = new WebServiceHost(frontend, new Uri(String.Format("http://{0}:8081/", Environment.MachineName)));
            ServiceEndpoint endpoint = this.frontendServiceHost.AddServiceEndpoint(typeof(IWebHttpFrontendService), binding, String.Empty);

            endpoint.Behaviors.Add(new WebHttpBehavior());

            string listenUri = endpoint.ListenUri.AbsoluteUri;

            this.frontendServiceHost.Open();

            this.result           = new BrokerInitializationResult();
            this.result.BrokerEpr = new string[3] {
                listenUri, null, null
            };
            this.result.ControllerEpr = new string[3];
            this.result.ResponseEpr   = new string[3];
        }
Esempio n. 2
0
        /// <summary>
        /// Initializes a new instance of the BrokerEntry class
        /// </summary>
        /// <param name="startInfo">indicating the start info</param>
        /// <param name="brokerInfo">indicating the broker info</param>
        public BrokerEntry(SessionStartInfoContract startInfo, BrokerStartInfo brokerInfo, BrokerManagementService serviceInstance)
        {
            if (startInfo.TransportScheme != TransportScheme.NetTcp)
            {
                throw new NotSupportedException("Sample broker does not support transport scheme other than NetTcp.");
            }

            if (brokerInfo.Durable)
            {
                throw new NotSupportedException("Sample broker does not support durable session.");
            }

            this.clientManager = new ServiceClientManager(brokerInfo.SessionId, brokerInfo.Headnode, serviceInstance);
            Frontend frontend = new Frontend(this.clientManager);

            // Choose different binding configuration by start info
            NetTcpBinding frontendBinding;

            if (startInfo.Secure)
            {
                frontendBinding = new NetTcpBinding();
            }
            else
            {
                frontendBinding = new NetTcpBinding(SecurityMode.None);
            }

            frontendBinding.PortSharingEnabled = true;

            this.frontendServiceHost = new ServiceHost(frontend, new Uri(String.Format("net.tcp://{0}:9091/SampleBroker", Environment.MachineName)));
            string listenUri = this.frontendServiceHost.AddServiceEndpoint(typeof(IDuplexService), frontendBinding, String.Empty).ListenUri.AbsoluteUri;

            this.frontendServiceHost.Open();

            this.result           = new BrokerInitializationResult();
            this.result.BrokerEpr = new string[3] {
                listenUri, null, null
            };
            this.result.ControllerEpr = new string[3];
            this.result.ResponseEpr   = new string[3];
        }
Esempio n. 3
0
 /// <summary>
 /// Initializes a new instance of the Frontend class
 /// </summary>
 /// <param name="clientManager">indicating the client manager</param>
 public Frontend(ServiceClientManager clientManager)
 {
     this.clientManager = clientManager;
 }