Re: Apache Camel XA transaction

2015-08-19 Thread Claus Ibsen
Hi

You can read about transactions here
http://camel.apache.org/transactional-client.html

On Thu, Aug 20, 2015 at 5:02 AM, kishoreJ  wrote:
>  have to send a message to an endpoint using camel and at the same time if
> the message is sent successfull then i have to update the database ..
>
> These two steps should be done in a single transaction
>
> Now i have to roll back the camel message if there is any exception in
> updating the database or i have to roll back db transaction if there is any
> exception in sending the message.
>
> so i have to either send both at the same time or if there is any exception
> in one case then i have to rollback both at the same time.
>
> Does anyone have any clue?
>
>
>
> --
> View this message in context: 
> http://camel.465427.n5.nabble.com/Apache-Camel-XA-transaction-tp5770836.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-
http://davsclaus.com @davsclaus
Camel in Action 2nd edition: http://www.manning.com/ibsen2


Apache Camel XA transaction

2015-08-19 Thread kishoreJ
 have to send a message to an endpoint using camel and at the same time if
the message is sent successfull then i have to update the database ..

These two steps should be done in a single transaction

Now i have to roll back the camel message if there is any exception in
updating the database or i have to roll back db transaction if there is any
exception in sending the message.

so i have to either send both at the same time or if there is any exception
in one case then i have to rollback both at the same time.

Does anyone have any clue?



--
View this message in context: 
http://camel.465427.n5.nabble.com/Apache-Camel-XA-transaction-tp5770836.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: File watcher and FTP using Camel

2015-08-19 Thread Claus Ibsen
Hi

There is a ftp example in the Camel distribution
https://github.com/apache/camel/tree/master/examples

On Wed, Aug 19, 2015 at 5:22 PM,   wrote:
> Hello Camel Experts,
> I am new to Camel, I would like implement File watcher and FTP using Camel, 
> can someone point me to Camel tutorial how this can be achieved?
>
> Need is to watch or keep on polling a folder on Unix or windows and FTP files 
> as they appear. This should happen 24/7 would need suggestion on what 
> approaches can be used to keep it running on windows and Unix.
>
> If need to create a service on windows for this ? is there camel 
> functionality for this?
> Or is it a good idea to add a Cron job or entry in rc.sh ? I am not a Unix 
> expert though.
>
> Thank you for your help
>
> -G



-- 
Claus Ibsen
-
http://davsclaus.com @davsclaus
Camel in Action 2nd edition: http://www.manning.com/ibsen2


what's happening to camel extra?

