private void CreateNativeClient(
            FabricTransportSettings transportSettings,
            string connectionAddress,
            IFabricTransportClientEventHandler eventHandler,
            IFabricTransportCallbackMessageHandler contract,
            NativeFabricTransport.IFabricTransportMessageDisposer messageMessageDisposer)
        {
            var iid = typeof(NativeFabricTransport.IFabricTransportClient).GetTypeInfo().GUID;

            using (var pin = new PinCollection())
            {
                var nativeTransportSettings = transportSettings.ToNativeV2(pin);
                var messageHandler          = new FabricTransportCallbackHandlerBroker(contract);
                var nativeConnectionAddress = pin.AddBlittable(connectionAddress);
                var nativeEventHandler      = new FabricTransportClientConnectionEventHandlerBroker(eventHandler);
                this.nativeClient =
                    NativeFabricTransport.CreateFabricTransportClient(
                        ref iid,
                        nativeTransportSettings,
                        nativeConnectionAddress,
                        messageHandler,
                        nativeEventHandler,
                        messageMessageDisposer);
            }
        }
 internal static extern IFabricTransportClient CreateFabricTransportClient(
     ref Guid iid,
     [In] IntPtr transportSettingsPtr,
     [In] IntPtr connectionAddress,
     [In, MarshalAs(UnmanagedType.Interface)] IFabricTransportCallbackMessageHandler callbackMessageHandler,
     [In, MarshalAs(UnmanagedType.Interface)] IFabricTransportClientEventHandler connectionEventHandler,
     [In, MarshalAs(UnmanagedType.Interface)] IFabricTransportMessageDisposer messageMessageDisposer
     );
Esempio n. 3
0
 public FabricTransportClient(
     FabricTransportSettings transportSettings,
     string connectionAddress,
     IFabricTransportClientConnectionHandler eventHandler,
     IFabricTransportCallbackMessageHandler contract = null)
 {
     this.ConnectionAddress = connectionAddress;
     this.settings          = transportSettings;
     Utility.WrapNativeSyncInvokeInMTA(
         () => this.CreateNativeClient(transportSettings, connectionAddress, eventHandler, contract),
         "FabricTransportClient.Create");
 }
 /// <summary>
 ///
 /// </summary>
 /// <param name="remotingSettings"></param>
 /// <param name="remotingCallbackMessageHandler"></param>
 /// <param name="servicePartitionResolver"></param>
 /// <param name="exceptionHandlers"></param>
 /// <param name="traceId"></param>
 /// <param name="serializersManager"></param>
 public FabricTransportServiceRemotingClientFactoryImpl(
     ServiceRemotingMessageSerializersManager serializersManager,
     FabricTransportRemotingSettings remotingSettings,
     IServiceRemotingCallbackMessageHandler remotingCallbackMessageHandler = null,
     IServicePartitionResolver servicePartitionResolver = null,
     IEnumerable <IExceptionHandler> exceptionHandlers  = null,
     string traceId = null)
     : base(
         servicePartitionResolver,
         GetExceptionHandlers(exceptionHandlers),
         traceId)
 {
     this.settings           = remotingSettings ?? FabricTransportRemotingSettings.GetDefault();
     this.serializersManager = serializersManager;
     this.disposer           = new NativeFabricTransportMessageDisposer();
     this.fabricTransportRemotingCallbackMessageHandler = new FabricTransportRemotingCallbackMessageHandler(remotingCallbackMessageHandler, this.serializersManager);
 }
Esempio n. 5
0
        private void CreateNativeClient(
            FabricTransportSettings transportSettings,
            string connectionAddress,
            IFabricTransportClientConnectionHandler eventHandler,
            IFabricTransportCallbackMessageHandler contract)
        {
            var iid = typeof(NativeServiceCommunication.IFabricServiceCommunicationClient2).GetTypeInfo().GUID;

            using (var pin = new PinCollection())
            {
                var nativeTransportSettings = transportSettings.ToNative(pin);
                var messageHandler          = new FabricTransportCallbackHandlerBroker(contract);
                var nativeConnectionAddress = pin.AddBlittable(connectionAddress);
                var nativeEventHandler      = new FabricTransportNativeClientConnectionEventHandler(eventHandler);
                this.nativeClient =
                    (NativeServiceCommunication.IFabricServiceCommunicationClient2)
                    NativeServiceCommunication.CreateServiceCommunicationClient(
                        ref iid,
                        nativeTransportSettings,
                        nativeConnectionAddress,
                        messageHandler,
                        nativeEventHandler);
            }
        }
Esempio n. 6
0
 public FabricTransportCallbackHandlerBroker(IFabricTransportCallbackMessageHandler callImpl)
 {
     this.callImpl = callImpl;
 }