internal EventBusApi(IXConnection conn, BClient_Indexserver bclient) { this.conn = conn; this.bclient = bclient; bclient.addRemote(new MyEventBusHandler(this)); }
private void internalCreateConnection(IXAuthentication auth, BAsyncResult <IXConnection> asyncResult) { // Check version if (MajorVersion < 9) { BException ex = new BException(BExceptionC.CONNECTION_TO_SERVER_FAILED, "Received server version " + Version + ". At least server version 9.00.000 is required."); asyncResult(null, ex); return; } // IX-URL, e.g. http://localhost:8084/ix-elo80/ix String url = connProps[PROP_URL]; // BYPS-URL, e.g. http://localhost:8084/ix-elo80/byps String bypsUrl = url; int pos = bypsUrl.LastIndexOf("/ix"); if (pos >= 0) { bypsUrl = bypsUrl.Substring(0, pos) + "/byps"; if (pos + 3 < url.Length) { bypsUrl += url.Substring(pos + 3); } } // timeout String timeoutSecondsStr = connProps[PROP_TIMEOUT_SECONDS]; int timeoutSeconds = Convert.ToInt32(timeoutSecondsStr != null && timeoutSecondsStr.Length != 0 ? timeoutSecondsStr : "120"); // #reverse connections String reverseConnsStr = connProps[NB_OF_REVERSE_CNNS]; int nbOfReverseConnections = Convert.ToInt32(reverseConnsStr != null && reverseConnsStr.Length != 0 ? reverseConnsStr : "1"); // Wire, transport, client IXWireClient wire = new IXWireClient(bypsUrl, 0, timeoutSeconds); BTransportFactory transportFactory = new HTransportFactoryClient(BApiDescriptor_Indexserver.instance, wire, nbOfReverseConnections); BClient_Indexserver bclient = BClient_Indexserver.createClient(transportFactory); // Authentication bclient.setAuthentication(auth); // IXConnection IXConnection conn = new IXConnection(this, bclient, auth, url, connProps, sessOpts); BAsyncResult <bool> outerResult = (ignored, e) => { if (e != null) { asyncResult(conn, e); } else if (this.CONST != null) { asyncResult(conn, e); } else { // Read constants BAsyncResult <IXServicePortC> constResult = (CONST, ex) => { this.CONSTVal = CONST; asyncResult(conn, ex); }; conn.getCONST(constResult); } }; // Start client bclient.start(outerResult, false); }