public DefaultDuplexInputChannel(string channelId, // address to listen IThreadDispatcher dispatcher, // threading model used to notify messages and events IThreadDispatcher dispatchingAfterMessageReading, IInputConnector inputConnector) // listener used for listening to messages { using (EneterTrace.Entering()) { if (string.IsNullOrEmpty(channelId)) { EneterTrace.Error(ErrorHandler.NullOrEmptyChannelId); throw new ArgumentException(ErrorHandler.NullOrEmptyChannelId); } ChannelId = channelId; Dispatcher = dispatcher; // Internal dispatcher used when the message is decoded. // E.g. Shared memory messaging needs to return looping immediately the protocol message is decoded // so that other senders are not blocked. myDispatchingAfterMessageReading = dispatchingAfterMessageReading; myInputConnector = inputConnector; } }
public Wire(Guid id, IInputConnector input, IOutputConnector output) { Id = id; Input = input; Output = output; _subscription = output.Subscribe(input); }
public IDuplexInputChannel CreateDuplexInputChannel(string channelId) { using (EneterTrace.Entering()) { IThreadDispatcher aDispatcher = InputChannelThreading.GetDispatcher(); IInputConnector anInputConnector = myInputConnectorFactory.CreateInputConnector(channelId); return(new DefaultDuplexInputChannel(channelId, aDispatcher, myDispatcherAfterMessageDecoded, anInputConnector)); } }
/// <summary> /// Creates the duplex input channel which can receive and send messages to the duplex output channel using shared memory. /// </summary> /// <param name="channelId">Address which shell be used for listening. /// It is the name of the memory-mapped file that will be used to send and receive messages. /// </param> /// <returns>duplex input channel</returns> public IDuplexInputChannel CreateDuplexInputChannel(string channelId) { using (EneterTrace.Entering()) { IInputConnectorFactory aConnectorFactory = new SharedMemoryConnectorFactory(myProtocolFormatter, ConnectTimeout, SendTimeout, MaxMessageSize, SharedMemorySecurity); IThreadDispatcher aThreadDispatcher = InputChannelThreading.GetDispatcher(); IInputConnector anInputConnector = aConnectorFactory.CreateInputConnector(channelId); IThreadDispatcher aDispatcherAfterMessageDecoded = myDispatchingAfterMessageDecoded.GetDispatcher(); return(new DefaultDuplexInputChannel(channelId, aThreadDispatcher, aDispatcherAfterMessageDecoded, anInputConnector)); } }
/// <summary> /// Creates the duplex input channel which can receive and send messages to the duplex output channel using UDP. /// </summary> /// <remarks> /// It can create duplex input channels for unicast, multicast or broadcast communication. /// If the property UnicastCommunication is set to true then it creates the input channel for the unicast communication. /// It means, like a service it can receive connections and messages from multiple output channels but /// send messages only to particular output channels which are connected. /// If the property UnicastCommunication is set to false then it creates the output channel for mulitcast or broadcast communication. /// It means it can send mulitcast or broadcast messages which can be received by multiple output channels. /// It also can receive multicast and broadcast messages. /// <example> /// Creating the duplex input channel for unicast communication. /// <code> /// IMessagingSystemFactory aMessaging = new UdpMessagingSystemFactory(); /// IDuplexInputChannel anInputChannel = aMessaging.CreateDuplexInputChannel("udp://127.0.0.1:8765/"); /// </code> /// </example> /// <example> /// Creating the duplex input channel for multicast communication. /// <code> /// IProtocolFormatter aProtocolFormatter = new EasyProtocolFormatter(); /// IMessagingSystemFactory aMessaging = new UdpMessagingSystemFactory(aProtocolFormatter) /// { /// // Setup the factory to create channels for mulitcast or broadcast communication. /// UnicastCommunication = false, /// /// // Specify the mulitcast group to receive messages from. /// MulticastGroupToReceive = "234.4.5.6" /// } /// /// // Create duplex input channel which is listening to udp://127.0.0.1:8095/ and can also receive multicast messages /// // sent to udp://234.4.5.6:8095/. /// IDuplexInputChannel anInputChannel = aMessaging.CreateDuplexInputChannel("udp://127.0.0.1:8095/"); /// </code> /// </example> /// <example> /// Sending mulitcast and broadcast messages from the duplex input channel. /// <code> /// IProtocolFormatter aProtocolFormatter = new EasyProtocolFormatter(); /// IMessagingSystemFactory aMessaging = new UdpMessagingSystemFactory(aProtocolFormatter) /// { /// // Setup the factory to create channels for mulitcast or broadcast communication. /// UnicastCommunication = false, /// /// // Setup the factory to create chennels which are allowed to send broadcast messages. /// AllowSendingBroadcasts = true /// } /// /// // Create duplex input channel which is listening to udp://127.0.0.1:8095/. /// IDuplexInputChannel anInputChannel = aMessaging.CreateDuplexInputChannel("udp://127.0.0.1:8095/"); /// /// // Subscribe to handle messages. /// anIputChannel.MessageReceived += OnMessageReceived; /// /// // Start listening. /// anIputChannel.StartListening(); /// /// ... /// /// // Send a multicast message. /// // Note: it will be received by all output and input channels which have joined the multicast group 234.4.5.6 /// // and are listening to the port 8095. /// anInputChannel.SendResponseMessage("udp://234.4.5.6:8095/", "Hello"); /// /// ... /// /// // Send a broadcast message. /// // Note: it will be received by all output and input channels within the sub-network which are listening to the port 8095. /// anInputChannel.SendResponseMessage("udp://255.255.255.255:8095/", "Hello"); /// /// ... /// /// // Stop listening. /// anInputChannel.StopListening(); /// </code> /// </example> /// </remarks> /// <param name="channelId">Identifies this duplex input channel. The channel id must be a valid URI address (e.g. udp://127.0.0.1:8090/) the input channel will listen to.</param> /// <returns>duplex input channel</returns> public IDuplexInputChannel CreateDuplexInputChannel(string channelId) { using (EneterTrace.Entering()) { IThreadDispatcher aDispatcher = InputChannelThreading.GetDispatcher(); IInputConnectorFactory aConnectorFactory = new UdpConnectorFactory(myProtocolFormatter, ReuseAddress, -1, UnicastCommunication, AllowSendingBroadcasts, Ttl, MulticastGroupToReceive, MulticastLoopback, MaxAmountOfConnections); IInputConnector anInputConnector = aConnectorFactory.CreateInputConnector(channelId); return(new DefaultDuplexInputChannel(channelId, aDispatcher, myDispatcherAfterMessageDecoded, anInputConnector)); } }
/// <summary> /// Creates the duplex input channel receiving messages from the duplex output channel and sending back response messages by using WebSocket. /// </summary> /// <param name="channelId">Identifies this duplex input channel. The channel id must be a valid URI address (e.g. ws://127.0.0.1:8090/MyService/) the input channel will listen to.</param> /// <returns>duplex input channel</returns> public IDuplexInputChannel CreateDuplexInputChannel(string channelId) { using (EneterTrace.Entering()) { IThreadDispatcher aDispatcher = InputChannelThreading.GetDispatcher(); IInputConnectorFactory anInputConnectorFactory = new WebSocketInputConnectorFactory(myProtocolFormatter, ServerSecurityStreamFactory, (int)SendTimeout.TotalMilliseconds, (int)ReceiveTimeout.TotalMilliseconds, ReuseAddress, MaxAmountOfConnections); IInputConnector anInputConnector = anInputConnectorFactory.CreateInputConnector(channelId); return(new DefaultDuplexInputChannel(channelId, aDispatcher, myDispatcherAfterMessageDecoded, anInputConnector)); } }
protected Adapter(IInputConnector input, IOutputConnector output) { }
public CollectorNode(Guid nodeId, TypeDescription typeDescription, IInputConnector connector) : base(nodeId) { }
public SenderFactory(WorkMode workMode, string path, IInputConnector service) { _workMode = workMode; _path = path; _service = service; }
public Wire(IInputConnector input, IOutputConnector output) { InputConnector = input; OutputConnector = output; }
public ServiceSender(IInputConnector service, WorkMode workMode) { _service = service; _workMode = workMode; }
public LinearTransformationAdapter(IInputConnector input, IOutputConnector output) : base(input, output) { }
public ServiceSender(IInputConnector service) { _service = service; }