Exemple #1
0
        public KafkaBackgroundReceiver(Microsoft.AspNetCore.SignalR.IHubContext <ImageMarshallingHub> imageHub)
        {
            // build the kafka consumer

            _imageHub = imageHub;

            var conf = new ConsumerConfig
            {
                GroupId          = "test-consumer-group",
                BootstrapServers = "kafka-server1:9092",
                // Note: The AutoOffsetReset property detemines the start offset in the event
                // there are not yet any committed offsets for the consumer group for the
                // topic/partitions of interest. By default, offsets are committed
                // automatically, so in this example, consumption will only start from the
                // earliest message in the topic 'my-topic' the first time you run the program.
                AutoOffsetReset = AutoOffsetReset.Earliest
            };

            var schemaRegistryConfig = new SchemaRegistryConfig
            {
                Url = "kafka-schema-registry:8081"
            };

            var schemaRegistry = new CachedSchemaRegistryClient(schemaRegistryConfig);

            //_consumer = new ConsumerBuilder<Ignore, string>(conf).Build();
            _consumer = new ConsumerBuilder <Ignore, imageResponse>(conf).SetValueDeserializer(new AvroDeserializer <imageResponse>(schemaRegistry).AsSyncOverAsync <imageResponse>()).Build();
            _consumer.Subscribe("imageResponse");
        }
 public StreamController(Microsoft.Extensions.Options.IOptions <Jwt> jwtSettings, IWebHostEnvironment env, ILogger <StreamController> logger, Microsoft.AspNetCore.SignalR.IHubContext <Core.ClientHub> hub)
 {
     _hub         = hub;
     _jwtSettings = jwtSettings;
     _env         = env;
     _logger      = logger;
 }
        public void StartListening(IWebHostEnvironment env, Microsoft.AspNetCore.SignalR.IHubContext <Core.ClientHub> hub, bool mode)
        {
            _env  = env;
            _hub  = hub;
            _mode = mode;
            // Bind the socket to the local endpoint and listen for incoming connections.
            try
            {
                // To force the socket to Close......................
                //if (socket != null && (socket.IsBound || !_mode))
                //{
                //    if (socket.Connected)
                //        socket.Shutdown(SocketShutdown.Both);

                //    // Reset safe thread
                //    allDone.Reset();
                //    socket.Close();
                //    socket.Dispose();
                //    _mode = false;
                //    socket = null;
                //    return;
                //}


                // Establish the local endpoint for the socket.
                // The DNS name of the computer
                // running the listener is "host.contoso.com".
                IPHostEntry ipHostInfo    = Dns.GetHostEntry(Dns.GetHostName());
                IPAddress   ipAddress     = IPAddress.Parse("127.0.0.1");//ipHostInfo.AddressList[3];
                IPEndPoint  localEndPoint = new IPEndPoint(ipAddress, 11111);
                // Create a TCP/IP socket.
                socket = new Socket(ipAddress.AddressFamily,
                                    SocketType.Stream, ProtocolType.Tcp);

                socket.Bind(localEndPoint);
                socket.Listen(10);

                while (socket != null && socket.IsBound && _mode)
                {
                    // Set the event to nonsignaled state.
                    allDone.Reset();

                    // Start an asynchronous socket to listen for connections.
                    Debug.WriteLine("Waiting for a connection...");
                    socket.BeginAccept(
                        new AsyncCallback(AcceptCallback),
                        socket);

                    // Wait until a connection is made before continuing.
                    allDone.WaitOne();
                }
            }
            catch (Exception e)
            {
                Debug.WriteLine(e.ToString());
            }
            //Debug.WriteLine("\nPress ENTER to continue...");
            //Debug.Read();
        }
Exemple #4
0
 public CiliController(IWebHostEnvironment env, ILogger <CiliController> logger, Microsoft.AspNetCore.SignalR.IHubContext <Core.ClientHub> hub)
 {
     //_jwtSettings = jwtSettings;
     _env    = env;
     _logger = logger;
     _hub    = hub;
     _utils  = new Utils();
 }
