public MessageConsumer(ILogger <MessageConsumer> logger, JsonSerializerSettings serializerSettings, MessageHubOptions options, IOptions <MessageConsumerOptions> consumerOptions) { _logger = logger; var conf = new ConsumerConfig { GroupId = consumerOptions.Value.GroupId, //"test-consumer-group", BootstrapServers = options.ServerURI, // Note: The AutoOffsetReset property determines 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 testExecuted = new ConsumerBuilder <Ignore, TestExecutedMessage>(conf) .Build(serializerSettings); var testAdded = new ConsumerBuilder <Ignore, TestAddedMessage>(conf) .Build(serializerSettings); var testAcquired = new ConsumerBuilder <Ignore, TestAcquiringResultMessage>(conf) .Build(serializerSettings); var testCompleted = new ConsumerBuilder <Ignore, TestCompletedMessage>(conf) .Build(serializerSettings); var testCompletedOnSource = new ConsumerBuilder <Ignore, TestCompletedOnSourceMessage>(conf) .Build(serializerSettings); var testDeleted = new ConsumerBuilder <Ignore, TestDeletedMessage>(conf) .Build(serializerSettings); var beginTest = new ConsumerBuilder <Ignore, BeginTestMessage>(conf) .Build(serializerSettings); var testRecorded = new ConsumerBuilder <Ignore, TestRecordedMessage>(conf) .Build(serializerSettings); consumeDaemon(testExecuted, options.TestExecutedTopic, m => TestExecutedAsync.InvokeAndWaitAsync(m)); consumeDaemon(testAdded, options.TestAddedTopic, m => TestAddedAsync.InvokeAndWaitAsync(m)); consumeDaemon(testAcquired, options.TestAcquiredTopic, m => TestAcquiredAsync.InvokeAndWaitAsync(m)); consumeDaemon(testCompleted, options.TestCompletedTopic, m => TestCompletedAsync.InvokeAndWaitAsync(m)); consumeDaemon(testCompletedOnSource, options.TestCompletedOnSourceTopic, m => TestCompletedOnSourceAsync.InvokeAndWaitAsync(m)); consumeDaemon(testDeleted, options.TestDeletedTopic, m => TestDeletedAsync.InvokeAndWaitAsync(m)); consumeDaemon(beginTest, options.BeginTestTopic, m => BeginTestAsync.InvokeAndWaitAsync(m)); consumeDaemon(testRecorded, options.TestRecordedTopic, m => TestRecordedAsync.InvokeAndWaitAsync(m)); startConsumeDaemon <CancelTestMessage>(conf, serializerSettings, options.CancelTestTopic, m => CancelTestAsync.InvokeAndWaitAsync(m)); startConsumeDaemon <TestCancelledMessage>(conf, serializerSettings, options.TestCancelledTopic, m => TestCancelledAsync.InvokeAndWaitAsync(m)); startConsumeDaemon <UpdateTestResultStateMessage>(conf, serializerSettings, null, m => UpdateTestResultAsync.InvokeAndWaitAsync(m)); startConsumeDaemon <TestResultStateAcquiredMessage>(conf, serializerSettings, null, m => TestResultStateAcquiredAsync.InvokeAndWaitAsync(m)); startConsumeDaemon <TestResultStateUpdatedMessage>(conf, serializerSettings, null, m => TestResultStateUpdatedAsync.InvokeAndWaitAsync(m)); }
public WebMessageHub(IDependencyResolver di) { di.ResolveProperties(this); _subscriptions = new DisposingActions() { ConnectionProvider.Connection.On <TestAddedWebMessage>("TestAdded", async(message) => { await TestAddedAsync.InvokeAndWaitAsync(message); }), ConnectionProvider.Connection.On <TestCompletedWebMessage>("TestCompleted", async(message) => { await TestCompletedAsync.InvokeAndWaitAsync(message); }), ConnectionProvider.Connection.On <TestDeletedWebMessage>("TestDeleted", async(message) => { await TestDeletedAsync.InvokeAndWaitAsync(message); }), ConnectionProvider.Connection.On <TestBegunWebMessage>("TestBegun", async(message) => { await TestBegunAsync.InvokeAndWaitAsync(message); }), ConnectionProvider.Connection.On <TestRecordedWebMessage>("TestRecorded", async(message) => { await TestRecordedAsync.InvokeAndWaitAsync(message); }), ConnectionProvider.Connection.On <TestCancelledWebMessage>("TestCancelled", async(message) => { await TestCancelledAsync.InvokeAndWaitAsync(message); }), ConnectionProvider.Connection.On <EntryChangedWebMessageBase>("EntryChanged", async(message) => { await EntryChangedAsync.InvokeAndWaitAsync(message); }) }; }