Пример #1
0
        private ICommunicationListener CreateWCFListenerForPlatformAuthentication(StatelessServiceContext context)
        {
            var servicePath     = "Platform/Authentication";
            var serviceUri      = String.Format("net.tcp://{0}:{1}/Services/{2}", wcfDomain, listenerPort, servicePath);
            var metaExchangeUri = String.Format("net.tcp://{0}:{1}/Services/{2}/mex", wcfDomain, metaExchangePort, servicePath);

            var bindings = WcfUtility.CreateTcpListenerBinding(maxMessageSize: 2500000); //<-- Set to 2.5mb for larger packages

            //((System.ServiceModel.NetTcpBinding)binding).MaxReceivedMessageSize = 6000000 <-- Cast as System.ServiceModel.NetTcpBinding to access other properties

            var listener = new WcfCommunicationListener <IPlatformAuthenticationService>(
                context,
                new PlatformAuthenticationService(),
                bindings,
                new EndpointAddress(serviceUri));
            ServiceMetadataBehavior metaDataBehavior = new ServiceMetadataBehavior();

            listener.ServiceHost.Description.Behaviors.Add(metaDataBehavior);

            Binding mexBinding = MetadataExchangeBindings.CreateMexTcpBinding();

            listener.ServiceHost.AddServiceEndpoint(typeof(IMetadataExchange), mexBinding, metaExchangeUri, new Uri(metaExchangeUri));

            listener.ServiceHost.Description.Behaviors.Remove(typeof(ServiceDebugBehavior));
            listener.ServiceHost.Description.Behaviors.Add(new ServiceDebugBehavior {
                IncludeExceptionDetailInFaults = true
            });

            return(listener);
        }
