private void PublishInstruments() { Console.WriteLine($"Begin publishing settles {_instrumentType} instruments"); var instruments = GetInstruments(); instruments.ToObservable().Subscribe(instr => { var mosInstrument = InstrumentTransformer.ToMosaicInstrument(instr); var payload = JsonConvert.SerializeObject(mosInstrument, Formatting.None, new JsonSerializerSettings() { ReferenceLoopHandling = ReferenceLoopHandling.Ignore }); _awsKafkaClient.Publish("dev-tt-settles-instruments", mosInstrument.InstrumentKey, payload); _njKafkaClient.Publish("dev-tt-instruments", mosInstrument.InstrumentKey, payload); }); Console.WriteLine($"End publishing settles {instruments.Count} {_instrumentType} instruments"); }
private void PublishInstruments() { Console.WriteLine($"Begin publishing live futures instruments"); var instruments = GetInstruments(); instruments.ToObservable <Instrument>() .Select <Instrument, MosaicInstrument>(InstrumentTransformer.ToMosaicInstrument) .Subscribe( mosInstr => { Console.WriteLine($"Publishing instrument {mosInstr.InstrumentKey}"); _njKafkaClient.Publish("dev-tt-instruments", mosInstr.InstrumentKey, JsonConvert.SerializeObject(mosInstr)); }); Console.WriteLine("End publishing live futures instruments"); }