2016-03-24 178 views
0

我目前正試圖在我的Cypher請求的Header中添加一個字段,告訴負載均衡器它是寫入請求還是讀取請求,因此它會將查詢指向Master或Slave Neo4j實例。NEO4J:CustomHeaders覆蓋默認標題?

HttpClientWrapper clientWrapper = new HttpClientWrapper(ConfigurationManager.AppSettings["Neo4jUserName"], ConfigurationManager.AppSettings["Neo4jPassword"]); 

Uri uri = new Uri(ConfigurationManager.AppSettings["Neo4jClient"]); 
GraphClient client = new GraphClient(uri, clientWrapper); 
client.JsonConverters.Add(new CoordinateConverter()); 
client.Connect(); 
...   
NameValueCollection collection = new NameValueCollection(); 
collection.Add("X:Write", "1"); 
... 
client.Cypher.CustomHeader(collection)... 

但在執行查詢時,我得到異常如:

System.FormatException:「頭名的格式是無效的。」

我的問題是,做的.CustomHeader(集合)重寫標準的頭,而不是隻添加字段X:寫? 我很努力地在CustomHeader上查找文檔以及它應該如何工作。

在此先感謝您的閱讀。

編輯:下面是一些代碼示例我發現應該工作:https://github.com/Readify/Neo4jClient/pull/149/files

回答

0

的錯誤是,我不能用「:」在headername,更名爲「IsWrite」解決了這個問題。