2017-05-05 72 views
0

我想使用4.0.0 C#客戶端API(EventStore.ClientAPI.dll)連接到GetEventStore版本3.2.2。我在LINQPad 5中將其作爲示例寫入,以便我可以弄清楚什麼是錯誤的。 LINQPad查詢爲C#語句設置。這是我迄今爲止編寫的用戶查詢。超時等待客戶端被識別(ReadStreamEventsForwardAsync)

var localHostAddressses = Dns.GetHostAddresses(Dns.GetHostName()); 
var localAddress = localHostAddressses.FirstOrDefault(ha => ha.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork) ?? IPAddress.Loopback; 
var endPoint = new IPEndPoint(localAddress, 1113); 
var userCredentials = new EventStore.ClientAPI.SystemData.UserCredentials("admin", "changeit"); 

var settings = EventStore.ClientAPI.ConnectionSettings.Create(); 
settings.SetDefaultUserCredentials(userCredentials); 
settings.UseConsoleLogger(); 
settings.WithConnectionTimeoutOf(TimeSpan.FromSeconds(2)); 
settings.LimitReconnectionsTo(1); 
settings.SetOperationTimeoutTo(TimeSpan.FromSeconds(2)); 

using (var client = EventStore.ClientAPI.EventStoreConnection.Create(settings, endPoint)) 
{ 
    client.ConnectAsync().Wait(); 

    var streamName = "SpecialStreamName42";  
    var task = client.ReadStreamEventsForwardAsync(streamName, 0, 10, false); 
    task.Wait(); 

    task.Result.Dump(); 
} 

它產生以下輸出

[19,14:05:27.126,DEBUG] TcpPackageConnection: connected to [192.168.15.201:1113, L192.168.15.201:28239, {c4f69c94-254f-475c-883a-06e427fd4610}]. 
[08,14:05:29.176,INFO] ClientAPI TcpConnection closed [14:05:29.176: N192.168.15.201:1113, L192.168.15.201:28239, {c4f69c94-254f-475c-883a-06e427fd4610}]: 
[08,14:05:29.176,INFO] Received bytes: 116, Sent bytes: 124 
[08,14:05:29.176,INFO] Send calls: 3, callbacks: 3 
[08,14:05:29.176,INFO] Receive calls: 4, callbacks: 3 
[08,14:05:29.176,INFO] Close reason: [Success] Timed out waiting for client to be identified 
[08,14:05:29.176,DEBUG] TcpPackageConnection: connection [192.168.15.201:1113, L192.168.15.201:28239, {c4f69c94-254f-475c-883a-06e427fd4610}] was closed cleanly. 
[11,14:05:29.377,DEBUG] TcpPackageConnection: connected to [192.168.15.201:1113, L192.168.15.201:28240, {9373790b-6f43-4d3f-bf66-77325b529bd0}]. 
[19,14:05:31.427,INFO] ClientAPI TcpConnection closed [14:05:31.427: N192.168.15.201:1113, L192.168.15.201:28240, {9373790b-6f43-4d3f-bf66-77325b529bd0}]: 
[19,14:05:31.427,INFO] Received bytes: 116, Sent bytes: 124 
[19,14:05:31.427,INFO] Send calls: 3, callbacks: 3 
[19,14:05:31.427,INFO] Receive calls: 4, callbacks: 3 
[19,14:05:31.427,INFO] Close reason: [Success] Timed out waiting for client to be identified 
[19,14:05:31.427,DEBUG] TcpPackageConnection: connection [192.168.15.201:1113, L192.168.15.201:28240, {9373790b-6f43-4d3f-bf66-77325b529bd0}] was closed cleanly. 

task.Wait();第19行的從未完成,最終查詢以發生一個或多個錯誤的AggregateException結束。內部異常顯示「Connection'ES-7a7e3dfb-db11-4a5c-872c-100ad7724ba2'已關閉。」我正在追蹤我見過的例子,我似乎沒有取得任何進展。希望這是愚蠢的,我只是沒有設置,這將允許我的客戶被通知。如果您有任何想法,請告訴我。

+0

顯然,當連接轉移到「確定國家」 [GoToIdentifyState](https://github.com/EventStore/EventStore/blob/56c5680f51325cf0e99846da72ae313402c63c2d/src/EventStore.ClientAPI/Internal/EventStoreConnectionLogicHandler.cs)線271.我我仍然失去了如何「識別」我的客戶端到服務器,但希望這會讓別人更有意義。 –

+0

進一步更新。當我使用客戶端版本3.3.1到3.9.4時,它按預期連接。 –

+0

4.0.0客戶端與ES 3.9.4及以上版本兼容。客戶端3.9.5兼容兩種方式。 –

回答

1

4.0.0客戶端與ES 3.9.4及以上版本兼容。客戶端3.9.5兼容兩種方式。

它在announcement中提到,請參見突破性變化。