예제 #1
0
        /// <summary>
        /// Subscribes the specified service bus.
        /// </summary>
        /// <typeparam name="TMessage">The type of the message.</typeparam>
        /// <param name="serviceBus">The service bus.</param>
        /// <param name="condition">The condition.</param>
        public static void Subscribe <TMessage>(this IPublishingServiceBus serviceBus, Predicate <TMessage> condition)
            where TMessage : class
        {
            var p = new Predicate <object>(m => (m is TMessage ? condition((TMessage)m) : true));

            serviceBus.Subscribe(typeof(TMessage), p);
        }
예제 #2
0
 /// <summary>
 /// Unsubscribes the specified service bus.
 /// </summary>
 /// <typeparam name="TMessage">The type of the message.</typeparam>
 /// <param name="serviceBus">The service bus.</param>
 public static void Unsubscribe <TMessage>(this IPublishingServiceBus serviceBus)
     where TMessage : class
 {
     serviceBus.Subscribe(typeof(TMessage));
 }
예제 #3
0
 /// <summary>
 /// Subscribes the specified service bus.
 /// </summary>
 /// <param name="serviceBus">The service bus.</param>
 /// <param name="messageType">Type of the message.</param>
 public static void Subscribe(this IPublishingServiceBus serviceBus, Type messageType)
 {
 }
예제 #4
0
 // publishing
 /// <summary>
 /// Publishes the specified service bus.
 /// </summary>
 /// <typeparam name="TMessage">The type of the message.</typeparam>
 /// <param name="serviceBus">The service bus.</param>
 /// <param name="messageBuilder">The message builder.</param>
 public static void Publish <TMessage>(this IPublishingServiceBus serviceBus, Action <TMessage> messageBuilder)
     where TMessage : class
 {
     serviceBus.Publish(serviceBus.CreateMessage <TMessage>(messageBuilder));
 }