static void Main(string[] args) { var bookingServiceContext = new BookingServiceContext(); bookingServiceContext.GetService <IMigrator>().Migrate(); var consumerConfig = new Dictionary <string, object> { { "group.id", "booking" }, { "bootstrap.servers", kafkaEndpoint }, { "auto.offset.reset", "latest" } }; using (var consumer = new Consumer <Null, string>(consumerConfig, null, new StringDeserializer(Encoding.UTF8))) { // Subscribe to the OnMessage event consumer.OnMessage += (obj, msg) => { if (msg.Value == "Success") { using (var context = new BookingServiceContext()) { context.Events.Add(new Event() { Capacity = 4, Price = 111, Title = msg.ToString() }); context.SaveChanges(); } } }; // Subscribe to the Kafka topic consumer.Subscribe(new List <string>() { kafkaTopic }); // Poll for messages while (true) { consumer.Poll(5); } } }
public BookingServiceAddFeatureSteps(BookingServiceContext bookingServiceContext) { _bookingServiceContext = bookingServiceContext; }
public BookingServiceRemoveFeatureSteps(BookingServiceContext bookingServiceContext) { _bookingServiceContext = bookingServiceContext; }
public RoomService(BookingServiceContext context, IMapper mapper) { _context = context; _mapper = mapper; }
public BookingService(BookingServiceContext context, IMapper mapper, IScopedCache cache) { _context = context; _mapper = mapper; _cache = cache; }