WMQ + CamelBlueprintTestSupport

2015-12-08 Thread web_nab...@sunilsamuel.com
Hello,

I was able to successfully configure Apache Camel 2.12 to listen to a WMQ
queue.  I am able to deploy it into Fuse 6.1 successfully and I get
messages.  I am trying to create some CamelBlueprintTestSupport tests and I
run into the following error:

Failed to create route .. because of Failed to resolve endpoint: ibmmq: ..

I have two XML files within the OSGI-INF/blueprint directory, namely
queue-route.xml and wmq-config.xml as follows:

queue-route.xml :

http://www.osgi.org/xmlns/blueprint/v1.0.0";
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
  
xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.1.0";
   xsi:schemaLocation="
   http://www.osgi.org/xmlns/blueprint/v1.0.0
http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd
   http://camel.apache.org/schema/blueprint
http://camel.apache.org/schema/blueprint/camel-blueprint.xsd";>
   
http://camel.apache.org/schema/blueprint";>
 






wmq-config.xml:

http://www.osgi.org/xmlns/blueprint/v1.0.0";
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.1.0";
xsi:schemaLocation="
   http://www.osgi.org/xmlns/blueprint/v1.0.0
http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd
   http://camel.apache.org/schema/blueprint
http://camel.apache.org/schema/blueprint/camel-blueprint.xsd";>
   































As you will note, the ibmmq is defined (and it in fact works perfectly in
Fuse 6.1)

In my test case, I return the two XML files from the
getBlueprintDescriptor() as follows:

@Override
protected String getBlueprintDescriptor() {
return
"OSGI-INF/blueprint/queue-route.xml,OSGI-INF/blueprint/wmq-config.xml";
}

But my test cases that extends CamelBlueprintTestSupport does not recognize
the 'ibmmq' component.  I know that we can use context.addComponent()
method, but I am not sure how I would do that (or IF I should do that). 
What could I be doing wrong?  Any help will be greatly appreciated.

Thank You,
Sunil




--
View this message in context: 
http://camel.465427.n5.nabble.com/WMQ-CamelBlueprintTestSupport-tp5774845.html
Sent from the Camel Development mailing list archive at Nabble.com.


Camel Kafka Component as a Consumer within a Route

2015-12-23 Thread web_nab...@sunilsamuel.com
Hello,

I am trying to use the kafka component as a consumer from within a route. 
For instance, 

from("timer://foo?fixedRate=true&period=6")
/* Use Kafka to consumer message */
.setHeader("kafka.OFFSET",constant("0"))
.to("kafka:192.168.111.54:9092?topic=test&"+

"zookeeperHost=192.168.111.54&zookeeperPort=2181&"+
"groupId=groupBatch&consumerId=100")
.to("log:input ${body}");

But at this point, the way that I am using it, the kafka component becomes a
producer.  Is there a way to consume from within a route?

thanks,
sunil.




--
View this message in context: 
http://camel.465427.n5.nabble.com/Camel-Kafka-Component-as-a-Consumer-within-a-Route-tp5775404.html
Sent from the Camel Development mailing list archive at Nabble.com.


Re: WMQ + CamelBlueprintTestSupport

2015-12-23 Thread web_nab...@sunilsamuel.com
Hello,

Thank you for the response.  I tried this already and it did not work.  I
will continue to work on this to see if I can figure out what the issue is
and will post if/once I solve this issue in case others run into the same
issue.

Thank You,
sunil.



--
View this message in context: 
http://camel.465427.n5.nabble.com/WMQ-CamelBlueprintTestSupport-tp5774845p5775400.html
Sent from the Camel Development mailing list archive at Nabble.com.


Re: Camel Kafka Component as a Consumer within a Route

2015-12-23 Thread web_nab...@sunilsamuel.com
Hello,

Yes.  Thank you.  We are able to do this with PollEnrich.  The following
route is modified:

