예제 #1
0
        private void Bulid_Click(object sender, RoutedEventArgs e)
        {
            if (string.IsNullOrEmpty(_buildCommandVM.SelectedSlaveName))
            {
                _buildCommandVM.AlertMessage = "Please selectde Chavp Build Slave";

                return;
            }

            var buildCommand = new BuildCommand
            {
                RepositoryProviderName = _buildCommandVM.RepositoryProviderName,
                RepositoryUri          = _buildCommandVM.RepositoryUri
            };

            _publishBuildCommandChannel.Publish <BuildCommand>(
                buildCommand,
                x => x.WithTopic(_buildCommandVM.SelectedSlaveName)
                .OnSuccess(() =>
            {
                _buildCommandVM.AlertMessage = string.Format(
                    "Build {0} Success. {1}", _buildCommandVM.SelectedSlaveName, DateTime.Now.ToString());
            })
                .OnFailure(() =>
            {
                _buildCommandVM.AlertMessage = string.Format(
                    "Build {0} Fail. {1}", _buildCommandVM.SelectedSlaveName, DateTime.Now.ToString());
            }));
        }
예제 #2
0
        private void Announce_Click(object sender, RoutedEventArgs e)
        {
            var sysCommand = new SystemCommand
            {
                Message = _buildCommandVM.AnnounceMessage
            };

            _publishSystemCommandChannel.Publish <SystemCommand>(sysCommand);
        }
예제 #3
0
 protected virtual void Publish(RoutedEventMessage message, RaiseScope raiseScope = null)
 {
     using (IPublishChannel channel = MessageBus.OpenPublishChannel())
     {
         var messageProperties = new MessageProperties()
         {
             DeliveryMode = 2
         };
         var body = Serializer.MessageToBytes(message);
         channel.Publish(RoutedEventExchange, GetRoutingKey(raiseScope), messageProperties, body);
     }
 }
예제 #4
0
        /// <summary>
        /// Schedule a message to be published at some time in the future.
        /// This required the EasyNetQ.Scheduler service to be running.
        /// </summary>
        /// <typeparam name="T">The message type</typeparam>
        /// <param name="publishChannel">The publish channel to publish the future message on</param>
        /// <param name="timeToRespond">The time at which the message should be sent (UTC)</param>
        /// <param name="message">The message to response with</param>
        public static void FuturePublish <T>(this IPublishChannel publishChannel, DateTime timeToRespond, T message)
        {
            Preconditions.CheckNotNull(message, "message");

            var advancedBus = publishChannel.Bus.Advanced;
            var typeName    = advancedBus.SerializeType(typeof(T));
            var messageBody = advancedBus.Serializer.MessageToBytes(message);

            publishChannel.Publish(new ScheduleMe
            {
                WakeTime     = timeToRespond,
                BindingKey   = typeName,
                InnerMessage = messageBody
            });
        }
예제 #5
0
        /// <summary>
        /// Schedule a message to be published at some time in the future.
        /// This required the EasyNetQ.Scheduler service to be running.
        /// </summary>
        /// <typeparam name="T">The message type</typeparam>
        /// <param name="publishChannel">The publish channel to publish the future message on</param>
        /// <param name="timeToRespond">The time at which the message should be sent (UTC)</param>
        /// <param name="message">The message to response with</param>
        public static void FuturePublish <T>(this IPublishChannel publishChannel, DateTime timeToRespond, T message)
        {
            if (message == null)
            {
                throw new ArgumentNullException("message");
            }

            var advancedBus = publishChannel.Bus.Advanced;
            var typeName    = advancedBus.SerializeType(typeof(T));
            var messageBody = advancedBus.Serializer.MessageToBytes(message);

            publishChannel.Publish(new ScheduleMe
            {
                WakeTime     = timeToRespond,
                BindingKey   = typeName,
                InnerMessage = messageBody
            });
        }