Exemple #5
0
 public ApiPortalController(
     UserManager <ApplicationUser> userManager,
     SignInManager <ApplicationUser> signInManager,
     RoleManager <IdentityRole> roleManager,
     Microsoft.AspNetCore.SignalR.IHubContext <Hub.PortalHub> hubContext
     )
     : base(hubContext)
 {
     _userManager   = userManager;
     _signInManager = signInManager;
     _roleManager   = roleManager;
 }
 public ApiPortalController(
     UserManager <ApplicationUser> userManager,
     SignInManager <ApplicationUser> signInManager,
     RoleManager <IdentityRole> roleManager,
     MixCmsContext context,
     Microsoft.AspNetCore.SignalR.IHubContext <Mix.Cms.Service.SignalR.Hubs.PortalHub> hubContext,
     IMemoryCache memoryCache
     )
     : base(context, memoryCache, hubContext)
 {
     _userManager   = userManager;
     _signInManager = signInManager;
     _roleManager   = roleManager;
 }
 public ApiInitCmsController(
     UserManager <ApplicationUser> userManager,
     SignInManager <ApplicationUser> signInManager,
     RoleManager <IdentityRole> roleManager,
     Microsoft.AspNetCore.SignalR.IHubContext <Mix.Cms.Service.SignalR.Hubs.PortalHub> hubContext,
     IMemoryCache memoryCache
     )
     : base(null, memoryCache, hubContext)
 {
     _userManager   = userManager;
     _signInManager = signInManager;
     _roleManager   = roleManager;
     _idHelper      = new IdentityHelper(userManager, signInManager, roleManager);
 }
 public ApiPortalController(
     UserManager <ApplicationUser> userManager,
     SignInManager <ApplicationUser> signInManager,
     RoleManager <IdentityRole> roleManager,
     Microsoft.AspNetCore.SignalR.IHubContext <Hub.PortalHub> hubContext,
     IApplicationLifetime appLifetime,
     IHostingEnvironment env
     )
     : base(hubContext)
 {
     _userManager   = userManager;
     _signInManager = signInManager;
     _roleManager   = roleManager;
     _appLifetime   = appLifetime;
 }
 public ApiInitCmsController(
     UserManager <ApplicationUser> userManager,
     SignInManager <ApplicationUser> signInManager,
     RoleManager <IdentityRole> roleManager,
     Microsoft.AspNetCore.SignalR.IHubContext <Hub.PortalHub> hubContext,
     IApplicationLifetime appLifetime,
     IHostingEnvironment env,
     IMemoryCache memoryCache
     )
     : base(null, memoryCache, hubContext)
 {
     _userManager   = userManager;
     _signInManager = signInManager;
     _roleManager   = roleManager;
     _appLifetime   = appLifetime;
     _env           = env;
     _idHelper      = new IdentityHelper(userManager, signInManager, roleManager);
 }
 public ApiODataTemplatePortalController(
     IMemoryCache memoryCache
     , Microsoft.AspNetCore.SignalR.IHubContext <Mix.Cms.Service.SignalR.Hubs.PortalHub> hubContext) : base(memoryCache, hubContext)
 {
 }
Exemple #11
0
 public FSWSessionCleanerService(Microsoft.AspNetCore.SignalR.IHubContext <CommunicationHub> hub, ILogger <FSWSessionCleanerService> logger)
 {
     CommunicationHub.Hub = hub;
     _logger = logger;
 }
 public ApiODataAttributeSetDataMobileController(
     IMemoryCache memoryCache
     , Microsoft.AspNetCore.SignalR.IHubContext <Mix.Cms.Service.SignalR.Hubs.PortalHub> hubContext) : base(memoryCache, hubContext)
 {
 }
