Package org.apache.camel.spi

Examples of org.apache.camel.spi.Synchronization


        private MyUOWProcessor(String id) {
            this.id = id;
        }

        public void process(Exchange exchange) throws Exception {
            exchange.getUnitOfWork().addSynchronization(new Synchronization() {
                public void onComplete(Exchange exchange) {
                    sync = "onComplete" + id;
                    lastOne = sync;
                }
View Full Code Here


            // update pending number of exchanges
            pendingExchanges = total - index - 1;

            // add on completion to handle after work when the exchange is done
            exchange.addOnCompletion(new Synchronization() {
                public void onComplete(Exchange exchange) {
                    processCommit(exchange);
                }

                public void onFailure(Exchange exchange) {
View Full Code Here

            // update pending number of exchanges
            pendingExchanges = total - index - 1;

            // add on completion to handle after work when the exchange is done
            exchange.addOnCompletion(new Synchronization() {
                public void onComplete(Exchange exchange) {
                    processCommit(exchange);
                }

                public void onFailure(Exchange exchange) {
View Full Code Here

            // update pending number of exchanges
            pendingExchanges = total - index - 1;

            // add on completion to handle after work when the exchange is done
            exchange.addOnCompletion(new Synchronization() {
                public void onComplete(Exchange exchange) {
                    String blobName = (String) exchange.getProperty(JcloudsConstants.BLOB_NAME);
                    blobStore.removeBlob(container, blobName);
                }
View Full Code Here

        assertEquals("Processed SomePayload", response);
    }

    @Test
    public void testAsyncRequestWithCallback() throws InterruptedException, ExecutionException {
        Future<Object> future = template.asyncCallbackRequestBody("direct:processInOut", "AnotherPayload", new Synchronization() {
            @Override
            public void onComplete(Exchange exchange) {
                assertEquals("Processed AnotherPayload", exchange.getOut().getBody());
            }
View Full Code Here

        mockOut.setExpectedMessageCount(messageCount);
        mockOut.setResultWaitTime(5000);

        for (int i = 0; i < messageCount; i++) {
            Future<Object> future = template.asyncCallbackRequestBody("direct:in", "Message[" + i + "]",
                new Synchronization() {
                    @Override
                    public void onComplete(Exchange exchange) {
                        final Message response = exchange.hasOut() ? exchange.getOut() : exchange.getIn();
                        assertEquals("Processed", response.getBody(String.class));
                    }
View Full Code Here

        final ProducerTemplate producerTemplate =
            exchange.getContext().createProducerTemplate();
        producerTemplate.send("mock:start", exchange);

        exchange.addOnCompletion(new Synchronization() {
            @Override
            public void onComplete(Exchange exchange) {
                log.info("Completed - confirming");
                producerTemplate.send("mock:confirm", exchange);
            }
View Full Code Here

            // must use the original message in case we need to workaround a charset issue when extracting mail content
            final Message mail = exchange.getIn(MailMessage.class).getOriginalMessage();

            // add on completion to handle after work when the exchange is done
            exchange.addOnCompletion(new Synchronization() {
                public void onComplete(Exchange exchange) {
                    processCommit(mail, exchange);
                }

                public void onFailure(Exchange exchange) {
View Full Code Here

        context().createProducerTemplate().asyncRequestBody("direct:test.x", "HELLO WORLD");
    }
   
    @Test
    public void sendAsyncCallbackMessage() throws Exception {
        context().createProducerTemplate().asyncCallbackSendBody("direct:test.w", "HELLO WORLD", new Synchronization() {
            @Override
            public void onComplete(Exchange exchange) {
                Assert.assertNull(exchange.getException());
            }
View Full Code Here

            commitStrategy = new BatchTransactionCommitStrategy(getTransactionBatchCount());
        } else {
            commitStrategy = new DefaultTransactionCommitStrategy();
        }

        Synchronization synchronization;
        if (commitStrategy instanceof BatchTransactionCommitStrategy) {
            TimedTaskManager timedTaskManager = getEndpoint().getComponent().getTimedTaskManager();
            synchronization = new SessionBatchTransactionSynchronization(timedTaskManager, session, commitStrategy, getTransactionBatchTimeout());
        } else {
            synchronization = new SessionTransactionSynchronization(session, commitStrategy);
View Full Code Here

TOP

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

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.