Exemplo n.º 1
0
        private static void InjectPersistenceServiceSpecificConfiguration(BusFactory busFactory, AppSettingsConfiguration configuration)
        {
            busFactory.ConfigureContainer(c =>
            {
                c.ForSingletonOf <IPersistenceConfiguration>().Use(configuration);

                // TODO: Add InMemoryStorage
                c.ForSingletonOf <IStorage>().Use <CqlStorage>();

                c.ForSingletonOf <IMessageReplayerRepository>().Use <MessageReplayerRepository>();
                c.ForSingletonOf <IMessageReplayer>().Use <MessageReplayer>();

                c.ForSingletonOf <IMessageDispatcher>().Use(typeof(Func <IContext, MessageDispatcher>).Name,
                                                            ctx =>
                {
                    var dispatcher = ctx.GetInstance <MessageDispatcher>();
                    dispatcher.ConfigureHandlerFilter(x => x != typeof(PeerDirectoryClient));

                    return(dispatcher);
                });

                c.ForSingletonOf <ITransport>().Use <QueueingTransport>().Ctor <ITransport>().Is <ZmqTransport>();
                c.ForSingletonOf <IInMemoryMessageMatcher>().Use <InMemoryMessageMatcher>();
                c.Forward <IInMemoryMessageMatcher, IProvideQueueLength>();
                c.ForSingletonOf <IStoppingStrategy>().Use <PersistenceStoppingStrategy>();

                c.ForSingletonOf <IReporter>().Use <NoopReporter>();

                // Cassandra specific
                c.ForSingletonOf <PeerStateRepository>().Use <PeerStateRepository>();
                c.ForSingletonOf <CassandraCqlSessionManager>().Use(() => CassandraCqlSessionManager.Create());
                c.Forward <PeerStateRepository, IPeerStateRepository>();
                c.ForSingletonOf <ICqlPersistenceConfiguration>().Use <CassandraAppSettingsConfiguration>();
            });
        }
Exemplo n.º 2
0
 public DirectoryDataContext(CassandraCqlSessionManager sessionManager, ICassandraConfiguration cassandraConfiguration)
     : base(sessionManager, cassandraConfiguration)
 {
 }
Exemplo n.º 3
0
 public PersistenceCqlDataContext(CassandraCqlSessionManager sessionManager, ICqlPersistenceConfiguration cassandraConfiguration) : base(sessionManager, cassandraConfiguration)
 {
 }