use of com.yahoo.messagebus.jdisc.MbusRequest in project vespa by vespa-engine.
the class ClientTestDriver method newClientRequest.
public Request newClientRequest(Message msg) {
msg.setRoute(Route.parse(server.connectionSpec()));
if (msg.getTrace().getLevel() == 0) {
msg.getTrace().setLevel(9);
}
final Request parent = newServerRequest();
try (final ResourceReference ref = References.fromResource(parent)) {
return new MbusRequest(parent, URI.create("mbus://remotehost/"), msg);
}
}
use of com.yahoo.messagebus.jdisc.MbusRequest in project vespa by vespa-engine.
the class DocumentProcessingHandler method handleRequest.
@Override
public ContentChannel handleRequest(Request request, ResponseHandler handler) {
RequestContext requestContext;
if (request instanceof MbusRequest) {
requestContext = new MbusRequestContext((MbusRequest) request, handler, docprocServiceRegistry, docFactoryRegistry, containerDocConfig);
} else {
// Other types can be added here in the future
throw new IllegalArgumentException("Request type not supported: " + request);
}
if (!requestContext.isProcessable()) {
requestContext.skip();
return null;
}
DocprocService service = docprocServiceRegistry.getComponent(requestContext.getServiceName());
// No need to enqueue a task if the docproc chain is empty, just forward requestContext
if (service == null) {
log.log(LogLevel.ERROR, "DocprocService for session '" + requestContext.getServiceName() + "' not found, returning request '" + requestContext + "'.");
requestContext.processingFailed(RequestContext.ErrorCode.ERROR_PROCESSING_FAILURE, "DocprocService " + requestContext.getServiceName() + " not found.");
return null;
} else if (service.getExecutor().getCallStack().size() == 0) {
// call stack was empty, just forward message
requestContext.skip();
return null;
}
DocumentProcessingTask task = new DocumentProcessingTask(requestContext, this, service);
submit(task);
return null;
}
Aggregations