/** * * @param host String arg specifying host * @param port int arg specifying port number * @param sessionId int arg specifying the sessionId, this is internal an private * @param extractor optional JSON extractor */ private ClientHostPortInstance(String host, int port, int sessionId, JSONExtractorCompleted extractor, long callTimeoutNS) { this.host = host; this.port = port; if (port<=0 || port>65535) { throw new UnsupportedOperationException("Invalid port "+port+" must be postive and <= 65535"); } if (sessionId<=0) { throw new UnsupportedOperationException("SessionId must be postive and greater than zero. found: "+sessionId); } this.sessionId = sessionId; this.hostBytes = host.getBytes(); this.extractor = extractor; this.hostId = ClientCoordinator.registerDomain(host); //TODO: this static is bad plus we need to reg the chpis ClientCoordinator.setSessionTimeoutNS(sessionId, callTimeoutNS); }
private static MQTTConfigImpl buildMQTTBridge(GraphManager gm, CharSequence host, int port, CharSequence clientId, int maxInFlight, int maxMessageLength, PipeConfigManager localPCM, long rate) { ClientCoordinator.registerDomain(host); if (maxInFlight>(1<<15)) { throw new UnsupportedOperationException("Does not suppport more than "+(1<<15)+" in flight"); } if (maxMessageLength>(256*(1<<20))) { throw new UnsupportedOperationException("Specification does not support values larger than 256M"); } localPCM.ensureSize(MessageSubscription.class, maxInFlight, maxMessageLength); MQTTConfigImpl mqttBridge = new MQTTConfigImpl(host, port, clientId, gm, rate, (short)maxInFlight, maxMessageLength); mqttBridge.beginDeclarations(); return mqttBridge; }
public ProxyRequestToBackEndStage(GraphManager graphManager, Pipe<HTTPRequestSchema>[] inputPipes, Pipe<ConnectionData>[] connectionId, Pipe<ClientHTTPRequestSchema>[] clientRequests, ServerCoordinator serverCoordinator) { super(graphManager, inputPipes, join(clientRequests,connectionId)); this.inputPipes = inputPipes; this.connectionId = connectionId; this.clientRequests = clientRequests; assert(inputPipes.length == connectionId.length); assert(inputPipes.length == clientRequests.length); this.targetHost = serverCoordinator.host(); this.targetPort = serverCoordinator.port(); this.spec = serverCoordinator.spec; assert(targetHost!=null); ClientCoordinator.registerDomain(targetHost); }
int hostId = ClientCoordinator.registerDomain(host); Pipe.addIntValue(hostId, pipe); Pipe.addLongValue(-1, pipe);
private void streamingRequest(Pipe<ClientHTTPRequestSchema> pipe, int httpRequestResponseId) { PipeWriter.presumeWriteFragment(pipe, ClientHTTPRequestSchema.MSG_GET_200); assert(httpRequestResponseId>=0); PipeWriter.writeInt(pipe, ClientHTTPRequestSchema.MSG_GET_200_FIELD_SESSION_10, httpRequestResponseId); PipeWriter.writeInt(pipe, ClientHTTPRequestSchema.MSG_GET_200_FIELD_PORT_1, port); int hostId = ClientCoordinator.registerDomain(host); PipeWriter.writeInt(pipe, ClientHTTPRequestSchema.MSG_GET_200_FIELD_HOSTID_2, hostId); PipeWriter.writeLong(pipe, ClientHTTPRequestSchema.MSG_GET_200_FIELD_CONNECTIONID_20, -1 ); PipeWriter.writeInt(pipe, ClientHTTPRequestSchema.MSG_GET_200_FIELD_DESTINATION_11, httpRequestResponseId); PipeWriter.writeUTF8(pipe, ClientHTTPRequestSchema.MSG_GET_200_FIELD_PATH_3, path); DataOutputBlobWriter<ClientHTTPRequestSchema> stream = PipeWriter.outputStream(pipe); DataOutputBlobWriter.openField(stream); myAuth.addHeaders(stream, "GET").append("\r\n"); //myAuth.addHeaders(System.out, "GET"); DataOutputBlobWriter.closeHighLevelField(stream, ClientHTTPRequestSchema.MSG_GET_200_FIELD_HEADERS_7); PipeWriter.publishWrites(pipe); }
PipeWriter.writeInt(pipe, ClientHTTPRequestSchema.MSG_POST_201_FIELD_SESSION_10, 0); PipeWriter.writeInt(pipe, ClientHTTPRequestSchema.MSG_POST_201_FIELD_PORT_1, port); PipeWriter.writeInt(pipe, ClientHTTPRequestSchema.MSG_POST_201_FIELD_HOSTID_2, ClientCoordinator.registerDomain(host)); PipeWriter.writeLong(pipe, ClientHTTPRequestSchema.MSG_POST_201_FIELD_CONNECTIONID_20, -1); PipeWriter.writeInt(pipe, ClientHTTPRequestSchema.MSG_POST_201_FIELD_DESTINATION_11, httpRequestResponseId);
Pipe.addIntValue(1, outputPipe); //session int hostId = ClientCoordinator.registerDomain(host); Pipe.addIntValue(hostId, outputPipe); Pipe.addLongValue(-1, outputPipe);
int messageSizeToOrderingSuper = 1<<12; ClientCoordinator.registerDomain("127.0.0.1"); PipeWriter.writeInt(output,ClientHTTPRequestSchema.MSG_GET_200_FIELD_SESSION_10, fieldSession); PipeWriter.writeInt(output,ClientHTTPRequestSchema.MSG_GET_200_FIELD_PORT_1, port); PipeWriter.writeInt(output,ClientHTTPRequestSchema.MSG_GET_200_FIELD_HOSTID_2, ClientCoordinator.registerDomain(bindHost)); PipeWriter.writeLong(output,ClientHTTPRequestSchema.MSG_GET_200_FIELD_CONNECTIONID_20, (long) -1); PipeWriter.writeInt(output,ClientHTTPRequestSchema.MSG_GET_200_FIELD_DESTINATION_11, fieldDestination);
int messageSizeToOrderingSuper = 1<<12; ClientCoordinator.registerDomain("127.0.0.1"); PipeWriter.writeInt(output,ClientHTTPRequestSchema.MSG_GET_200_FIELD_SESSION_10, fieldSession); PipeWriter.writeInt(output,ClientHTTPRequestSchema.MSG_GET_200_FIELD_PORT_1, port); PipeWriter.writeInt(output,ClientHTTPRequestSchema.MSG_GET_200_FIELD_HOSTID_2, ClientCoordinator.registerDomain(bindHost)); PipeWriter.writeLong(output,ClientHTTPRequestSchema.MSG_GET_200_FIELD_CONNECTIONID_20, (long) -1); PipeWriter.writeInt(output,ClientHTTPRequestSchema.MSG_GET_200_FIELD_DESTINATION_11, fieldDestination);
CharSequence fieldPath = "/"+testFile; CharSequence fieldHeaders = null; ClientCoordinator.registerDomain("127.0.0.1"); PipeWriter.writeInt(output,ClientHTTPRequestSchema.MSG_GET_200_FIELD_SESSION_10, fieldSession); PipeWriter.writeInt(output,ClientHTTPRequestSchema.MSG_GET_200_FIELD_PORT_1, port); PipeWriter.writeInt(output,ClientHTTPRequestSchema.MSG_GET_200_FIELD_HOSTID_2, ClientCoordinator.registerDomain(bindHost)); PipeWriter.writeLong(output,ClientHTTPRequestSchema.MSG_GET_200_FIELD_CONNECTIONID_20, (long) -1); PipeWriter.writeInt(output,ClientHTTPRequestSchema.MSG_GET_200_FIELD_DESTINATION_11, fieldDestination);
PipeWriter.writeInt(httpRequest, ClientHTTPRequestSchema.MSG_GET_200_FIELD_PORT_1, twitterQueryPort); int hostId = ClientCoordinator.registerDomain(twitterQueryHost); PipeWriter.writeInt(httpRequest, ClientHTTPRequestSchema.MSG_GET_200_FIELD_HOSTID_2, hostId); PipeWriter.writeLong(httpRequest, ClientHTTPRequestSchema.MSG_GET_200_FIELD_CONNECTIONID_20, -1 );
Pipe.addIntValue(ClientCoordinator.registerDomain(targetHost), targetClientRequest); Pipe.addLongValue(-1, targetClientRequest); Pipe.addIntValue(fieldDestination, targetClientRequest);