2015-08-19 Thread Tim Dudgeon
Now that the Google code site is about to switch to read only 
(https://code.google.com/a/apache-extras.org/p/camel-extra/) I wondered 
what is going to happen to the Camel Extras stuff?


Tim


File watcher and FTP using Camel

2015-08-19 Thread Ganesh.Yadav
Hello Camel Experts,
I am new to Camel, I would like implement File watcher and FTP using Camel, can 
someone point me to Camel tutorial how this can be achieved?

Need is to watch or keep on polling a folder on Unix or windows and FTP files 
as they appear. This should happen 24/7 would need suggestion on what 
approaches can be used to keep it running on windows and Unix.

If need to create a service on windows for this ? is there camel functionality 
for this?
Or is it a good idea to add a Cron job or entry in rc.sh ? I am not a Unix 
expert though.

Thank you for your help

-G


Re: camel http v/s cxfrs component to consume REST service

2015-08-19 Thread Sergey Beryozkin

Hi

I've checked the latest source, I see:

// set response
 if (exchange.getPattern().isOutCapable()) {
 // ... 
exchange.getOut().setBody(binding.bindResponseToCamelBody(response, 
exchange));

}


The producer can optionally invoke against the proxy interface 
representing the target server API.


CXFRS depends on CXF JAX-RS implementation. If working with CXF or 
JAX-RS is not important then you'll find many alternatives in Camel...


Thanks, Sergey

On 19/08/15 13:40, calyan.bandi wrote:

Hi,

I am trying to consume a REST webservice using the cxfrs component. The code
looks as below:

http://localhost:8080/camel-cxf-rest/webapi/myapp/hello/greet";
serviceClass="org.examples.camel.camel_cxfrs_client.HelloWorldIntf">








And the corresponding route is as follows. From my java program i am
invoking this route which invokes the service and i am able to see the
response.




GET



 

 

In the console output i can see the following output:

ID: 1
Response-Code: 200
Encoding: ISO-8859-1
Content-Type: text/plain
Headers: {content-type=[text/plain], Date=[Wed, 19 Aug 2015 12:18:31 GMT],
Server=[Apache-Coyote/1.1], transfer-encoding=[chunked]}
Payload: Hi There!!!
--
[  main] Tracer INFO  >>>
(route1) cxfrs://bean:restClient?synchronous=true --> log[response received
from service is.${body}] <<< Pattern:InOnly,
Headers:{CamelHttpMethod=GET, BodyType:null, Body:[Body is null]
[  main] route1 INFO
response received from service is.
[  main] Tracer INFO  >>>
(route1) log[response received from service is.${body}] -->
ref:responseProcessor <<< Pattern:InOnly, Headers:{CamelHttpMethod=GET,
BodyType:null, Body:[Body is null]


As you can see i am getting my response from the Web service in the Payload
part. It is a simple GET request that returns a string - "Hi There!!!". I am
trying to display the same using the ${body} in the log component,  but what
i am getting is null Body and the BodyType too is set to null.

I tried the same using camel http component. The route looks as below:




GET

http://localhost:8080/camel-cxf-rest/webapi/myapp/hello/greet";
/>   

 

 


Console Output looks as below.

[ main] Tracer INFO  >>> (route1) from(direct://start) --> log[invoking the
rest service] <<< Pattern:InOnly, Headers: BodyType:null, Body:[Body is
null]
[ main] route1 INFO  invoking the rest service
[ main] Tracer INFO  >>> (route1) log[invoking the rest service] -->
setHeader[CamelHttpMethod] <<< Pattern:InOnly, Headers: BodyType:null,
Body:[Body is null]
[ main] Tracer INFO  >>> (route1) setHeader[CamelHttpMethod] -->
http://localhost:8080/camel-cxf-rest/webapi/myapp/hello/greet <<<
Pattern:InOnly, Headers:{CamelHttpMethod=GET}, BodyType:null, Body:[Body is
null]
[ main] Tracer INFO  >>> (route1)
http://localhost:8080/camel-cxf-rest/webapi/myapp/hello/greet -->
log[response received from service is.${body}] <<< Pattern:InOnly,
Headers:{Content-Type=text/plain, CamelHttpResponseCode=200,
Server=Apache-Coyote/1.1, Transfer-Encoding=chunked, CamelHttpMethod=GET,
Date=Wed, 19 Aug 2015 12:22:56 GMT},
BodyType:org.apache.camel.converter.stream.CachedOutputStream.WrappedInputStream,
Body:[Body is instance of java.io.InputStream]
[ main] route1 INFO  response received from service is.Hi There!!!



Using http component, i am able to capture the response in the ${body} which
i can use further down in the route. I looked into the documentatino for the
cxfrs component to understand the behavior of the rs:Client module but it is
of less use.

Can some body please provide some explaination on the below points.

1) Why is it that for cxfrs component the payload was not set in the message
body?
2) Any advantages/disadvantages of choosing cxfrs over http and vice-versa?
3) When using the cxfrs component, there is an option to set  httpClientAPI
to either true/false. When this value is set to true, CxfRsProducer will use
HttpClientAPI to invoke the service. What does this mean? Are there other
APIs available to invoke the service?

Camel core and components Version - 2.13.2
CXF Version - 2.7.11

Thanks,
Kalyan





--
View this message in context: 
http://camel.465427.n5.nabble.com/camel-http-v-s-cxfrs-component-to-consume-REST-service-tp5770829.html
Sent from the Camel - Users mailing list archive at Nabble.com.





Re: Properties Management Question

2015-08-19 Thread Claus Ibsen
Hi

Yeah you are welcome to dive into the source, to see if we can add
those prefix/suffix to the bridge. I am not aware of a tech reason not
to. Assuming we can append those prefix/suffix in the bridge before
letting spring resolve it.



On Wed, Aug 19, 2015 at 2:18 PM, James L Greene  wrote:
> I¹m not a big Spring user, so I apologize in advance if this question is a
> bit basic.
>
> For managing my application¹s properties, I have a single file which
> contains details for all of my non-production environments/regions.  The
> properties look something like this:
>
> dev.source.uri=...
> dev.destination.uri=...
>
> test.source.uri=bar=Š
> test.destination.uri=...
>
> qa.source.uri=...
> qa.destination.uri=...
>
> Using the org.apache.camel.component.properties.PropertiesComponent class,
> in combination with its propertyPrefix property, I can use a System
> environment property to specify which region to load properties for.  This
> works great.
>
> I also have connection parameters for external sources (i.e. JMS brokers
> and databases) for which I would like to store their properties in the
> same file.  From reading the documentation, it seems that I would have to
> use the org.apache.camel.spring.spi.BridgePropertyPlaceholderConfigurer in
> lieu of the PropertiesComponent class, so that I can reference the
> properties outside of the camelContext definition.  Unfortunately, the
> BridgePropertyPlaceholderConfigurer class does not appear to have the same
> ability to specify a propertyPrefix setting.
>
> Obviously, I could separate out the configurations into different
> properties files, per environment.  But I was just curious if there some
> technical reason for why this capability doesn¹t exist in the
> BridgePropertyPlaceholderConfigurer class, or is it just an inconsistency
> between the API¹s?
>
> I¹m using Camel 2.15.0.
>
> Regards,
> Jim
>



