public DaprEventCenter( IClaptrapDesignStore designStore, IMinionLocator minionLocator, ILogger <DaprEventCenter> logger) { _minionLocator = minionLocator; _logger = logger; _minionDesignsLookup = designStore .Where(x => x.IsMinion()) .ToLookup(x => x.ClaptrapMasterDesign !.ClaptrapTypeCode); }
public OrleansMinionActivator( ILogger <OrleansMinionActivator> logger, IGrainFactory grainFactory, IClaptrapDesignStore claptrapDesignStore) { _logger = logger; _grainFactory = grainFactory; _minionLookUp = claptrapDesignStore.Where(x => x.ClaptrapMasterDesign != null) .ToLookup(x => x.ClaptrapMasterDesign.ClaptrapTypeCode) .ToDictionary(x => x.Key, x => x.ToArray()); }
public DaprMinionActivator( ILogger <DaprMinionActivator> logger, IActorProxyFactory actorProxyFactory, IClaptrapDesignStore claptrapDesignStore) { _logger = logger; _actorProxyFactory = actorProxyFactory; _minionLookUp = claptrapDesignStore.Where(x => x.ClaptrapMasterDesign != null) .ToLookup(x => x.ClaptrapMasterDesign !.ClaptrapTypeCode) .ToDictionary(x => x.Key, x => x.ToArray()); }
public ClaptrapHandler(IActorProxyFactory actorProxyFactory, IClaptrapDesignStore claptrapDesignStore, IEventSerializer <EventJsonModel> eventSerializer, IEventStringSerializer eventStringSerializer) { _actorProxyFactory = actorProxyFactory; _eventSerializer = eventSerializer; _eventStringSerializer = eventStringSerializer; _minionTypeCodes = claptrapDesignStore.Where(x => x.IsMinion()) .GroupBy(x => x.ClaptrapMasterDesign !.ClaptrapTypeCode) .ToDictionary(x => x.Key, x => x.Select(a => a.ClaptrapTypeCode)); }
public MinionLocator( IClaptrapDesignStore designStore, IGrainFactory grainFactory, GrainMinionProxy.Factory grainMinionProxyFactory, ILogger <OrleansEventCenter> logger) { _grainFactory = grainFactory; _grainMinionProxyFactory = grainMinionProxyFactory; _logger = logger; _minionDesignsDic = designStore .Where(x => x.IsMinion()) .ToDictionary(x => x.ClaptrapTypeCode); }
public Task StartAsync() { return(Task.Run(InitCore)); void InitCore() { _connection = _connectionManager.CreateConnection(); _senders = _claptrapDesignStore .Where(x => !x.IsMinion()) .ToDictionary(x => x.ClaptrapTypeCode, x => { var exchangeName = TopicHelper.GetExchangeName(x.ClaptrapTypeCode); var topics = x.EventHandlerDesigns .ToDictionary(a => a.Key, a => TopicHelper.GetRouteKey(x.ClaptrapTypeCode, a.Key)); using var model = _connection.CreateModel(); model.ExchangeDeclare(exchangeName, ExchangeType.Topic); var mqSender = _mqSenderFactory.Invoke(exchangeName, topics, _connection); return(mqSender); }); } }
public Task StartAsync() { return(Task.Run(StartCore)); void StartCore() { var connection = _connectionManager.CreateConnection(); _consumers = _claptrapDesignStore .Where(x => x.IsMinion()) .ToDictionary(x => x.ClaptrapTypeCode, x => { var masterDesign = x.ClaptrapMasterDesign; var model = connection.CreateModel(); var exchangeName = TopicHelper.GetExchangeName(masterDesign.ClaptrapTypeCode); var subscribeKey = TopicHelper.GetSubscribeKey(masterDesign.ClaptrapTypeCode); var queueName = TopicHelper.GetQueueName(x.ClaptrapTypeCode); model.ExchangeDeclare(exchangeName, ExchangeType.Topic); _logger.LogTrace("declare exchange : {exchangeName}", exchangeName); model.QueueDeclare(queueName, false, false, false, null); _logger.LogTrace("declare queue : {queueName}", queueName); model.QueueBind(queueName, exchangeName, subscribeKey, null); _logger.LogTrace("bind queue : {queueName} to {exchangeName}", queueName, exchangeName); var consumer = new AsyncEventingBasicConsumer(model); consumer.Received += (sender, @event) => AsyncEventingBasicConsumerOnReceived(sender, @event, x); model.BasicConsume(queueName, false, consumer); return(model); }); } }