public void Send <T>(Action <IMessageSendTopologyConfigurator <T> > configureTopology)
            where T : class
        {
            IMessageSendTopologyConfigurator <T> configurator = _configuration.Topology.Send.GetMessageTopology <T>();

            configureTopology?.Invoke(configurator);
        }
Exemplo n.º 2
0
        public void MessageTopologyCreated <T>(IMessageSendTopologyConfigurator <T> configuration)
            where T : class
        {
            IMessageSendTopologyConfigurator <T> specification = _sendTopology.GetMessageTopology <T>();

            configuration.AddDelegate(specification);
        }
        public void MessageTopologyCreated <T>(IMessageSendTopologyConfigurator <T> configuration)
            where T : class
        {
            All(observer =>
            {
                observer.MessageTopologyCreated(configuration);

                return(true);
            });
        }
        public static void UseRoutingKeyFormatter <T>(this IMessageSendTopologyConfigurator <T> configurator, IMessageRoutingKeyFormatter <T> formatter)
            where T : class
        {
            configurator.UpdateConvention <IRoutingKeyMessageSendTopologyConvention <T> >(
                update =>
            {
                update.SetFormatter(formatter);

                return(update);
            });
        }
Exemplo n.º 5
0
        void ApplyConventionsToMessageTopology <T>(IMessageSendTopologyConfigurator <T> messageTopology)
            where T : class
        {
            IMessageSendTopologyConvention[] conventions;
            lock (_lock)
                conventions = _conventions.ToArray();

            foreach (var convention in conventions)
            {
                if (convention.TryGetMessageSendTopologyConvention(out IMessageSendTopologyConvention <T> messageSendTopologyConvention))
                {
                    messageTopology.TryAddConvention(messageSendTopologyConvention);
                }
            }
        }
Exemplo n.º 6
0
        /// <summary>
        /// Specify for the message type that the delegate be used for setting the CorrelationId
        /// property of the message envelope.
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="configurator"></param>
        /// <param name="correlationIdSelector"></param>
        public static void UseCorrelationId <T>(this IMessageSendTopologyConfigurator <T> configurator, Func <T, Guid?> correlationIdSelector)
            where T : class
        {
            configurator.AddOrUpdateConvention <ICorrelationIdMessageSendTopologyConvention <T> >(
                () =>
            {
                var convention = new CorrelationIdMessageSendTopologyConvention <T>();
                convention.SetCorrelationId(new NullableDelegateMessageCorrelationId <T>(correlationIdSelector));

                return(convention);
            },
                update =>
            {
                update.SetCorrelationId(new NullableDelegateMessageCorrelationId <T>(correlationIdSelector));

                return(update);
            });
        }
 /// <summary>
 /// Use the delegate to format the routing key, using Empty if the string is null upon return
 /// </summary>
 /// <typeparam name="T"></typeparam>
 /// <param name="configurator"></param>
 /// <param name="formatter"></param>
 public static void UseRoutingKeyFormatter <T>(this IMessageSendTopologyConfigurator <T> configurator, Func <SendContext <T>, string> formatter)
     where T : class
 {
     configurator.UseRoutingKeyFormatter(new DelegateRoutingKeyFormatter <T>(formatter));
 }
Exemplo n.º 8
0
        IAmazonSqsMessageSendTopologyConfigurator <T> IAmazonSqsSendTopology.GetMessageTopology <T>()
        {
            IMessageSendTopologyConfigurator <T> configurator = base.GetMessageTopology <T>();

            return(configurator as IAmazonSqsMessageSendTopologyConfigurator <T>);
        }
Exemplo n.º 9
0
 protected void OnMessageTopologyCreated <T>(IMessageSendTopologyConfigurator <T> messageTopology)
     where T : class
 {
     _observers.MessageTopologyCreated(messageTopology);
 }
Exemplo n.º 10
0
        void ISendTopologyConfigurator.AddMessageSendTopology <T>(IMessageSendTopology <T> topology)
        {
            IMessageSendTopologyConfigurator <T> messageConfiguration = GetMessageTopology <T>();

            messageConfiguration.Add(topology);
        }
Exemplo n.º 11
0
 void ISendTopologyConfigurationObserver.MessageTopologyCreated <T>(IMessageSendTopologyConfigurator <T> messageTopology)
 {
     ApplyConventionsToMessageTopology(messageTopology);
 }
Exemplo n.º 12
0
        IRabbitMqMessageSendTopologyConfigurator <T> IRabbitMqSendTopology.GetMessageTopology <T>()
        {
            IMessageSendTopologyConfigurator <T> configurator = base.GetMessageTopology <T>();

            return(configurator as IRabbitMqMessageSendTopologyConfigurator <T>);
        }