public FileChannelServerDispatcher(string directory, string channelName, IFileChannelFormatter channelFormatter, Action<object> onReceiveRequestMessage) { if (string.IsNullOrEmpty(directory)) { throw new ArgumentNullException(nameof(directory)); } if (string.IsNullOrEmpty(channelName)) { throw new ArgumentNullException(nameof(channelName)); } if (channelFormatter == null) { throw new ArgumentNullException(nameof(channelFormatter)); } if (onReceiveRequestMessage == null) { throw new ArgumentNullException(nameof(onReceiveRequestMessage)); } var requestFileMask = $"*.{channelName}.Request"; _channelName = channelName; _serverChannel = new FileChannel(directory, requestFileMask, channelFormatter, onReceiveRequestMessage); }
public FileChannelServerDispatcher(string directory, string channelName, IFileChannelFormatter channelFormatter, Action <object> onReceiveRequestMessage) { if (string.IsNullOrEmpty(directory)) { throw new ArgumentNullException(nameof(directory)); } if (string.IsNullOrEmpty(channelName)) { throw new ArgumentNullException(nameof(channelName)); } if (channelFormatter == null) { throw new ArgumentNullException(nameof(channelFormatter)); } if (onReceiveRequestMessage == null) { throw new ArgumentNullException(nameof(onReceiveRequestMessage)); } var requestFileMask = $"*.{channelName}.Request"; _channelName = channelName; _serverChannel = new FileChannel(directory, requestFileMask, channelFormatter, onReceiveRequestMessage); }
public FileChannel(string directory, string channelFileMask, IFileChannelFormatter channelFormatter, Action <object> onReceiveMessage) { if (string.IsNullOrEmpty(directory)) { throw new ArgumentNullException(nameof(directory)); } if (string.IsNullOrEmpty(channelFileMask)) { throw new ArgumentNullException(nameof(channelFileMask)); } if (channelFormatter == null) { throw new ArgumentNullException(nameof(channelFormatter)); } if (onReceiveMessage == null) { throw new ArgumentNullException(nameof(onReceiveMessage)); } _directory = directory; _channelFileMask = channelFileMask; _channelFormatter = channelFormatter; _onReceiveMessage = onReceiveMessage; _channelHistory = new FileChannelHistory(); }
public FileChannelClient(string channel, string client = null, string directory = null, IFileChannelFormatter formatter = null) { if (string.IsNullOrEmpty(channel)) { throw new ArgumentNullException(nameof(channel)); } if (string.IsNullOrEmpty(client)) { client = Guid.NewGuid().ToString("N"); } if (string.IsNullOrEmpty(directory)) { directory = AppDomain.CurrentDomain.BaseDirectory; } if (formatter == null) { formatter = JsonFileChannelFormatter.Instance; } InvokeTimeout = DefaultInvokeTimeout; _client = client; _dispatcher = new FileChannelClientDispatcher(directory, client, channel, formatter, OnReceiveReplyMessage); _requests = new ConcurrentDictionary<string, TaskCompletionSource<object>>(); }
public FileChannel(string directory, string channelFileMask, IFileChannelFormatter channelFormatter, Action<object> onReceiveMessage) { if (string.IsNullOrEmpty(directory)) { throw new ArgumentNullException(nameof(directory)); } if (string.IsNullOrEmpty(channelFileMask)) { throw new ArgumentNullException(nameof(channelFileMask)); } if (channelFormatter == null) { throw new ArgumentNullException(nameof(channelFormatter)); } if (onReceiveMessage == null) { throw new ArgumentNullException(nameof(onReceiveMessage)); } _directory = directory; _channelFileMask = channelFileMask; _channelFormatter = channelFormatter; _onReceiveMessage = onReceiveMessage; _channelHistory = new FileChannelHistory(); }
public FileChannelClientDispatcher(string directory, string clientName, string channelName, IFileChannelFormatter channelFormatter, Action<object> onReceiveReplyMessage) { if (string.IsNullOrEmpty(directory)) { throw new ArgumentNullException(nameof(directory)); } if (string.IsNullOrEmpty(clientName)) { throw new ArgumentNullException(nameof(clientName)); } if (string.IsNullOrEmpty(channelName)) { throw new ArgumentNullException(nameof(channelName)); } if (channelFormatter == null) { throw new ArgumentNullException(nameof(channelFormatter)); } if (onReceiveReplyMessage == null) { throw new ArgumentNullException(nameof(onReceiveReplyMessage)); } _directory = directory; _requestFile = $"{clientName}.{channelName}.Request"; _replyFile = $"{clientName}.{channelName}.Reply"; _clientChannel = new FileChannel(directory, _replyFile, channelFormatter, onReceiveReplyMessage); }
public FileChannelServer(string channel, string directory = null, IFileChannelFormatter formatter = null) { if (string.IsNullOrEmpty(channel)) { throw new ArgumentNullException(nameof(channel)); } if (string.IsNullOrEmpty(directory)) { directory = AppDomain.CurrentDomain.BaseDirectory; } if (formatter == null) { formatter = JsonFileChannelFormatter.Instance; } _dispatcher = new FileChannelServerDispatcher(directory, channel, formatter, OnReciveRequestMessage); _handlers = new Dictionary<string, IFileChannelHandler>(); }
public FileChannelServer(string channel, string directory = null, IFileChannelFormatter formatter = null) { if (string.IsNullOrEmpty(channel)) { throw new ArgumentNullException(nameof(channel)); } if (string.IsNullOrEmpty(directory)) { directory = AppDomain.CurrentDomain.BaseDirectory; } if (formatter == null) { formatter = JsonFileChannelFormatter.Instance; } _dispatcher = new FileChannelServerDispatcher(directory, channel, formatter, OnReciveRequestMessage); _handlers = new Dictionary <string, IFileChannelHandler>(); }
public FileChannelClientDispatcher(string directory, string clientName, string channelName, IFileChannelFormatter channelFormatter, Action <object> onReceiveReplyMessage) { if (string.IsNullOrEmpty(directory)) { throw new ArgumentNullException(nameof(directory)); } if (string.IsNullOrEmpty(clientName)) { throw new ArgumentNullException(nameof(clientName)); } if (string.IsNullOrEmpty(channelName)) { throw new ArgumentNullException(nameof(channelName)); } if (channelFormatter == null) { throw new ArgumentNullException(nameof(channelFormatter)); } if (onReceiveReplyMessage == null) { throw new ArgumentNullException(nameof(onReceiveReplyMessage)); } _directory = directory; _requestFile = $"{clientName}.{channelName}.Request"; _replyFile = $"{clientName}.{channelName}.Reply"; _clientChannel = new FileChannel(directory, _replyFile, channelFormatter, onReceiveReplyMessage); }
public FileChannelClient(string channel, string client = null, string directory = null, IFileChannelFormatter formatter = null) { if (string.IsNullOrEmpty(channel)) { throw new ArgumentNullException(nameof(channel)); } if (string.IsNullOrEmpty(client)) { client = Guid.NewGuid().ToString("N"); } if (string.IsNullOrEmpty(directory)) { directory = AppDomain.CurrentDomain.BaseDirectory; } if (formatter == null) { formatter = JsonFileChannelFormatter.Instance; } InvokeTimeout = DefaultInvokeTimeout; _client = client; _dispatcher = new FileChannelClientDispatcher(directory, client, channel, formatter, OnReceiveReplyMessage); _requests = new ConcurrentDictionary <string, TaskCompletionSource <object> >(); }