Problem with REST DSL (2.14.0) and String bean

2014-11-10 Thread Vaïsse-Lesteven Arthur
Hi everyone, 

I'm currently trying the new REST DSL of the Apache Camel 2.14.0 release.
And as the title of this post state it, I got problems with a bean that
specify a file name. Let's show what's wrong.

Here come a valid XML file reduced to a test case. It only define a String
bean and a Camel context containing a rest endpoint and a single route
called by the rest endpoint.
___

http://www.springframework.org/schema/beans";
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
xsi:schemaLocation="http://www.springframework.org/schema/beans

http://www.springframework.org/schema/beans/spring-beans-3.0.xsd

http://camel.apache.org/schema/spring

http://camel.apache.org/schema/spring/camel-spring.xsd";
>





http://camel.apache.org/schema/spring";>


  







  





${headers.words}






___

To load and test this Camel context I use the following test case : 
___
import org.apache.camel.CamelContext;
import org.springframework.context.support.FileSystemXmlApplicationContext;

public class Test {
@org.junit.Test
public void testT() throws Exception {
final FileSystemXmlApplicationContext bean = new
FileSystemXmlApplicationContext("src/test/resources/camelContext.xml");
final CamelContext context = bean.getBean("camelContext",
CamelContext.class);
context.start();
Thread.yield();
Thread.sleep(60);
}
}
___

