Exemple #1
0
        static void Main(string[] args)
        {
            NetMsmqBinding binding = new NetMsmqBinding(NetMsmqSecurityMode.None);

            binding.ExactlyOnce = false;
            binding.Durable     = true;
            ChannelFactory <IMSMQService> channel =
                new ChannelFactory <IMSMQService>(
                    //这里面解释一下:localhost代表是本机服务器,Private字面上是私有,这里面表示是“消息队列”里面的“专用队列”,“LMXQueue”是我们专用队列的一个类似“消息组”的一个名称。
                    binding, new EndpointAddress("net.msmq://localhost/Private/LMXQueue"));
            IMSMQService client = channel.CreateChannel();

            for (int i = 0; i < 100000; i++)
            {
                client.PlaceOrder(
                    new OrderEntry()
                {
                    OrderID   = 1,
                    OrderDate = DateTime.Now,
                    UnitPrice = 10,
                    Quantity  = 10
                });
            }


            Console.WriteLine("发送了一个订单");
            Console.Read();
        }
 public OrderplaceRepo(IConfiguration configuration, IMSMQService mSMQService)
 {
     this.configuration    = configuration;
     this.connectionString = configuration.GetConnectionString("UserDbConnection");
     this.connection       = new SqlConnection(this.connectionString);
     this.mSMQService      = mSMQService;
 }
 public UserRepo(UserContext userDbContext,IMSMQService msmq, IConfiguration configuration, IDistributedCache cache)
 {
     this.msmq = msmq;
     this.userDbContext = userDbContext;
     this.configuration = configuration;
     this.cache = cache;
     this.cacheKey = "User";
 }
 public SecurityController(ISecurityService securityService, IMSMQService mSMQService)
 {
     this.securityService = securityService;
     this.mSMQService     = mSMQService;
 }
 public DriverController(IDriverService driverService, IMSMQService mSMQService)
 {
     this.driverService = driverService;
     this.mSMQService   = mSMQService;
 }
Exemple #6
0
 public OwnerController(IOwnerService ownerService, IMSMQService mSMQService)
 {
     this.ownerService = ownerService;
     this.mSMQService  = mSMQService;
 }
 public PoliceController(IPoliceService policeService, IMSMQService mSMQService)
 {
     this.policeService = policeService;
     this.mSMQService   = mSMQService;
 }