Exemple #1
0
        public void Send(string endpoint, object message)
        {
            var channelMessage = ChannelMessageFactory.CreateChannelMessage(message, serializer);
            var destination    = EndpointAddress.Parse(endpoint);

            channelMessage.AddHeader(MessageHeaders.Destination, destination.ToString());
            sendingChannel.Send(destination, channelMessage);
        }
Exemple #2
0
        public void Unsubscribe(string endpoint, string messageName)
        {
            var message = new UnsubscribeMessage
            {
                Endpoint    = $"{busConfig.EndpointName}@{Environment.MachineName}",
                MessageName = messageName
            };

            var destination = EndpointAddress.Parse(endpoint);

            var logMsg = messageName == string.Empty ? "All" : messageName;

            log.Info($"Unsubscribing from endpoint '{destination}'. Message '{logMsg}'");

            var channelMessage     = ChannelMessageFactory.CreateChannelMessage(message, bodySerializer);
            var msmqSendingChannel = new MsmqSendingChannel();

            msmqSendingChannel.Send(destination, channelMessage);
        }
        private Connection BuildConnection()
        {
            var serialiser            = new PortingAssistantJsonSerializer();
            var channelMessageFactory = new ChannelMessageFactory(serialiser);

            Console.OutputEncoding = System.Text.Encoding.UTF8;
            return(new Connection(
                       new Channel(new TabSeparatedInputStreamParser(), serialiser),
                       new MessageDispatcher(),
                       new RequestExecutor(serialiser, channelMessageFactory),
                       new ResponseHandlerExecutor(serialiser),
                       new System.Threading.Tasks.Dataflow.BufferBlock <IChannelMessage>(),
                       channelMessageFactory)
            {
                LogFilePath = "electron-cgi.log",
                MinimumLogLevel = LogLevel.Warning,
                IsLoggingEnabled = false
            });
        }
Exemple #4
0
        public void Publish(object message)
        {
            var channelMessage = ChannelMessageFactory.CreateChannelMessage(message, serializer);

            publishingChannel.Publish(channelMessage);
        }