/// <summary> /// Constructor. Initializes the <see cref="_consumer"/> instance. /// </summary> /// <param name="consumerFactory"> /// A <see cref="IKafkaConsumerFactory{TKey,TValue}"/> using <see cref="SubmitKey"/> keys and <see cref="string"/> values</param> /// <param name="diffGenerator">A <see cref="IDiffGenerator"/>. Used to generate diffs from left and right values.</param> /// <param name="diffRepository">A <see cref="IDiffRepository"/>. Used to persist <see cref="DiffRecord"/>s.</param> /// <param name="keyDeserializer">A <see cref="IDeserializer{T}"/>, used to deserialize <see cref="SubmitKey"/>s.</param> /// <param name="valueDeserializer">A <see cref="IDeserializer{T}"/>, used to deserialize <see cref="string"/> values.</param> /// <param name="logger">A <see cref="ILogger{T}"/> for this class.</param> /// <param name="bootstrapServer">Kafka server. Overrides default 'localhost:9092' value.</param> public TopicListener( IKafkaConsumerFactory <SubmitKey, string> consumerFactory, IDiffGenerator diffGenerator, IDiffRepository diffRepository, IDeserializer <SubmitKey> keyDeserializer, IDeserializer <string> valueDeserializer, ILogger <TopicListener> logger, string bootstrapServer) { _diffGenerator = diffGenerator; _diffRepository = diffRepository; _logger = logger; // TODO: not sure it must be a ConcurrentDictionary here, but keeping it just in case var config = new ConcurrentDictionary <string, object>(Config); if (!string.IsNullOrWhiteSpace(bootstrapServer)) { config["bootstrap.servers"] = bootstrapServer; } _logger.Info($"config[bootstrap.servers] = {config["bootstrap.servers"]}."); _consumer = consumerFactory.Create(config, keyDeserializer, valueDeserializer); _consumer.Assign(new List <TopicPartitionOffset> { new TopicPartitionOffset(Topic, 0, 0) }); }
public UpdateRecordImpl( int nodeId, IDiffRepository <TUserId, TKey, TDb, TNew> diffRepository) { this.nodeId = nodeId; this.diffRepository = diffRepository; }
public DiffDsl( IDiffRepository <TUserId, TKey, TDb, TNew> diffRepository, bool immutable) { this.diffRepository = diffRepository; this.immutable = immutable; }
public DiffMvcController(IDiffRepository diffRepository) { if (diffRepository == null) { throw new ArgumentNullException(nameof(diffRepository)); } _diffRepository = diffRepository; }
public DiffService(IDiffRepository diffRepository) { if (diffRepository == null) { throw new ArgumentNullException(nameof(diffRepository)); } _diffRepository = diffRepository; }
public RootNode( int nodeId, bool immutable, IDiffRepository <TUserId, TKey, TDb, TNew> diffRepository, List <IUpdateValue <TNew, TDb, TKey> > updateValues) : base(nodeId) { this.diffRepository = diffRepository; this.immutable = immutable; this.updateValues = updateValues; }
/// <summary> /// Dependency Injection Container used for decoupling (testability etc.) /// </summary> /// <param name="diffRepository">Constructor injected repository.</param> public DiffController(IDiffRepository diffRepository) { if (diffRepository == null) { throw new ArgumentNullException(nameof(diffRepository)); } _diffRepository = diffRepository; _diffService = new DiffService(_diffRepository); _modelFactory = new ModelFactory(); }
public DiffController( ILogger <DiffController> logger, IDiffRepository diffRepository, IInputRepository inputRepository, IMapper mapper, IRabbitMQEventBus eventBus ) { _logger = logger; _diffRepository = diffRepository; _inputRepository = inputRepository; _mapper = mapper; _eventBus = eventBus; }
public UpdateManyToOne( int nodeId, bool immutable, Func <TNew, TNewProp> newProp, Expression <Func <TDbValue, TDbProp> > dbValue, IEnumerable <IUpdateValue <TNewProp, TDbProp, TChildKey> > childValues, IDiffRepository <TUserId, TChildKey, TDbProp, TNewProp> diffRepository) : base(nodeId) { this.immutable = immutable; this.newProp = newProp; this.dbValue = dbValue.Compile(); this.setDbValue = ExpressionUtils.CreateSetter(dbValue); this.childValues = childValues; this.diffRepository = diffRepository; }
/// <summary> /// Controller. Fetches injected instances and starts kafka worker thread. /// </summary> /// <param name="topicListener">A <see cref="ITopicListener"/>, which will process messages from the listened topic.</param> /// <param name="diffRepository">A <see cref="IDiffRepository"/>, used to store the generated <see cref="DiffRecord"/>.</param> public DiffController( ITopicListener topicListener, IDiffRepository diffRepository) : base("v1/diff") { _topicListener = topicListener; _diffRepository = diffRepository; Get("{id}", args => { Guid id = args.id; return(Response.AsJson(GetDiff(id).Body, GetDiff(id).StatusCode)); }); StartWorker(); }
public UpdateManyToMany( int nodeId, bool immutable, Func <TNewProp, TChildKey> newPropKey, Func <TNew, IEnumerable <TNewProp> > newProp, Func <TDbValue, List <TDbProp> > dbValue, IEnumerable <IUpdateValue <TNewProp, TDbProp, TChildKey> > childValues, Action <TDbProp, TDbValue> setParent, IDiffRepository <TUserId, TChildKey, TDbProp, TNewProp> diffRepository) : base(nodeId) { this.immutable = immutable; this.newProp = newProp; this.dbValue = dbValue; this.childValues = childValues; this.diffRepository = diffRepository; this.newPropKey = newPropKey; this.setParent = setParent; }
public DiffService(IDiffRepository diffRepository) { _diffReository = diffRepository; }
public DiffService(IDiffRepository diffRepository) { this.diffRepository = diffRepository; }
public DiffCommandHandler(IDiffRepository repository) { _repository = repository; }
public PushLeftJsonCommandHandler(IDiffRepository diffRepository) { _diffRepository = diffRepository; }
public DiffDomainService(IDiffRepository diffRepository) { _diffRepository = diffRepository; }
public DiffAppService(IMapper mapper, IDiffRepository diffRepository, IDiffDomainService diffDomainService) { _mapper = mapper; _diffRepository = diffRepository; _diffDomainService = diffDomainService; }