Search in sources :

Example 1 with MbusRequest

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);
    }
}
Also used : MbusRequest(com.yahoo.messagebus.jdisc.MbusRequest) MbusRequest(com.yahoo.messagebus.jdisc.MbusRequest) Request(com.yahoo.jdisc.Request) ResourceReference(com.yahoo.jdisc.ResourceReference)

Example 2 with MbusRequest

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;
}
Also used : MbusRequest(com.yahoo.messagebus.jdisc.MbusRequest) MbusRequestContext(com.yahoo.docproc.jdisc.messagebus.MbusRequestContext) DocprocService(com.yahoo.docproc.DocprocService) MbusRequestContext(com.yahoo.docproc.jdisc.messagebus.MbusRequestContext)

Aggregations

MbusRequest (com.yahoo.messagebus.jdisc.MbusRequest)2 DocprocService (com.yahoo.docproc.DocprocService)1 MbusRequestContext (com.yahoo.docproc.jdisc.messagebus.MbusRequestContext)1 Request (com.yahoo.jdisc.Request)1 ResourceReference (com.yahoo.jdisc.ResourceReference)1