-- 
Claus Ibsen
-
http://davsclaus.com @davsclaus
Camel in Action 2nd edition: http://www.manning.com/ibsen2


camel http v/s cxfrs component to consume REST service

2015-08-19 Thread calyan.bandi
Hi,

I am trying to consume a REST webservice using the cxfrs component. The code
looks as below:

http://localhost:8080/camel-cxf-rest/webapi/myapp/hello/greet";
serviceClass="org.examples.camel.camel_cxfrs_client.HelloWorldIntf">








And the corresponding route is as follows. From my java program i am
invoking this route which invokes the service and i am able to see the
response.




GET



 



In the console output i can see the following output:

ID: 1
Response-Code: 200
Encoding: ISO-8859-1
Content-Type: text/plain
Headers: {content-type=[text/plain], Date=[Wed, 19 Aug 2015 12:18:31 GMT],
Server=[Apache-Coyote/1.1], transfer-encoding=[chunked]}
Payload: Hi There!!!
--
[  main] Tracer INFO  >>>
(route1) cxfrs://bean:restClient?synchronous=true --> log[response received
from service is.${body}] <<< Pattern:InOnly,
Headers:{CamelHttpMethod=GET, BodyType:null, Body:[Body is null]
[  main] route1 INFO 
response received from service is.
[  main] Tracer INFO  >>>
(route1) log[response received from service is.${body}] -->
ref:responseProcessor <<< Pattern:InOnly, Headers:{CamelHttpMethod=GET,
BodyType:null, Body:[Body is null]


As you can see i am getting my response from the Web service in the Payload
part. It is a simple GET request that returns a string - "Hi There!!!". I am
trying to display the same using the ${body} in the log component,  but what
i am getting is null Body and the BodyType too is set to null.

I tried the same using camel http component. The route looks as below:
   



GET

http://localhost:8080/camel-cxf-rest/webapi/myapp/hello/greet";
/>  

 




Console Output looks as below.

[ main] Tracer INFO  >>> (route1) from(direct://start) --> log[invoking the
rest service] <<< Pattern:InOnly, Headers: BodyType:null, Body:[Body is
null]
[ main] route1 INFO  invoking the rest service
[ main] Tracer INFO  >>> (route1) log[invoking the rest service] -->
setHeader[CamelHttpMethod] <<< Pattern:InOnly, Headers: BodyType:null,
Body:[Body is null]
[ main] Tracer INFO  >>> (route1) setHeader[CamelHttpMethod] -->
http://localhost:8080/camel-cxf-rest/webapi/myapp/hello/greet <<<
Pattern:InOnly, Headers:{CamelHttpMethod=GET}, BodyType:null, Body:[Body is
null]
[ main] Tracer INFO  >>> (route1)
http://localhost:8080/camel-cxf-rest/webapi/myapp/hello/greet -->
log[response received from service is.${body}] <<< Pattern:InOnly,
Headers:{Content-Type=text/plain, CamelHttpResponseCode=200,
Server=Apache-Coyote/1.1, Transfer-Encoding=chunked, CamelHttpMethod=GET,
Date=Wed, 19 Aug 2015 12:22:56 GMT},
BodyType:org.apache.camel.converter.stream.CachedOutputStream.WrappedInputStream,
Body:[Body is instance of java.io.InputStream]
[ main] route1 INFO  response received from service is.Hi There!!!



Using http component, i am able to capture the response in the ${body} which
i can use further down in the route. I looked into the documentatino for the
cxfrs component to understand the behavior of the rs:Client module but it is
of less use. 

Can some body please provide some explaination on the below points.  

1) Why is it that for cxfrs component the payload was not set in the message
body? 
2) Any advantages/disadvantages of choosing cxfrs over http and vice-versa?
3) When using the cxfrs component, there is an option to set  httpClientAPI
to either true/false. When this value is set to true, CxfRsProducer will use
HttpClientAPI to invoke the service. What does this mean? Are there other
APIs available to invoke the service?  

Camel core and components Version - 2.13.2
CXF Version - 2.7.11

Thanks,
Kalyan





--
View this message in context: 
http://camel.465427.n5.nabble.com/camel-http-v-s-cxfrs-component-to-consume-REST-service-tp5770829.html
Sent from the Camel - Users mailing list archive at Nabble.com.


RE: HOW TO SORT EMAIL POLLING

2015-08-19 Thread Mills, Gary (GE Energy Management, consultant)
Thanks again Claus!!!

You're a god send, appreciate your attention in all the business!

Gary

