Esempio n. 1
0
        RoutingProperties GetIotHubRoutingProperties(ResourceGroup resourceGroup)
        {
            var ehConnectionString      = this.CreateExternalEH(resourceGroup, location);
            var sbTopicConnectionString = this.CreateExternalQueueAndTopic(resourceGroup, location);
            var sbConnectionString      = sbTopicConnectionString.Item1;
            var topicConnectionString   = sbTopicConnectionString.Item2;

            // Create Hub

            var routingProperties = new RoutingProperties()
            {
                Endpoints = new RoutingEndpoints()
                {
                    EventHubs = new List <RoutingEventHubProperties>()
                    {
                        new RoutingEventHubProperties()
                        {
                            Name             = "eh1",
                            ConnectionString = ehConnectionString
                        }
                    },
                    ServiceBusQueues = new List <RoutingServiceBusQueueEndpointProperties>()
                    {
                        new RoutingServiceBusQueueEndpointProperties()
                        {
                            Name             = "sb1",
                            ConnectionString = sbConnectionString
                        }
                    },
                    ServiceBusTopics = new List <RoutingServiceBusTopicEndpointProperties>()
                    {
                        new RoutingServiceBusTopicEndpointProperties()
                        {
                            Name             = "tp1",
                            ConnectionString = topicConnectionString
                        }
                    }
                },
                Routes = new List <RouteProperties>()
                {
                    new RouteProperties()
                    {
                        Condition     = "true",
                        EndpointNames = new List <string>()
                        {
                            "events"
                        },
                        IsEnabled = true,
                        Name      = "route1",
                        Source    = "DeviceMessages"
                    },
                    new RouteProperties()
                    {
                        Condition     = "true",
                        EndpointNames = new List <string>()
                        {
                            "eh1"
                        },
                        IsEnabled = true,
                        Name      = "route2",
                        Source    = "DeviceMessages"
                    },
                    new RouteProperties()
                    {
                        Condition     = "true",
                        EndpointNames = new List <string>()
                        {
                            "sb1"
                        },
                        IsEnabled = true,
                        Name      = "route3",
                        Source    = "DeviceMessages"
                    },
                    new RouteProperties()
                    {
                        Condition     = "true",
                        EndpointNames = new List <string>()
                        {
                            "tp1"
                        },
                        IsEnabled = true,
                        Name      = "route4",
                        Source    = "DeviceMessages"
                    }
                }
            };

            return(routingProperties);
        }
Esempio n. 2
0
        private async Task <RoutingProperties> GetIotHubRoutingPropertiesAsync(ResourceGroup resourceGroup)
        {
            string ehConnectionString = await CreateExternalEhAsync(resourceGroup, _location);

            Tuple <string, string> sbTopicConnectionString = await CreateExternalQueueAndTopicAsync(resourceGroup, _location);

            string sbConnectionString    = sbTopicConnectionString.Item1;
            string topicConnectionString = sbTopicConnectionString.Item2;

            // Create hub
            var routingProperties = new RoutingProperties
            {
                Endpoints = new RoutingEndpoints
                {
                    EventHubs = new List <RoutingEventHubProperties>
                    {
                        new RoutingEventHubProperties
                        {
                            Name             = "eh1",
                            ConnectionString = ehConnectionString
                        }
                    },
                    ServiceBusQueues = new List <RoutingServiceBusQueueEndpointProperties>
                    {
                        new RoutingServiceBusQueueEndpointProperties
                        {
                            Name             = "sb1",
                            ConnectionString = sbConnectionString
                        }
                    },
                    ServiceBusTopics = new List <RoutingServiceBusTopicEndpointProperties>
                    {
                        new RoutingServiceBusTopicEndpointProperties
                        {
                            Name             = "tp1",
                            ConnectionString = topicConnectionString
                        }
                    }
                },
                Routes = new List <RouteProperties>
                {
                    new RouteProperties
                    {
                        Condition     = "true",
                        EndpointNames = new List <string> {
                            "events"
                        },
                        IsEnabled = true,
                        Name      = "route1",
                        Source    = "DeviceMessages"
                    },
                    new RouteProperties
                    {
                        Condition     = "true",
                        EndpointNames = new List <string> {
                            "eh1"
                        },
                        IsEnabled = true,
                        Name      = "route2",
                        Source    = "DeviceMessages"
                    },
                    new RouteProperties
                    {
                        Condition     = "true",
                        EndpointNames = new List <string> {
                            "sb1"
                        },
                        IsEnabled = true,
                        Name      = "route3",
                        Source    = "DeviceMessages"
                    },
                    new RouteProperties
                    {
                        Condition     = "true",
                        EndpointNames = new List <string> {
                            "tp1"
                        },
                        IsEnabled = true,
                        Name      = "route4",
                        Source    = "DeviceMessages"
                    },
                }
            };

            return(routingProperties);
        }