@Override public boolean restRequest(HTTPRequestReader request) { if (pubSubService.hasRoomFor(1)) { if (!clientService.httpGet(session, path)) { return false;//try again later }; pubSubService.presumePublishTopic(w-> request.handoff(w) ); return true; } else { return false; } }
public HTTPGetBehaviorChained(GreenRuntime runtime, ClientHostPortInstance session) { GreenCommandChannel newCommandChannel = runtime.newCommandChannel(); this.cmd = newCommandChannel.newHTTPClientService(); this.x = newCommandChannel.newPubSubService(); this.session = session; }
public boolean publishHTTPResponse(HTTPFieldReader<?> reqeustReader, HTTPContentType contentType, Writable writable) { return publishHTTPResponse(reqeustReader.getConnectionId(), reqeustReader.getSequenceCode(), 200, false, null, contentType, writable); }
public RestBehaviorEmptyResponse(GreenRuntime runtime, long nameFieldId, AppendableProxy console) { this.nameFieldId = nameFieldId; this.cmd = runtime.newCommandChannel().newHTTPResponseService(4,400); this.console = console; }
public TimingBehavior(GreenRuntime runtime, AppendableProxy console) { this.channel = runtime.newCommandChannel().newPubSubService(); this.console = console; this.runtime = runtime; }
@Override public void declareBehavior(GreenRuntime runtime) { //log the telemetry snapshot upon every pulse final GreenCommandChannel cmd = runtime.newCommandChannel(); runtime.addTimePulseListener("log",(t,i)->{ cmd.logTelemetrySnapshot(); }); }
@Override public boolean restRequest(HTTPRequestReader request) { return cmd.publishTopic((writer)->{ request.handoff(writer); }); }
/** * * @param w HTTPFieldReader arg used in publishHTTPResponseContinuation * @param hasContinuation boolean arg used in publishHTTPResponseContinuation * @param writable Writable arg used in publishHTTPResponseContinuation * @return publishHTTPResponseContinuation(w.getConnectionId(),w.getSequenceCode(), hasContinuation, writable) */ public boolean publishHTTPResponseContinuation(HTTPFieldReader<?> w, boolean hasContinuation, Writable writable) { return publishHTTPResponseContinuation(w.getConnectionId(),w.getSequenceCode(), hasContinuation, writable); }
@Override public void declareBehavior(GreenRuntime runtime) { runtime.addFileServer(filePath).includeRoutesByAssoc(ROUTE_ID.ROOT); }
public HTTPResponder(MsgCommandChannel<?> commandChannel, int maximumPayloadSize) { clearAll(); int maximumMessages = 4; this.responseService = commandChannel.newHTTPResponseService(maximumMessages, maximumPayloadSize); }
public SimpleRest(GreenRuntime runtime, int maxResponseCount, int maxResponseSize) { responseService = runtime .newCommandChannel() .newHTTPResponseService(maxResponseCount, maxResponseSize); }
public ExternalRequest(GreenRuntime runtime, ClientHostPortInstance session, String path, String topic) { this.clientService = runtime.newCommandChannel().newHTTPClientService(4,400); this.pubSubService = runtime.newCommandChannel().newPubSubService(topic,4,400); this.session = session; this.path = path; }
public ProductsBehavior(GreenRuntime runtime, int maxProductId, String topic, Server server) { this.server = server; this.publishService = runtime.newCommandChannel().newPubSubService(topic,4,400); }
/** * * @param requestReader HTTPFieldReader arg used in publishHTTPResponse * @param statusCode int arg used in publishHTTPResponse * @return HTTPResponse with given args */ public boolean publishHTTPResponse(HTTPFieldReader<?> requestReader, int statusCode) { assert((0 != (msgCommandChannel.initFeatures & MsgCommandChannel.NET_RESPONDER))) : "CommandChannel must be created with NET_RESPONDER flag"; //logger.info("Building response for connection {} sequence {} ",w.getConnectionId(),w.getSequenceCode()); return publishHTTPResponse(requestReader.getConnectionId(), requestReader.getSequenceCode(), statusCode,false,null,Writable.NO_OP); //no type and no body so use null }
@Override public boolean restRequest(HTTPRequestReader request) { return cmd.publishTopic((writer)->{ request.handoff(writer); }); }
public ShutdownRestListener(GreenRuntime runtime, long keyFieldId) { this.newCommandChannel = runtime.newCommandChannel(); this.responseService = newCommandChannel.newHTTPResponseService(); this.keyFieldId = keyFieldId; }
public HTTPGetBehaviorSingle(GreenRuntime runtime, ClientHostPortInstance session) { this.session = session; GreenCommandChannel cmd = runtime.newCommandChannel(); clientService = cmd.newHTTPClientService(); pubSubService = cmd.newPubSubService(); }
/** * * @param reqeustReader HTTPFieldReader arg used in publishHTTPResponse * @param headers HeaderWritable arg used in publishHTTPResponse * @param writable Writable arg used in publishHTTPResponse * @return publishHTTPResponse(reqeustReader.getConnectionId (), reqeustReader.getSequenceCode(), * false, headers, 200, writable) */ public boolean publishHTTPResponse(HTTPFieldReader reqeustReader, HeaderWritable headers, HTTPContentType contentType, Writable writable) { return publishHTTPResponse(reqeustReader.getConnectionId(), reqeustReader.getSequenceCode(), 200, false, headers, contentType, writable); }
public RestBehaviorLargeResponse(GreenRuntime runtime, AppendableProxy console) { this.cmd = runtime.newCommandChannel().newHTTPResponseService(4,400); this.console = console; }
public RestBehaviorLargeResponse(GreenRuntime runtime, AppendableProxy console) { this.cmd = runtime.newCommandChannel().newHTTPResponseService(4,400); this.console = console; }