private CreateKardexEntryEventJson CreateJsonObject(string routingKey) { CreateKardexEntryEventJson jsonObject = new CreateKardexEntryEventJson(); jsonObject.Event = routingKey; jsonObject.Id = this.id; jsonObject.KardexEntryDate = this.kardexEntryDate; jsonObject.ProductId = this.productId; jsonObject.Description = this.description; jsonObject.Quantity = this.quantity; jsonObject.Price = this.price; jsonObject.IsASale = this.isASale; return(jsonObject); }
public bool Create() { string routingKey = "CreateKardexEntryEvent"; CreateKardexEntryEventJson jsonObject = this.CreateJsonObject(routingKey); // Add to the EventStore bool stored = RepositoryFactory <CreateKardexEntryEventJson> .Create().Append(jsonObject); // Publish to RabbitMQ if (stored) { jsonObject.Event = null; IProducerAttributes attributes = ProducerAttributesFactory <CreateKardexEntryEventJson> .Create(routingKey, jsonObject); EventBusQueueProducer producer = new EventBusQueueProducer(); producer.Publish(attributes); } return(stored); }