示例#1
0
        private void Redeliver(byte[] message, int redeliveredCount)
        {
            RabbitMQConnectionFactory Instance = RabbitMQConnectionFactory.RabbitMQConnectionFactoryInstance;

            Instance.CreateFanoutExchange("SendMessages", true, false);
            bool isPublished = Instance.PublishMessage("SendMessages", "", false, null, message, redeliveredCount);
        }
示例#2
0
        // GET api/values
        public void Get()
        {
            RabbitMQConnectionFactory Instance = RabbitMQConnectionFactory.RabbitMQConnectionFactoryInstance;

            Instance.CreateFanoutExchange("SendMessages", true, false);

            System.Collections.IEnumerable quotes = FetchStockQuotes(new[] { "GOOG", "HD", "MCD" });
            foreach (string quote in quotes)
            {
                byte[] message     = Encoding.UTF8.GetBytes(quote);
                bool   isPublished = Instance.PublishMessage("SendMessages", "", false, null, message, 0);
            }
        }
示例#3
0
        public void StoreEvents(ICommand createUserCmd, object streamId, IEnumerable <object> events)
        {
            if (createUserCmd is CreateUserCommand)
            {
                StoreUsers(createUserCmd);
            }
            else if (createUserCmd is UpdateUserCommand)
            {
            }
            string str = JsonConvert.SerializeObject(events.First <object>());

            byte[] message = Encoding.UTF8.GetBytes(str);

            RabbitMQConnectionFactory rmqConn = RabbitMQConnectionFactory.RabbitMQConnectionFactoryInstance;

            rmqConn.CreateDirectExchange("Events", false, true);
            rmqConn.PublishMessage("Events", "UserCreatedEvent", false, null, message, 0);
            // _bus.Publish(events);
        }
示例#4
0
 private void Redeliver(byte[] message, int redeliveredCount)
 {
     rmq.CreateFanoutExchange("SendMessages", true, false);
     bool isPublished = rmq.PublishMessage("SendMessages", "", false, null, message, redeliveredCount);
 }