Examples of DefaultConsumer


Examples of org.apache.camel.impl.DefaultConsumer

        }
    }

    protected void dispatchToConsumer() {
        try {
            DefaultConsumer consumer;
            while ((consumer = this.consumer.get()) != null) {
                // See if there is a new record to process
                Location location = dataManager.getNextLocation(lastReadLocation);
                if (location != null) {

                    // Send it on.
                    ByteSequence read = dataManager.read(location);
                    Exchange exchange = createExchange();
                    exchange.getIn().setBody(read);
                    exchange.getIn().setHeader("journal", getEndpointUri());
                    exchange.getIn().setHeader("location", location);
                    consumer.getProcessor().process(exchange);

                    // Setting the mark makes the data manager forget about
                    // everything
                    // before that record.
                    if (LOG.isDebugEnabled()) {
View Full Code Here

Examples of org.apache.camel.impl.DefaultConsumer

    public Producer createProducer() throws Exception {
        return new DirectProducer(this);
    }

    public Consumer createConsumer(Processor processor) throws Exception {
        return new DefaultConsumer(this, processor) {
            @Override
            public void start() throws Exception {
                if (!allowMultipleConsumers && !consumers.isEmpty()) {
                    throw new IllegalStateException("Endpoint " + getEndpointUri() + " only allows 1 active consumer but you attempted to start a 2nd consumer.");
                }
View Full Code Here

Examples of org.apache.camel.impl.DefaultConsumer

    public boolean process(Exchange exchange, AsyncCallback callback) {
        int size = endpoint.getConsumers().size();
        if (size == 0) {
            LOG.warn("No consumers available on endpoint: " + endpoint + " to process " + exchange);
        } else if (size == 1) {
            DefaultConsumer consumer = endpoint.getConsumers().get(0);
            AsyncProcessor processor = AsyncProcessorTypeConverter.convert(consumer.getProcessor());
            return processor.process(exchange, callback);
        } else if (size > 1) {
            // Too hard to do multiple async.. do it sync
            try {
                for (DefaultConsumer consumer : endpoint.getConsumers()) {
                    consumer.getProcessor().process(exchange);
                }
            } catch (Exception e) {
                exchange.setException(e);
            }
        }
View Full Code Here

Examples of org.codehaus.plexus.util.cli.DefaultConsumer

        CommandLineUtils.StringStreamConsumer err = new CommandLineUtils.StringStreamConsumer();

        try
        {
            int exitCode = CommandLineUtils.executeCommandLine(command, new DefaultConsumer(), err);

            if (exitCode != 0)
            {
                String message = String.format("Javadoc exit code: %d - %s\nCommand line was: %s", exitCode,
                                               err.getOutput(), command);
View Full Code Here

Examples of org.codehaus.plexus.util.cli.DefaultConsumer

        CommandLineUtils.StringStreamConsumer err = new CommandLineUtils.StringStreamConsumer();

        try
        {
            int exitCode = CommandLineUtils.executeCommandLine(command, new DefaultConsumer(), err);

            if (exitCode != 0)
            {
                String message = String.format("Javadoc exit code: %d - %s\nCommand line was: %s", exitCode,
                                               err.getOutput(), command);
View Full Code Here

Examples of org.codehaus.plexus.util.cli.DefaultConsumer

        CommandLineUtils.StringStreamConsumer err = new CommandLineUtils.StringStreamConsumer();

        try
        {
            int exitCode = CommandLineUtils.executeCommandLine(command, new DefaultConsumer(), err);

            if (exitCode != 0)
            {
                String message = String.format(
                        "Javadoc exit code: %d - %s\nCommand line was: %s",
View Full Code Here

Examples of org.codehaus.plexus.util.cli.DefaultConsumer

        CommandLineUtils.StringStreamConsumer err = new CommandLineUtils.StringStreamConsumer();

        try
        {
            int exitCode = CommandLineUtils.executeCommandLine(command, new DefaultConsumer(), err);

            if (exitCode != 0)
            {
                String message = String.format(
                        "Javadoc exit code: %d - %s\nCommand line was: %s",
View Full Code Here

Examples of org.codehaus.plexus.util.cli.DefaultConsumer

                }

                CommandLineUtils.StringStreamConsumer err = new CommandLineUtils.StringStreamConsumer();
                try
                {
                    int exitCode = CommandLineUtils.executeCommandLine( cmd, new DefaultConsumer(), err );

                    getLog().error( err.getOutput() );

                    if ( exitCode != 0 )
                    {
View Full Code Here

Examples of org.codehaus.plexus.util.cli.DefaultConsumer

            return;
        }

        Commandline cl = createDeleteLocalCommand( repo, fileSet, version );

        StreamConsumer consumer = new DefaultConsumer();

        CommandLineUtils.StringStreamConsumer stderr = new CommandLineUtils.StringStreamConsumer();

        int exitCode = StarteamCommandLineUtils.executeCommandline( cl, consumer, stderr, getLogger() );
View Full Code Here

Examples of org.codehaus.plexus.util.cli.DefaultConsumer

        if ( ! StringUtils.isEmpty( this.profiles ) )
        {
            cl.createArg().setValue( "-P" + this.profiles );
        }

        StreamConsumer consumer = new DefaultConsumer();

        try
        {
            int result = CommandLineUtils.executeCommandLine( cl, consumer, consumer );
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.