Package org.apache.camel

Examples of org.apache.camel.Message


            getEndpoint().getS3Client().abortMultipartUpload(new AbortMultipartUploadRequest(
                    getConfiguration().getBucketName(), keyName, initResponse.getUploadId()));
            throw e;
        }

        Message message = getMessageForResponse(exchange);
        message.setHeader(S3Constants.E_TAG, uploadResult.getETag());
        if (uploadResult.getVersionId() != null) {
            message.setHeader(S3Constants.VERSION_ID, uploadResult.getVersionId());
        }

        if (getConfiguration().isDeleteAfterWrite() && filePayload != null) {
            FileUtil.deleteFile(filePayload);
        }
View Full Code Here


            endpoinVerifier.setOutputXmlEncoding(null);
        }
    }

    private void checkBodyContains(MockEndpoint mock, String expectedPartContent) {
        Message message = getMessage(mock);
        String body = message.getBody(String.class);
        assertNotNull(body);
        assertTrue("The message body " + body + " does not contain the expected string " + expectedPartContent,
                body.contains(expectedPartContent));
    }
View Full Code Here

                body.contains(expectedPartContent));
    }

    private Object checkXpath(MockEndpoint mock, String xpathString, final Map<String, String> prefix2Namespace)
        throws XPathExpressionException, SAXException, IOException, ParserConfigurationException {
        Message mess = getMessage(mock);
        InputStream body = mess.getBody(InputStream.class);
        assertNotNull(body);
        XPathFactory xpathFactory = XPathFactory.newInstance();
        XPath xpath = xpathFactory.newXPath();
        NamespaceContext nc = new NamespaceContext() {
View Full Code Here

        PutObjectResult putObjectResult = getEndpoint().getS3Client().putObject(putObjectRequest);

        LOG.trace("Received result [{}]", putObjectResult);

        Message message = getMessageForResponse(exchange);
        message.setHeader(S3Constants.E_TAG, putObjectResult.getETag());
        if (putObjectResult.getVersionId() != null) {
            message.setHeader(S3Constants.VERSION_ID, putObjectResult.getVersionId());
        }

        if (getConfiguration().isDeleteAfterWrite() && filePayload != null) {
            IOHelper.close(putObjectRequest.getInputStream());
            FileUtil.deleteFile(filePayload);
View Full Code Here

    private Message getMessage(MockEndpoint mock) {
        List<Exchange> exs = mock.getExchanges();
        assertNotNull(exs);
        assertEquals(1, exs.size());
        Exchange ex = exs.get(0);
        Message mess = ex.getIn();
        assertNotNull(mess);
        return mess;
    }
View Full Code Here

        return storageClass;
    }

    private Message getMessageForResponse(final Exchange exchange) {
        if (exchange.getPattern().isOutCapable()) {
            Message out = exchange.getOut();
            out.copyFrom(exchange.getIn());
            return out;
        }

        return exchange.getIn();
    }
View Full Code Here

        final int result = client.kick(jobs);
        if (LOG.isDebugEnabled()) {
            LOG.debug(String.format("Kick %d jobs. Kicked %d actually.", jobs, result));
        }

        final Message answer = getAnswerMessage(exchange);
        answer.setBody(result, Integer.class);
    }
View Full Code Here

        super(endpoint);
    }

    @Override
    public void act(final Client client, final Exchange exchange) throws NoSuchHeaderException {
        final Message in = exchange.getIn();

        final Long jobId = BeanstalkExchangeHelper.getJobID(exchange);
        final long priority = BeanstalkExchangeHelper.getPriority(endpoint, in);
        final int delay = BeanstalkExchangeHelper.getDelay(endpoint, in);
View Full Code Here

        super(endpoint);
    }

    @Override
    public void act(final Client client, final Exchange exchange) throws NoSuchHeaderException {
        final Message in = exchange.getIn();

        final long priority = BeanstalkExchangeHelper.getPriority(endpoint, in);
        final int delay = BeanstalkExchangeHelper.getDelay(endpoint, in);
        final int timeToRun = BeanstalkExchangeHelper.getTimeToRun(endpoint, in);

        final long jobId = client.put(priority, delay, timeToRun, in.getBody(byte[].class));
        if (LOG.isDebugEnabled()) {
            LOG.debug(String.format("Created job %d with priority %d, delay %d seconds and time to run %d", jobId, priority, delay, timeToRun));
        }

        answerWith(exchange, Headers.JOB_ID, jobId);
View Full Code Here

    public DefaultCommand(BeanstalkEndpoint endpoint) {
        this.endpoint = endpoint;
    }

    protected Message getAnswerMessage(final Exchange exchange) {
        Message answer = exchange.getIn();
        if (ExchangeHelper.isOutCapable(exchange)) {
            answer = exchange.getOut();
            // preserve headers
            answer.getHeaders().putAll(exchange.getIn().getHeaders());
        }
        return answer;
    }
View Full Code Here

TOP

Related Classes of org.apache.camel.Message

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.