Пример #2
0
        protected override IEnumerable <ServiceReplicaListener> CreateServiceReplicaListeners()
        {
            var grpcServices = new[] { GrpcMessageService.BindService(new GrpcMessageServiceImpl(this.Context, ProcessGrpcMessage)) };


            return(new[] {
                //new ServiceReplicaListener(this.CreateServiceRemotingListener, name: "Remoting"),
                new ServiceReplicaListener((ctx) =>
                {
                    //return new FabricTransportServiceRemotingListener(ctx, this, serializationProvider: new ServiceRemotingJsonSerializationProvider());
                    return new FabricTransportServiceRemotingListener(ctx, this);
                }, name: "RemotingV2"),
                new ServiceReplicaListener((ctx) =>
                {
                    return new WcfCommunicationListener <IServiceFour>(
                        wcfServiceObject: this,
                        serviceContext: ctx,
                        endpointResourceName: WcfEndpoint,
                        listenerBinding: WcfUtility.CreateTcpListenerBinding());
                }, name: "WcfTcp"),
                new ServiceReplicaListener((ctx) =>
                {
                    return new WsCommunicationListener(ctx, SocketEndpoint, AppPrefix, this.ProcessWsRequest);
                }, "WebSocket"),
                new ServiceReplicaListener((ctx) => { return new ServiceBusTopicListener(ctx, ProcessTopicMessage, LogError, ServiceBusTopicReceiverType.Performance); }, "PubSub"),
                new ServiceReplicaListener((ctx) => { return new EventHubCommunicationListener(ctx, ProcessEventHubMessage, LogError); }, "EventHub"),
                new ServiceReplicaListener((ctx) => { return new SimpleCommunicationListener(ctx, DotNettySimpleTcpEndpoint, ProcessDotNettyMessage, LogError); }, "DotNettySimpleTcp"),
                new ServiceReplicaListener((ctx) => { return new GrpcCommunicationListener(ctx, grpcServices, LogMessage, GrpcEndpoint); }, "grpc")
            });
        }
        /// <summary>
        /// Optional override to create listeners (e.g., HTTP, Service Remoting, WCF, etc.) for this service replica to handle client or user requests.
        /// </summary>
        /// <remarks>
        /// For more information on service communication, see https://aka.ms/servicefabricservicecommunication
        /// </remarks>
        /// <returns>A collection of listeners.</returns>
        protected override IEnumerable <ServiceReplicaListener> CreateServiceReplicaListeners()
        {
            //return new ServiceReplicaListener[0];
            return(new ServiceReplicaListener[]
            {
                //OmsOutageSimulatorEndpoint
                new ServiceReplicaListener(context =>
                {
                    return new WcfCommunicationListener <IOutageSimulatorContract>(context,
                                                                                   this.outageSimulatorProvider,
                                                                                   WcfUtility.CreateTcpListenerBinding(),
                                                                                   EndpointNames.OmsOutageSimulatorEndpoint);
                }, EndpointNames.OmsOutageSimulatorEndpoint),

                //OmsOutageSimulatorUIEndpoint
                new ServiceReplicaListener(context =>
                {
                    return new WcfCommunicationListener <IOutageSimulatorUIContract>(context,
                                                                                     this.outageSimulatorUIProvider,
                                                                                     WcfUtility.CreateTcpListenerBinding(),
                                                                                     EndpointNames.OmsOutageSimulatorUIEndpoint);
                }, EndpointNames.OmsOutageSimulatorUIEndpoint),

                //PubSubNotifySubscriberEndpoint
                new ServiceReplicaListener(context =>
                {
                    return new WcfCommunicationListener <INotifySubscriberContract>(context,
                                                                                    this.notifySubscriberProvider,
                                                                                    WcfUtility.CreateTcpListenerBinding(),
                                                                                    EndpointNames.PubSubNotifySubscriberEndpoint);
                }, EndpointNames.PubSubNotifySubscriberEndpoint),
            });
        }
        /// <summary>
        /// Optional override to create listeners (e.g., HTTP, Service Remoting, WCF, etc.) for this service replica to handle client or user requests.
        /// </summary>
        /// <remarks>
        /// For more information on service communication, see https://aka.ms/servicefabricservicecommunication
        /// </remarks>
        /// <returns>A collection of listeners.</returns>
        protected override IEnumerable <ServiceReplicaListener> CreateServiceReplicaListeners()
        {
            return(new[]
            {
                new ServiceReplicaListener(context =>
                {
                    return new WcfCommunicationListener <ICeModelProviderContract>(context,
                                                                                   this.modelProvider,
                                                                                   WcfUtility.CreateTcpListenerBinding(),
                                                                                   EndpointNames.CeModelProviderServiceEndpoint);
                }, EndpointNames.CeModelProviderServiceEndpoint),

                new ServiceReplicaListener(context =>
                {
                    return new WcfCommunicationListener <ITransactionActorContract>(context,
                                                                                    this.ceTransactionActor,
                                                                                    WcfUtility.CreateTcpListenerBinding(),
                                                                                    EndpointNames.TmsTransactionActorEndpoint);
                }, EndpointNames.TmsTransactionActorEndpoint),

                new ServiceReplicaListener(context =>
                {
                    return new WcfCommunicationListener <INotifyNetworkModelUpdateContract>(context,
                                                                                            this.ceNetworkNotifyModelUpdate,
                                                                                            WcfUtility.CreateTcpListenerBinding(),
                                                                                            EndpointNames.TmsNotifyNetworkModelUpdateEndpoint);
                }, EndpointNames.TmsNotifyNetworkModelUpdateEndpoint),
            });
        }
 private static ICommunicationListener CreateTcpListener(IRedisConnectionService service, StatelessServiceContext context)
 {
     return(new WcfCommunicationListener <IRedisConnectionService>(
                wcfServiceObject: service,
                serviceContext: context,
                endpointResourceName: "RedisConnectionService",
                listenerBinding: WcfUtility.CreateTcpListenerBinding()
                ));
 }
 /// <summary>
 ///     Creates a V2 service remoting listener for remoting the actor interfaces.
 /// </summary>
 /// <param name="actorService">
 ///     The implementation of the actor service that hosts the actors whose interfaces
 ///     needs to be remoted.
 /// </param>
 /// <returns>
 ///     An <see cref="IServiceRemotingListener"/>
 ///     for the specified actor service.
 /// </returns>
 public override IServiceRemotingListener CreateServiceRemotingListenerV2(ActorService actorService)
 {
     return(new Actors.Remoting.V2.Wcf.Runtime.WcfActorServiceRemotingListener(
                actorService,
                WcfUtility.CreateTcpListenerBinding(
                    maxMessageSize: this.GetMaxMessageSize(),
                    openTimeout: this.GetOpenTimeout(),
                    closeTimeout: this.GetCloseTimeout())));
 }
