Hi,
We’ve just been trying to use the EventStore.ClientAPI.Embedded in a test and ran into problems trying to enable projections. This is the code we have taken from here https://github.com/yreynhout/AggregateSource/blob/d5be94fb805f44838121759bb86b4cb41a1ac85f/src/EventStore/AggregateSource.EventStore.IntegratedTests/Framework/EmbeddedEventStore.cs
public static void Start()
{
var ipAddress = IPAddress.Parse(“127.0.0.1”);
var node = EmbeddedVNodeBuilder.
AsSingleNode().
RunProjections(ProjectionsMode.All).
WithInternalHttpOn(new IPEndPoint(ipAddress, 2219)).
WithExternalHttpOn(new IPEndPoint(ipAddress, 2220)).
WithInternalTcpOn(new IPEndPoint(ipAddress, 1219)).
WithExternalTcpOn(new IPEndPoint(ipAddress, 1220)).
RunInMemory().
Build();
node.Start();
var tcs = new TaskCompletionSource();
node.NodeStatusChanged += (sender, args) =>
{
if (args.NewVNodeState == VNodeState.Master)
tcs.SetResult(null);
};
tcs.Task.Wait();
Node = node;
Credentials = new UserCredentials(“admin”, “changeit”);
var connection = EmbeddedEventStoreConnection.Create(Node);
connection.ConnectAsync().Wait();
Connection = connection;
EnableProjection("$by_event_type", new IPEndPoint(ipAddress, 2220));
EnableProjection("$by_category", new IPEndPoint(ipAddress, 2220));
}
private static void EnableProjection(string projectionName, IPEndPoint httpEndpoint)
{
var webClient = new WebClient() { Credentials = new NetworkCredential(“admin”, “changeit”) };
var url = string.Format(“http://{0}:{1}/projection/{2}/command/enable”, httpEndpoint.Address, httpEndpoint.Port,
projectionName);
var uploadString = webClient.UploadString(url, “POST”, “”);
}
``
``
We also cannot browse to the instance (i.e. http://127.0.0.1:2220)
Is it possible to use projections with the embedded version? If so, what are we doing wrong?
Thanks
Tom