Esempio n. 1
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()
        {
            var listeners = new ServiceReplicaListener[1]
            {
                new ServiceReplicaListener((context) => this.CreateServiceRemotingListener(context), "ServiceEndpoint")
            };

            return(listeners);
        }
Esempio n. 2
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()
        {
            // TODO : implement security on remoting endpoint
            var listeners = new ServiceReplicaListener[1]
            {
                new ServiceReplicaListener((context) => this.CreateServiceRemotingListener(context), "ServiceEndpoint")
            };

            return(listeners);
        }
Esempio n. 3
0
        protected override IEnumerable <ServiceReplicaListener> CreateServiceReplicaListeners()
        {
            logger.LogInfo("Creating Service Replica Listeners For Audit Services");
            var serviceListener = new ServiceReplicaListener(context =>
                                                             listener = lifetimeScope.Resolve <IStatefulEndpointCommunicationListener>());

            return(new List <ServiceReplicaListener>
            {
                serviceListener,
            });
        }
Esempio n. 4
0
        public static ServiceReplicaListener CreateCorrelatingReplicaListener(this StatefulService service,
                                                                              IService serviceImplementation,
                                                                              string listenerName    = "",
                                                                              bool listenOnSecondary = false)
        {
            var handler = new CorrelatingRemotingMessageHandler(service.Context, serviceImplementation);

            var listener = new ServiceReplicaListener(c => new FabricTransportServiceRemotingListener(c, handler));

            return(listener);
        }
        public static ServiceReplicaListener CreateCorrelatingReplicaListener <TServiceInterface>(this StatefulService service,
                                                                                                  IService serviceImplementation,
                                                                                                  string listenerName               = "",
                                                                                                  bool listenOnSecondary            = false,
                                                                                                  Action <CallSummary> raiseSummary = null)
        {
            var handler = new CorrelatingRemotingMessageHandler(L.G <TServiceInterface>(), service.Context, serviceImplementation, raiseSummary);

            var listener = new ServiceReplicaListener(c => new FabricTransportServiceRemotingListener(c, handler), listenerName);

            return(listener);
        }
Esempio n. 6
0
        protected override IEnumerable <ServiceReplicaListener> CreateServiceReplicaListeners()
        {
            //collect base types where actor attribute can be defined
            var typeList = new List <Type> {
                ActorTypeInformation.ImplementationType
            };

            typeList.AddRange(ActorTypeInformation.InterfaceTypes);

            //get provider attribute that can override listener endpoints
            ActorRemotingProviderAttribute provider = ActorHelper.GetProvider(typeList);

            //create service remoting listeners the correct way
            var replicaListeners = new List <ServiceReplicaListener>();

            if (Helper.IsEitherRemotingV2(provider.RemotingListenerVersion))
            {
                foreach (KeyValuePair <string, Func <ActorService, IServiceRemotingListener> > remotingListener in provider.CreateServiceRemotingListeners())
                {
                    //create our own correlating message handler
                    var handler = new CorrelatingRemotingMessageHandler(
                        L.G(GetType()), //the most upstream type's log
                        this);

                    string listenerName = remotingListener.Key;
                    Func <ActorService, IServiceRemotingListener> createCommunicationListener = remotingListener.Value;

                    /*Func<ActorService, IServiceRemotingListener> debug = a =>
                     * {
                     * IServiceRemotingListener result = createCommunicationListener(a);
                     *
                     * return result;
                     * };*/

                    var listener = new ServiceReplicaListener(
                        c => new FabricTransportActorServiceRemotingListener(c, handler),
                        listenerName,
                        false);

                    /*var listener = new ServiceReplicaListener(
                     * //context => createCommunicationListener(this),
                     * context => debug(this),
                     * listenerName,
                     * false);*/

                    replicaListeners.Add(listener);
                }
            }

            return(replicaListeners);
        }
        protected override IEnumerable <ServiceReplicaListener> CreateServiceReplicaListeners()
        {
            List <ServiceReplicaListener> listeners = new List <ServiceReplicaListener>();
            KeyedCollection <string, EndpointResourceDescription> endpoints = this.Context.CodePackageActivationContext.GetEndpoints();
            ServiceReplicaListener listener = new ServiceReplicaListener((context) =>
            {
                return(new FabricTransportServiceRemotingListener(context,
                                                                  this,
                                                                  new FabricTransportRemotingListenerSettings()
                {
                    EndpointResourceName = "ResourceManagerEndpoint",
                }));
            });

            listeners.Add(listener);
            return(listeners);
        }
