示例#1
0
        static EventStoreHelper()
        {
            var settings = CommonHelper.GetConfig().GetSection("eventStore");

            var userCredentials = new ReactiveDomain.UserCredentials(
                username: settings["ESUserId"],
                password: settings["ESPassword"]);

            var eventStoreLoader = new EventStoreLoader();

            eventStoreLoader.Connect(
                credentials: userCredentials,
                server: IPAddress.Parse(settings["ESipAddress"]),
                tcpPort: int.Parse(settings["ESTcpPort"]));

            var streamNameBuilder = new PrefixedCamelCaseStreamNameBuilder(Constants.DomainPrefix);

            GetListener = name => new StreamListener(
                listenerName: name,
                eventStoreConnection: eventStoreLoader.Connection,
                streamNameBuilder: streamNameBuilder,
                serializer: new JsonMessageSerializer());

            GetRepository = () => new StreamStoreRepository(
                streamNameBuilder: streamNameBuilder,
                eventStoreConnection: eventStoreLoader.Connection,
                eventSerializer: new JsonMessageSerializer());
        }
示例#2
0
        private void ConnectToLiveES()
        {
            var userCredentials = new ReactiveDomain.UserCredentials(username: "******", password: "******");

            var eventStoreLoader = new EventStoreLoader();

            eventStoreLoader.Connect(
                credentials: userCredentials,
                server: IPAddress.Parse("127.0.0.1"),
                tcpPort: 1113);

            Connection = eventStoreLoader.Connection;

            // ReSharper disable once PossibleNullReferenceException
            _connection = (IEventStoreConnection)typeof(EventStoreConnectionWrapper)
                          .GetField("_conn", BindingFlags.NonPublic | BindingFlags.Instance)
                          .GetValue(eventStoreLoader.Connection);

            log.Info("Connected to ES");
        }