public static ServiceReplicaListener CreateCorrelatingActorReplicaListener(this ActorService service, bool switchOperationContext = false) { IServiceRemotingMessageHandler messageHandler = CreateHandler(service, switchOperationContext); return(new ServiceReplicaListener(ctx => new FabricTransportActorServiceRemotingListener(ctx, messageHandler, new FabricTransportRemotingListenerSettings()))); }
public static ServiceReplicaListener CreateCorrelatingReplicaListener(this StatefulService service, bool switchOperationContext = false) { IServiceRemotingMessageHandler messageHandler = CreateHandler(service, service.Context, switchOperationContext); return(new ServiceReplicaListener(ctx => new FabricTransportServiceRemotingListener(ctx, messageHandler))); }
public CorrelatingRemotingMessageHandler(ILog log, ServiceContext serviceContext, IService serviceImplementation, Action <CallSummary> raiseSummary) { _innerHandler = new ServiceRemotingMessageDispatcher(serviceContext, serviceImplementation); MethodResolver.AddMethodsForProxyOrService(serviceImplementation.GetType().GetInterfaces(), typeof(IService)); _log = log; _raiseSummary = raiseSummary; }
public MockFabricTransportServiceRemotingListener( ServiceContext serviceContext, IServiceRemotingMessageHandler serviceRemotingMessageHandler, FabricTransportRemotingListenerSettings remotingListenerSettings = null, IServiceRemotingMessageSerializationProvider serializationProvider = null) : base(serviceContext, serviceRemotingMessageHandler, remotingListenerSettings, serializationProvider) { }
/// <summary> /// Initializes the <see cref="CorrelatingRemotingMessageHandler"/> object. It wraps the given service for all the core /// operations for servicing the request. /// </summary> /// <param name="service">The service whose remoting messages this handler should handle.</param> /// <param name="serviceContext">The context object for the service.</param> public CorrelatingRemotingMessageHandler(ServiceContext serviceContext, IService service) { this.InitializeCommonFields(); this.innerHandler = new ServiceRemotingDispatcher(serviceContext, service); // Populate our method name provider with methods from the IService interfaces this.methodNameProvider.AddMethodsForProxyOrService(service.GetType().GetInterfaces(), typeof(IService)); }
internal WcfServiceRemotingListener( ServiceContext serviceContext, IServiceRemotingMessageHandler messageHandler, ServiceRemotingMessageSerializersManager serializerManager, Binding listenerBinding = null, string endpointResourceName = "ServiceEndpointV2") { this.Initialize(serviceContext, messageHandler, listenerBinding, endpointResourceName, serializerManager); }
public ServiceHostRemotingCommunicationListenerComponents( IServiceRemotingMessageHandler messageDispatcher, IServiceRemotingMessageSerializationProvider messageSerializationProvider, FabricTransportRemotingListenerSettings listenerSettings) { this.MessageHandler = messageDispatcher; this.ListenerSettings = listenerSettings; this.MessageSerializationProvider = messageSerializationProvider; }
/// <summary> /// Construct a fabric TCP transport based service remoting listener for the specified actor service. /// </summary> /// <param name="serviceContext"> /// The context of the service for which the remoting listener is being constructed. /// </param> /// <param name="messageHandler"> /// The handler for processing remoting messages. As the messages are received, /// the listener delivers them to this handler. /// </param> /// <param name="listenerSettings"></param> public FabricTransportActorServiceRemotingListener( ServiceContext serviceContext, IServiceRemotingMessageHandler messageHandler, FabricTransportRemotingListenerSettings listenerSettings = null) : base( serviceContext, messageHandler, listenerSettings) { }
/// <summary> /// Constructs a fabric transport based service remoting listener with <see cref="FabricTransportRemotingListenerSettings"/> /// loaded from configuration section. /// </summary> /// <param name="serviceContext"> /// The context of the service for which the remoting listener is being constructed. /// </param> /// <param name="messageHandler"> /// The handler for processing remoting messages. As the messages are received, /// the listener delivers them to this handler. /// </param> /// <param name="listenerSettingsConfigSectionName"> /// The name of the configuration section in the configuration package named /// "Config" in the service manifest that defines the settings for the listener. /// </param> public FabricTransportServiceRemotingListener( ServiceContext serviceContext, IServiceRemotingMessageHandler messageHandler, string listenerSettingsConfigSectionName) : this( serviceContext, messageHandler, FabricTransportRemotingListenerSettings.LoadFrom(listenerSettingsConfigSectionName)) { }
/// <summary> /// Initializes the <see cref="CorrelatingRemotingMessageHandler"/> object. It wraps the given actor service for all the core /// operations for servicing the request. /// </summary> /// <param name="actorService">The actor service whose remoting messages this handler should handle.</param> public CorrelatingRemotingMessageHandler(ActorService actorService) { this.InitializeCommonFields(); this.innerHandler = new ActorServiceRemotingDispatcher(actorService); this.isActorService = true; // Populate our method name provider with methods from the ActorService interfaces, and the Actor interfaces this.methodNameProvider.AddMethodsForProxyOrService(actorService.GetType().GetInterfaces(), typeof(IService)); this.methodNameProvider.AddMethodsForProxyOrService(actorService.ActorTypeInformation.InterfaceTypes, typeof(IActor)); }
public CorrelatingRemotingMessageHandler(ILog log, ActorService actorService) { _innerHandler = new ActorServiceRemotingDispatcher(actorService, null); MethodResolver.AddMethodsForProxyOrService(actorService.GetType().GetInterfaces(), typeof(IService)); MethodResolver.AddMethodsForProxyOrService(actorService.ActorTypeInformation.InterfaceTypes, typeof(IActor)); _log = log; _raiseSummary = null; }
public CorrelatingRemotingMessageHandler(ServiceContext serviceContext, IService service) { this.serviceContext = serviceContext; // Populate our method name provider with methods from the IService interfaces methodNameProvider = new MethodNameProvider(false /* threadSafe */); methodNameProvider.AddMethodsForProxyOrService(service.GetType().GetInterfaces(), typeof(IService)); innerHandler = new ServiceRemotingDispatcher(serviceContext, service); }
public ServiceHostRemotingListenerMessageHandler( IServiceRemotingMessageHandler handler, ILogger logger) { this.handler = handler ?? throw new ArgumentNullException(nameof(handler)); this.logger = logger ?? throw new ArgumentNullException(nameof(logger)); }
/// <summary> /// Constructs a fabric transport based service remoting listener. /// </summary> /// <param name="serviceContext"> /// The context of the service for which the remoting listener is being constructed. /// </param> /// <param name="messageHandler"> /// The handler for processing remoting messages. As the messages are received, /// the listener delivers them to this handler. /// </param> /// <param name="listenerSettings"> /// The settings to use for the listener. /// </param> public FabricTransportServiceRemotingListener( ServiceContext serviceContext, IServiceRemotingMessageHandler messageHandler, FabricTransportRemotingListenerSettings listenerSettings) { this.nativeListener = this.CreateNativeListener( listenerSettings, messageHandler, serviceContext); }
private void Initialize(ServiceContext serviceContext, IServiceRemotingMessageHandler messageHandler, Binding listenerBinding, string endpointResourceName, ServiceRemotingMessageSerializersManager serializerManager) { this.messageHandler = messageHandler; this.wcfListener = new WcfCommunicationListener <IServiceRemotingContract>( serviceContext, new WcfRemotingService(this.messageHandler, serializerManager), listenerBinding, endpointResourceName); }
/// <summary> /// Constructs a fabric transport based service remoting listener. /// </summary> /// <param name="serviceContext"> /// The context of the service for which the remoting listener is being constructed. /// </param> /// <param name="serviceRemotingMessageHandler"> /// The handler for processing remoting messages. As the messages are received, /// the listener delivers them to this handler. /// </param> /// <param name="serializationProvider">It is used to serialize deserialize request and response body </param> /// <param name="remotingListenerSettings">The settings for the listener</param> public FabricTransportServiceRemotingListener( ServiceContext serviceContext, IServiceRemotingMessageHandler serviceRemotingMessageHandler, FabricTransportRemotingListenerSettings remotingListenerSettings = null, IServiceRemotingMessageSerializationProvider serializationProvider = null ) : this(serviceContext, serviceRemotingMessageHandler, InitializeSerializersManager(serializationProvider, remotingListenerSettings), remotingListenerSettings) { }
/// <summary> /// Constructs a WCF based service remoting listener. /// </summary> /// <param name="serviceContext">The context of the service for which the remoting listener is being constructed.</param> /// <param name="serviceRemotingMessageHandler">The handler for receiving and processing remoting messages. As the messages are received /// the listener delivers the messages to the handler. /// </param> /// <param name="listenerBinding">WCF binding to use for the listener. If the listener binding is not specified or null, /// a default listener binding is created using <see cref="Microsoft.ServiceFabric.Services.Communication.Wcf.WcfUtility.CreateTcpListenerBinding"/> method. /// </param> /// <param name="address">The endpoint address to use for the WCF listener. If not specified or null, the endpoint /// address is created using the default endpoint resource named "ServiceEndpoint" defined in the service manifest. /// </param> public WcfActorServiceRemotingListener( ServiceContext serviceContext, IServiceRemotingMessageHandler serviceRemotingMessageHandler, Binding listenerBinding = null, EndpointAddress address = null) : base( serviceContext, serviceRemotingMessageHandler, listenerBinding, address) { }
/// <summary> /// Constructs a WCF based service remoting listener. /// </summary> /// <param name="serviceContext">The context of the service for which the remoting listener is being constructed.</param> /// <param name="messageHandler">The handler for receiving and processing remoting messages. As the messages are received /// the listener delivers the messages to the handler. /// </param> /// <param name="listenerBinding">WCF binding to use for the listener. If the listener binding is not specified or null, /// a default listener binding is created using <see cref="WcfUtility.CreateTcpListenerBinding"/> method which creates /// a <see cref="System.ServiceModel.NetTcpBinding"/> with no security. /// </param> /// <param name="endpointResourceName">The name of the endpoint resource defined in the service manifest that /// should be used to create the address for the listener. If the endpointResourceName is not specified or it is null, /// the default value "ServiceEndpoint" is used. /// </param> public WcfServiceRemotingListener( ServiceContext serviceContext, IServiceRemotingMessageHandler messageHandler, Binding listenerBinding = null, string endpointResourceName = "ServiceEndpoint") { this.wcfListener = new WcfCommunicationListener <IServiceRemotingContract>( serviceContext, new WcfRemotingService(messageHandler), listenerBinding, endpointResourceName); }
internal WcfServiceRemotingListener( ServiceContext serviceContext, IServiceRemotingMessageHandler messageHandler, ServiceRemotingMessageSerializersManager serializersManager, Binding listenerBinding = null, EndpointAddress address = null) { this.Initialize(serviceContext, listenerBinding, address, serializersManager, messageHandler); }
/// <summary> /// Constructs a fabric transport based service remoting listener with the specified /// <see cref="FabricTransportRemotingListenerSettings"/>. /// </summary> /// <param name="serviceContext"> /// The context of the service for which the remoting listener is being constructed. /// </param> /// <param name="messageHandler"> /// The handler for processing remoting messages. As the messages are received, /// the listener delivers them to this handler. /// </param> /// <param name="listenerSettings"> /// The settings to use for the listener. /// </param> public FabricTransportServiceRemotingListener( ServiceContext serviceContext, IServiceRemotingMessageHandler messageHandler, FabricTransportRemotingListenerSettings listenerSettings) { this.messageHandler = messageHandler; this.nativeListener = this.CreateNativeListener( listenerSettings, this.messageHandler, serviceContext); this.listenAddress = serviceContext.ListenAddress; this.publishAddress = serviceContext.PublishAddress; }
private FabricTransportListener CreateNativeListener( FabricTransportRemotingListenerSettings listenerSettings, IServiceRemotingMessageHandler messageHandler, ServiceContext serviceContext) { var connectionHandler = new FabricTransportServiceRemotingConnectionHandler(); return(new FabricTransportListener( listenerSettings.GetInternalSettings(), listenerSettings.GetInternalSettings().GetListenerAddress(serviceContext), new FabricTransportMessagingHandler(messageHandler), connectionHandler)); }
/// <summary> /// Constructs a WCF based service remoting listener. /// </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> /// <param name="listenerBinding">WCF binding to use for the listener. If the listener binding is not specified or null, /// a default listener binding is created using <see cref="WcfUtility.CreateTcpListenerBinding"/> method which creates /// a <see cref="System.ServiceModel.NetTcpBinding"/> with no security. /// </param> /// <param name="endpointResourceName">The name of the endpoint resource defined in the service manifest that /// should be used to create the address for the listener. If the endpointResourceName is not specified or null, /// the default value "ServiceEndpoint" is used. /// </param> public WcfServiceRemotingListener( ServiceContext serviceContext, IService serviceImplementation, Binding listenerBinding = null, string endpointResourceName = "ServiceEndpoint") { this.messageHandler = new ServiceRemotingDispatcher(serviceContext, serviceImplementation); this.wcfListener = new WcfCommunicationListener <IServiceRemotingContract>( serviceContext, new WcfRemotingService( this.messageHandler), listenerBinding, endpointResourceName); }
public FabricTransportMessageHandler( IServiceRemotingMessageHandler remotingMessageHandler, ServiceRemotingMessageSerializersManager serializersManager, Guid partitionId, long replicaOrInstanceId) { this.remotingMessageHandler = remotingMessageHandler; this.serializersManager = serializersManager; this.partitionId = partitionId; this.replicaOrInstanceId = replicaOrInstanceId; this.serviceRemotingPerformanceCounterProvider = new ServiceRemotingPerformanceCounterProvider(this.partitionId, this.replicaOrInstanceId); this.headerSerializer = this.serializersManager.GetHeaderSerializer(); }
/// <summary> /// Construct a fabric TCP transport based service remoting listener for the specified actor service. /// </summary> /// <param name="serviceContext"> /// The context of the service for which the remoting listener is being constructed. /// </param> /// <param name="messageHandler"> /// The handler for processing remoting messages. As the messages are received, /// the listener delivers them to this handler. /// </param> /// <param name="listenerSettings"></param> /// <param name="serializationProvider"></param> public FabricTransportActorServiceRemotingListener( ServiceContext serviceContext, IServiceRemotingMessageHandler messageHandler, FabricTransportRemotingListenerSettings listenerSettings = null, IServiceRemotingMessageSerializationProvider serializationProvider = null ) : base( serviceContext, messageHandler, InitializeSerializerManager(listenerSettings, serializationProvider), listenerSettings) { }
/// <summary> /// Constructs a WCF based service remoting listener. /// </summary> /// <param name="serviceContext">The context of the service for which the remoting listener is being constructed.</param> /// <param name="serviceRemotingMessageHandler">The handler for receiving and processing remoting messages. As the messages are received /// the listener delivers the messages to the handler. /// </param> /// <param name="serializationProvider"></param> /// <param name="listenerBinding">WCF binding to use for the listener. If the listener binding is not specified or null, /// a default listener binding is created using <see cref="Microsoft.ServiceFabric.Services.Communication.Wcf.WcfUtility.CreateTcpListenerBinding"/> method. /// </param> /// <param name="address">The endpoint address to use for the WCF listener. If not specified or null, the endpoint /// address is created using the default endpoint resource named "ServiceEndpoint" defined in the service manifest. /// </param> public WcfActorServiceRemotingListener( ServiceContext serviceContext, IServiceRemotingMessageHandler serviceRemotingMessageHandler, IServiceRemotingMessageSerializationProvider serializationProvider, Binding listenerBinding = null, EndpointAddress address = null) : base( serviceContext, serviceRemotingMessageHandler, new ActorRemotingSerializationManager(serializationProvider ?? new BasicDataContractSerializationProvider(), new BasicDataContractActorHeaderSerializer()), listenerBinding, address) { }
/// <summary> /// Constructs a WCF based service remoting listener. /// </summary> /// <param name="serviceContext">The context of the service for which the remoting listener is being constructed.</param> /// <param name="messageHandler">The handler for receiving and processing remoting messages. As the messages are received /// the listener delivers the messages to the handler. /// </param> /// <param name="serializationProvider"></param> /// <param name="listenerBinding">WCF binding to use for the listener. If the listener binding is not specified or null, /// a default listener binding is created using <see cref="WcfUtility.CreateTcpListenerBinding"/> method which creates /// a <see cref="System.ServiceModel.NetTcpBinding"/> with no security. /// </param> /// <param name="endpointResourceName">The name of the endpoint resource defined in the service manifest that /// should be used to create the address for the listener. If the endpointResourceName is not specified or it is null, /// the default value "ServiceEndpointV2" is used. /// </param> public WcfServiceRemotingListener( ServiceContext serviceContext, IServiceRemotingMessageHandler messageHandler, IServiceRemotingMessageSerializationProvider serializationProvider = null, Binding listenerBinding = null, string endpointResourceName = "ServiceEndpointV2") { if (serializationProvider == null) { serializationProvider = new BasicDataContractSerializationProvider(); } var serializerManager = new ServiceRemotingMessageSerializersManager(serializationProvider, new BasicDataContractHeaderSerializer()); this.Initialize(serviceContext, messageHandler, listenerBinding, endpointResourceName, serializerManager); }
/// <summary> /// Constructs a WCF based service remoting listener. /// </summary> /// <param name="serviceContext">The context of the service for which the remoting listener is being constructed.</param> /// <param name="messageHandler">The handler for receiving and processing remoting messages. As the messages are received /// the listener delivers the messages to the handler. /// </param> /// <param name="serializationProvider"></param> /// <param name="listenerBinding">WCF binding to use for the listener. If the listener binding is not specified or null, /// a default listener binding is created using <see cref="WcfUtility.CreateTcpListenerBinding"/> method. /// </param> /// <param name="address">The endpoint address to use for the WCF listener. If not specified or null, the endpoint /// address is created using the default endpoint resource named "ServiceEndpointV2" defined in the service manifest. /// </param> public WcfServiceRemotingListener( ServiceContext serviceContext, IServiceRemotingMessageHandler messageHandler, IServiceRemotingMessageSerializationProvider serializationProvider = null, Binding listenerBinding = null, EndpointAddress address = null) { if (serializationProvider == null) { serializationProvider = new BasicDataContractSerializationProvider(); } var serializerManager = new ServiceRemotingMessageSerializersManager(serializationProvider, new BasicDataContractHeaderSerializer()); this.Initialize(serviceContext, listenerBinding, address, serializerManager, messageHandler); }
/// <summary> /// Constructs a WCF based service remoting listener. /// </summary> /// <param name="serviceContext">The context of the service for which the remoting listener is being constructed.</param> /// <param name="messageHandler">The handler for receiving and processing remoting messages. As the messages are received /// the listener delivers the messages to the handler. /// </param> /// <param name="listenerBinding">WCF binding to use for the listener. If the listener binding is not specified or null, /// a default listener binding is created using <see cref="WcfUtility.CreateTcpListenerBinding"/> method. /// </param> /// <param name="address">The endpoint address to use for the WCF listener. If not specified or null, the endpoint /// address is created using the default endpoint resource named "ServiceEndpoint" defined in the service manifest. /// </param> public WcfServiceRemotingListener( ServiceContext serviceContext, IServiceRemotingMessageHandler messageHandler, Binding listenerBinding = null, EndpointAddress address = null) { if (address != null) { this.wcfListener = new WcfCommunicationListener <IServiceRemotingContract>( serviceContext, new WcfRemotingService(messageHandler), listenerBinding, address); } else { this.wcfListener = new WcfCommunicationListener <IServiceRemotingContract>( serviceContext, new WcfRemotingService(messageHandler), listenerBinding, "ServiceEndpoint"); } }
/// <summary> /// Constructs a WCF based service remoting listener. /// </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> /// <param name="listenerBinding">WCF binding to use for the listener. If the listener binding is not specified or null, /// a default listener binding is created using <see cref="WcfUtility.CreateTcpListenerBinding"/> method which creates /// a <see cref="System.ServiceModel.NetTcpBinding"/> with no security. /// </param> /// <param name="serializationProvider"></param> /// <param name="endpointResourceName">The name of the endpoint resource defined in the service manifest that /// should be used to create the address for the listener. If the endpointResourceName is not specified or null, /// the default value "ServiceEndpointV2" is used. /// </param> public WcfServiceRemotingListener( ServiceContext serviceContext, IService serviceImplementation, Binding listenerBinding = null, IServiceRemotingMessageSerializationProvider serializationProvider = null, string endpointResourceName = "ServiceEndpointV2") { if (serializationProvider == null) { serializationProvider = new BasicDataContractSerializationProvider(); } var serializerManager = new ServiceRemotingMessageSerializersManager(serializationProvider, new BasicDataContractHeaderSerializer()); this.messageHandler = new ServiceRemotingMessageDispatcher(serviceContext, serviceImplementation, serializerManager.GetSerializationProvider().CreateMessageBodyFactory()); this.wcfListener = new WcfCommunicationListener <IServiceRemotingContract>( serviceContext, new WcfRemotingService( this.messageHandler, serializerManager), listenerBinding, endpointResourceName); }
private void Initialize(ServiceContext serviceContext, Binding listenerBinding, EndpointAddress address, ServiceRemotingMessageSerializersManager serializerManager, IServiceRemotingMessageHandler messageHandler) { this.messageHandler = messageHandler; if (address != null) { this.wcfListener = new WcfCommunicationListener <IServiceRemotingContract>( serviceContext, new WcfRemotingService(this.messageHandler, serializerManager), listenerBinding, address); } else { this.wcfListener = new WcfCommunicationListener <IServiceRemotingContract>( serviceContext, new WcfRemotingService(this.messageHandler, serializerManager), listenerBinding, "ServiceEndpointV2"); } }
public WcfRemotingService(IServiceRemotingMessageHandler messageHandler, Type serviceType) { _serviceDescription = new ServiceClassDescription(serviceType); _messageHandler = messageHandler; _requestContext = new WcfServiceRemotingRequestContext(); }
public WcfServiceRemotingListener(IServiceRemotingMessageHandler remotingMessageHandler, Type serviceType, Func<object, ICommunicationListener> factory) { _innerListener = factory(new WcfRemotingService(remotingMessageHandler, serviceType)); }