-Original Message-
From: Claus Ibsen [mailto:claus.ib...@gmail.com] 
Sent: Wednesday, August 19, 2015 1:01 AM
To: users@camel.apache.org
Subject: Re: HOW TO SORT EMAIL POLLING

Hi

You can use the sortTerm option
https://urldefense.proofpoint.com/v2/url?u=http-3A__camel.apache.org_mail.html&d=BQIBaQ&c=IV_clAzoPDE253xZdHuilRgztyh_RiV3wUrLrDQYWSI&r=Hb1nXb7biSqY9NYScX39HfYaeuqILlgaLYiYNWt8oJo&m=byZL_4pNIkwNjhS6xnTrON4QdRDI2eZgOQWMV-cXw5E&s=4B2NsXAq1MQcanT9tOaMyCtvkuL3Y0ejulNXstEBQEI&e=
 

On Tue, Aug 18, 2015 at 10:48 PM, Mills, Gary (GE Energy Management,
consultant)  wrote:
> Hello all,
>
> I need to be able to pull files from email in time sequential order.  How can 
> you do this in camel apache, does anyone have experience here?
>
> Thank you,
> Gary



--
Claus Ibsen
-
https://urldefense.proofpoint.com/v2/url?u=http-3A__davsclaus.com&d=BQIBaQ&c=IV_clAzoPDE253xZdHuilRgztyh_RiV3wUrLrDQYWSI&r=Hb1nXb7biSqY9NYScX39HfYaeuqILlgaLYiYNWt8oJo&m=byZL_4pNIkwNjhS6xnTrON4QdRDI2eZgOQWMV-cXw5E&s=IyttWsMSdxMCD37nWO3GfUfZ_lsKIE80NenheQE3_QA&e=
  @davsclaus Camel in Action 2nd edition: 
https://urldefense.proofpoint.com/v2/url?u=http-3A__www.manning.com_ibsen2&d=BQIBaQ&c=IV_clAzoPDE253xZdHuilRgztyh_RiV3wUrLrDQYWSI&r=Hb1nXb7biSqY9NYScX39HfYaeuqILlgaLYiYNWt8oJo&m=byZL_4pNIkwNjhS6xnTrON4QdRDI2eZgOQWMV-cXw5E&s=CwEDqgCfkSvK5H9wsu6eZ5NH9VOkKimbkqm7ysFYKug&e=
 


Properties Management Question

2015-08-19 Thread James L Greene
I¹m not a big Spring user, so I apologize in advance if this question is a
bit basic.

For managing my application¹s properties, I have a single file which
contains details for all of my non-production environments/regions.  The
properties look something like this:

dev.source.uri=...
dev.destination.uri=...

test.source.uri=bar=Š
test.destination.uri=...

qa.source.uri=...
qa.destination.uri=...

Using the org.apache.camel.component.properties.PropertiesComponent class,
in combination with its propertyPrefix property, I can use a System
environment property to specify which region to load properties for.  This
works great.  

I also have connection parameters for external sources (i.e. JMS brokers
and databases) for which I would like to store their properties in the
same file.  From reading the documentation, it seems that I would have to
use the org.apache.camel.spring.spi.BridgePropertyPlaceholderConfigurer in
lieu of the PropertiesComponent class, so that I can reference the
properties outside of the camelContext definition.  Unfortunately, the
BridgePropertyPlaceholderConfigurer class does not appear to have the same
ability to specify a propertyPrefix setting.

Obviously, I could separate out the configurations into different
properties files, per environment.  But I was just curious if there some
technical reason for why this capability doesn¹t exist in the
BridgePropertyPlaceholderConfigurer class, or is it just an inconsistency
between the API¹s?

I¹m using Camel 2.15.0.

Regards, 
Jim



Re: spring osgix:cm-properties not reloading the properties

2015-08-19 Thread chaituu
reloading properties at runtime working  for Spring DM as well.



--
View this message in context: 
http://camel.465427.n5.nabble.com/spring-osgix-cm-properties-not-reloading-the-properties-tp5770739p5770827.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Camel Restlet basic Authentication

2015-08-19 Thread CloudHuang
Hi all,Now I'm follow the http://camel.apache.org/restlet.html samples to
setup the basic authentication success, then I want to using SOAPUI to test
it, from the sample, 

The sample client sends a request to the direct:start-auth endpoint with the
following headers:
CamelRestletLogin (used internally by Camel)
CamelRestletPassword (used internally by Camel)
so I add these two headers in the SOAPUI "Headers" tabBut I always get the
error message: 
> Unauthorized
> The request requires user authentication
> You can get technical details here.
> Please continue your visit at our home page.





--
View this message in context: 
http://camel.465427.n5.nabble.com/Camel-Restlet-basic-Authentication-tp5770822.html
Sent from the Camel - Users mailing list archive at Nabble.com.