Пример #1
0
        public bool Delete()
        {
            string routingKey = "DeleteProductUnityEvent";
            CreateProductUnityEventJson jsonObject = this.CreateJsonObject(routingKey);

            // Add to the EventStore
            return(RepositoryFactory <CreateProductUnityEventJson> .Create().Append(jsonObject));
        }
Пример #2
0
        private CreateProductUnityEventJson CreateJsonObject(string routingKey)
        {
            CreateProductUnityEventJson jsonObject = new CreateProductUnityEventJson();

            jsonObject.Event       = routingKey;
            jsonObject.Id          = this.id;
            jsonObject.Name        = this.name;
            jsonObject.Description = this.description;

            return(jsonObject);
        }
Пример #3
0
        public bool Create()
        {
            string routingKey = "CreateProductUnityEvent";
            CreateProductUnityEventJson jsonObject = this.CreateJsonObject(routingKey);

            // Add to the EventStore
            bool stored = RepositoryFactory <CreateProductUnityEventJson> .Create().Append(jsonObject);

            // Publish to RabbitMQ
            if (stored)
            {
                jsonObject.Event = null;

                IProducerAttributes attributes = ProducerAttributesFactory <CreateProductUnityEventJson> .Create(routingKey, jsonObject);

                EventBusQueueProducer producer = new EventBusQueueProducer();
                producer.Publish(attributes);
            }

            return(stored);
        }