Exemplo n.º 1
0
 /// <summary>
 ///     Route requests using a custom rule.
 /// </summary>
 /// <param name="rule">The rule.</param>
 /// <param name="destination">The destination to invoke if the rule accepts the CQS object.</param>
 /// <exception cref="System.ArgumentNullException">
 ///     rule
 ///     or
 ///     destination
 /// </exception>
 public void RouteRequests(IRoutingRule rule, IRequestReplyBus destination)
 {
     if (rule == null)
     {
         throw new ArgumentNullException("rule");
     }
     if (destination == null)
     {
         throw new ArgumentNullException("destination");
     }
     _requestRoutes.Add(new RoutedRequestReplyBus(rule, destination));
 }
Exemplo n.º 2
0
 /// <summary>
 ///     Route queries using a custom rule.
 /// </summary>
 /// <param name="rule">The rule.</param>
 /// <param name="destination">The destination to invoke if the rule accepts the CQS object.</param>
 /// <exception cref="System.ArgumentNullException">
 ///     rule
 ///     or
 ///     destination
 /// </exception>
 public void RouteQueries(IRoutingRule rule, IQueryBus destination)
 {
     if (rule == null)
     {
         throw new ArgumentNullException("rule");
     }
     if (destination == null)
     {
         throw new ArgumentNullException("destination");
     }
     _queryRoutes.Add(new RoutedQueryBus(rule, destination));
 }
Exemplo n.º 3
0
 /// <summary>
 ///     Route events using a custom rule.
 /// </summary>
 /// <param name="rule">The rule.</param>
 /// <param name="destination">The destination to invoke if the rule accepts the CQS object.</param>
 /// <exception cref="System.ArgumentNullException">
 ///     rule
 ///     or
 ///     destination
 /// </exception>
 public void RouteEvents(IRoutingRule rule, IEventBus destination)
 {
     if (rule == null)
     {
         throw new ArgumentNullException("rule");
     }
     if (destination == null)
     {
         throw new ArgumentNullException("destination");
     }
     _eventRoutes.Add(new RoutedEventBus(rule, destination));
 }
Exemplo n.º 4
0
 /// <summary>
 ///     Route commands using a custom rule.
 /// </summary>
 /// <param name="rule">The rule.</param>
 /// <param name="destination">The destination to invoke if the rule accepts the CQS object.</param>
 /// <exception cref="System.ArgumentNullException">
 ///     rule
 ///     or
 ///     destination
 /// </exception>
 public void RouteCommands(IRoutingRule rule, ICommandBus destination)
 {
     if (rule == null)
     {
         throw new ArgumentNullException("rule");
     }
     if (destination == null)
     {
         throw new ArgumentNullException("destination");
     }
     _commandRoutes.Add(new RoutedCommandBus(rule, destination));
 }
Exemplo n.º 5
0
        private bool MatchMessage(Message msg, IRoutingRule rule)
        {
            bool res = false;

            if (msg == null || rule == null)
            {
                return(res);
            }

            switch (rule.Type)
            {
            default:
            case RoutingRuleType.MessageType:
            {
                if (msg.Header == null || msg.Header.Type == null)
                {
                    return(res);
                }
                XCollection <MessageType> mtlist = rule.MessageTypeList;
                if (mtlist == null)
                {
                    return(res);
                }
                foreach (MessageType mt in mtlist)
                {
                    if (msg.Header.Type.EqualsTo(mt))
                    {
                        res = true;
                        break;
                    }
                }
                break;
            }

            case RoutingRuleType.ContentBased:
            {
                return(MatchMessageContent(msg, rule.ContentCriteria));
            }
            }

            return(res);
        }
Exemplo n.º 6
0
        public static RoutingRuleValidator CreateRoutingRuleValidatorFromCache(IRoutingRule r)
        {
            if (r == null)
            {
                return(null);
            }

            RoutingRuleValidator v = null;

            lock (_routingRuleValidatorList.SyncRoot)
            {
                v = _routingRuleValidatorList[r] as RoutingRuleValidator;
                if (v == null)
                {
                    v = new RoutingRuleValidator(r);
                    _routingRuleValidatorList.Add(r, v);
                }
            }

            return(v);
        }
