Example #1
0
 /// <summary>
 /// Find edge gateway.
 /// </summary>
 /// <param name="service"></param>
 /// <param name="gatewayId"></param>
 /// <param name="onlyServerState"></param>
 /// <param name="ct"></param>
 /// <returns></returns>
 public static async Task <GatewayInfoModel> FindGatewayAsync(
     this IGatewayRegistry service, string gatewayId,
     bool onlyServerState = false, CancellationToken ct = default)
 {
     try {
         return(await service.GetGatewayAsync(gatewayId, onlyServerState, ct));
     }
     catch (ResourceNotFoundException) {
         return(null);
     }
 }
Example #2
0
        /// <summary>
        /// Returns all edge gateway ids from the registry
        /// </summary>
        /// <param name="service"></param>
        /// <param name="ct"></param>
        /// <returns></returns>
        public static async Task <List <string> > ListAllGatewayIdsAsync(
            this IGatewayRegistry service, CancellationToken ct = default)
        {
            var publishers = new List <string>();
            var result     = await service.ListGatewaysAsync(null, null, ct);

            publishers.AddRange(result.Items.Select(s => s.Id));
            while (result.ContinuationToken != null)
            {
                result = await service.ListGatewaysAsync(result.ContinuationToken,
                                                         null, ct);

                publishers.AddRange(result.Items.Select(s => s.Id));
            }
            return(publishers);
        }
 /// <summary>
 /// Create registry services
 /// </summary>
 /// <param name="gateways"></param>
 /// <param name="applications"></param>
 public DiscoveryProcessor(IGatewayRegistry gateways, IApplicationBulkProcessor applications)
 {
     _gateways     = gateways ?? throw new ArgumentNullException(nameof(gateways));
     _applications = applications ?? throw new ArgumentNullException(nameof(applications));
 }
 /// <summary>
 /// Create controller for Gateway services
 /// </summary>
 /// <param name="Gateways"></param>
 /// <param name="events"></param>
 public GatewaysController(IGatewayRegistry Gateways,
                           IGroupRegistration events)
 {
     _Gateways = Gateways;
     _events   = events;
 }
 /// <summary>
 /// Create controller for Gateway services
 /// </summary>
 /// <param name="gateways"></param>
 public GatewaysController(IGatewayRegistry gateways)
 {
     _gateways = gateways;
 }