public RabbitEventBus AddGrainConsumer <PrimaryKey>(string observerGroup) { var consumer = new RabbitConsumer(observerUnitContainer.GetUnit <PrimaryKey>(ProducerType).GetEventHandlers(observerGroup)) { EventBus = this, QueueList = RouteList.Select(route => new QueueInfo { RoutingKey = route, Queue = $"{route}_{observerGroup}" }).ToList(), Config = ConsumerConfig }; Consumers.Add(consumer); return(this); }
public RabbitEventBus AddConsumer(Func <byte[], Task> handler, string observerGroup) { var consumer = new RabbitConsumer(new List <Func <byte[], Task> > { handler }) { EventBus = this, QueueList = RouteList.Select(route => new QueueInfo { RoutingKey = route, Queue = $"{route}_{observerGroup}" }).ToList(), Config = ConsumerConfig }; Consumers.Add(consumer); return(this); }
public Route Copy() { var newRouteList = new List <AbsNode>(RouteList.Count); newRouteList.AddRange(RouteList.Select(node => node.ShallowCopy())); var r = new Route(Problem) { RouteList = newRouteList, ServiceBeginingTimes = new List <double>(ServiceBeginingTimes) }; for (int i = 1; i < RouteList.Count - 1; ++i) { ((Customer)r.RouteList[i]).Route = r; } r.UpdateId(); return(r); }