Exemplo n.º 7
0
 public RoutingRuleValidator(IRoutingRule rule)
 {
     _rule = rule;
 }
Exemplo n.º 8
0
 /// <summary>
 /// Initializes a new instance of the <see cref="RoutedCommandBus"/> class.
 /// </summary>
 /// <param name="routingRule">The routing rule.</param>
 /// <param name="inner">Bus to invoke command on if the rule accepts the command.</param>
 public RoutedQueryBus(IRoutingRule routingRule, IQueryBus inner)
 {
     _routingRule = routingRule;
     _inner       = inner;
 }
Exemplo n.º 9
0
 /// <summary>
 /// Initializes a new instance of the <see cref="RoutedCommandBus"/> class.
 /// </summary>
 /// <param name="routingRule">The routing rule.</param>
 /// <param name="inner">Bus to invoke command on if the rule accepts the command.</param>
 public RoutedCommandBus(IRoutingRule routingRule, ICommandBus inner)
 {
     _routingRule = routingRule;
     _inner       = inner;
 }
Exemplo n.º 10
0
		/// <summary>
		/// Pendent
		/// </summary>
		public void AddFirst(IRoutingRule rule, RouteAction action)
		{
			AddFirst(new DecoratedRule(rule, action));
		}
Exemplo n.º 11
0
			public DecoratedRule(IRoutingRule inner, RouteAction selectionAction) : this(inner)
			{
				this.selectionAction = selectionAction;
			}
Exemplo n.º 12
0
 public DecoratedRule(IRoutingRule inner, RouteAction selectionAction)
     : this(inner)
 {
     this.selectionAction = selectionAction;
 }
Exemplo n.º 13
0
 public DecoratedRule(IRoutingRule inner)
 {
     this.inner = inner;
 }
Exemplo n.º 14
0
 /// <summary>
 /// Initializes a new instance of the <see cref="RoutedCommandBus"/> class.
 /// </summary>
 /// <param name="routingRule">The routing rule.</param>
 /// <param name="inner">Bus to invoke command on if the rule accepts the command.</param>
 public RoutedEventBus(IRoutingRule routingRule, IEventBus inner)
 {
     _routingRule = routingRule;
     _inner       = inner;
 }
Exemplo n.º 15
0
 internal MessageTrackExpression(MessagingConfiguration bus, IRoutingRule routing)
 {
     _bus     = bus;
     _routing = routing;
 }
Exemplo n.º 16
0
 /// <summary>
 /// Adds the specified rule.
 /// </summary>
 /// <param name="rule">The rule.</param>
 public void AddFirst(IRoutingRule rule)
 {
     AddFirst(new DecoratedRule(rule));
 }
Exemplo n.º 17
0
			public DecoratedRule(IRoutingRule inner)
			{
				this.inner = inner;
			}
Exemplo n.º 18
0
 /// <summary>
 /// Pendent
 /// </summary>
 public void AddFirst(IRoutingRule rule, RouteAction action)
 {
     AddFirst(new DecoratedRule(rule, action));
 }
Exemplo n.º 19
0
		/// <summary>
		/// Adds the specified rule.
		/// </summary>
		/// <param name="rule">The rule.</param>
		public void AddFirst(IRoutingRule rule)
		{
			AddFirst(new DecoratedRule(rule));
		}
Exemplo n.º 20
0
 internal MessageTrackExpression(ServiceBusFeature bus, IRoutingRule routing)
 {
     _bus     = bus;
     _routing = routing;
 }
Exemplo n.º 21
0
 public SendExpression(JasperBusRegistry parent, IRoutingRule routing)
 {
     _parent  = parent;
     _routing = routing;
 }
Exemplo n.º 22
0
 /// <summary>
 /// Initializes a new instance of the <see cref="RoutedCommandBus"/> class.
 /// </summary>
 /// <param name="routingRule">The routing rule.</param>
 /// <param name="inner">Bus to invoke request on if the rule accepts the request.</param>
 public RoutedRequestReplyBus(IRoutingRule routingRule, IRequestReplyBus inner)
 {
     _routingRule = routingRule;
     _inner       = inner;
 }