public static OutboundRouteDefinition Create(RouteSourceType type, string template)
        {
            var route = new OutboundRouteDefinition(type, template);

            route.Validate();
            return(route);
        }
 public bool TryMapRouteToTopicName(RouteSourceType routeType, IDictionary<string, string> context, out string topicName)
 {
     UriPathTemplate template;
     if (!this.routeTemplateMap.TryGetValue(routeType, out template))
     {
         topicName = null;
         return false;
     }
     topicName = template.Bind(context);
     return true;
 }
Exemplo n.º 3
0
        public bool TryMapRouteToTopicName(RouteSourceType routeType, IDictionary <string, string> context, out string topicName)
        {
            UriPathTemplate template;

            if (!this.routeTemplateMap.TryGetValue(routeType, out template))
            {
                topicName = null;
                return(false);
            }
            topicName = template.Bind(context);
            return(true);
        }
        /// <summary>
        /// Tries to route a device bound message and append route by message metadata
        /// </summary>
        /// <param name="routeType"></param>
        /// <param name="context"></param>
        /// <param name="path"></param>
        /// <returns></returns>
        public bool TryRouteOutgoingMessage(RouteSourceType routeType, IMessage context, out string path)
        {
            UriPathTemplate template;

            if (!this.routeTemplateMap.TryGetValue(routeType, out template))
            {
                path = null;
                return(false);
            }
            try
            {
                path = template.Bind(context.Properties);
            }
            catch (InvalidOperationException)
            {
                path = null;
                return(false);
            }
            return(true);
        }
 OutboundRouteDefinition(RouteSourceType type, string template)
 {
     this.Type     = type;
     this.Template = template;
 }
 /// <summary>
 /// Tries to route a device bound message and append route by message metadata
 /// </summary>
 /// <param name="routeType"></param>
 /// <param name="context"></param>
 /// <param name="path"></param>
 /// <returns></returns>
 public bool TryRouteOutgoingMessage(RouteSourceType routeType, IMessage context, out string path)
 {
     UriPathTemplate template;
     if (!this.routeTemplateMap.TryGetValue(routeType, out template))
     {
         path = null;
         return false;
     }
     try
     {
         path = template.Bind(context.Properties);
     }
     catch (InvalidOperationException)
     {
         path = null;
         return false;
     }
     return true;
 }
 OutboundRouteDefinition(RouteSourceType type, string template)
 {
     this.Type = type;
     this.Template = template;
 }
 public static OutboundRouteDefinition Create(RouteSourceType type, string template)
 {
     var route = new OutboundRouteDefinition(type, template);
     route.Validate();
     return route;
 }