public void Handle(AuditMessageReceived transportMessage)
        {
            var messageTypes = transportMessage.MessageTypes().ToList();

            if (!messageTypes.Any())
            {
                return;
            }

            foreach (var messageType in messageTypes)
            {
                var serviceName = ServiceStructureConventions.ServiceName(messageType.TypeName);
                var serviceId   = ServiceStructureConventions.ServiceId(messageType.TypeName);

                bus.Send(new RegisterLogicalService
                {
                    ServiceId   = serviceId,
                    ServiceName = serviceName,
                });

                var  bcName = ServiceStructureConventions.BusinessComponentName(messageType.TypeName);
                Guid bcId   = Guid.Empty;

                if (!string.IsNullOrEmpty(bcName))
                {
                    bcId = bcName.ToGuid();

                    bus.Send(new RegisterBusinessComponent
                    {
                        BusinessComponentId   = bcId,
                        BusinessComponentName = bcName,
                        OwnedByService        = serviceId,
                    });
                }


                bus.Send(new RegisterMessageOwner
                {
                    OwnedByService   = serviceId,
                    OwnedByComponent = bcId,
                    MessageTypeId    = messageType.TypeName.ToGuid()
                });
            }
        }
Exemple #2
0
        public void Handle(AuditMessageReceived auditMessage)
        {
            var messageTypes = auditMessage.MessageTypes().ToList();

            if (!messageTypes.Any())
            {
                return;
            }

            foreach (var messageType in messageTypes)
            {
                var autonomousComponentsThatHandledThisMessage = auditMessage.GetPipelineInfoFor(messageType).ToList();



                foreach (var autonomousComponent in autonomousComponentsThatHandledThisMessage)
                {
                    var typeName = autonomousComponent.Split(',').First();
                    var version  = autonomousComponent.Split(',').Single(s => s.StartsWith(" Version")).Split('=').Last();
                    bus.Send(new RegisterAutonomousComponent
                    {
                        AutonomousComponentId   = ServiceStructureConventions.AutonomousComponentId(typeName),
                        ServiceId               = ServiceStructureConventions.ServiceId(typeName),
                        AutonomousComponentName = ServiceStructureConventions.AutonomousComponentName(typeName),
                        Version = version
                    });
                }

                if (autonomousComponentsThatHandledThisMessage.Any())
                {
                    bus.Send(new RegisterMessageConsumers
                    {
                        MessageTypeId = messageType.TypeName.ToGuid(),
                        ConsumedBy    = autonomousComponentsThatHandledThisMessage.Select(ServiceStructureConventions.AutonomousComponentId).ToList()
                    });
                }
            }
        }