Пример #7
0
 protected override IEnumerable <ServiceInstanceListener> CreateServiceInstanceListeners()
 {
     return(new[]
     {
         new ServiceInstanceListener(context => new WcfCommunicationListener <ICalculatorService>(
                                         serviceContext: context,
                                         wcfServiceObject: this,
                                         listenerBinding: WcfUtility.CreateTcpListenerBinding(),
                                         endpointResourceName: "ServiceEndpoint"))
     });
 }
Пример #8
0
        private ICommunicationListener CreateHiCommunicationListener(StatefulServiceContext context)
        {
            var listener = new WcfCommunicationListener <IHiContract>(
                wcfServiceObject: new Hi(),
                serviceContext: context,
                endpointResourceName: "HiEndpoint",
                listenerBinding: WcfUtility.CreateTcpListenerBinding()
                );

            return(listener);
        }
Пример #9
0
 /// <summary>
 ///     Creates a V2 service remoting listener for remoting the service interface.
 /// </summary>
 /// <param name="serviceContext">
 ///     The context of the service for which the remoting listener is being constructed.
 /// </param>
 /// <param name="serviceImplementation">
 ///     The service implementation object.
 /// </param>
 /// <returns>
 ///     A <see cref=" V2.Wcf.Runtime.WcfServiceRemotingListener"/> for the specified service.
 /// </returns>
 public override IServiceRemotingListener CreateServiceRemotingListenerV2(
     ServiceContext serviceContext, IService serviceImplementation)
 {
     return(new V2.Wcf.Runtime.WcfServiceRemotingListener(
                serviceContext,
                serviceImplementation,
                WcfUtility.CreateTcpListenerBinding(
                    this.GetMaxMessageSize(),
                    this.GetOpenTimeout(),
                    this.GetCloseTimeout())));
 }
Пример #10
0
        private ICommunicationListener CreateDuplexListener(StatelessServiceContext context)
        {
            var listener = new WcfCommunicationListener <IDuplexContract>(
                wcfServiceObject: new WcfDuplexImplementation(),
                serviceContext: context,
                endpointResourceName: "WCFDuplexEndpoint",
                listenerBinding: WcfUtility.CreateTcpListenerBinding()
                );

            return(listener);
        }
Пример #11
0
 /// <summary>
 /// Optional override to create listeners (e.g., HTTP, Service Remoting, WCF, etc.) for this service replica to handle client or user requests.
 /// </summary>
 /// <remarks>
 /// For more information on service communication, see https://aka.ms/servicefabricservicecommunication
 /// </remarks>
 /// <returns>A collection of listeners.</returns>
 protected override IEnumerable <ServiceReplicaListener> CreateServiceReplicaListeners()
 {
     return(new[]
     {
         new ServiceReplicaListener(context =>
                                    new WcfCommunicationListener <IShoppingCartService>(
                                        wcfServiceObject: this,
                                        serviceContext: context,
                                        endpointResourceName: "ServiceEndpoint",
                                        listenerBinding: WcfUtility.CreateTcpListenerBinding()))
     });
 }
 CreateServiceInstanceListeners()
 {
     return(new[]
     {
         new ServiceInstanceListener(context =>
                                     new WcfCommunicationListener <ICalculatorService>(
                                         wcfServiceObject: this,
                                         serviceContext: context,
                                         endpointResourceName: "ServiceEndpoint",
                                         listenerBinding: WcfUtility.CreateTcpListenerBinding()))
     });
 }
