private void CreateNativeListener( IFabricTransportMessageHandler contract, FabricTransportSettings transportSettings, FabricTransportListenerAddress listenerAddress, IFabricTransportConnectionHandler connectionHandler) { var iid = typeof(NativeServiceCommunication.IFabricServiceCommunicationListener).GetTypeInfo().GUID; using (var pin = new PinCollection()) { var nativeTransportSettings = transportSettings.ToNative(pin); var nativeListenerAddress = listenerAddress.ToNative(pin); var nativeConnectionHandler = new FabricTransportServiceConnectionHandlerBroker(connectionHandler); var messageHandler = new FabricTransportMessageHandlerBroker(contract, connectionHandler); this.nativeListner = NativeServiceCommunication.CreateServiceCommunicationListener( ref iid, nativeTransportSettings, nativeListenerAddress, messageHandler, nativeConnectionHandler); } }
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); } }