Re: Post Json as an attachment in the Camel Route (blueprint)
Do you mean posting multipart form? This thread may help: http://camel.465427.n5.nabble.com/Camel-2-12-1-How-to-send-Http-post-with-an-attachment-using-ProducerTemplate-td5752217.html On 10/17/2016 03:51 AM, sai wrote: Hello, How can i post Json file as an attachment to the Rest web-service call (https4)? Also, after my Json request hits the web-service, it should return a Json response. I would really appreciate for the help. Please give me the links if possible! Thanks, Sai -- View this message in context: http://camel.465427.n5.nabble.com/Post-Json-as-an-attachment-in-the-Camel-Route-blueprint-tp5788844.html Sent from the Camel - Users mailing list archive at Nabble.com.
[camel-ftp] Can't catch Invalid SFTP port exception
I am trying to handle all the exception use cases of SFTP for logging purposes. In case user has given invalid Port address for sftp server even when using pollStrategy attribute -> 1) We are not able to get the exception back in the code. 2) Exchange comes back null. 3) Associated below code to logger and see the exception logged though. (Partial stack given first; complete exception later) I am intentionally giving wrong PORT () instead of the correct port (22). What are we missing here? Other Cases: - Valid Port - the poll strategy 'begin' & 'commit' are called. - Invalid User or Invalid Password - 'rollback' method is invoked with GenericFileOperationFailedException. Regards, Arpit. Exception: -- org.apache.camel.component.file.GenericFileOperationFailedException: Cannot connect to sftp://d...@test.rebex.net: at org.apache.camel.component.file.remote.SftpOperations.connect(SftpOperations.java:146) at org.apache.camel.component.file.remote.RemoteFileConsumer.connectIfNecessary(RemoteFileConsumer.java:203) at org.apache.camel.component.file.remote.RemoteFileConsumer.recoverableConnectIfNecessary(RemoteFileConsumer.java:171) at org.apache.camel.component.file.remote.RemoteFileConsumer.prePollCheck(RemoteFileConsumer.java:59) at org.apache.camel.component.file.GenericFileConsumer.poll(GenericFileConsumer.java:106) at org.apache.camel.impl.ScheduledPollConsumer.doRun(ScheduledPollConsumer.java:174) at org.apache.camel.impl.ScheduledPollConsumer.run(ScheduledPollConsumer.java:101) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:304) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:178) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:812) Caused by: com.jcraft.jsch.JSchException: timeout: socket is not established at com.jcraft.jsch.Util.createSocket(Util.java:389) at com.jcraft.jsch.Session.connect(Session.java:215) at org.apache.camel.component.file.remote.SftpOperations.connect(SftpOperations.java:118) ... 13 more Sample Program: public class ConsumerTemplateAndSftpIssues { private static final String DIRECT_START = "direct:start"; public static void main(String[] args) throws Exception { BasicConfigurator.configure(); DefaultCamelContext c = new DefaultCamelContext(); SimpleRegistry sr = new SimpleRegistry(); c.setRegistry(sr); sr.put("customPoll", new PollingConsumerPollStrategy(){ @Override public boolean begin(Consumer consumer, Endpoint endpoint) { return true; } @Override public void commit(Consumer consumer, Endpoint endpoint, int polledMessages) { System.out.println(endpoint.getEndpointUri()); } @Override public boolean rollback(Consumer consumer, Endpoint endpoint, int retryCounter, Exception cause) throws Exception { System.out.println(endpoint.getEndpointUri() + " Cause exception with message " + cause.getMessage()); throw cause; } }); RouteBuilder r1 = new RouteBuilder() { @Override public void configure() throws Exception { /* Can't use from("sftp://...;) because business logic triggering */ RouteDefinition from = from(DIRECT_START); /* Processor reads data from sftp -- invalid port test */ from.process(new Processor() { @Override public void process(Exchange exchange) throws Exception { ConsumerTemplate template = exchange.getContext().createConsumerTemplate(); template.start(); try { Exchange ex = template.receive("sftp://test.rebex.net:/?; + "username=demo&" + "password=password&" + "stepwise=false&" + "disconnect=true&" + "reconnectDelay=5000&" + "useList=false&" + "ignoreFileNotFoundOrPermissionError=false&" + "throwExceptionOnConnectFailed=true&" + "fileName=readme.txt&" + "consumer.bridgeErrorHandler=true&" + "autoCreate=false&" + "pollStrategy=#customPoll", 6); if (ex != null && ex.getException() == null) { exchange.getOut().setBody(ex.getIn().getBody(String.class)); } else { System.out.println("EXCHANGE
Post Json as an attachment in the Camel Route (blueprint)
Hello, How can i post Json file as an attachment to the Rest web-service call (https4)? Also, after my Json request hits the web-service, it should return a Json response. I would really appreciate for the help. Please give me the links if possible! Thanks, Sai -- View this message in context: http://camel.465427.n5.nabble.com/Post-Json-as-an-attachment-in-the-Camel-Route-blueprint-tp5788844.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Avro component example
Unfortunately, I can't share work code, but you can check examples from test code: https://github.com/apache/camel/blob/52a739feb9da8acd29067304c7c8356bbc5ef4dd/components/camel-avro/src/test/resources/org/apache/camel/dataformat/avro/springDataFormat.xml Сб, 15 жовт. 2016 о 04:20 owainпише: > Have you a simple example you could share? > > Sent from my iPhone > > > On 15 Oct 2016, at 03:11, Vitalii Tymchyshyn [via Camel] < > ml-node+s465427n5788829...@n5.nabble.com> wrote: > > > > We are using avro quite succesfully. > > > > Чт, 13 жовт. 2016 07:25 користувач owain <[hidden email]> > > пише: > > > > > Hi, > > > > > > Has anyone had any success converting a body (pojo) to an avro message > via > > > the avro component. I have generated the avro serialiser for the avro > > > message bit I am struggling with the documentation and questions > online. I > > > am planning to send the avro message to some other routes via kakfa and > > > avro > > > seems like a good choice to reduce the coupling of the subsequent > routes > > > (services) on the domain model. > > > > > > I am using Blueprint. > > > > > > Thanks, > > > > > > O. > > > > > > > > > > > > > > > -- > > > View this message in context: > > > > http://camel.465427.n5.nabble.com/Avro-component-example-tp5788728.html > > > Sent from the Camel - Users mailing list archive at Nabble.com. > > > > > > > > > If you reply to this email, your message will be added to the discussion > below: > > > http://camel.465427.n5.nabble.com/Avro-component-example-tp5788728p5788829.html > > To unsubscribe from Avro component example, click here. > > NAML > > > > > -- > View this message in context: > http://camel.465427.n5.nabble.com/Avro-component-example-tp5788728p5788833.html > Sent from the Camel - Users mailing list archive at Nabble.com.
Re: http-conf:client not working
Hi helenlok, CXF uses a bus to pick up the configuration from spring, if the camel-cxf endpoint doesn’t have the bus you may have the trouble to set the client configuration from spring. http://willemjiang.blogspot.com (English) http://jnn.iteye.com (Chinese) Twitter: willemjiang Weibo: 姜宁willem On October 14, 2016 at 3:40:18 PM, helenlok (helenlok1...@gmail.com) wrote: > Hi, I'm trying to edit the default timeout for my web service to wait for a > response where it is set with a Thread.sleep for 5000 ms. > > I set the timeout to be 1000 ms using http-conf:client and it suppose to be > timeout in 1000 ms seconds instead but nothing occurs. > > Can someone enlighten me as to what I am doing wrong? > > I had to edit out some of the names of my config file, but everything is > listed below. > > Thanks a lot. > > (Config file below) > > > > > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance; > xmlns:camel="http://camel.apache.org/schema/spring; > xmlns:cxf="http://camel.apache.org/schema/cxf; > xmlns:context="http://www.springframework.org/schema/context; > > xmlns:http-conf="http://cxf.apache.org/transports/http/configuration; > xsi:schemaLocation="http://www.springframework.org/schema/beans > http://www.springframework.org/schema/beans/spring-beans.xsd > http://www.springframework.org/schema/context > http://www.springframework.org/schema/context/spring-context.xsd > http://camel.apache.org/schema/spring > http://camel.apache.org/schema/spring/camel-spring.xsd > http://camel.apache.org/schema/cxf > http://camel.apache.org/schema/cxf/camel-cxf.xsd > http://cxf.apache.org/transports/http/configuration > http://cxf.apache.org/schemas/configuration/http-conf.xsd;> > > > > ConnectionTimeout="1000"/> > > > > > > uri="cxf:http://someservice?dataFormat=PAYLOAD=http://someservice?wsdl&; > > > id="endpointa" /> > > > uri="cxf:http://someservice1?dataFormat=PAYLOAD=http://someservice1?wsdl&; > > > id="endpointb" /> > > > > > > > > > > > > > > > > -- > View this message in context: > http://camel.465427.n5.nabble.com/http-conf-client-not-working-tp5788755.html > > Sent from the Camel - Users mailing list archive at Nabble.com. >