It currently lead to the following error :
/org.apache.camel.RuntimeCamelException:
org.apache.camel.FailedToCreateRouteException: Failed to create route route2
at: >>> RestBinding <<< in route:
Route(route2)[[From[rest:get:/rest-api/:/{words}/?produces=a... because of
Provider com.sun.xml.bind.v2.ContextFactory could not be instantiated:
javax.xml.bind.JAXBException: "file" ne contient pas ObjectFactory.class ou
jaxb.index/

It seems that removing the bean  declaration OR the rest endpoint
declaration solve the problem, there is so an incompatibility between them,
but, as a Camel newbie, I'm unable to figure out what is the problem.

Can someone give me clues ? Do I'm doing something wrong ?

Thanks in advance,
Arthur.



--
View this message in context: 
http://camel.465427.n5.nabble.com/Problem-with-REST-DSL-2-14-0-and-String-bean-tp5758812.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Proxying RESTful service using the REST DSL :Camel 2.14.0

2014-11-10 Thread zeecamel
I am new to Camel, I want to proxy my RESTful webservice so I can provide
additional output formats on top of json and xml. I then used the REST dsl
for this and RestConfiguration component is "jetty". My Real webservice uses
JaxB and Jackson httpconvertters. At the moment I was just doing a
passthrough service no transformations.

The call comes in, and get forwarded to the real webservice, the service
returns the correct response whether xml or inputstream with xml data, but
the it is not returned to the caller. If I use normal routes the caller get
the response correctly.
Spring DSL(Part of):
 

  http://localhost:8080/api-service-rest/users/6/0?bridgeEndpoint=true&throwExceptionOnFailure=true";
 
/>
   


Normal route works:

http://ZARDPLPT6014:1101/test"; />
http://localhost:8080/api-service-rest/users/6/0?bridgeEndpoint=true&throwExceptionOnFailure=false";
 
/>




--
View this message in context: 
http://camel.465427.n5.nabble.com/Proxying-RESTful-service-using-the-REST-DSL-Camel-2-14-0-tp5758813.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Problem with REST DSL (2.14.0) and String bean

2014-11-10 Thread Claus Ibsen
Hi

Errors like that smells like mixed versions of Camel JARs on the
classpath etc. So I suggest to double check that all the camel JARs
are the same version. And also for Spring JARs.

On Mon, Nov 10, 2014 at 9:10 AM, Vaïsse-Lesteven Arthur
 wrote:
> Hi everyone,
>
> I'm currently trying the new REST DSL of the Apache Camel 2.14.0 release.
> And as the title of this post state it, I got problems with a bean that
> specify a file name. Let's show what's wrong.
>
> Here come a valid XML file reduced to a test case. It only define a String
> bean and a Camel context containing a rest endpoint and a single route
> called by the rest endpoint.
> ___
> 
>  xmlns="http://www.springframework.org/schema/beans";
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
> xsi:schemaLocation="http://www.springframework.org/schema/beans
> 
> http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
> 
> http://camel.apache.org/schema/spring
> 
> http://camel.apache.org/schema/spring/camel-spring.xsd";
>>
>
> 
>  value="file:/opt/a/directory/data/audio" />
> 
>
>  xmlns="http://camel.apache.org/schema/spring";>
>
> 
>unmarshalTypeName="org.apache.camel.component.jackson.TestPojo"/>
> 
>
>  port="5117" />
>
> 
>  produces="application/json">
> 
> 
> 
>
> 
> 
> 
> ${headers.words}
> 
> 
>
> 
>
> 
> ___
>
> To load and test this Camel context I use the following test case :
> ___
> import org.apache.camel.CamelContext;
> import org.springframework.context.support.FileSystemXmlApplicationContext;
>
> public class Test {
> @org.junit.Test
> public void testT() throws Exception {
> final FileSystemXmlApplicationContext bean = new
> FileSystemXmlApplicationContext("src/test/resources/camelContext.xml");
> final CamelContext context = bean.getBean("camelContext",
> CamelContext.class);
> context.start();
> Thread.yield();
> Thread.sleep(60);
> }
> }
> ___
>
> It currently lead to the following error :
> /org.apache.camel.RuntimeCamelException:
> org.apache.camel.FailedToCreateRouteException: Failed to create route route2
> at: >>> RestBinding <<< in route:
> Route(route2)[[From[rest:get:/rest-api/:/{words}/?produces=a... because of
> Provider com.sun.xml.bind.v2.ContextFactory could not be instantiated:
> javax.xml.bind.JAXBException: "file" ne contient pas ObjectFactory.class ou
> jaxb.index/
>
> It seems that removing the bean  declaration OR the rest endpoint
> declaration solve the problem, there is so an incompatibility between them,
> but, as a Camel newbie, I'm unable to figure out what is the problem.
>
> Can someone give me clues ? Do I'm doing something wrong ?
>
> Thanks in advance,
> Arthur.
>
>
>
> --
> View this message in context: 
> http://camel.465427.n5.nabble.com/Problem-with-REST-DSL-2-14-0-and-String-bean-tp5758812.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-
Red Hat, Inc.
Email: cib...@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
hawtio: http://hawt.io/
fabric8: http://fabric8.io/


Re: [HEADS UP] - camel-scr for OSGi with pure Java in Camel 2.15

2014-11-10 Thread Christian Schneider

I just looked into the camel-scr component.

If found some design issues:

- Why do we need to @Reference to ComponentResolver. I think we should 
do this under the covers so the user does not have to configure it himself.

The easiest way would probably be to do this using plain OSGi APIs.

- It seems the context start is delayed when additional components are 
found. This seems to be a bit fragile as the delay means we can miss 
components.
In the case of camel blueprint we go into GracePeriod and specify which 
component we are missing. For SCR I think the correct way would be to 
only start after all required components are present. Not sure if this 
is easy to do though. In any case I think the problem of depending on 
components and only starting once they are there is a general problem 
that should be solved outside camel blueprint or camel scr.


- If component auto detection does not work we could create a custom 
camel annotation @RequiresComponent("") and 
@RequiresCompoents. So people could annotate their concrete context 
class with all components they need.


- I think the direct injection of properties into RouteBuilders should 
not be done. Or at least not by default. Instead I would by default let 
the user do the injection in getRouteBuilders. At least we could use the 
@Inject annotation to mark properties that are meant for injection 
perhaps even with @Named so the user can specify the name.


I can help with implementing some of my proposals. I will wait for more 
comments and discussions though.


Christian


On 09.11.2014 09:42, Claus Ibsen wrote:

Hi

There is a great contribution for a new camel-scr module that allows
end users to use OSGi declarative services instead of spring-dm /
blueprint.

The code has just been pushed to master branch, but there is still
some work to finish and polish the code.

But I wanted to bring this to attention, so we can have more eyes on
this - especially for the OSGi folks.

The JIRA ticket is, with some bullets to look at:
https://issues.apache.org/jira/browse/CAMEL-7997

And the code is in the camel-scr module. And there is a camel-scr
feature to install the module.








--
Christian Schneider
http://www.liquid-reality.de

Open Source Architect
http://www.talend.com



Re: Camel's tps

2014-11-10 Thread Walzer, Thomas
Hi Frans,

first of all it would have helped if you included a link to the mentioned 
presentation instead of letting us search for it ourselves:
http://de.slideshare.net/JBossArchitectForum/jboss-fuse-invodafone?qid=bbceab91-7904-447c-9a77-1eef3efd2910&v=qf1&b=&from_search=1

The tps will vary with you use case. It depends on the systems in your routes 
and how you wire them together.
If you just do http like Vodafone you can expect more tps than when you do 
process files, make lookups in SAP, and wire multiple database transactions.

There are countless options in Camel to increase your throughput and scale your 
solution. Sometimes involving trade-offs. But without use case this is futile 
and arbitrary.

Cheers, Thomas.

Am 09.11.2014 um 14:08 schrieb Frans Thamura 
mailto:fr...@meruvian.org>>:

Hi all

Reading the Vodafone presentation in slideshare.net 
regarding Fuse and
jboss and netty confuse me.

Anyone have a case regarding camel in tps,  transaction persecond,

Does this tps case relevant in route?

Frans



Re: Strange issue with JDBC add Postgres

2014-11-10 Thread Tim Dudgeon
I dug a bit deeper here and I think that Camel is doing something with 
the connection, possibly related to autoCommit.
I worked around the problem by writing my own Processor that sets 
autoCommit to false, sets maxRows on the statement and then iterates 
through the ResultSet and a cursor does seem to be used as expected.
But trying to do the same with the Camel JDBC component fails for 
reasons described earlier.


Tim

On 06/11/2014 18:57, Claus Ibsen wrote:

So maybe its your maxRows=1000 that is the problem, so when you are
trying to get rows > 1000 then it throws that exception.

What is your use case? You want to select * from a table, but only the
first 1000 rows?

On Wed, Nov 5, 2014 at 10:05 PM, Tim Dudgeon  wrote:

On 05/11/2014 19:07, Claus Ibsen wrote:

maxRowSize ??? do you mean fetchSize?


Sorry, I mean maxRows (as in the example here:
http://camel.apache.org/jdbc.html).
So something like:

.to('jdbc:myDataSoruce?outputType=StreamList&statement.fetchSize=100&statement.maxRows=1000')



Also which version of Camel do you use?


2.14

Tim








Re: Configuring hibernate with blueprint in karaf

2014-11-10 Thread Aryan
Hi,

We also tried to use the latest karaf version(3.0.2) and using hibernate
version as 4.2.15.Final but still same issue.

Any ideas?

Thanks,
Aryan



--
View this message in context: 
http://camel.465427.n5.nabble.com/Configuring-hibernate-with-blueprint-in-karaf-tp5758588p5758835.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Custom ShutdownStrategy to persist inflight exchanges?

2014-11-10 Thread Carsten

Hi all,

I'm thinking about implementing a custom ShutdownStrategy to persist 
inflight exchanges to disk (or database). The reason for this is that we 
can't rely on a Messaging middleware to take care of the persistence, 
but we want to be able to shutdown routes without loosing those inflight 
exchanges.


Is anyone doing something like this?

My initial thought was this:

In my custom ShutdownStrategy I persist the inflight exchanges of one 
route to a directory in the local filesystem on shutdown, going for a 
fast shutdown. When the application comes up again, one route is 
listening for files in that directory and picking up previously stored 
messages again, deleting the files after they are handed over to the 
original route. If there are inflight exchanges on the 2nd route when 
receiving a shutdown, that inflight exchanges can be discarded.


I'd appreciate any feedback if someone is already doing this kind of 
shutdown or if I should avoid going down this path.



thanks,

Carsten


Issue with in-out pattern

2014-11-10 Thread cesar.tl
Hi, 

we are trying to use the in-out pattern with the following route: 






  

We have an MDB listening to queue1. This beans reads the bytes of the file,
makes some modifications and then sends the bytes back with a ByteMessage
(the MDB does set the replyTo destination and the CorrelationID). 

If we don't attempt to edit the name of the file: 

  public void sendByteMessage(final byte[] bytes, final Message onReplyOf)
throws JMSException { 
log.info("Sending message"); 
JmsTemplate jmsTemplate = new JmsTemplate(connectionFactory); 
MessageCreator msgCreator = new MessageCreator() { 
@Override 
public Message createMessage(Session session) throws
JMSException { 
BytesMessage msg = session.createBytesMessage(); 
msg.setJMSCorrelationID(onReplyOf.getJMSCorrelationID()); 
msg.writeBytes(bytes); 
return msg; 
} 
}; 
jmsTemplate.send(onReplyOf.getJMSReplyTo(), msgCreator); 
} 

this works as expected. A file dropped in the input folder is consumed, and
a new file is created in the output folder. The  name of the file in the
output folder is the transaction id (as it is explained in the Camel
documentation). 

However when we try to modify the name of the output file from the MDB by
doing the following: 

msg.setStringProperty("camelFileName", "new.txt"); 

we get an error in Camel: 
org.apache.camel.component.file.GenericFileOperationFailedException: Cannot
create directory: \.camel (could be because of denied permissions) 

We are using Camel 2.12, ActiveMq-camel 5.8 




--
View this message in context: 
http://camel.465427.n5.nabble.com/Issue-with-in-out-pattern-tp5758840.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Camel Aggregator: how to stop route on first failed Message

2014-11-10 Thread srikarn
Hi,

I have setup my aggregator as follows. 

LevelDBAggregationRepository repository = new
LevelDBAggregationRepository(REPO_NAME, repoLocation+"/"+REPO_NAME+".dat");
repository.setUseRecovery(true);
repository.setMaximumRedeliveries(3);
repository.setRecoveryInterval(3000);
repository.setDeadLetterUri("mock:dead");

from(UPDATE_ENDPOINT)
.aggregate(header("fileId"), new
ESSessionAggregationStrategy()) // aggregates into an arraylist
.aggregationRepository(repository)
.completionPredicate(constant(false))
.to("es://bulk") // my elasticsearch component

I am flushing all the aggregates by sending a message with the header
Exchange.AGGREGATION_COMPLETE_ALL_GROUPS=true.

If elasticsearch component is not available, I would like to stop the route
with all messages in the repository. Is there any way to do this?



--
View this message in context: 
http://camel.465427.n5.nabble.com/Camel-Aggregator-how-to-stop-route-on-first-failed-Message-tp5758837.html
Sent from the Camel - Users mailing list archive at Nabble.com.


how to process json and dispatch to several processors

2014-11-10 Thread gmh
All,
I have a simple use case I am trying to implement.
We will be receiving data from websocket.
I am thinking about using poll consumer pattern to test for now.
Essentially I will have the following json coming thru the activemq queue. 

{name: abc
  address: xyz
}

Where the json does not really matter but how I dispatch the data to
different components is what I am looking for.
I need to be able to rout the json data to different components. I am
thinking about using jsonpath.

Something like this?

from("direct:type")
  .choice()
 
.when(PredicateBuilder.isEqualTo(ExpressionBuilder.languageExpression("jsonpath",
"$.kind"), ExpressionBuilder.constantExpression("full")))
.to("mock:full")
.otherwise()
.to("mock:empty");
}

But the components will be the same just need t send the value of name
(example above) to some component that will do the processing (calling the
db  to do some querying)
So essentially this is the work flow.

Receive a json
Read the json and dispatch the value of the json to some processor to do
some type of querying against the database (find name in db) .  Do this for
each json name:value pair (json wil not change, will always have the same
name:value pairs)  Combine the result for each name:value pair.

Any pointers/ideas as how to implement this type of processing? What kind of
patterns should I implement? Any simple code snippets to illustrate the
points.
I am also thinking about leveraging Akka for this pattern as well since we
have potentially many millions of records and will need to ensure the
processing is done per json and concurrency is guaranteed.
Thanks,
Gordon



--
View this message in context: 
http://camel.465427.n5.nabble.com/how-to-process-json-and-dispatch-to-several-processors-tp5758838.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Camel Aggregator: how to stop route on first failed Message

2014-11-10 Thread Claus Ibsen
See the control bus eip

On Mon, Nov 10, 2014 at 4:10 PM, srikarn  wrote:
> Hi,
>
> I have setup my aggregator as follows.
>
> LevelDBAggregationRepository repository = new
> LevelDBAggregationRepository(REPO_NAME, repoLocation+"/"+REPO_NAME+".dat");
> repository.setUseRecovery(true);
> repository.setMaximumRedeliveries(3);
> repository.setRecoveryInterval(3000);
> repository.setDeadLetterUri("mock:dead");
>
> from(UPDATE_ENDPOINT)
> .aggregate(header("fileId"), new
> ESSessionAggregationStrategy()) // aggregates into an arraylist
> .aggregationRepository(repository)
> .completionPredicate(constant(false))
> .to("es://bulk") // my elasticsearch component
>
> I am flushing all the aggregates by sending a message with the header
> Exchange.AGGREGATION_COMPLETE_ALL_GROUPS=true.
>
> If elasticsearch component is not available, I would like to stop the route
> with all messages in the repository. Is there any way to do this?
>
>
>
> --
> View this message in context: 
> http://camel.465427.n5.nabble.com/Camel-Aggregator-how-to-stop-route-on-first-failed-Message-tp5758837.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-
Red Hat, Inc.
Email: cib...@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
hawtio: http://hawt.io/
fabric8: http://fabric8.io/


Re: how to process json and dispatch to several processors

2014-11-10 Thread Claus Ibsen
Hi

Do you need to route to a "dynamic to" then see this FAQ
http://camel.apache.org/how-to-use-a-dynamic-uri-in-to.html

On Mon, Nov 10, 2014 at 4:43 PM, gmh  wrote:
> All,
> I have a simple use case I am trying to implement.
> We will be receiving data from websocket.
> I am thinking about using poll consumer pattern to test for now.
> Essentially I will have the following json coming thru the activemq queue.
>
> {name: abc
>   address: xyz
> }
>
> Where the json does not really matter but how I dispatch the data to
> different components is what I am looking for.
> I need to be able to rout the json data to different components. I am
> thinking about using jsonpath.
>
> Something like this?
>
> from("direct:type")
>   .choice()
>
> .when(PredicateBuilder.isEqualTo(ExpressionBuilder.languageExpression("jsonpath",
> "$.kind"), ExpressionBuilder.constantExpression("full")))
> .to("mock:full")
> .otherwise()
> .to("mock:empty");
> }
>
> But the components will be the same just need t send the value of name
> (example above) to some component that will do the processing (calling the
> db  to do some querying)
> So essentially this is the work flow.
>
> Receive a json
> Read the json and dispatch the value of the json to some processor to do
> some type of querying against the database (find name in db) .  Do this for
> each json name:value pair (json wil not change, will always have the same
> name:value pairs)  Combine the result for each name:value pair.
>
> Any pointers/ideas as how to implement this type of processing? What kind of
> patterns should I implement? Any simple code snippets to illustrate the
> points.
> I am also thinking about leveraging Akka for this pattern as well since we
> have potentially many millions of records and will need to ensure the
> processing is done per json and concurrency is guaranteed.
> Thanks,
> Gordon
>
>
>
> --
> View this message in context: 
> http://camel.465427.n5.nabble.com/how-to-process-json-and-dispatch-to-several-processors-tp5758838.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-
Red Hat, Inc.
Email: cib...@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
hawtio: http://hawt.io/
fabric8: http://fabric8.io/


Re: how to process json and dispatch to several processors

2014-11-10 Thread Claus Ibsen
Oh and your use-case may seem a bit like this eip
http://camel.apache.org/composed-message-processor.html

You can more easily do this using the splitter only, so see  the
_splitter only_ section on that page

On Mon, Nov 10, 2014 at 4:43 PM, gmh  wrote:
> All,
> I have a simple use case I am trying to implement.
> We will be receiving data from websocket.
> I am thinking about using poll consumer pattern to test for now.
> Essentially I will have the following json coming thru the activemq queue.
>
> {name: abc
>   address: xyz
> }
>
> Where the json does not really matter but how I dispatch the data to
> different components is what I am looking for.
> I need to be able to rout the json data to different components. I am
> thinking about using jsonpath.
>
> Something like this?
>
> from("direct:type")
>   .choice()
>
> .when(PredicateBuilder.isEqualTo(ExpressionBuilder.languageExpression("jsonpath",
> "$.kind"), ExpressionBuilder.constantExpression("full")))
> .to("mock:full")
> .otherwise()
> .to("mock:empty");
> }
>
> But the components will be the same just need t send the value of name
> (example above) to some component that will do the processing (calling the
> db  to do some querying)
> So essentially this is the work flow.
>
> Receive a json
> Read the json and dispatch the value of the json to some processor to do
> some type of querying against the database (find name in db) .  Do this for
> each json name:value pair (json wil not change, will always have the same
> name:value pairs)  Combine the result for each name:value pair.
>
> Any pointers/ideas as how to implement this type of processing? What kind of
> patterns should I implement? Any simple code snippets to illustrate the
> points.
> I am also thinking about leveraging Akka for this pattern as well since we
> have potentially many millions of records and will need to ensure the
> processing is done per json and concurrency is guaranteed.
> Thanks,
> Gordon
>
>
>
> --
> View this message in context: 
> http://camel.465427.n5.nabble.com/how-to-process-json-and-dispatch-to-several-processors-tp5758838.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-
Red Hat, Inc.
Email: cib...@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
hawtio: http://hawt.io/
fabric8: http://fabric8.io/


Re: how to process json and dispatch to several processors

2014-11-10 Thread gmh
Thanks Claus.
I have came across the Composed Message Processor in my research before and
it does look like something we can leverage.
How do you incorporate JsonPath in this pattern? 
Are there simple test cases I can use to illustrate the use of this pattern?
How about concurrency issue?
Can we ensure the json is processed in a concurrent manner?
Should I consider adding Akka in the solution to ensure concurrency?
Thanks,   Gordon



--
View this message in context: 
http://camel.465427.n5.nabble.com/how-to-process-json-and-dispatch-to-several-processors-tp5758838p5758847.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Camel Template solution for JSON

2014-11-10 Thread salemi
Hi All,

is there JSON template solution for camel? I saw camel supports the
following  templating:
FreeMarker
StringTemplate
Velocity
XQuery
XSLT

I like to convert incoming messages all to JSON using a template. There is
framework called JOLT that maps json to json. It would be nice to have
templating framework that would convert xml as well json to a json format.

Thanks,
Ali



-
Alireza Salemi
--
View this message in context: 
http://camel.465427.n5.nabble.com/Camel-Template-solution-for-JSON-tp5758858.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Date format issue in xstream marshalling.

2014-11-10 Thread sayed_india
Hi,
I observed that while marshalling uisng XStream, the date field of an XML
tag gets changed to GMT(i.e,-5:30 hrs).
 
Could you please point to a quick solution to avoid this changes?
 
Before transformation.All...[{COPYRIGHTYEAR=2009-01-01
00:00:00.0}]

After Transformation..2008-12-31 18:30:00.0

 
Best regards,
Sayed




--
View this message in context: 
http://camel.465427.n5.nabble.com/Date-format-issue-in-xstream-marshalling-tp5758860.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: CXF webservice deployment on glassfish

2014-11-10 Thread sab12in
Hi,
Thanks for your reply. I did as you suggested as below

 http://localhost:8080/webservices/incident";
  
serviceClass="org.apache.camel.example.reportincident.ReportIncidentEndpoint"
   wsdlURL="etc/report_incident.wsdl"
   endpointName="ons:ReportIncidentService"
xmlns:ons="http://reportincident.example.camel.apache.org";
   xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"/>

But i get the error Caused by: java.io.IOException: Cannot find any
registered HttpDestinationFactory from the Bus. This was the reason i was
not using complete qualified URL in the address.

Thanks,



--
View this message in context: 
http://camel.465427.n5.nabble.com/CXF-webservice-deployment-on-glassfish-tp5758405p5758863.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: http not cleaning up tmp files when exchange is stopped

2014-11-10 Thread freesbee EV
I have the same issue.
There are some temporary files that aren't deleted.

This an example of my code:

  private class ProcessorSend implements Processor {

public void process(Exchange exchange) throws Exception {
//... some operations

String myEndpoint = "http://localhost:8191/ws/echoService";;
HttpComponent httpComponent = (HttpComponent)
getContext().getComponent("http");
httpComponent.createEndpoint(myEndpoint);
Endpoint endpoint = getContext().getEndpoint(myEndpoint);

try {
  Producer producer = endpoint.createProducer();
  producer.start();
  // no temporary file in ${java.io.tmpdir}/camel-/
  producer.process(exchange);
  // one cos*.tmp file in ${java.io.tmpdir}/camel-/
 producer.stop();

} catch (Exception e) {
 //... report exception

   }

  // ... other operation

}
  }

I also tried to close the stream from the exchange.getIn() but non change.
The temporary file are deleted only when I stop the application.



--
View this message in context: 
http://camel.465427.n5.nabble.com/http-not-cleaning-up-tmp-files-when-exchange-is-stopped-tp4269124p5758865.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Manual commit inside a loop using Camel

2014-11-10 Thread gabfssilva
Hello! I'm trying to do a manual commit a JMS transaction inside a loop using
camel:

from("direct:some-endpoint")
.routeId("my-route")
.process(createObject)
.marshal().json(JsonLibrary.Jackson)
.transacted("policyRequiresNew")
.loop(1000)
.to("jms:queue:my-queue")
.log("Sent!")
.end()
.end();

For instance, i want to commit each 50 registers sent to the queue, not
after all the registers are sent.
Does anyone know what can I do?

Thanks in advance.



--
View this message in context: 
http://camel.465427.n5.nabble.com/Manual-commit-inside-a-loop-using-Camel-tp5758864.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Camel Template solution for JSON

2014-11-10 Thread Willem Jiang
+1 for adding this new component.
I just have a quick look at the JOLT[1] license, it uses ASLv2, which means we 
can use it within Apache Camel without any issue.

[1]https://github.com/bazaarvoice/jolt

--  
Willem Jiang

Red Hat, Inc.
Web: http://www.redhat.com
Blog: http://willemjiang.blogspot.com (English)
http://jnn.iteye.com (Chinese)
Twitter: willemjiang  
Weibo: 姜宁willem



On November 11, 2014 at 4:09:25 AM, salemi (sal...@avaya.com) wrote:
> Hi All,
>  
> is there JSON template solution for camel? I saw camel supports the
> following templating:
> FreeMarker
> StringTemplate
> Velocity
> XQuery
> XSLT
>  
> I like to convert incoming messages all to JSON using a template. There is
> framework called JOLT that maps json to json. It would be nice to have
> templating framework that would convert xml as well json to a json format.
>  
> Thanks,
> Ali
>  
>  
>  
> -
> Alireza Salemi
> --
> View this message in context: 
> http://camel.465427.n5.nabble.com/Camel-Template-solution-for-JSON-tp5758858.html
>   
> Sent from the Camel - Users mailing list archive at Nabble.com.
>  



Best way to discard changes made to Exchange by invoked route

2014-11-10 Thread Camel Guy
Hello,

I am using Spring XML. I would like to invoke a route synchronously,
passing the current Exchange. However, I want to discard the changes
that the invoked route makes to the Exchange (e.g., modification of
headers).

So far this is the shortest recipe that results in the desired behavior:

1

Is there a more elegant way to do this?

I tried direct:Foo
but the current Exchange was modified.


Thanks,
~cg


Proxying RESTful service using the REST DSL :Camel 2.14.0

2014-11-10 Thread zeecamel
I am new to Camel, I want to proxy my RESTful webservice so I can provide
additional output formats on top of json and xml. I then used the REST dsl
for this and RestConfiguration component is "jetty". My Real webservice uses
JaxB and Jackson httpconvertters. At the moment I was just doing a
passthrough service no transformations.

The call comes in, and get forwarded to the real webservice, the service
returns the correct response whether xml or inputstream with xml data, but
the it is not returned to the caller. If I use normal routes the caller get
the response correctly.
Spring DSL(Part of):
 

  http://localhost:8080/api-service-rest/users/6/0?bridgeEndpoint=true&throwExceptionOnFailure=true";
 
/>
   


Normal route works:

http://ZARDPLPT6014:1101/test"; />
http://localhost:8080/api-service-rest/users/6/0?bridgeEndpoint=true&throwExceptionOnFailure=false";
 
/>




--
View this message in context: 
http://camel.465427.n5.nabble.com/Proxying-RESTful-service-using-the-REST-DSL-Camel-2-14-0-tp5758873.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Best way to discard changes made to Exchange by invoked route

2014-11-10 Thread Claus Ibsen
See about the content enricher

On Tue, Nov 11, 2014 at 4:21 AM, Camel Guy  wrote:
> Hello,
>
> I am using Spring XML. I would like to invoke a route synchronously,
> passing the current Exchange. However, I want to discard the changes
> that the invoked route makes to the Exchange (e.g., modification of
> headers).
>
> So far this is the shortest recipe that results in the desired behavior:
>
> 1
>
> Is there a more elegant way to do this?
>
> I tried direct:Foo
> but the current Exchange was modified.
>
>
> Thanks,
> ~cg



-- 
Claus Ibsen
-
Red Hat, Inc.
Email: cib...@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
hawtio: http://hawt.io/
fabric8: http://fabric8.io/


Re: [HEADS UP] - camel-scr for OSGi with pure Java in Camel 2.15

2014-11-10 Thread Claus Ibsen
Hi

Christian sounds good if you have the time and willingness to dive
into improving the camel-scr code.

In camel-blueprint / camel-core-osgi is some code that gathers all the
component names, data formats, and languages that are define in the
Camel routes. And then use that to reference as the needed osgi
services. And hence why camel-blueprint apps can go into grace period
waiting for bundles to be installed with the needed Camel components.

Not sure how easy that work would be to do with routes define in Java
code. Though they build up the same model, so its likely doable.

Though at first we could instead just fail fast. And therefore require
all the needed bundles to be installed first. Then we can look into
this "grace period" work later.

Though we could also as you say introduce a set of annotations where
people specify the needed components. Or maybe there is a OSGi way to
define that in the MANIFEST.MF file? Though annotations is maybe
easier for end users?

Though at first I think cleanup of the code is needed and making the
sample code simpler etc as you also say.



On Mon, Nov 10, 2014 at 10:17 AM, Christian Schneider
 wrote:
> I just looked into the camel-scr component.
>
> If found some design issues:
>
> - Why do we need to @Reference to ComponentResolver. I think we should do
> this under the covers so the user does not have to configure it himself.
> The easiest way would probably be to do this using plain OSGi APIs.
>
> - It seems the context start is delayed when additional components are
> found. This seems to be a bit fragile as the delay means we can miss
> components.
> In the case of camel blueprint we go into GracePeriod and specify which
> component we are missing. For SCR I think the correct way would be to only
> start after all required components are present. Not sure if this is easy to
> do though. In any case I think the problem of depending on components and
> only starting once they are there is a general problem that should be solved
> outside camel blueprint or camel scr.
>
> - If component auto detection does not work we could create a custom camel
> annotation @RequiresComponent("") and @RequiresCompoents. So
> people could annotate their concrete context class with all components they
> need.
>
> - I think the direct injection of properties into RouteBuilders should not
> be done. Or at least not by default. Instead I would by default let the user
> do the injection in getRouteBuilders. At least we could use the @Inject
> annotation to mark properties that are meant for injection perhaps even with
> @Named so the user can specify the name.
>
> I can help with implementing some of my proposals. I will wait for more
> comments and discussions though.
>
> Christian
>
>
> On 09.11.2014 09:42, Claus Ibsen wrote:
>>
>> Hi
>>
>> There is a great contribution for a new camel-scr module that allows
>> end users to use OSGi declarative services instead of spring-dm /
>> blueprint.
>>
>> The code has just been pushed to master branch, but there is still
>> some work to finish and polish the code.
>>
>> But I wanted to bring this to attention, so we can have more eyes on
>> this - especially for the OSGi folks.
>>
>> The JIRA ticket is, with some bullets to look at:
>> https://issues.apache.org/jira/browse/CAMEL-7997
>>
>> And the code is in the camel-scr module. And there is a camel-scr
>> feature to install the module.
>>
>>
>>
>>
>>
>
>
> --
> Christian Schneider
> http://www.liquid-reality.de
>
> Open Source Architect
> http://www.talend.com
>



-- 
Claus Ibsen
-
Red Hat, Inc.
Email: cib...@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
hawtio: http://hawt.io/
fabric8: http://fabric8.io/


Re: Best way to discard changes made to Exchange by invoked route

2014-11-10 Thread Camel Guy
Hi Claus,

Thanks for the pointer!

This program logs "INFO hello" followed by an empty INFO message. I
would like the second logged message to also be "INFO hello."

Am I doing something wrong?

Camel 2.14.0


Thank you,
~cg


  
  hello
  
  
  



  
  


On Mon, Nov 10, 2014 at 10:06 PM, Claus Ibsen  wrote:
> See about the content enricher
>
> On Tue, Nov 11, 2014 at 4:21 AM, Camel Guy  wrote:
>> Hello,
>>
>> I am using Spring XML. I would like to invoke a route synchronously,
>> passing the current Exchange. However, I want to discard the changes
>> that the invoked route makes to the Exchange (e.g., modification of
>> headers).
>>
>> So far this is the shortest recipe that results in the desired behavior:
>>
>> 1
>>
>> Is there a more elegant way to do this?
>>
>> I tried direct:Foo
>> but the current Exchange was modified.
>>
>>
>> Thanks,
>> ~cg
>


Re: Active MQ - Camel Digital signature verification not working with ActiveMQ 5.10

2014-11-10 Thread ahmad.abed




--
View this message in context: 
http://camel.465427.n5.nabble.com/Active-MQ-Camel-Digital-signature-verification-not-working-with-ActiveMQ-5-10-tp5758877p5758879.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Active MQ - Camel Digital signature verification not working with ActiveMQ 5.10

2014-11-10 Thread ahmad.abed

Environment :

Windows 7 64 Bit
java version "1.7.0_21"
ActiveMQ 5.10 with camel 2.13.1

using following camel route is failed during (crypto:verify) :







Error during digital signature verification :
INFO | jvm 1 | 2014/11/10 15:07:02 | ERROR | Failed delivery for (MessageId:
queue_SSLTEST.ssl1_ID_Ahmad-LPT-3363-1415621206712-5_1_1_1_1 on ExchangeId:
ID-Ahmad-LPT-3368-1415621207974-0-1). Exhausted after delivery attempt: 1
caught: org.apache.camel.CamelExecutionException: Exception occurred during
execution on the exchange: Exchange[JmsMessage[JmsMessageID:
ID:Ahmad-LPT-3363-1415621206712-5:1:1:1:1]]
INFO | jvm 1 | 2014/11/10 15:07:02 | 
INFO | jvm 1 | 2014/11/10 15:07:02 | Message History
INFO | jvm 1 | 2014/11/10 15:07:02 |
---
INFO | jvm 1 | 2014/11/10 15:07:02 | RouteId ProcessorId Processor Elapsed
(ms)
INFO | jvm 1 | 2014/11/10 15:07:02 | [TestSSL ] [TestSSL ]
[activemq://queue:SSLTEST.ssl1 ] [ 58]
INFO | jvm 1 | 2014/11/10 15:07:02 | [TestSSL ] [to1 ]
crypto:sign://keystore?keystore=#myKeystore&alias=system_a&password=keyPasswor
[ 40]
INFO | jvm 1 | 2014/11/10 15:07:02 | [TestSSL ] [to2 ]
crypto:verify//keystore?keystore=#myTruststore&alias=system_a [ 5]
INFO | jvm 1 | 2014/11/10 15:07:02 | 
INFO | jvm 1 | 2014/11/10 15:07:02 | Exchange
INFO | jvm 1 | 2014/11/10 15:07:02 |
---
INFO | jvm 1 | 2014/11/10 15:07:02 | Exchange[
INFO | jvm 1 | 2014/11/10 15:07:02 | Id ID-Ahmad-LPT-3368-1415621207974-0-1
INFO | jvm 1 | 2014/11/10 15:07:02 | ExchangePattern InOnly
INFO | jvm 1 | 2014/11/10 15:07:02 | Headers
{breadcrumbId=ID:Ahmad-LPT-3363-1415621206712-5:1:1:1:1,
CamelDigitalSignature=[B@2081df09, CamelRedelivered=false,
CamelRedeliveryCounter=0, JMSCorrelationID=, JMSDeliveryMode=1,
JMSDestination=queue://SSLTEST.ssl1, JMSExpiration=0,
JMSMessageID=ID:Ahmad-LPT-3363-1415621206712-5:1:1:1:1, JMSPriority=0,
JMSRedelivered=false, JMSReplyTo=null, JMSTimestamp=1415621221993, JMSType=,
JMSXGroupID=null, JMSXUserID=null}
INFO | jvm 1 | 2014/11/10 15:07:02 | BodyType String
INFO | jvm 1 | 2014/11/10 15:07:02 | Body Enter some text here for the
message body...
INFO | jvm 1 | 2014/11/10 15:07:02 | ]
INFO | jvm 1 | 2014/11/10 15:07:02 | 
INFO | jvm 1 | 2014/11/10 15:07:02 | Stacktrace
INFO | jvm 1 | 2014/11/10 15:07:02 |
---
INFO | jvm 1 | 2014/11/10 15:07:02 |
org.apache.camel.CamelExecutionException: Exception occurred during
execution on the exchange: Exchange[JmsMessage[JmsMessageID:
ID:Ahmad-LPT-3363-1415621206712-5:1:1:1:1]]
INFO | jvm 1 | 2014/11/10 15:07:02 | at
org.apache.camel.util.ObjectHelper.wrapCamelExecutionException(ObjectHelper.java:1379)[camel-core-2.13.1.jar:2.13.1]
INFO | jvm 1 | 2014/11/10 15:07:02 | at
org.apache.camel.impl.DefaultExchange.setException(DefaultExchange.java:283)[camel-core-2.13.1.jar:2.13.1]
INFO | jvm 1 | 2014/11/10 15:07:02 | at
org.apache.camel.util.AsyncProcessorConverterHelper$ProcessorToAsyncProcessorBridge.process(AsyncProcessorConverterHelper.java:64)[camel-core-2.13.1.jar:2.13.1]
INFO | jvm 1 | 2014/11/10 15:07:02 | at
org.apache.camel.processor.SendProcessor.process(SendProcessor.java:113)[camel-core-2.13.1.jar:2.13.1]
INFO | jvm 1 | 2014/11/10 15:07:02 | at
org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:72)[camel-core-2.13.1.jar:2.13.1]
INFO | jvm 1 | 2014/11/10 15:07:02 | at
org.apache.camel.processor.interceptor.TraceInterceptor.process(TraceInterceptor.java:163)[camel-core-2.13.1.jar:2.13.1]
INFO | jvm 1 | 2014/11/10 15:07:02 | at
org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:398)[camel-core-2.13.1.jar:2.13.1]
INFO | jvm 1 | 2014/11/10 15:07:02 | at
org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:191)[camel-core-2.13.1.jar:2.13.1]
INFO | jvm 1 | 2014/11/10 15:07:02 | at
org.apache.camel.processor.Pipeline.process(Pipeline.java:118)[camel-core-2.13.1.jar:2.13.1]
INFO | jvm 1 | 2014/11/10 15:07:02 | at
org.apache.camel.processor.Pipeline.process(Pipeline.java:80)[camel-core-2.13.1.jar:2.13.1]
INFO | jvm 1 | 2014/11/10 15:07:02 | at
org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:191)[camel-core-2.13.1.jar:2.13.1]
INFO | jvm 1 | 2014/11/10 15:07:02 | at
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:105)[camel-core-2.13.1.jar:2.13.1]
INFO | jvm 1 | 2014/11/10 15:07:02 | at
org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:87)[camel-core-2.13.1.jar:2.13.1]
INFO | jvm 1 | 2014/11/10 15:07:02 | at
org.apache.camel.component.jms.EndpointMessageListener.on