/// <summary> /// Optional override to create listeners (like tcp, http) for this service instance. /// </summary> /// <returns>The collection of listeners.</returns> protected override IEnumerable <ServiceInstanceListener> CreateServiceInstanceListeners() { var listeners = new ServiceInstanceListener[] { new ServiceInstanceListener(serviceContext => new KestrelCommunicationListener(serviceContext, "ServiceEndpoint", (url, listener) => { ServiceEventSource.Current.ServiceMessage(serviceContext, $"Starting Kestrel on {url}"); return(new WebHostBuilder() .UseKestrel() .ConfigureServices( services => services .AddSingleton <StatelessServiceContext>(serviceContext) .AddSingleton <FabricClient>(new FabricClient()) .AddSingleton <HttpClient>(new HttpClient()) .AddSingleton <ConfigSettings>(new ConfigSettings(serviceContext))) .UseContentRoot(Directory.GetCurrentDirectory()) .UseStartup <Startup>() .UseServiceFabricIntegration(listener, ServiceFabricIntegrationOptions.None) .UseUrls(url) .Build()); })), }; return(listeners.Concat(this.CreateServiceRemotingInstanceListeners())); }
/// <summary> /// Optional override to create listeners (e.g., TCP, HTTP) for this service replica to handle client or user requests. /// </summary> /// <returns>A collection of listeners.</returns> protected override IEnumerable <ServiceInstanceListener> CreateServiceInstanceListeners() { Binding binding = new BindingConfig().GetBinding(); string host = this.Context.NodeContext.IPAddressOrFQDN; var endpointConfig = this.Context.CodePackageActivationContext.GetEndpoint("ServiceEndpoint"); int port = endpointConfig.Port; string scheme = endpointConfig.Protocol.ToString(); string nodeName = this.Context.NodeContext.NodeName; string servicename = this.Context.ServiceTypeName; string uri = string.Format(CultureInfo.InvariantCulture, "{0}://{1}:{2}/{3}/{4}.svc", "net." + scheme, host, port, nodeName, servicename); WcfCommunicationListener <IPresidentialService> pressListener = new WcfCommunicationListener <IPresidentialService>(this.Context, this, binding, new EndpointAddress(uri)); // Check to see if the service host already has a ServiceMetadataBehavior, If not, add one // For net.tcp need to find a way to expose metadata //if (pressListener.ServiceHost.Description.Behaviors.Find<ServiceMetadataBehavior>() == null) //{ // ServiceMetadataBehavior behavior = new ServiceMetadataBehavior(); // behavior.HttpGetEnabled = true; // need to figure it out how to bypass this for net.tcp // behavior.HttpGetUrl = new Uri(uri + "mex/"); // need to figure it out how to bypass this for net.tcp // pressListener.ServiceHost.Description.Behaviors.Add(behavior); // pressListener.ServiceHost.AddServiceEndpoint(typeof(IMetadataExchange), MetadataExchangeBindings.CreateMexTcpBinding(), uri + "mex/"); //} ServiceInstanceListener listener = new ServiceInstanceListener(context => pressListener); return(new[] { listener }); }
/// <summary> /// Optional override to create listeners (e.g., TCP, HTTP) for this service replica to handle client or user requests. /// </summary> /// <returns>A collection of listeners.</returns> protected override IEnumerable <ServiceInstanceListener> CreateServiceInstanceListeners() { Binding binding = new BindingConfig().GetBindingWSHttp(); // set the proper way to expose the URI on cluster manager string host = this.Context.NodeContext.IPAddressOrFQDN; var endpointConfig = this.Context.CodePackageActivationContext.GetEndpoint("ServiceHttpEndPoint"); int port = endpointConfig.Port; string scheme = endpointConfig.Protocol.ToString(); string nodeName = this.Context.NodeContext.NodeName; string servicename = this.Context.ServiceTypeName; string uri = string.Format(CultureInfo.InvariantCulture, "{0}://{1}:{2}/{3}/{4}.svc", scheme, host, port, nodeName, servicename); WcfCommunicationListener <IPressContract> pressListener = new WcfCommunicationListener <IPressContract>(this.Context, this, binding, new EndpointAddress(uri)); // Check to see if the service host already has a ServiceMetadataBehavior, If not, add one if (pressListener.ServiceHost.Description.Behaviors.Find <ServiceMetadataBehavior>() == null) { ServiceMetadataBehavior behavior = new ServiceMetadataBehavior(); behavior.HttpGetEnabled = true; behavior.HttpGetUrl = new Uri(uri + "/mex/"); pressListener.ServiceHost.Description.Behaviors.Add(behavior); pressListener.ServiceHost.AddServiceEndpoint(typeof(IMetadataExchange), MetadataExchangeBindings.CreateMexHttpBinding(), uri + "/mex/"); } ServiceInstanceListener listener = new ServiceInstanceListener(context => pressListener); return(new[] { listener }); }
protected override IEnumerable<ServiceInstanceListener> CreateServiceInstanceListeners() { var silo = new ServiceInstanceListener( parameters => new OrleansCommunicationListener(parameters, GetClusterConfiguration(), Partition)); return new[] { silo }; }
protected override IEnumerable <ServiceInstanceListener> CreateServiceInstanceListeners() { var silo = new ServiceInstanceListener( parameters => new OrleansCommunicationListener(parameters, GetClusterConfiguration(), Partition)); return(new[] { silo }); }
public static ServiceInstanceListener CreateCorrelatingServiceInstanceListener(this StatelessService service, IService serviceImplementation, string listenerName = "") { var handler = new CorrelatingRemotingMessageHandler(service.Context, serviceImplementation); var listener = new ServiceInstanceListener(c => new FabricTransportServiceRemotingListener(c, handler)); return(listener); }
public static ServiceInstanceListener CreateCorrelatingServiceInstanceListener <TServiceInterface>(this StatelessService service, IService serviceImplementation, string listenerName = "", Action <CallSummary> raiseSummary = null) { var handler = new CorrelatingRemotingMessageHandler(L.G <TServiceInterface>(), service.Context, serviceImplementation, raiseSummary); var listener = new ServiceInstanceListener(c => new FabricTransportServiceRemotingListener(c, handler), listenerName); return(listener); }
protected override IEnumerable <ServiceInstanceListener> CreateServiceInstanceListeners() { ServiceInstanceListener serviceInstanceListener = ServiceInstanceListenersBuilder.CreateHttpListener <Startup>( this.serviceContext.CodePackageActivationContext, ServiceComponent.CloudBornWebService.ToString()); return(new[] { serviceInstanceListener, }); }
/// <summary> /// Optional override to create listeners (like tcp, http) for this service instance. /// </summary> /// <returns>The collection of listeners.</returns> protected override IEnumerable <ServiceInstanceListener> CreateServiceInstanceListeners() { var instanceListener = new ServiceInstanceListener( parameteres => { var owinlistener = new OwinCommunicationListener(new SaaSGatwaySvcListenerSpec(this), parameteres); return(owinlistener); }, "http"); return(new ServiceInstanceListener[1] { instanceListener }); }
/// <summary> /// Optional override to create listeners (like tcp, http) for this service instance. /// </summary> /// <returns>The collection of listeners.</returns> protected override IEnumerable <ServiceInstanceListener> CreateServiceInstanceListeners() { var silo = new ServiceInstanceListener( initializationParameters => new OrleansCommunicationListener( initializationParameters, this.GetClusterConfiguration(), this.ServicePartition), "Orleans"); return(new[] { silo, }); }
protected override IEnumerable<ServiceInstanceListener> CreateServiceInstanceListeners() { const int bufferSize = 512000; //500KB NetTcpBinding binding = new NetTcpBinding(SecurityMode.None) { SendTimeout = TimeSpan.FromSeconds(30), ReceiveTimeout = TimeSpan.FromSeconds(30), CloseTimeout = TimeSpan.FromSeconds(30), MaxConnections = 1000, MaxReceivedMessageSize = bufferSize, MaxBufferSize = bufferSize, MaxBufferPoolSize = bufferSize * Environment.ProcessorCount, }; ServiceInstanceListener listener = new ServiceInstanceListener(context => new WcfCommunicationListener<IPresidentialService>(context, this, binding, "ServiceEndpoint") ); return new[] { listener }; }
public AsyncBusListenersFactory(IAsyncBusBroker asyncBusBroker, string actionsEntityId, ILogger log) { var entity = asyncBusBroker.GetEntity(actionsEntityId); ActionsListener = new ServiceInstanceListener(ctx => new AsyncBusListener(entity, ctx, log), entity.EntityId); }
protected sealed override string GetListenerName( ServiceInstanceListener listener) { return(listener.Name); }