Beispiel #1
0
        /// <summary>
        /// The configure receiver.
        /// </summary>
        private void ConfigureReceiver()
        {
            // Create reliable message receiver.
            var messagesFactory = new ReliableTypedMessagesFactory();

            _messageSender = messagesFactory.CreateReliableDuplexTypedMessageSender <bool?, NotificationMessage>();

            _messageSender.MessageDelivered    += OnMessageDelivered;
            _messageSender.MessageNotDelivered += OnMessageNotDelivered;
            _messageSender.ConnectionClosed    += OnConnectionClosed;

            // Create Named Pipe based messaging to communicate with clients.
            IMessagingSystemFactory messageFactory = new NamedPipeMessagingSystemFactory();

            _channel = messageFactory.CreateDuplexOutputChannel(Constants.ChannelId);
        }
Beispiel #2
0
        /// <summary>
        /// The configure broker client.
        /// </summary>
        private void ConfigureReceiver()
        {
            // Create reliable message receiver.
            var receiverFactory = new ReliableTypedMessagesFactory();

            _receiver = receiverFactory.CreateReliableDuplexTypedMessageReceiver<bool?, NotificationMessage>();

            // Create the Shared Memory messaging for the communication with the publisher.
            // Note: For the interprocess communication you can use: Tcp, NamedPipes and Http.
            IMessagingSystemFactory factory = new NamedPipeMessagingSystemFactory();

            // Create duplex output channel for the communication with the publisher.
            // Note: The duplex output channel can send requests and receive responses.
            //       In our case, the broker client will send requests to subscribe/unsubscribe
            //       and receive notifications as response messages.
            var channel = factory.CreateDuplexInputChannel(Constants.ChannelId);

            _receiver.MessageReceived += OnMessageReceived;

            // Attach the output channel to the broker client
            _receiver.AttachDuplexInputChannel(channel);
        }