Package org.apache.camel.spi

Examples of org.apache.camel.spi.UnitOfWork


        context.getProperties().put(CachedOutputStream.THRESHOLD, "16");
        deleteDirectory("./target/cachedir");
        createDirectory("./target/cachedir");

        exchange = new DefaultExchange(context);
        UnitOfWork uow = new DefaultUnitOfWork(exchange);
        exchange.setUnitOfWork(uow);
    }
View Full Code Here


     * @param processor    the processor wrapped in this unit of work processor
     * @param exchange     the exchange
     * @return the unit of work processor
     */
    protected UnitOfWorkProcessor createUnitOfWorkProcessor(RouteContext routeContext, Processor processor, Exchange exchange) {
        UnitOfWork parent = exchange.getProperty(Exchange.PARENT_UNIT_OF_WORK, UnitOfWork.class);
        if (parent != null) {
            return new ChildUnitOfWorkProcessor(parent, routeContext, processor);
        } else {
            return new UnitOfWorkProcessor(routeContext, processor);
        }
View Full Code Here

        Exchange copy = exchange.copy();
        // do not share the unit of work
        copy.setUnitOfWork(null);
        // hand over on completion to the copy if we got any
        UnitOfWork uow = exchange.getUnitOfWork();
        if (handover && uow != null) {
            uow.handoverSynchronization(copy);
        }
        // set a correlation id so we can track back the original exchange
        copy.setProperty(Exchange.CORRELATION_ID, id);
        return copy;
    }
View Full Code Here

    public boolean isFailed() {
        return (hasOut() && getOut().isFault()) || getException() != null;
    }

    public boolean isTransacted() {
        UnitOfWork uow = getUnitOfWork();
        if (uow != null) {
            return uow.isTransacted();
        } else {
            return false;
        }
    }
View Full Code Here

        context.getProperties().put(CachedOutputStream.THRESHOLD, "16");
        deleteDirectory("./target/cachedir");
        createDirectory("./target/cachedir");

        exchange = new DefaultExchange(context);
        UnitOfWork uow = new DefaultUnitOfWork(exchange);
        exchange.setUnitOfWork(uow);
    }
View Full Code Here

    public static Exchange createCorrelatedCopy(Exchange exchange, boolean handover) {
        Exchange copy = exchange.copy();
        // do not share the unit of work
        copy.setUnitOfWork(null);
        // hand over on completion to the copy if we got any
        UnitOfWork uow = exchange.getUnitOfWork();
        if (handover && uow != null) {
            uow.handoverSynchronization(copy);
        }
        // set a correlation id so we can track back the original exchange
        copy.setProperty(Exchange.CORRELATION_ID, exchange.getExchangeId());
        return copy;
    }
View Full Code Here

        if (routeId != null && exchange.getFromRouteId() == null) {
            exchange.setFromRouteId(routeId);
        }

        if (exchange.getUnitOfWork() == null) {
            UnitOfWork unitOfWork;
            // If there is no existing UoW, then we should start one and
            // terminate it once processing is completed for the exchange.
            if (exchange.getContext().isUseMDCLogging()) {
                unitOfWork = new MDCUnitOfWork(exchange);
            } else {
                unitOfWork = new DefaultUnitOfWork(exchange);
            }
            final UnitOfWork uow = unitOfWork;

            exchange.setUnitOfWork(uow);
            try {
                uow.start();
            } catch (Exception e) {
                callback.done(true);
                exchange.setException(e);
                return true;
            }
View Full Code Here

    public boolean isFailed() {
        return (hasOut() && getOut().isFault()) || getException() != null;
    }

    public boolean isTransacted() {
        UnitOfWork uow = getUnitOfWork();
        if (uow != null) {
            return uow.isTransacted();
        } else {
            return false;
        }
    }
View Full Code Here

     * @throws Exception is thrown if error starting the unit of work
     *
     * @see #doneUoW(org.apache.camel.Exchange)
     */
    public UnitOfWork createUoW(Exchange exchange) throws Exception {
        UnitOfWork uow = UnitOfWorkHelper.createUoW(exchange);
        exchange.setUnitOfWork(uow);
        uow.start();
        return uow;
    }
View Full Code Here

     * @param processor the processor wrapped in this unit of work processor
     * @param exchange  the exchange
     * @return the unit of work processor
     */
    protected UnitOfWorkProcessor createUnitOfWorkProcessor(Processor processor, Exchange exchange) {
        UnitOfWork parent = exchange.getProperty(Exchange.PARENT_UNIT_OF_WORK, UnitOfWork.class);
        if (parent != null) {
            return new ChildUnitOfWorkProcessor(parent, processor);
        } else {
            return new UnitOfWorkProcessor(processor);
        }
View Full Code Here

TOP

Related Classes of org.apache.camel.spi.UnitOfWork

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.