-
Notifications
You must be signed in to change notification settings - Fork 111
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merging code for 2.8.211 nuget packages. (#47)
- Loading branch information
Showing
321 changed files
with
14,890 additions
and
2,160 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
95 changes: 95 additions & 0 deletions
95
...icrosoft.ServiceFabric.Actors.Wcf/Remoting/V2/Wcf/Client/WcfActorRemotingClientFactory.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
// ------------------------------------------------------------ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License (MIT). See License.txt in the repo root for license information. | ||
// ------------------------------------------------------------ | ||
namespace Microsoft.ServiceFabric.Actors.Remoting.V2.Wcf.Client | ||
{ | ||
using System.Collections.Generic; | ||
using System.ServiceModel.Channels; | ||
using Microsoft.ServiceFabric.Actors.Remoting.Client; | ||
using Microsoft.ServiceFabric.Actors.Remoting.V2.Wcf.Client; | ||
using Microsoft.ServiceFabric.Actors.Remoting.V2; | ||
using Microsoft.ServiceFabric.Services.Client; | ||
using Microsoft.ServiceFabric.Services.Communication.Client; | ||
using Microsoft.ServiceFabric.Services.Remoting.V2.Wcf.Client; | ||
using Microsoft.ServiceFabric.Services.Remoting.V2; | ||
using Microsoft.ServiceFabric.Services.Remoting.V2.Client; | ||
|
||
/// <summary> | ||
/// An <see cref="IServiceRemotingClientFactory"/> that uses | ||
/// Windows Communication Foundation to create <see cref="IServiceRemotingClient"/> | ||
/// to communicate with an actor service and actors hosted by it, using actor and service interfaces that are remoted via | ||
/// <see cref="Microsoft.ServiceFabric.Actors.Remoting.V2.Wcf.Runtime.WcfActorServiceRemotingListener"/>. | ||
/// </summary> | ||
public class WcfActorRemotingClientFactory : WcfServiceRemotingClientFactory | ||
{ | ||
/// <summary> | ||
/// Constructs a WCF based actor remoting factory. | ||
/// </summary> | ||
/// <param name="callbackClient"> | ||
/// The callback client that receives the callbacks from the service. | ||
/// </param> | ||
public WcfActorRemotingClientFactory( | ||
IServiceRemotingCallbackMessageHandler callbackClient) | ||
: this(null, callbackClient) | ||
{ | ||
} | ||
|
||
/// <summary> | ||
/// Constructs a WCF based actor remoting factory. | ||
/// </summary> | ||
/// <param name="clientBinding"> | ||
/// WCF binding to use for the client. If the client binding is null, | ||
/// a default client binding is created using | ||
/// <see cref="Microsoft.ServiceFabric.Services.Communication.Wcf.WcfUtility.CreateTcpClientBinding"/> method | ||
/// which creates a <see cref="System.ServiceModel.NetTcpBinding"/> with no security. | ||
/// </param> | ||
/// <param name="callbackClient"> | ||
/// The callback client that receives the callbacks from the service. | ||
/// </param> | ||
/// <param name="exceptionHandlers"> | ||
/// Exception handlers to handle the exceptions encountered in communicating with the service. | ||
/// </param> | ||
/// <param name="servicePartitionResolver"> | ||
/// Service partition resolver to resolve the service endpoints. If not specified, a default | ||
/// service partition resolver returned by <see cref="ServicePartitionResolver.GetDefault"/> is used. | ||
/// </param> | ||
/// <param name="traceId"> | ||
/// Id to use in diagnostics traces from this component. | ||
/// </param> | ||
/// <param name="serializationProvider"></param> | ||
/// <remarks> | ||
/// This factory uses <see cref="Microsoft.ServiceFabric.Services.Communication.Wcf.Client.WcfExceptionHandler"/>, | ||
/// <see cref="Microsoft.ServiceFabric.Actors.Remoting.Client.ActorRemotingExceptionHandler"/>, in addition to the | ||
/// exception handlers supplied to the constructor. | ||
/// </remarks> | ||
public WcfActorRemotingClientFactory( | ||
Binding clientBinding, | ||
IServiceRemotingCallbackMessageHandler callbackClient, | ||
IEnumerable<IExceptionHandler> exceptionHandlers = null, | ||
IServicePartitionResolver servicePartitionResolver = null, | ||
string traceId = null, | ||
IServiceRemotingMessageSerializationProvider serializationProvider=null) : | ||
base( | ||
new ActorRemotingSerializationManager(serializationProvider ?? new BasicDataContractSerializationProvider(), | ||
new BasicDataContractActorHeaderSerializer()), | ||
clientBinding, | ||
callbackClient, | ||
GetExceptionHandlers(exceptionHandlers), | ||
servicePartitionResolver, | ||
traceId) | ||
{ | ||
} | ||
|
||
private static IEnumerable<IExceptionHandler> GetExceptionHandlers(IEnumerable<IExceptionHandler> exceptionHandlers) | ||
{ | ||
var handlers = new List<IExceptionHandler>(); | ||
if (exceptionHandlers != null) | ||
{ | ||
handlers.AddRange(exceptionHandlers); | ||
} | ||
handlers.Add(new ActorRemotingExceptionHandler()); | ||
return handlers; | ||
} | ||
} | ||
} |
87 changes: 87 additions & 0 deletions
87
...osoft.ServiceFabric.Actors.Wcf/Remoting/V2/Wcf/Runtime/WcfActorServiceRemotingListener.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
// ------------------------------------------------------------ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License (MIT). See License.txt in the repo root for license information. | ||
// ------------------------------------------------------------ | ||
namespace Microsoft.ServiceFabric.Actors.Remoting.V2.Wcf.Runtime | ||
{ | ||
using System; | ||
using System.Fabric; | ||
using System.ServiceModel; | ||
using System.ServiceModel.Channels; | ||
using Microsoft.ServiceFabric.Actors.Generator; | ||
using Microsoft.ServiceFabric.Actors.Runtime; | ||
using Microsoft.ServiceFabric.Actors.Remoting.V2; | ||
using Microsoft.ServiceFabric.Actors.Remoting.V2.Runtime; | ||
using Microsoft.ServiceFabric.Services.Remoting.Runtime; | ||
using Microsoft.ServiceFabric.Services.Remoting.V2; | ||
using Microsoft.ServiceFabric.Services.Remoting.V2.Runtime; | ||
using Microsoft.ServiceFabric.Services.Remoting.V2.Wcf.Runtime; | ||
|
||
/// <summary> | ||
/// An <see cref="IServiceRemotingListener"/> that uses | ||
/// Windows Communication Foundation to provide interface remoting for actor services. | ||
/// </summary> | ||
public class WcfActorServiceRemotingListener : WcfServiceRemotingListener | ||
{ | ||
/// <summary> | ||
/// Constructs a WCF based actor remoting listener. | ||
/// </summary> | ||
/// <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 which creates | ||
/// a <see cref="System.ServiceModel.NetTcpBinding"/> with no security. | ||
/// </param> | ||
/// <param name="actorService">The actor service.</param> | ||
public WcfActorServiceRemotingListener( | ||
ActorService actorService, | ||
Binding listenerBinding = null) | ||
: base( | ||
GetContext(actorService), | ||
new ActorServiceRemotingDispatcher(actorService, new DataContractRemotingMessageFactory()), | ||
new ActorRemotingSerializationManager(new BasicDataContractSerializationProvider(), | ||
new BasicDataContractActorHeaderSerializer()), | ||
listenerBinding, | ||
ActorNameFormat.GetFabricServiceEndpointName(actorService.ActorTypeInformation.ImplementationType)) | ||
{ | ||
} | ||
|
||
/// <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) | ||
{ | ||
} | ||
|
||
private static ServiceContext GetContext(ActorService actorService) | ||
{ | ||
if (actorService == null) | ||
{ | ||
throw new ArgumentNullException("actorService"); | ||
} | ||
|
||
return actorService.Context; | ||
} | ||
} | ||
} |
Oops, something went wrong.