Exemple #1
0
 private static void FakeAQuery(Core.Particle particle)
 {
     // Aggregates all of the stores and returns unified results
     // Note that this would be mounted inside of Nancy / OWIN
     // And would probably be built with View Model Composition
     Console.WriteLine(particle.Api["/messages"].Get());
 }
Exemple #2
0
        private static void FakeSomeAuditMessages(Core.Particle particle)
        {
            // Note that a real transport wouldn't make its internals public to allow this
            var main      = particle.TransportInterfaces.Get("Main");
            var transport = main.Get <InMemoryTransport>();
            var auditQ    = transport.Get("audit");

            auditQ.Write("Hello");
            auditQ.Write("World");
            auditQ.Write("How are");
            auditQ.Write("You today?");
        }
Exemple #3
0
        public void ApplyTo(Core.Particle particle)
        {
            // This is just a sample. We could be loading config from an external config file
            // Or reading it from a database somewhere

            // Each store has a unique name, a type, and possibly some other details it needs to do its job
            particle.Stores.Add(
                name: "Daphne",
                type: "In Memory"
                );

            particle.Stores.Add(
                name: "Scooby",
                type: "Remote",
                data: new RemoteStoreConnectionSettings {
                ConnectionString = "http://scooby:8080/api"
            }
                );
            particle.Stores.Add(
                name: "Shaggy",
                type: "Remote",
                data: new RemoteStoreConnectionSettings {
                ConnectionString = "http://shaggy:8080/api"
            }
                );

            // Each transport interface has a unique name, a type, and possibly some other details it needs to do its job
            particle.TransportInterfaces.Add(
                name: "Main",
                type: "In Memory"
                );
            // Note that there is absolutely no reason that single particle instance couldn't be connected to multiple transport interfaces

            // Each channel has a unique name, a type, and possibly some other details it needs to do its job
            particle.Channels.Add(
                name: "Main Audit",
                type: "Audits",
                data: new object[]
            {
                new ChannelSettings {
                    Interface = "Main", PhysicalAddress = "audit", ForwardingAddress = "audit.log"
                },
                new AuditSettings {
                    Store = "Daphne"
                }
            });
        }
Exemple #4
0
        public void ApplyTo(Core.Particle particle)
        {
            // Velma is a scaled out store running across 3 instances
            particle.Stores.Add(
                name: "Velma-1",
                type: "In Memory"
                );
            particle.Stores.Add(
                name: "Velma-2",
                type: "In Memory"
                );
            particle.Stores.Add(
                name: "Velma-3",
                type: "In Memory"
                );
            particle.Stores.Add(
                name: "Velma",
                type: "Round Robin",
                data: new RoundRobinStorageSettings {
                Stores = new[] { "Velma-1", "Velma-2", "Velma-3" }
            }
                );

            particle.TransportInterfaces.Add(
                name: "Main",
                type: "In Memory"
                );

            particle.Channels.Add(
                name: "Main Audit",
                type: "Audits",
                data: new object[]
            {
                new ChannelSettings {
                    Interface = "Main", PhysicalAddress = "audit"
                },
                new AuditSettings {
                    Store = "Velma"
                }
            });
        }
Exemple #5
0
 public AuditChannelMonitor(Core.Particle particle, ChannelSettings channelSettings, AuditSettings auditSettings)
 {
     this.particle        = particle;
     this.channelSettings = channelSettings;
     this.auditSettings   = auditSettings;
 }
Exemple #6
0
 public Writer(Core.Particle particle, RoundRobinStorageSettings settings)
 {
     stores = settings.Stores.Select(x => particle.Stores.Get(x)).ToArray();
 }