Esempio n. 8
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()
        {
            var scadaSetpointListener = new ServiceReplicaListener((context) =>
                                                                   new WcfCommunicationListener <ISCADAReceiving>(
                                                                       wcfServiceObject: scadaSetpoint,
                                                                       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: "ScadaSPServiceEndpoint",

                                                                       //
                                                                       // Populate the binding information that you want the service to use.
                                                                       //
                                                                       listenerBinding: new NetTcpBinding()
            {
                ReceiveTimeout = TimeSpan.MaxValue
            }
                                                                       ), "SCADASetpointService"
                                                                   );

            var twoPCCallbackListener = new ServiceReplicaListener((context) =>
                                                                   new WcfCommunicationListener <ITwoPhaseCommit>(
                                                                       wcfServiceObject: SCADAModel.Instance,
                                                                       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: "2PCCallbackEndpoint",

                                                                       //
                                                                       // Populate the binding information that you want the service to use.
                                                                       //
                                                                       listenerBinding: new NetTcpBinding()
            {
                ReceiveTimeout = TimeSpan.MaxValue
            }
                                                                       ), "2PCCallbackListener"
                                                                   );

            return(new[] { scadaSetpointListener, twoPCCallbackListener });
        }
 protected override IEnumerable <ServiceReplicaListener> CreateServiceReplicaListeners()
 {
     try
     {
         partitionEndpointName = ((NamedPartitionInformation)Partition.PartitionInfo).Name;
         var batchListener = lifetimeScope.Resolve <IServiceBusBatchCommunicationListener>();
         batchListener.EndpointName += partitionEndpointName;
         var serviceListener = new ServiceReplicaListener(context => batchListener);
         return(new List <ServiceReplicaListener>
         {
             serviceListener
         });
     }
     catch (Exception e)
     {
         logger.LogError($"Error: {e.Message}", e);
         throw;
     }
 }
Esempio n. 10
0
        protected override IEnumerable <ServiceReplicaListener> CreateServiceReplicaListeners()
        {
            try
            {
                var partitionEndpointName = ((NamedPartitionInformation)Partition.PartitionInfo).Name;
                EndpointConfigurationEvents.ConfiguringEndpointName += (object sender, Payments.Application.Infrastructure.Ioc.Modules.EndpointName e) =>
                {
                    e.Name += partitionEndpointName;
                };

                var batchListener = lifetimeScope.Resolve <IServiceBusBatchCommunicationListener>();
                batchListener.EndpointName += partitionEndpointName;
                var serviceListener = new ServiceReplicaListener(context => batchListener);
                return(new List <ServiceReplicaListener>
                {
                    serviceListener
                });
            }
            catch (Exception e)
            {
                logger.LogError($"Error: {e.Message}", e);
                throw;
            }
        }
        /// <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 http://aka.ms/servicefabricservicecommunication
        /// </remarks>
        /// <returns>A collection of listeners.</returns>
        protected override IEnumerable <ServiceReplicaListener> CreateServiceReplicaListeners()
        {
            ServiceReplicaListener serviceReplicaListener = new ServiceReplicaListener(this.CreateFabricCommunicationListener);

            return(new[] { serviceReplicaListener });
        }
Esempio n. 12
0
 protected sealed override string GetListenerName(
     ServiceReplicaListener listener)
 {
     return(listener.Name);
 }