Пример #13
0
 /// <summary>
 /// Optional override to create listeners (e.g., HTTP, Service Remoting, WCF, etc.) for this service replica to handle client or user requests.
 /// </summary>
 /// <remarks>
 /// For more information on service communication, see https://aka.ms/servicefabricservicecommunication
 /// </remarks>
 /// <returns>A collection of listeners.</returns>
 protected override IEnumerable <ServiceReplicaListener> CreateServiceReplicaListeners()
 {
     return(new List <ServiceReplicaListener>()
     {
         new ServiceReplicaListener(context =>
         {
             return new WcfCommunicationListener <INotifySubscriberContract>(context,
                                                                             this.callTracker,
                                                                             WcfUtility.CreateTcpListenerBinding(),
                                                                             EndpointNames.PubSubNotifySubscriberEndpoint);
         }, EndpointNames.PubSubNotifySubscriberEndpoint)
     });
 }
Пример #14
0
		/// <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()
		{
			return new List<ServiceInstanceListener>(1)
			{
				new ServiceInstanceListener(context =>
				{
					 return new WcfCommunicationListener<ILoadFlowContract>(context,
																			   this.loadFlowEngine,
																			   WcfUtility.CreateTcpListenerBinding(),
																			   EndpointNames.CeLoadFlowServiceEndpoint);
				}, EndpointNames.CeLoadFlowServiceEndpoint)
			};
		}
 /// <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()
 {
     return(new List <ServiceInstanceListener>(1)
     {
         new ServiceInstanceListener(context =>
         {
             return new WcfCommunicationListener <ITopologyBuilderContract>(context,
                                                                            this.topologyBuilder,
                                                                            WcfUtility.CreateTcpListenerBinding(),
                                                                            EndpointNames.CeTopologyBuilderServiceEndpoint);
         }, EndpointNames.CeTopologyBuilderServiceEndpoint)
     });
 }
 /// <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()
 {
     return(new List <ServiceInstanceListener>
     {
         new ServiceInstanceListener(context =>
         {
             return new WcfCommunicationListener <ITopologyRequest>(context,
                                                                    this,
                                                                    WcfUtility.CreateTcpListenerBinding(),
                                                                    "TopologyManagerServiceEndpoint");
         }, "TopologyManagerServiceEndpoint"),
     });
 }
Пример #17
0
 /// <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 <ServiceReplicaListener> CreateServiceReplicaListeners()
 {
     return(new List <ServiceReplicaListener>
     {
         new ServiceReplicaListener(context =>
         {
             return new WcfCommunicationListener <ITopologyAnalyzer>(context,
                                                                     this,
                                                                     WcfUtility.CreateTcpListenerBinding(),
                                                                     endpointResourceName: "TopologyAnalyzerServiceEndpoint");
         }, "TopologyAnalyzerServiceEndpoint")
     });
 }
Пример #18
0
 /// <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()
 {
     return(new List <ServiceInstanceListener>
     {
         new ServiceInstanceListener(context =>
         {
             return new WcfCommunicationListener <ILoadFlowManagerContract>(context,
                                                                            this,
                                                                            WcfUtility.CreateTcpListenerBinding(),
                                                                            "LoadFlowManagerEndpoint");
         }, "LoadFlowManagerEndpoint"),
     });
 }
 /// <summary>
 /// Optional override to create listeners (e.g., HTTP, Service Remoting, WCF, etc.) for this service replica to handle client or user requests.
 /// </summary>
 /// <remarks>
 /// For more information on service communication, see https://aka.ms/servicefabricservicecommunication
 /// </remarks>
 /// <returns>A collection of listeners.</returns>
 protected override IEnumerable <ServiceReplicaListener> CreateServiceReplicaListeners()
 {
     return(new List <ServiceReplicaListener>
     {
         new ServiceReplicaListener(context =>
         {
             return new WcfCommunicationListener <ILoadFlowSolver>(context,
                                                                   this,
                                                                   WcfUtility.CreateTcpListenerBinding(),
                                                                   "LoadFlowSolverEndpoint");
         }, "LoadFlowSolverEndpoint")
     });
 }
