Example #1
0
        private void AddNewItem2()
        {
            var qs = new QueueSender();

            while (true)
            {
                _count++;

                TodoItem item = new TodoItem()
                {
                    Name      = $"Item {_count}",
                    Completed = false,
                    DueDate   = DateTime.Now,
                    UserName  = "******"
                };

                Message m = new Message()
                {
                    Operation = Operation.Add, Item = item
                };

                qs.Send(m);

                Console.WriteLine("Sent item.");
                Console.ReadKey();
            }
        }
Example #2
0
    internal csQueueSender(string[] args)
    {
        ParseArgs(args);

#if _NET_20
        try {
            tibemsUtilities.initSSLParams(serverUrl, args);
        }
        catch (Exception e)
        {
            System.Console.WriteLine("Exception: " + e.Message);
            System.Console.WriteLine(e.StackTrace);
            System.Environment.Exit(-1);
        }
#endif
        if (data.Count == 0)
        {
            Console.Error.WriteLine("Error: must specify at least one message text");
            usage();
        }

        Console.WriteLine("\n------------------------------------------------------------------------");
        Console.WriteLine("csQueueSender SAMPLE");
        Console.WriteLine("------------------------------------------------------------------------");
        Console.WriteLine("Server....................... " + ((serverUrl != null)?serverUrl:"localhost"));
        Console.WriteLine("User......................... " + ((userName != null)?userName:"******"));
        Console.WriteLine("Queue........................ " + queueName);
        Console.WriteLine("------------------------------------------------------------------------\n");

        try {
            QueueConnectionFactory factory = new TIBCO.EMS.QueueConnectionFactory(serverUrl);

            QueueConnection connection = factory.CreateQueueConnection(userName, password);

            QueueSession session = connection.CreateQueueSession(false, Session.AUTO_ACKNOWLEDGE);

            /*
             * Use createQueue() to enable sending into dynamic queues.
             */
            TIBCO.EMS.Queue queue = session.CreateQueue(queueName);

            QueueSender sender = session.CreateSender(queue);

            /* publish messages */
            for (int i = 0; i < data.Count; i++)
            {
                TextMessage message = session.CreateTextMessage();
                string      text    = (string)data[i];
                message.Text = text;
                sender.Send(message);
                Console.WriteLine("Sent message: " + text);
            }

            connection.Close();
        } catch (EMSException e) {
            Console.Error.WriteLine(e.StackTrace);
            Environment.Exit(0);
        }
    }
Example #3
0
        public IActionResult Post([FromBody] TodoItem value)
        {
            _queue.Send(new Message {
                Operation = Operation.Add, Item = value
            });

            return(Ok());
        }
Example #4
0
        public void GivePromoCodeToCustomer(PromoCode promoCode)
        {
            var dto = new GivePromoCodeToCustomerDto()
            {
                PartnerId        = promoCode.Partner.Id,
                BeginDate        = promoCode.BeginDate.ToShortDateString(),
                EndDate          = promoCode.EndDate.ToShortDateString(),
                PreferenceId     = promoCode.PreferenceId,
                PromoCode        = promoCode.Code,
                ServiceInfo      = promoCode.ServiceInfo,
                PartnerManagerId = promoCode.PartnerManagerId
            };
            var message = JsonSerializer.Serialize(dto, typeof(GivePromoCodeToCustomerDto));

            _queueSender.Send(message, "GivinigPromoCodeToCustomerPromoCode");
        }
        public void Update(CustomerViewModel CustomerViewModel)
        {
            UpdateCustomerCommand updateCustomerCommand = new UpdateCustomerCommand(_mapper.Map <Customer>(CustomerViewModel));

            QueueSender.Send(updateCustomerCommand);
        }
        public void Delete(Guid id)
        {
            DeleteCustomerCommand deleteCustomerCommand = new DeleteCustomerCommand(id);

            QueueSender.Send(deleteCustomerCommand);
        }
        public void Create(CustomerViewModel CustomerViewModel)
        {
            CreateCustomerCommand createCustomerCommand = new CreateCustomerCommand(_mapper.Map <Customer>(CustomerViewModel));

            QueueSender.Send(createCustomerCommand);
        }
Example #8
0
        public void Update(RentItemViewModel RentItemViewModel)
        {
            UpdateRentItemCommand updateRentItemCommand = new UpdateRentItemCommand(_mapper.Map <RentItem>(RentItemViewModel));

            QueueSender.Send(updateRentItemCommand);
        }
Example #9
0
        public void Delete(Guid id)
        {
            DeleteRentItemCommand deleteRentItemCommand = new DeleteRentItemCommand(id);

            QueueSender.Send(deleteRentItemCommand);
        }
Example #10
0
        public void Create(RentItemViewModel RentItemViewModel)
        {
            CreateRentCommand createRentCommand = new CreateRentCommand(_mapper.Map <Rent>(RentItemViewModel));

            QueueSender.Send(createRentCommand);
        }
Example #11
0
        public void Update(VendorViewModel vendorViewModel)
        {
            UpdateVendorCommand updateVendorCommand = new UpdateVendorCommand(_mapper.Map <Vendor>(vendorViewModel));

            QueueSender.Send(updateVendorCommand);
        }
Example #12
0
        public void Create(VendorViewModel vendorViewModel)
        {
            CreateVendorCommand createVendorCommand = new CreateVendorCommand(_mapper.Map <Vendor>(vendorViewModel));

            QueueSender.Send(createVendorCommand);
        }
Example #13
0
        public void NotifyAdminAboutPartnerManagerPromoCode(Guid partnerManagerId)
        {
            var id = partnerManagerId.ToString();

            _queueSender.Send(id, "AdministratorPromoCode");
        }