Camel websocket resource URI issue

2017-03-06 Thread Ravindra Godbole
Hi

I have a routebuider with the following configuration.
Only resource URI is different while port is same.
Ideally other clients connecting to newsTopic should get messages published
on this topic only but I found out that they are also getting messages
published on stockQuoteTopic.

On further investigation I found out that memory store used to by sendAll
is shared by all resource uri for a given port in the server.

Looks like this is a bug which needs to be fixed.

   from("activemq:topic:newsTopic").to("websocket://
0.0.0.0:9090/newsTopic?sendToAll=true");
   from("activemq:topic:stockQuoteTopic").to("websocket://
0.0.0.0:9090/stockQuoteTopic?sendToAll=true");


Ouput received from client.

2017-03-06 15:35:15.789:INFO::main: Logging initialized @313ms
Connected to server
Message received from server:
Message received from server:MSFT
Message received from server:CNBC News
Message received from server:BBC News



-- 
- Ravi

*[ View My Youtube Channel ] *

Phone: +91 *98 509 760 91*


Re: Split by message in XML

2017-02-28 Thread Ravindra Godbole
Which version of camel you are using ?

Also expression seems to be missing from your Java DSL as well as XML one
which will split the message into pieces.

Hope you have already looked at these URLs
===
http://camel.apache.org/splitter.html
http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/SplitterTest.java?view=markup

On Tue, Feb 28, 2017 at 5:27 AM, Erol  wrote:

> Hello
>
> I'm writing my routes in XML. Currently, I have a route in DSL
>
> from("direct:operation-1")
> .to("bean:ExportOrdersComponent")
> .split().message()
> .to("bean:RenderOrderComponent")
> .to("bean:SaveOrderComponent")
>
> How should I convert this to XML? I tried
>
> 
> 
> 
> 
> 
> 
> 
> 
>
> But I get an error
>
> Failed to create route operation-1 at: >>> Split[null ->...
>
> Can somebody please help me correctly build XML route?
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.
> com/Split-by-message-in-XML-tp5794534.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>



-- 
- Ravi

*[ View My Youtube Channel ] *

Phone: +91 *98 509 760 91*


Re: Consuming data from external REST service

2017-02-27 Thread Ravindra Godbole
You can try something like this. Include json specific jars as applicable
for the ObjectMapper.

from("direct:getRestFromExternalService")
.to("http4://www.externalRestServiceUri"")
.process(new Processor() {
  public void process(Exchange exchange) throws Exception {

String jsonString = exchange.getIn().getBody(String.class);

ObjectMapper mapper = new ObjectMapper();   // import
com.fasterxml.jackson.databind.ObjectMapper;

   RestObject post = mapper.readValue(jsonString,
RestObject .class);

  }
  })





com.fasterxml.jackson.datatype
jackson-datatype-hibernate5


com.fasterxml.jackson.datatype
jackson-datatype-hppc
${jackson.version}


com.fasterxml.jackson.datatype
jackson-datatype-jsr310


com.fasterxml.jackson.datatype
jackson-datatype-json-org
${jackson.version}





On Mon, Feb 27, 2017 at 5:29 PM, rkmohapatra  wrote:

> Hi,
>
> I am a newbie to Apache Camel.
> I am using Apache Camel 2.18.2 and trying to build an application that
> needs
> to do this
>
> - Make a REST call to fetch data in JSON format. The REST service is
> external to the application where Camel is deployed.
> - Process the JSON data and store in a target database.
>
> As per my understanding from earlier posts, I can use
> camel-http/camel-cxf/camel-jetty for this purpose. Which one I should
> prefer
> from these based on the above requirement?
>
> Also, please point me to an example that I can refer to understand more
> about this.
>
> Thanks,
> Rajesh
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.
> com/Consuming-data-from-external-REST-service-tp5794514.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>



-- 
- Ravi

*[ View My Youtube Channel ] *

Phone: +91 *98 509 760 91*


Facebook component Documentation on website

2017-02-17 Thread Ravindra Godbole
As per the documentation available for this component on the website [
http://camel.apache.org/facebook.html ] , some endpoints are deprecated.

i.e. activities / checkins / interests / location / notes etc

It will be good if document mentions the Facebook API version with which
endpoint will work.

Also looked at the following page and endpoint information is missing

https://github.com/apache/camel/blob/master/components/camel-facebook/src/main/docs/facebook-component.adoc

Which is the source of truth if I have to update the information ?


-- 
- Ravi

*[ View My Youtube Channel ] *

Phone: +91 *98 509 760 91*


Camel and Kafka Example

2017-02-09 Thread Ravindra Godbole
Hi


Examples directory of camel distribution does not have one on Kafka
component.

I have created the same at the following URL:

https://github.com/godbolerr/camel-example-kafka

Is it fine to create a JIRA for the same and attach this as a patch ?



-- 
- Ravi

*[ View My Youtube Channel ] *

Phone: +91 *98 509 760 91*


Re: Kafka Producer Serialization Error

2017-02-08 Thread Ravindra Godbole
I am also not able to understand the error but after this change it works.

.routeId(routeId).marshal().json(JsonLibrary.Jackson,
Map.class).convertBodyTo(String.class)

On Wed, Feb 8, 2017 at 4:26 AM, Webster  wrote:

> I am new to camel and kafka.
> I am using Camel 2.18.2 with Kafka 0.10.1.1
>
> I am getting this error and don't understand why:
> org.apache.kafka.common.errors.SerializationException: Can't convert value
> of class [B to class org.apache.kafka.common.
> serialization.StringSerializer
> specified in value.serializer
>
>
> I have the following route:
> from("direct://toEnrichEmail")
> .routeId(routeId).marshal().json(JsonLibrary.Jackson, Map.class)
> .log(LoggingLevel.INFO, "Sending to Kafka: ${body}")
> .to("kafka:localhost:9092?topic=enrich-email&requestRequiredAcks=-1");
>
> The code that actually sends to the route:
> ProducerTemplate template = kafkaProducerFactory.
> getProducerTemplate();
> logger.debug("Sending message type: {}, to uri: {}, route:
> {}",
> wimsConfiguration.getMessageType(),
> wimsConfiguration.getDirectUri(),
> wimsConfiguration.getRouteName());
> Mapheaders = new HashMap<>(); // added
> because the examples
> do
> headers.put(KafkaConstants.PARTITION_KEY, 0);
> headers.put(KafkaConstants.KEY, "1");
> template.sendBodyAndHeaders(wimsConfiguration.
> getDirectUri(),
> wimsConfiguration.getWimsMessage(), headers);
>
>
> The log message in the route shows that the message is a proper JSON
> string,
> the default serializer is string, So why is it complaining that it cannot
> serialize?
>
> I looked through the camel kafka component test cases and this looks like
> it
> should work
>
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.
> com/Kafka-Producer-Serialization-Error-tp5793630.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>



-- 
- Ravi

*[ View My Youtube Channel ] *

Phone: +91 *98 509 760 91*


Re: Camel for ETL batch jobs

2016-10-06 Thread Ravindra Godbole
Yes. We r using camel routes to process etl batch.
On Sep 29, 2016 2:10 PM, "contactreji"  wrote:

> Hi Friends
>
> Has anyone attempted to write some etl batch jobs using Apache Camel? With
> multiple source data joins as stuff? Will it be sane to even attempt it
> with
> Apache Camel. I know apache camel is built for a different purpose though
> ;-)
>
> Reji
>
>
>
> -
> Reji Mathews
> Sr. Developer - Middleware Integration / SOA ( Open Source - Apache Camel
> & Jboss Fuse ESB | Mule ESB )
> LinkedIn - http://in.linkedin.com/pub/reji-mathews/31/9a2/40a
> Twitter - reji_mathews
> --
> View this message in context: http://camel.465427.n5.nabble.
> com/Camel-for-ETL-batch-jobs-tp5788183.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>


Re: Camel Large File Processing Issues

2016-04-17 Thread Ravindra Godbole
Have u tried this route ?

from("file://src/data?readLock=changed&readLockCheckInterval=1500").marshal().string("UTF-8")
.split(body().tokenize("\n"))
.streaming().setHeader("xxx", constant("xxx"))
.aggregate(header("xxx"), new
StringBodyAggregator()).completionSize(100).completionTimeout(1500)
.process(new Processor() {
public void process(Exchange exchange) throws Exception {
// Process your batch here send it to kafka or whatever...
}

});


On Mon, Apr 18, 2016 at 11:34 AM, h0mer  wrote:

> That's sort of the problem.  It seems I can't even do a
> marshal().string("UTF-8") before the split as it seems to run out of heap
> space.
>
> Here's what I've tried:
>
> public void configure() throws Exception {
> from(ftpToKafkaObj.getFtpEndpoint())
> .marshal().string("UTF-8")
> .split(body().tokenize("\n"))
> .streaming()
> .process(new FtpToLocalFileProcessor())
> .routeId("ROUTEID: " + ftpToKafkaObj.getRouteId())
> .aggregate(constant(true),batchAggregationStrategy())
> .completionPredicate(batchSizePredicate())
> .to(ftpToKafkaObj.getKafkaEndpoint())
> .end();
> }
>
> Now the above also throws an OOME as the "marshal().string("UTF-8")" line
> above tries to convert the entire object to a string.
>
> If I remove the "marshal().string("UTF-8")" line above, it goes through,
> but
> the exchange does not receive the content of the file, but rather just the
> file name and some other information (like my original post above states).
> Keep in mind that this is a 3gig file with about 7 million lines (apache
> log
> file).
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/Camel-Large-File-Processing-Issues-tp5781221p5781236.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>



-- 
- Ravi

*[ View My Youtube Channel ] *

Phone: +91 *98 509 760 91*


Re: timer reschedule / loop between routes

2016-01-10 Thread Ravindra Godbole
Can you maintain a persistent state for directcaller ? If you can do that


1. Timer always executes at predefined interval [ 1 sec or whatever
2. direct:apiCaller maintains a state STARTED, INPROGRESS, FINISHED.
3. if next call from timer sees that state is INPROGRESS then nothing
happens. If it is FINISHED then new execution started.

-Ravi


On Fri, Jan 8, 2016 at 7:17 PM, zappee  wrote:

> Hi,
>
> I am new in Apache Camel and have an interesting scenario. Could you please
> help me?
>
> My current route looks like this:
> (1) mainRoute > timer://xxx?period=1, to: "direct:apiCaller"
> (2) apiCaller > retrieve data from restapi, to: "direct:persistData"
> (3) persistData > save data to database
>
> So every x second a restapi is called and the received data is persisted.
> It
> works fine. But I need to call the restapi continuously until it receives
> an
> empty answer in the rest response so I need to do a loop with (2) and (3)
> steps. And then if there is no more data at moment then have to wait till
> the next timer event is fired to start downloading the newcomer data if we
> have.
>
> So my route needs to do this:
> (1) route1 > timer://xxx?period=1, to: "direct:apiCaller"
> --> do
> (2) apiCaller > retrieve data from restapi, to: "direct:persistData"
> (3) persistData > save data to database
> --> while (answer of restapi is empty)
>
> My first idea was to reschedule the timer from 1 minutes to 1 sec in case
> of
> I have more data to download. And when we do not have more data to download
> then reschedule my timer from 1 sec to 1 min just because of wait till a
> little bit.
>
> But I am not able to reschedule the timer runntime so it needs to be some
> different solution to handle my use case.
>
> What is the best way to reach my target?
>
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/timer-reschedule-loop-between-routes-tp5776017.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>



-- 
- Ravi

*[ View My Youtube Channel ] *

Phone: +91 *98 509 760 91*


Re: Read emails

2015-07-10 Thread Ravindra Godbole
Can you have a look at this example I have uploaded.

https://github.com/godbolerr/camel-example-mail



On Fri, Jul 10, 2015 at 7:15 PM, bbenny93  wrote:

> Hi, thank you for your reply.
>
> I had already allowed imap in gmail. I tried with a yahoo address too but
> it's not working either, I don't know what I'm doing wrong.
>
> Also I've tried this to send an email... not working either :(
> I wrote this:
> from("file:data/inbox").setHeader("subject",constant("coucou")).to("smtp://
> smtp.gmail.com?username=emailt...@gmail.com&password=xx");
>
> I'm sorry to bother you if what I ask is really obvious.
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/Read-emails-tp5769085p5769096.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>



-- 
- Ravi

*[ View My Youtube Channel

]*

Phone: +91 *98 509 760 91*


Re: tail logging- How to know parent endpoint from child exchange.

2015-06-18 Thread Ravindra Godbole
Controbus component enables you to have a look at route specific stats.
Have you looked at the same ?

http://camel.apache.org/controlbus.html

Not sure it will address your parent child relationship as each route
considered separately in camel.





On Fri, Jun 19, 2015 at 1:58 AM, Amit  wrote:

> I would like to print tail log at end of the request with elapsed time as
> below. Is in Apache Camel any way
> we can know the parent end point. So we maintain the Parent-child relation
> ship as below.
>
> Trail log:
>
> -servlet:///jaxrsExample?matchOnUriPrefix=true  took 20 ms
> --cxfbean:jaxrsServices took 10 ms
> --helloworldtook  5ms
> --direct:start  took   5ms
> ---helloworld-13 ms
> ---helloworld-23ms
>
>
> Parent route
> ===
> http://camel.apache.org/schema/spring"; trace="true">
> 
>   
>   
>   
> 
>
> Child route
> 
>  http://camel.apache.org/schema/spring"; trace="true">
> 
> 
> 
> 
>
>
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/tail-logging-How-to-know-parent-endpoint-from-child-exchange-tp5768373.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>



-- 
- Ravi

*[ View My Youtube Channel

]*

Phone: +91 *98 509 760 91*


Re: https4 2.15.2 not recognizing my httpClientConfigurer endpoint option

2015-06-08 Thread Ravindra Godbole
It looks like you are not setting the httpClientBuilder argument with your
ssl configuration. Can you have a relook at the method configureHttpClient
you have overridden ?



--
View this message in context: 
http://camel.465427.n5.nabble.com/https4-2-15-2-not-recognizing-my-httpClientConfigurer-endpoint-option-tp5767922p5767993.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Camel Restlet

2015-06-08 Thread Ravindra Godbole
Hi

You will have to parse the query string yourself.

In order to get the values in header and use the api to get the same, you
will have to set the endpoint uri correctly.

For example

http://0.0.0.0:8181/cars/100/{color}/{year}?httpMethods=get,post"/>

If your request is like this ...

http://0.0.0.0:8181/cars/100/red/2004, then you can access the values in
code like this..

String color = exchange.getIn().getHeader("color", String.class);
String year = exchange.getIn().getHeader("year", String.class);




For more details refer to https://camel.apache.org/restlet.html



On Mon, Jun 8, 2015 at 11:54 PM, contactreji  wrote:

> Hi
>
> I am trying to do a POC using camel-restlet component. I was wondering if I
> use something like follows
>
> 
> http://0.0.0.0:8181/cars/100?httpMethods=get,post"/>
> 
> 
>
> Suppose I hit the endpoint with
> *http://localhost:8181/cars/100?color=red&model=2015* with a http GET
> method, how do I access the *color=red* data in camel exchange. where does
> it get stored?
> When i print the camel header CamelHttpQuery, I can see it printint as
> color=red&model=2015. Is there any way i can have 2 separate headers in
> camel exchange named color, model populated with red,2015 respectively?
>
> Cheers
> Reji
>
>
>
> -
> Reji Mathews
> Sr. Developer - Middleware Integration / SOA ( Open Source - Apache Camel
> & Jboss Fuse ESB | Mule ESB )
> LinkedIn - http://in.linkedin.com/pub/reji-mathews/31/9a2/40a
> Twitter - reji_mathews
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/Camel-Restlet-tp5767988.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>



-- 
- Ravi

*[ View My Youtube Channel

]*

Phone: +91 *98 509 760 91*


Re: Is there any way to unschedule the Camel quartz job

2015-06-05 Thread Ravindra Godbole
To use controlbus you need to identify/name your route. Your from
definition will look like this

from("quartz://myGroup/everyMinute?cron=0+0/1+*+*+*+?
&stateful=true).routeId("stopThisRoute").
.to("stream:out")/

If you dont plan to use the controlbus, then in the current stopRoute
method you can stop the route with following lines.

context.stopRoute("stopThisRoute");




On Fri, Jun 5, 2015 at 11:02 PM, Andrew Block  wrote:

> Take a look at the Control Bus [1] which provides the functionality to
> start/stop routes from another route.
>
> - Andy
>
> [1] - http://camel.apache.org/controlbus.html
>
> --
> Andrew Block
>
>
> On June 5, 2015 at 11:41:24 AM, Akram (akram.s...@gmail.com) wrote:
>
> I am triggering the quartz cron scheduler in one route. The requirement is
> to
> stop/remove the scheduled quartz job from another route. I have tried the
> below code but in vain.
> //Quartz route
> /from("quartz://myGroup/everyMinute?cron=0+0/1+*+*+*+?&stateful=true)
> .to("stream:out")/
>
> //Another route to stop the quartz scheduler
> /from("restlet:/stopquartz?restletMethod=GET")
> .beanRef("processor", "StopRoute")
> .to("stream:out");/
>
> //Stop Route method
> /public void stopRoute(Exchange exchange) throws Exception {
> CamelContext context = exchange.getContext();
> ServiceStatus status =
> context.getRouteStatus(exchange.getIn().getHeader(ROUTE_NAME).toString());
> if (!(status == ServiceStatus.Stopped || status ==
> ServiceStatus.Stopping)) {
> context.stopRoute(ROUTE_NAME);
>
> exchange.getOut().setBody(context.getRouteStatus(exchange.getIn().getHeader(ROUTE_NAME).toString()));
> }else{
> exchange.getOut().setBody(ROUTE_NAME+" is already in stopped
> state");
>
> }
> }/
>
> Quartz route is not stopping and Scheduled job is still running.
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/Is-there-any-way-to-unschedule-the-Camel-quartz-job-tp5767916.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>



-- 
- Ravi

*[ View My Youtube Channel

]*

Phone: +91 *98 509 760 91*


Re: How to handle exception within consumer?

2015-06-03 Thread Ravindra Godbole
Have you tried catching RuntimeCamelException while making a call.

http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/ConsumerTemplate.html


Re: Caching the upstream queue

2015-06-02 Thread Ravindra Godbole
Camel stores information in various headers and information related to
original queue can be captured from the same. Based on the scenario/use
case this information can be used dynamically as well to route the message
[ Routing slip EIP ]. Is this what you are looking for ?  It will be great
if you can explain your use case with respect to camel in detail.



On Tue, Jun 2, 2015 at 3:41 PM, mohanradhakrishnan <
mohan.radhakrish...@cognizant.com> wrote:

> I am new to EIP. Recently I came across code that serializes
> com.ibm.mq.jms.MQQueue. This is done in order to remember which queue to
> post to when the downstream queues - there are multiple layers of queues -
> respond later.
>
> Can someone help me understand how an integration framework caches or
> figures out which queue originated the message ? This message is passed on
> to another queue and so on. Later we receive the response and post it back
> to the originating queue.
>
> What EIP pattern covers this ? Any Camel sample ?
>
> Thanks,
> Mohan
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/Caching-the-upstream-queue-tp5767790.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>



-- 
- Ravi

*[ View My Youtube Channel

]*

Phone: +91 *98 509 760 91*


Re: Camel File Write per 5 minute

2015-05-28 Thread Ravindra Godbole
Have you explored delayer option. ?

http://camel.apache.org/delayer.html


On Fri, May 29, 2015 at 10:12 AM, Vanshul.Chawla 
wrote:

> Hello,
>
> We have a Camel context wherein we are writing file per minute.
>
> uri="file:src/output?fileName=XXX_${date:now:MMddhhmm}_1.txt&fileExist=Append"
> />
>
> Is there a way we can have a file per 5 minute without writing any extra
> code?
>
>
> Thanks and Regards,
>
> Vanshul Chawla
>
>


-- 
- Ravi

*[ View My Youtube Channel

]*

Phone: +91 *98 509 760 91*


Re: FTP Downloading get corrupted files

2015-05-27 Thread Ravindra Godbole
You can write bean to do the checksum. It will throw exception and the file
will not be downloaded. Off course you will have to take care of ' how many
times to retry logic ' !

Like 

   
ftp://t...@xx.xx.xx.xx
?password=test&binary=true&delay=6000&move=.done"/>
 
 

  


On Wed, May 27, 2015 at 6:19 PM, Copernico  wrote:

> Hi!
>
> I'm using Camel FTP2 to download ZIP files from remote ftp server.
> Sometimes, downloaded files get corrupted. This occurs randomly. I know
> they
> are corrupted because when i try to unzip their content and i get an error
> during extraction. But when i download the same file with a ftp client like
> FileZilla or another, i can extract the content without trouble. There is a
> way to check (md5 checksum for example) if downloaded files are OK? and in
> case aren't ok: how do i retry the download?
>
> Thanks  regards
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/FTP-Downloading-get-corrupted-files-tp5767530.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>



-- 
- Ravi

*[ View My Youtube Channel

]*

Phone: +91 *98 509 760 91*