Ejemplo n.º 1
0
 private static void Timer_Elapsed(object sender, ElapsedEventArgs e)
 {
     using (var cmd = new CheckCardAction())
     {
         cmd.Execute(ObjectContext.CreateContext(null, null));
     }
 }
Ejemplo n.º 2
0
        private void InitRabbitMQ()
        {
            Context = ObjectContext.CreateContext(null, null);
            var factory = new ConnectionFactory()
            {
                HostName = this.Context.GlobalConfig.RabbitHost,
                UserName = this.Context.GlobalConfig.RabbitUsername,
                Password = this.Context.GlobalConfig.RabbitPassword,
                Port     = this.Context.GlobalConfig.RabbitPort
            };

            // create connection
            Connection = factory.CreateConnection();

            // create channel
            Channel = Connection.CreateModel();

            Channel.ExchangeDeclare(Exchange, ExchangeType.Direct);
            Channel.QueueDeclare(Queue, false, false, false, null);
            Channel.QueueBind(Queue, Exchange, RoutingKey, null);
            Channel.BasicQos(0, 1, false);
        }