Пример #20
0
        /// <summary>
        /// Optional override to create listeners (e.g., HTTP, Service Remoting, WCF, etc.) for this service replica to handle client or user requests.
        /// </summary>
        /// <remarks>
        /// For more information on service communication, see https://aka.ms/servicefabricservicecommunication
        /// </remarks>
        /// <returns>A collection of listeners.</returns>
        protected override IEnumerable <ServiceReplicaListener> CreateServiceReplicaListeners()
        {
            //return new ServiceReplicaListener[0];
            return(new[]
            {
                //ScadaModelReadAccessEndpoint
                new ServiceReplicaListener(context =>
                {
                    return new WcfCommunicationListener <IScadaModelReadAccessContract>(context,
                                                                                        this.modelReadAccessProvider,
                                                                                        WcfUtility.CreateTcpListenerBinding(),
                                                                                        EndpointNames.ScadaModelReadAccessEndpoint);
                }, EndpointNames.ScadaModelReadAccessEndpoint),

                //ScadaModelUpdateAccessEndpoint
                new ServiceReplicaListener(context =>
                {
                    return new WcfCommunicationListener <IScadaModelUpdateAccessContract>(context,
                                                                                          this.modelUpdateAccessProvider,
                                                                                          WcfUtility.CreateTcpListenerBinding(),
                                                                                          EndpointNames.ScadaModelUpdateAccessEndpoint);
                }, EndpointNames.ScadaModelUpdateAccessEndpoint),

                //SCADAIntegrityUpdateEndpoint
                new ServiceReplicaListener(context =>
                {
                    return new WcfCommunicationListener <IScadaIntegrityUpdateContract>(context,
                                                                                        this.integrityUpdateProvider,
                                                                                        WcfUtility.CreateTcpListenerBinding(),
                                                                                        EndpointNames.ScadaIntegrityUpdateEndpoint);
                }, EndpointNames.ScadaIntegrityUpdateEndpoint),

                //SCADAModelUpdateNotifierEndpoint
                new ServiceReplicaListener(context =>
                {
                    return new WcfCommunicationListener <INotifyNetworkModelUpdateContract>(context,
                                                                                            this.scadaNotifyNetworkModelUpdate,
                                                                                            WcfUtility.CreateTcpListenerBinding(),
                                                                                            EndpointNames.TmsNotifyNetworkModelUpdateEndpoint);
                }, EndpointNames.TmsNotifyNetworkModelUpdateEndpoint),

                //SCADATransactionActorEndpoint
                new ServiceReplicaListener(context =>
                {
                    return new WcfCommunicationListener <ITransactionActorContract>(context,
                                                                                    this.scadaTransactionActorProviders,
                                                                                    WcfUtility.CreateTcpListenerBinding(),
                                                                                    EndpointNames.TmsTransactionActorEndpoint);
                }, EndpointNames.TmsTransactionActorEndpoint),
            });
        }
 /// <summary>
 /// Optional override to create listeners (e.g., HTTP, Service Remoting, WCF, etc.) for this service replica to handle client or user requests.
 /// </summary>
 /// <remarks>
 /// For more information on service communication, see https://aka.ms/servicefabricservicecommunication
 /// </remarks>
 /// <returns>A collection of listeners.</returns>
 protected override IEnumerable <ServiceReplicaListener> CreateServiceReplicaListeners()
 {
     //return new List<ServiceReplicaListener>();
     return(new List <ServiceReplicaListener>
     {
         new ServiceReplicaListener(context =>
         {
             return new WcfCommunicationListener <IModelAccessContract>(context,
                                                                        new ModelAccessProvider(StateManager),
                                                                        WcfUtility.CreateTcpListenerBinding(),
                                                                        "ModelAccessEndpoint");
         }, "ModelAccessEndpoint"),
     });
 }
