Examples of createExchange()


Examples of org.apache.camel.Endpoint.createExchange()

*/
public class JettyImageFileTest extends ContextTestSupport {

    public void testImageContentType() throws Exception {
        Endpoint endpoint = context.getEndpoint("http://localhost:8080/myapp/myservice");
        Exchange exchange = endpoint.createExchange();
        template.send(endpoint, exchange);

        assertNotNull(exchange.getOut().getBody());
        assertOutMessageHeader(exchange, "Content-Type", "image/jpeg");
    }
View Full Code Here

Examples of org.apache.camel.Producer.createExchange()

        Endpoint producerEndpoint = component.createEndpoint(getEndpointUri(settingsFile.getName(), acceptorSessionID));
        Producer producer = producerEndpoint.createProducer();
       
        // FIX message to send
        Email email = new Email(new EmailThreadID("ID"), new EmailType(EmailType.NEW), new Subject("Test"));
        Exchange exchange = producer.createExchange(ExchangePattern.InOnly);
        exchange.getIn().setBody(email);
       
        producer.process(exchange);           

        // Produce with no session ID specified, session ID must be in message
View Full Code Here

Examples of org.apache.camel.Producer.createExchange()

            }
        });

        Endpoint endpoint = context.getEndpoint(uri);
        Producer producer = endpoint.createProducer();
        Exchange exchange = producer.createExchange();
        exchange.getIn().setBody(hello);

        producer.start();
        producer.process(exchange);
        producer.stop();
View Full Code Here

Examples of org.apache.camel.component.direct.DirectEndpoint.createExchange()

    private void sendExchangesThroughDroppingThrottler(List<Exchange> sentExchanges, int messages) throws Exception {
        ProducerTemplate myTemplate = context.createProducerTemplate();

        DirectEndpoint targetEndpoint = resolveMandatoryEndpoint("direct:sample", DirectEndpoint.class);
        for (int i = 0; i < messages; i++) {
            Exchange e = targetEndpoint.createExchange();
            e.getIn().setBody("<message>" + i + "</message>");
            // only send if we are still started
            if (context.getStatus().isStarted()) {
                myTemplate.send(targetEndpoint, e);
                sentExchanges.add(e);
View Full Code Here

Examples of org.apache.camel.component.file.FileEndpoint.createExchange()

        file = new File("target/filelanguage/test/hello.txt");
        GenericFile<File> gf = FileConsumer.asGenericFile("target/filelanguage", file, null);

        FileEndpoint endpoint = getMandatoryEndpoint(uri, FileEndpoint.class);

        Exchange answer = endpoint.createExchange(gf);
        endpoint.configureMessage(gf, answer.getIn());

        Calendar cal = GregorianCalendar.getInstance();
        cal.set(1974, Calendar.APRIL, 20);
        answer.getIn().setHeader("birthday", cal.getTime());
View Full Code Here

Examples of org.apache.camel.component.file.GenericFileEndpoint.createExchange()

    public void testTroubleDeletingFile() throws Exception {
        deleteCounter = 0;
        existsCounter = 0;

        GenericFileEndpoint endpoint = context.getEndpoint("file://target/foo", GenericFileEndpoint.class);
        Exchange exchange = endpoint.createExchange();

        GenericFile file = new GenericFile();
        file.setAbsoluteFilePath("target/foo/me.txt");

        GenericFileDeleteProcessStrategy strategy = new GenericFileDeleteProcessStrategy();
View Full Code Here

Examples of org.apache.camel.component.mail.MailEndpoint.createExchange()

    public void send(Collection<Message> emails) {
        if (mailService.isEnabled()) {
            for (Message email : emails) {
                CamelContext context = mailService.getCamelContext();
                MailEndpoint endpoint = (MailEndpoint) context.getEndpoint(mailService.getEndpointUri());
                Exchange exchange = endpoint.createExchange(email);
                template.send("seda:mailUsers?multipleConsumers=true",
                        exchange);
            }
        }
    }
View Full Code Here

Examples of org.apache.camel.component.zookeeper.ZooKeeperEndpoint.createExchange()

            log.info(format("Initializing ZookeeperRoutePolicy with uri '%s'", uri));
        }
        ZooKeeperEndpoint zep = camelContext.getEndpoint(uri, ZooKeeperEndpoint.class);
        zep.getConfiguration().setCreate(true);
        String fullpath = createFullPathToCandidate(zep);
        Exchange e = zep.createExchange();
        e.setPattern(ExchangePattern.InOut);
        e.getIn().setHeader(ZooKeeperMessage.ZOOKEEPER_NODE, fullpath);
        e.getIn().setHeader(ZooKeeperMessage.ZOOKEEPER_CREATE_MODE, CreateMode.EPHEMERAL_SEQUENTIAL);
        template.send(zep, e);
View Full Code Here

Examples of org.apache.camel.impl.DefaultEndpoint.createExchange()

                zipFile = FileUtil.createTempFile(this.filePrefix, this.fileSuffix);
            } catch (IOException e) {
                throw new GenericFileOperationFailedException(e.getMessage(), e);
            }
            DefaultEndpoint endpoint = (DefaultEndpoint) newExchange.getFromEndpoint();
            answer = endpoint.createExchange();
            answer.addOnCompletion(new DeleteZipFileOnCompletion(zipFile));
        } else {
            zipFile = oldExchange.getIn().getBody(File.class);
        }
       
View Full Code Here

Examples of org.apache.qpid.server.exchange.DefaultExchangeFactory.createExchange()

        SecurityManager securityManager = new SecurityManager(mock(Broker.class), false);
        VirtualHost virtualHost = mock(VirtualHost.class);
        when(virtualHost.getName()).thenReturn(hostName);
        when(virtualHost.getSecurityManager()).thenReturn(securityManager);
        DefaultExchangeFactory factory = new DefaultExchangeFactory(virtualHost);
        return factory.createExchange("amp.direct", "direct", false, false);
    }

    public static SimpleAMQQueue createQueue(String queueName, VirtualHost virtualHost) throws AMQException
    {
        SimpleAMQQueue queue = (SimpleAMQQueue) virtualHost.createQueue(UUIDGenerator.generateRandomUUID(), queueName, false, null,
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.