from("timer://foo?fixedRate=true&period=1")
.setBody().constant("test")
.setHeader("kafka.OFFSET",constant("smallest"))
.pollEnrich("kafka:192.168.111.54:9092?topic=test&"+

"zookeeperHost=192.168.111.54&zookeeperPort=2181&"+
"groupId=groupBatch",1000)
.log("FROM THE TIMER [${body}]")
;   

Thank You,
sunil.



--
View this message in context: 
http://camel.465427.n5.nabble.com/Camel-Kafka-Component-as-a-Consumer-within-a-Route-tp5775404p5775410.html
Sent from the Camel Development mailing list archive at Nabble.com.


pollEnricher + Kafka + Aggregator

2015-12-24 Thread web_nab...@sunilsamuel.com
Hello,

I am trying to use the pollEnrich to consume messages from a kafka server in
the following manner:

A "timer" based route runs periodically
Use "pollEnrich" with an AggregatorStrategy to get as much messages from the
topic until the pollEnricher expires.

The issues is that the pollEnrich will only get one message at a time, no
matter what type of AggregatorStrategy I use.I saw the following in the
documentation for pollEnrich :
pollEnrich only accept one message as response. That means that if you
target to enrich your original message with the enricher collecting messages
from a seda, ... components using an aggregation strategy. Only one response
message will be aggregated with the original message.
Is there any way that I can get more than one message from kafka in this
manner.
I use the following route:
from("timer://foo?fixedRate=true&period=1") 
.log("IN THE TIMER")
.setHeader("kafka.OFFSET",constant("smallest")) 
.pollEnrich("kafka:192.168.111.54:9092?topic=test&"+
"zookeeperHost=192.168.111.54&zookeeperPort=2181&"+ 
"groupId=groupBatch",   5000L, new 
EnrichAggregatorStrategy()   )   
.beanRef("commonHelper","aggregate").log("FROM THE TIMER 
[${body}]")
The EnrichAggregatorStrategy is a very simple class that extends the
Aggregator Strategy so I will not include that here (unless requested).

Is there any way I can get all the messages that I can within the 5000L time
period?

Thank You,
sunil.



--
View this message in context: 
http://camel.465427.n5.nabble.com/pollEnricher-Kafka-Aggregator-tp5775433.html
Sent from the Camel Development mailing list archive at Nabble.com.

Re: pollEnricher + Kafka + Aggregator

2015-12-24 Thread web_nab...@sunilsamuel.com
Hello,

Forgot to mention that I am using Camel 2.12 (Fuse 6.1).

thanks,
sunil.



--
View this message in context: 
http://camel.465427.n5.nabble.com/pollEnricher-Kafka-Aggregator-tp5775433p5775434.html
Sent from the Camel Development mailing list archive at Nabble.com.


PollEnrich + JPA + setCompletionFromBatchConsumer + aggregator

2016-01-06 Thread web_nab...@sunilsamuel.com
Hello,
I am using Apache Camel 2.12 (Fuse 6.1).  I am trying to use the JPA
consumer to consume from a database at every given interval using a timer. 
I like to consume all of the records that match the search criteria using
the aggregator.  If the JPA consumer is a standalone route, I can use the
aggregate EIP as follows:

from ("jpa://com.cigna.upp.model.CustomerAccount?consumer.nativeQuery=" +   
"SELECT A, B, C, FROM MYTABLE WHERE CLNT_ACCT_NUM='5'" +
"&consumeDelete=false" +"&consumer.delay=6000" +
"&consumer.resultClass=com.myapp.model.CustomerAccount")
.aggregate(constant(true), new GroupedExchangeAggregationStrategy())
.beanRef("jpaRouterHelper","processGroupedExchanges")
.setCompletionFromBatchConsumer(true)
Given the above route, I will get all records that match the search criteria
using the GroupedExchangeAggregationStrategy().  That is, by the time my
bean "jpaRouterHelper.processGroupedExchanges" is called, I can process all
of the Exchanges using the Exchange.GROUPED_EXCHANGE.

I would like to do the same within a pollEnrich.  But there is no way to
tell pollEnrich to set the setCompletionFromBatchConsumer() so that I will
get all of the record.  I can set a timeout on the .pollEnrich(resourceUri,
timeout, aggregationStrategy).  The following is the route that I have:

from ("timer://jpaTimer?fixedRate=true&period=10s") .pollEnrich (   
"jpa://com.cigna.upp.model.CustomerAccount?consumer.nativeQuery=" + 
"SELECT A, B, C, FROM MYTABLE WHERE CLNT_ACCT_NUM='5'" +
"&consumeDelete=false" +
"&consumer.resultClass=com.myapp.model.CustomerAccount",new
GroupedExchangeAggregationStrategy())
.beanRef("jpaRouterHelper","processGroupedExchanges")
How would I get all of the records using the pollEnrich using the completion
from batch consumer?  Or should I be approaching this differently?

Any help is greatly appreciated.

thanks,
sunil.



--
View this message in context: 
http://camel.465427.n5.nabble.com/PollEnrich-JPA-setCompletionFromBatchConsumer-aggregator-tp5775895.html
Sent from the Camel Development mailing list archive at Nabble.com.

dataformat:// Component with JSON

2016-01-26 Thread web_nab...@sunilsamuel.com
Hello,

I am trying to use the dataformat: component to unmarshal a JSON payload.  

The following code works:
from("direct-vm:moxy-unmarshal-json")
.unmarshal("jsonDataformat");

I want to use dataformat: component in the following manner:
from("direct-vm:moxy-unmarshal-json")
.to("dataformat:jsonDataformat:unmarshal");

I have a blueprint bean defined as follows:






For some reason, this dataformat is not found with the
context.resolveDataFormat("jsonDataformat");

That is, the following code from
org.apache.camel.component.dataformat.createEndpoint () return null for df
below.

@Override
protected Endpoint createEndpoint(String uri, String remaining,
Map parameters) throws Exception {
String name = ObjectHelper.before(remaining, ":");
    DataFormat df = getCamelContext().resolveDataFormat(name); 
IS NULL
if (df == null) {
throw new IllegalArgumentException("Cannot find data format with
name: " + name);
}

But if I define an XML data format as follows:




And then use the dataformat: component, everything works fine.

Why is org.apache.camel.model.dataformat.JsonDataFormat not registered as a
dataFormat within the Camel Context?

I am using Camel 2.12.

Any help is greatly appreciated.

Thanks,
Sunil





--
View this message in context: 
http://camel.465427.n5.nabble.com/dataformat-Component-with-JSON-tp5776757.html
Sent from the Camel Development mailing list archive at Nabble.com.


Re: WMQ + CamelBlueprintTestSupport

2016-01-26 Thread web_nab...@sunilsamuel.com
Hi Quinn,

Sorry I did not see this comment.  I configure the /etc folder within JBoss
Fuse to provide this information.  That part is working fine though.

Thanks,
Sunil.



--
View this message in context: 
http://camel.465427.n5.nabble.com/WMQ-CamelBlueprintTestSupport-tp5774845p5776758.html
Sent from the Camel Development mailing list archive at Nabble.com.


Issues with Spring DSL with Splitter + Tokenizer + Header

2016-02-08 Thread web_nab...@sunilsamuel.com
Hello,

I can do the following in Java DSL:
split(header("something").tokenize("\n")).to("something");

But I cannot do the same in Blueprint/Spring DSL:

${header.something}



I get the following error:
Caused by: org.xml.sax.SAXParseException; cvc-complex-type.2.4.a: Invalid
content was found starting with element 'camel:simple'. One of
'{"http://camel.apache.org/schema/blueprint":onException ...

Any help is appreciated.

thanks,
sunil.



--
View this message in context: 
http://camel.465427.n5.nabble.com/Issues-with-Spring-DSL-with-Splitter-Tokenizer-Header-tp5777406.html
Sent from the Camel Development mailing list archive at Nabble.com.