Пример #22
0
 /// <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()
 {
     //return new ServiceInstanceListener[0];
     return(new List <ServiceInstanceListener>()
     {
         //ScadaCommandService
         new ServiceInstanceListener(context =>
         {
             return new WcfCommunicationListener <IScadaCommandingContract>(context,
                                                                            this.commandingProvider,
                                                                            WcfUtility.CreateTcpListenerBinding(),
                                                                            EndpointNames.ScadaCommandingEndpoint);
         }, EndpointNames.ScadaCommandingEndpoint),
     });
 }
Пример #23
0
 /// <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()
 {
     //return new ServiceInstanceListener[0];
     return(new List <ServiceInstanceListener>()
     {
         //ScadaReadCommandEnqueuerEndpoint
         new ServiceInstanceListener(context =>
         {
             return new WcfCommunicationListener <INotifySubscriberContract>(context,
                                                                             this,
                                                                             WcfUtility.CreateTcpListenerBinding(),
                                                                             EndpointNames.PubSubNotifySubscriberEndpoint);
         }, EndpointNames.PubSubNotifySubscriberEndpoint),
     });
 }
Пример #24
0
        private ICommunicationListener CreateWCFListenerForAdd(StatelessServiceContext context)
        {
            var bindings = WcfUtility.CreateTcpListenerBinding();
            var listener = new WcfCommunicationListener <IAdd>(
                context,
                new AddService(context),
                bindings,
                new EndpointAddress("net.tcp://localhost:8085/Services/Tests1"));
            ServiceMetadataBehavior metaDataBehavior = new ServiceMetadataBehavior();

            listener.ServiceHost.Description.Behaviors.Add(metaDataBehavior);
            Binding mexBinding = MetadataExchangeBindings.CreateMexTcpBinding();

            listener.ServiceHost.AddServiceEndpoint(typeof(IMetadataExchange), mexBinding,
                                                    "net.tcp://localhost:8086/Services/Tests1/mex", new Uri("net.tcp://localhost:8086/Services/Tests1/mex"));
            return(listener);
        }
Пример #25
0
        /// <summary>
        /// Optional override to create listeners (e.g., HTTP, Service Remoting, WCF, etc.) for this service replica to handle client or user requests.
        /// </summary>
        /// <remarks>
        /// For more information on service communication, see https://aka.ms/servicefabricservicecommunication
        /// </remarks>
        /// <returns>A collection of listeners.</returns>
        protected override IEnumerable <ServiceReplicaListener> CreateServiceReplicaListeners()
        {
            return(new List <ServiceReplicaListener>
            {
                new ServiceReplicaListener(context =>
                {
                    return new WcfCommunicationListener <IPotentialOutageReportingContract>(context,
                                                                                            this.potentialOutageReportingProvider,
                                                                                            WcfUtility.CreateTcpListenerBinding(),
                                                                                            EndpointNames.OmsPotentialOutageReportingEndpoint);
                }, EndpointNames.OmsPotentialOutageReportingEndpoint),

                new ServiceReplicaListener(context =>
                {
                    return new WcfCommunicationListener <IOutageIsolationContract>(context,
                                                                                   this.outageIsolationProvider,
                                                                                   WcfUtility.CreateTcpListenerBinding(),
                                                                                   EndpointNames.OmsOutageIsolationEndpoint);
                }, EndpointNames.OmsOutageIsolationEndpoint),

                new ServiceReplicaListener(context =>
                {
                    return new WcfCommunicationListener <ICrewSendingContract>(context,
                                                                               this.crewSendingProvider,
                                                                               WcfUtility.CreateTcpListenerBinding(),
                                                                               EndpointNames.OmsCrewSendingEndpoint);
                }, EndpointNames.OmsCrewSendingEndpoint),

                new ServiceReplicaListener(context =>
                {
                    return new WcfCommunicationListener <IOutageResolutionContract>(context,
                                                                                    this.outageResolutionProvider,
                                                                                    WcfUtility.CreateTcpListenerBinding(),
                                                                                    EndpointNames.OmsOutageResolutionEndpoint);
                }, EndpointNames.OmsOutageResolutionEndpoint),

                new ServiceReplicaListener(context =>
                {
                    return new WcfCommunicationListener <INotifySubscriberContract>(context,
                                                                                    this.notifySubscriberProvider,
                                                                                    WcfUtility.CreateTcpListenerBinding(),
                                                                                    EndpointNames.PubSubNotifySubscriberEndpoint);
                }, EndpointNames.PubSubNotifySubscriberEndpoint),
            });
        }
        /// <summary>
        /// Optional override to create listeners (e.g., HTTP, Service Remoting, WCF, etc.) for this service replica to handle client or user requests.
        /// </summary>
        /// <remarks>
        /// For more information on service communication, see https://aka.ms/servicefabricservicecommunication
        /// </remarks>
        /// <returns>A collection of listeners.</returns>
        protected override IEnumerable <ServiceReplicaListener> CreateServiceReplicaListeners()
        {
            return(new[] { new ServiceReplicaListener((context) =>
                                                      new WcfCommunicationListener <ICalculator>(
                                                          wcfServiceObject: this,
                                                          serviceContext: context,
                                                          //
                                                          // The name of the endpoint configured in the ServiceManifest under the Endpoints section
                                                          // that identifies the endpoint that the WCF ServiceHost should listen on.
                                                          //
                                                          endpointResourceName: "WcfServiceEndpoint",

                                                          //
                                                          // Populate the binding information that you want the service to use.
                                                          //
                                                          listenerBinding: WcfUtility.CreateTcpListenerBinding()
                                                          )
                                                      ) });
        }