Exemple #13
0
 public ApiAttributeSetDataNavigationController(MixCmsContext context, IMemoryCache memoryCache, Microsoft.AspNetCore.SignalR.IHubContext <Mix.Cms.Service.SignalR.Hubs.PortalHub> hubContext) : base(context, memoryCache, hubContext)
 {
 }
 public ApiModuleController(MixCmsContext context, IMemoryCache memoryCache, Microsoft.AspNetCore.SignalR.IHubContext <PortalHub> hubContext, MixIdentityHelper idHelper) : base(context, memoryCache, hubContext)
 {
     _idHelper = idHelper;
 }
 public ApiRelatedAttributeSetDataPortalController(MixCmsContext context, IMemoryCache memoryCache, Microsoft.AspNetCore.SignalR.IHubContext <Hub.PortalHub> hubContext) : base(context, memoryCache, hubContext)
 {
 }
 public static void setContext(Microsoft.AspNetCore.SignalR.IHubContext <MessageHub> hubContext)
 {
     context = hubContext;
     //context = Startup.ConnectionManager.GetHubContext<MessageHub>();
 }
Exemple #17
0
 public ApiTemplateController(MixCmsContext context, IMemoryCache memoryCache, Microsoft.AspNetCore.SignalR.IHubContext <Mix.Cms.Service.SignalR.Hubs.PortalHub> hubContext) : base(context, memoryCache, hubContext)
 {
 }
 public ApiODataAttributeSetReadController(
     IMemoryCache memoryCache
     , Microsoft.AspNetCore.SignalR.IHubContext <Hub.PortalHub> hubContext) : base(memoryCache, hubContext)
 {
 }
 public ApiODataRelatedAttributeSetDataMobileFullController(
     IMemoryCache memoryCache
     , Microsoft.AspNetCore.SignalR.IHubContext <Hub.PortalHub> hubContext) : base(memoryCache, hubContext)
 {
 }
 public DefaultHubDispatcher(Microsoft.Extensions.DependencyInjection.IServiceScopeFactory serviceScopeFactory, Microsoft.AspNetCore.SignalR.IHubContext <THub> hubContext, Microsoft.Extensions.Options.IOptions <Microsoft.AspNetCore.SignalR.HubOptions <THub> > hubOptions, Microsoft.Extensions.Options.IOptions <Microsoft.AspNetCore.SignalR.HubOptions> globalHubOptions, Microsoft.Extensions.Logging.ILogger <Microsoft.AspNetCore.SignalR.Internal.DefaultHubDispatcher <THub> > logger)
 {
 }
Exemple #21
0
 public LanguageController(LanguageIdentifier li, Microsoft.AspNetCore.Hosting.IHostingEnvironment env, Microsoft.AspNetCore.SignalR.IHubContext<Hubs.ProgressHub> hub)
 {
     _li = li;
     _env = env;
     _hub = hub;
 }
 public ApiMixDatabaseColumnController(MixCmsContext context, IMemoryCache memoryCache, Microsoft.AspNetCore.SignalR.IHubContext <PortalHub> hubContext) : base(context, memoryCache, hubContext)
 {
 }
Exemple #23
0
 public ApiModuleController(IMemoryCache memoryCache, Microsoft.AspNetCore.SignalR.IHubContext <Hub.PortalHub> hubContext) : base(memoryCache, hubContext)
 {
 }
Exemple #24
0
 public ApiODataPositionPortalController(
     IMemoryCache memoryCache, Microsoft.AspNetCore.SignalR.IHubContext <Hub.PortalHub> hubContext) : base(memoryCache, hubContext)
 {
 }
Exemple #25
0
 public ApiPostController(MixCmsContext context, IMemoryCache memoryCache, Microsoft.AspNetCore.SignalR.IHubContext <Hub.PortalHub> hubContext) : base(context, memoryCache, hubContext)
 {
 }
 public HomeController(Microsoft.AspNetCore.Hosting.IHostingEnvironment env, Microsoft.AspNetCore.SignalR.IHubContext <Hubs.ProgressHub> hub)
 {
     _env = env;
     _hub = hub;
 }