Пример #27
0
        //private async Task<IList<KeyValuePair<Tkey, T>>> QueryReliableDictionary<Tkey, T>(IReliableStateManager stateManager, string collectionName, Func<T, bool> filter)
        //{
        //    var result = new List<KeyValuePair<Tkey, T>>();

        //    var reliableDictionary =
        //        await stateManager.GetOrAddAsync<IReliableDictionary<Tkey, T>>(collectionName);

        //    using (ITransaction tx = stateManager.CreateTransaction())
        //    {
        //        IAsyncEnumerable<KeyValuePair<Tkey, T>> asyncEnumerable = await reliableDictionary.CreateEnumerableAsync(tx);
        //        using (IAsyncEnumerator<KeyValuePair<Tkey, T>> asyncEnumerator = asyncEnumerable.GetAsyncEnumerator())
        //        {
        //            while (await asyncEnumerator.MoveNextAsync(CancellationToken.None))
        //            {
        //                if (filter(asyncEnumerator.Current.Value))
        //                    result.Add(asyncEnumerator.Current);
        //            }
        //        }
        //    }
        //    return result;
        //}

        /// <summary>
        /// Optional override to create listeners (e.g., HTTP, Service Remoting, WCF, etc.) for this service replica to handle client or user requests.
        /// </summary>
        /// <remarks>
        /// For more information on service communication, see https://aka.ms/servicefabricservicecommunication
        /// </remarks>
        /// <returns>A collection of listeners.</returns>
        protected override IEnumerable <ServiceReplicaListener> CreateServiceReplicaListeners()
        {
            try
            {
                var listenerSettings = new FabricTransportRemotingListenerSettings
                {
                    MaxMessageSize = _maxMessageSize // 1GB
                };

                return(new[]
                {
                    new ServiceReplicaListener((context) =>
                                               new WcfCommunicationListener <IReferenceDataService>(
                                                   wcfServiceObject: this,
                                                   serviceContext: context,
                                                   //
                                                   // The name of the endpoint configured in the ServiceManifest under the Endpoints section
                                                   // that identifies the endpoint that the WCF ServiceHost should listen on.
                                                   //
                                                   endpointResourceName: "WcfDataServiceEndpoint",

                                                   //
                                                   // Populate the binding information that you want the service to use.
                                                   //
                                                   listenerBinding: WcfUtility.CreateTcpListenerBinding()
                                                   ), "dataServiceWCFListener"),
                    new ServiceReplicaListener(
                        (c) => new FabricTransportServiceRemotingListener(c, this,
                                                                          FabricTransportRemotingListenerSettings.LoadFrom("DataTransportSettings"),
                                                                          new ServiceRemotingJsonSerializationProvider()),
                        "dataServiceRemotingListener", true)
//                     new ServiceReplicaListener(context =>
//                         new ServiceBusSubscriptionListener(ProcessLoadULNMessageHandler, "ULNLoadDataSubscriptionName"), "Stateless-ServiceBusFundingCalcSubsListener")
//                     new ServiceReplicaListener(context =>
//                         new ServiceBusSubscriptionListener(ProcessGetULNsTestMessageHandler, "ULNGetTestSubscriptionName"), "Stateless-ULNGetTestListener")
                });
            }
            catch (Exception)
            {
                throw;
            }
        }
Пример #28
0
        /// <summary>
        /// Optional override to create listeners (e.g., HTTP, Service Remoting, WCF, etc.) for this service replica to handle client or user requests.
        /// </summary>
        /// <remarks>
        /// For more information on service communication, see https://aka.ms/servicefabricservicecommunication
        /// </remarks>
        /// <returns>A collection of listeners.</returns>
        protected override IEnumerable <ServiceReplicaListener> CreateServiceReplicaListeners()
        {
            return(new[]
            {
                new ServiceReplicaListener(context =>
                {
                    return new WcfCommunicationListener <ITopologyProviderContract>(context,
                                                                                    this.topologyProvider,
                                                                                    WcfUtility.CreateTcpListenerBinding(),
                                                                                    EndpointNames.CeTopologyProviderServiceEndpoint);
                }, EndpointNames.CeTopologyProviderServiceEndpoint),

                new ServiceReplicaListener(context =>
                {
                    return new WcfCommunicationListener <ITopologyConverterContract>(context,
                                                                                     this.topologyConverter,
                                                                                     WcfUtility.CreateTcpListenerBinding(),
                                                                                     EndpointNames.CeTopologyConverterServiceEndpoint);
                }, EndpointNames.CeTopologyConverterServiceEndpoint),
            });
        }
        /// <summary>
        /// Optional override to create listeners (e.g., HTTP, Service Remoting, WCF, etc.) for this service replica to handle client or user requests.
        /// </summary>
        /// <remarks>
        /// For more information on service communication, see https://aka.ms/servicefabricservicecommunication
        /// </remarks>
        /// <returns>A collection of listeners.</returns>
        protected override IEnumerable <ServiceReplicaListener> CreateServiceReplicaListeners()
        {
            return(new List <ServiceReplicaListener>()
            {
                new ServiceReplicaListener(context =>
                {
                    return new WcfCommunicationListener <INetworkModelGDAContract>(context,
                                                                                   genericDataAccess,
                                                                                   WcfUtility.CreateTcpListenerBinding(maxMessageSize: 1024 * 1024 * 1024),
                                                                                   "NMSGdaServiceEndpoint");
                }, "NMSGdaServiceEndpoint")
                //new ServiceReplicaListener(context =>
                //{
                //	return new WcfCommunicationListener<ITest>(context,
                //											   this,
                //											   WcfUtility.CreateTcpListenerBinding(),
                //											   "TestEndpoint");

                //})
            });
        }
Пример #30
0
        private ICommunicationListener CreateGatewayListener(StatelessServiceContext context)
        {
            string host = context.NodeContext.IPAddressOrFQDN;

            var endpointConfig = context.CodePackageActivationContext.GetEndpoint("GatewayHelloEndpoint");
            int port           = endpointConfig.Port;
            var scheme         = endpointConfig.UriScheme.ToString();
            var pathSufix      = endpointConfig.PathSuffix.ToString();


            string uri = string.Format(CultureInfo.InvariantCulture, "{0}://{1}:{2}/Gateway/{3}", scheme, host, port, pathSufix);

            var listener = new WcfCommunicationListener <IHelloContract>(
                wcfServiceObject: new GatewayServiceImplementation(),
                serviceContext: context,
                listenerBinding: WcfUtility.CreateTcpListenerBinding(),
                address: new EndpointAddress(uri)
                );

            return(listener);
        }