Re: How to pass properties between endpoints...

2013-09-02 Thread Claus Ibsen
There is 2 kind of properties with Camel

- properties on Exchange
- property placeholder

They are very different. You can find details on the Camel doc if you
search a bit and read.


On Mon, Sep 2, 2013 at 4:06 AM, apara  wrote:
> Before converting the event to JSON, I would like to store some variables
> from the event and later use them in a to: destination.
>
> So, am using header to stash away the values prior to conversion.  Is this
> the best way of doing this, or should I be using properties?
>
> 
> ...
>
> 
>  resultType="java.lang.Integer">${body.userId}
> 
>
> 
>  resultType="java.lang.String">${body.class.simpleName}
> 
>
> 
> 
> 
>
> 
>
>  uri="bean:drupalRestService?method=notifyEvent(${in.header.userId},
> ${in.header.eventName}, ${body})" />
>
> 
>
> However, when I try to use the properties, I always a runtime exception
> telling me that a PropertiesComponent needs to be defined inside of the
> camel context.  However, I am not sure how to create a properties component
> inside of the camel context.  I tried with just  but that did
> not quite do the trick.
>
> Any clues?
>
> Thanks.
> -AP_
>
>
>
>
>
> --
> View this message in context: 
> http://camel.465427.n5.nabble.com/How-to-pass-properties-between-endpoints-tp5738449.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


Re: camel-context only seems to work within the same file or do I use it wrong?

2013-09-02 Thread dantam74
Aha :-) I tested in Spring and it works. 

I think the service approach actually is what I'm looking for, since the
import seems to "run" the xml-file again, which means if I include it in
many files, camel will try to define the routes in the included files as
many times as it's included.

Where should I look to find information about export and import
camel-context as a service?

I very much appreciate your help. I've spend almost a day on trying to
figure this out :-)


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

 

 http://camel.apache.org/schema/spring";
depends-on="blackbox">






 





--
View this message in context: 
http://camel.465427.n5.nabble.com/camel-context-only-seems-to-work-within-the-same-file-or-do-I-use-it-wrong-tp5738442p5738480.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: camel-context only seems to work within the same file or do I use it wrong?

2013-09-02 Thread pradeep
Hi,

I think you can refer the below mentioned link for creating a service in one
blueprint and use the same service in other blueprint. 
http://www.ibm.com/developerworks/xml/library/os-osgiblueprint/index.html

You have to use Service reference managers and Service managers for
creating/accessing the services.



--
View this message in context: 
http://camel.465427.n5.nabble.com/camel-context-only-seems-to-work-within-the-same-file-or-do-I-use-it-wrong-tp5738442p5738483.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Change timer runtime

2013-09-02 Thread lassesvestergaard
Hi all.

I have a problem regarding changing the timer period on the fly. My concrete
problem is that I have around 1.200.000 historic records I need to extract
at one time, and the database table is updated every 24 hours. Furthermore
I'm extracting from a Microsoft SQL database.

My preliminary tests have shown that I can't retrieve more than 3000 rows at
a time.

All this means that I would like to create a route that starts out by
extracting 3000 rows, at a time, as fast a possible. When all the 1.200.000
historic records have been extracted, the timer period should be changed to
only "fire" every 24 hours.

I have been looking into the throttler component, but I'm not sure that one
will work. The reason for this is that it will only be in a very short time,
that I want to poll as fast as possible, and after that I will only poll
every 24 hours for eternity. Furthermore, I can't figure out how the
throttler component know when to hold back. As I understand, the throttler
is controlled by how many exchanges that are going on right now, and
therefore only relates to the internal part of Camel. This means that the
throttler doesn't care about me only wanting data from a remote place every
24 hours.

Best regards

Lasse Vestergaard



--
View this message in context: 
http://camel.465427.n5.nabble.com/Change-timer-runtime-tp5738484.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Change timer runtime

2013-09-02 Thread Marco Westermann

Hi,

I think you have more opinions to reach your goal.

One easy solution would be to use the quarz component instead of the 
timer. You can configure the quarz component by a cron config. Therefor 
you could configure that it should run as many times as you need to 
process all rows.

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

Another solution would be to have a route with a timer and after all 
rows have been processed you can stop the route and start it on the 
next  day at a certain time. To archive that have a look here:


http://camel.apache.org/how-can-i-stop-a-route-from-a-route.html

regards, Marco

Am 02.09.2013 10:16, schrieb lassesvestergaard:

Hi all.

I have a problem regarding changing the timer period on the fly. My concrete
problem is that I have around 1.200.000 historic records I need to extract
at one time, and the database table is updated every 24 hours. Furthermore
I'm extracting from a Microsoft SQL database.

My preliminary tests have shown that I can't retrieve more than 3000 rows at
a time.

All this means that I would like to create a route that starts out by
extracting 3000 rows, at a time, as fast a possible. When all the 1.200.000
historic records have been extracted, the timer period should be changed to
only "fire" every 24 hours.

I have been looking into the throttler component, but I'm not sure that one
will work. The reason for this is that it will only be in a very short time,
that I want to poll as fast as possible, and after that I will only poll
every 24 hours for eternity. Furthermore, I can't figure out how the
throttler component know when to hold back. As I understand, the throttler
is controlled by how many exchanges that are going on right now, and
therefore only relates to the internal part of Camel. This means that the
throttler doesn't care about me only wanting data from a remote place every
24 hours.

Best regards

Lasse Vestergaard



--
View this message in context: 
http://camel.465427.n5.nabble.com/Change-timer-runtime-tp5738484.html
Sent from the Camel - Users mailing list archive at Nabble.com.





Re: The Message header with the name of CxfConstants.OPERATION_NAME

2013-09-02 Thread Ernest Lu
Thanks for your reply

I have a test case like this:

public class CXFTest extends CamelTestSupport {

protected static Endpoint endpoint;
protected static WebServiceTestImpl implementor;

public static String proxyAddress = "http://localhost:11000/cxf/proxy/";;
public static String realServiceAddress =
"http://localhost:12000/cxf/service/";;

@Override
protected RouteBuilder createRouteBuilder() {
return new RouteBuilder() {
public void configure() {
from("cxf://" + proxyAddress + 
"?dataFormat=PAYLOAD")
.to("cxf://" + realServiceAddress + 
"?dataFormat=PAYLOAD");
}
};
}

@Test
public void invokeSayHelloMethod() throws Exception {
JaxWsDynamicClientFactory dcf = 
JaxWsDynamicClientFactory.newInstance();
Client client = dcf.createClient(proxyAddress + "?wsdl");
//BindingOperationInfo oi = new BindingOperationInfo();
Object[] res = client.invoke("sayHello", "xiaoMing");
if(res.length > 0){
System.out.println("response: " + res[0]); 
}
}


@AfterClass
public static void stopService() {
if (endpoint != null) {
endpoint.stop();
}
}

@BeforeClass
public static void startService() {
implementor = new WebServiceTestImpl();
endpoint = Endpoint.publish(realServiceAddress, implementor);
}

}

The SEI(Service Endpoint Interface) like this:

@WebService(targetNamespace = "http://service.test.com/";)
public interface WebServiceTest {

@WebMethod
String sayHi();

@WebMethod
String sayHello(String name);
}

@WebService(endpointInterface = "WebServiceTest",targetNamespace =
"http://service.test.com/";)
public class WebServiceTestImpl  implements WebServiceTest {

@Override
@WebMethod
public String sayHi()  {
return "hi";
}

@Override
@WebMethod
public String sayHello(String name)  {
return "hello " + name;
}

}

when running  the test case,it throw an Exception below.
org.apache.cxf.common.i18n.UncheckedException: No operation was found with
the name {http://camel.apache.org/cxf/jaxws/provider}sayHello.
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:331)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:325)
at
com.rongji.esb.junit.CXFTest.testInvokingServiceFromCXFClient(CXFTest.java:49)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at
org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
at
org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
at
org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
at
org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
at org.junit.rules.TestWatchman$1.evaluate(TestWatchman.java:48)
at
org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
at
org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
at
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:76)
at
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
at
org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
at
org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
at
org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
at
org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at
org.eclipse.jdt.int

Re: The Message header with the name of CxfConstants.OPERATION_NAME

2013-09-02 Thread Willem jiang
CXF client is using the operation qName to look up the request method.

As you specify another targetNamespace which we cannot tell from the SEI 
package name, you need to specify the header of 
CxfConstants.OPERATION_NAMESPACE at the same time.  

--  
Willem Jiang

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





On Monday, September 2, 2013 at 5:08 PM, Ernest Lu wrote:

> Thanks for your reply
>  
> I have a test case like this:
>  
> public class CXFTest extends CamelTestSupport {
>  
> protected static Endpoint endpoint;
> protected static WebServiceTestImpl implementor;
>  
> public static String proxyAddress = "http://localhost:11000/cxf/proxy/";;
> public static String realServiceAddress =
> "http://localhost:12000/cxf/service/";;
>  
> @Override
> protected RouteBuilder createRouteBuilder() {
> return new RouteBuilder() {
> public void configure() {
> from("cxf://" + proxyAddress + "?dataFormat=PAYLOAD")
> .to("cxf://" + realServiceAddress + "?dataFormat=PAYLOAD");
> }
> };
> }
>  
> @Test
> public void invokeSayHelloMethod() throws Exception {
> JaxWsDynamicClientFactory dcf = JaxWsDynamicClientFactory.newInstance();
> Client client = dcf.createClient(proxyAddress + "?wsdl");
> //BindingOperationInfo oi = new BindingOperationInfo();
> Object[] res = client.invoke("sayHello", "xiaoMing");
> if(res.length > 0){
> System.out.println("response: " + res[0]);  
> }
> }
>  
>  
> @AfterClass
> public static void stopService() {
> if (endpoint != null) {
> endpoint.stop();
> }
> }
>  
> @BeforeClass
> public static void startService() {
> implementor = new WebServiceTestImpl();
> endpoint = Endpoint.publish(realServiceAddress, implementor);
> }
>  
> }
>  
> The SEI(Service Endpoint Interface) like this:
>  
> @WebService(targetNamespace = "http://service.test.com/";)
> public interface WebServiceTest {
>  
> @WebMethod
> String sayHi();
>  
> @WebMethod
> String sayHello(String name);
> }
>  
> @WebService(endpointInterface = "WebServiceTest",targetNamespace =
> "http://service.test.com/";)
> public class WebServiceTestImpl implements WebServiceTest {
>  
> @Override
> @WebMethod
> public String sayHi() {
> return "hi";
> }
>  
> @Override
> @WebMethod
> public String sayHello(String name) {
> return "hello " + name;
> }
>  
> }
>  
> when running the test case,it throw an Exception below.
> org.apache.cxf.common.i18n.UncheckedException: No operation was found with
> the name {http://camel.apache.org/cxf/jaxws/provider}sayHello.
> at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:331)
> at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:325)
> at
> com.rongji.esb.junit.CXFTest.testInvokingServiceFromCXFClient(CXFTest.java:49)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> at java.lang.reflect.Method.invoke(Method.java:597)
> at
> org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
> at
> org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
> at
> org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
> at
> org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
> at org.junit.rules.TestWatchman$1.evaluate(TestWatchman.java:48)
> at
> org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
> at
> org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
> at
> org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:76)
> at
> org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
> at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
> at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
> at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
> at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
> at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
> at
> org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
> at
> org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
> at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
> at
> org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
> at
> org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
> at
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
> at
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
> at
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.jav

camel-exception-handler

2013-09-02 Thread mahii.in87
Hi ,

How to handle target invocation exception in camel.The secnario is like this
.If the target  in the jaxwsclient throws any invocation exception .The
exception hadler shoud handle the exception and update the database table
with sme error information.What change should i need to make in this below
code.



  


java.lang.Exception


   





--
View this message in context: 
http://camel.465427.n5.nabble.com/camel-exception-handler-tp5738496.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Change timer runtime

2013-09-02 Thread Claus Ibsen
Hi

You can also use a route policy, and then just mark the exchange to
stop if you do not want to route anymore today. Then the timer keeps
running.

There is an onExchangeBegin method where you can mark the exchange to stop with

// mark the exchange to stop continue routing
exchange.setProperty(Exchange.ROUTE_STOP, Boolean.TRUE);

On Mon, Sep 2, 2013 at 10:16 AM, lassesvestergaard
 wrote:
> Hi all.
>
> I have a problem regarding changing the timer period on the fly. My concrete
> problem is that I have around 1.200.000 historic records I need to extract
> at one time, and the database table is updated every 24 hours. Furthermore
> I'm extracting from a Microsoft SQL database.
>
> My preliminary tests have shown that I can't retrieve more than 3000 rows at
> a time.
>
> All this means that I would like to create a route that starts out by
> extracting 3000 rows, at a time, as fast a possible. When all the 1.200.000
> historic records have been extracted, the timer period should be changed to
> only "fire" every 24 hours.
>
> I have been looking into the throttler component, but I'm not sure that one
> will work. The reason for this is that it will only be in a very short time,
> that I want to poll as fast as possible, and after that I will only poll
> every 24 hours for eternity. Furthermore, I can't figure out how the
> throttler component know when to hold back. As I understand, the throttler
> is controlled by how many exchanges that are going on right now, and
> therefore only relates to the internal part of Camel. This means that the
> throttler doesn't care about me only wanting data from a remote place every
> 24 hours.
>
> Best regards
>
> Lasse Vestergaard
>
>
>
> --
> View this message in context: 
> http://camel.465427.n5.nabble.com/Change-timer-runtime-tp5738484.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


Re: camel cache

2013-09-02 Thread Claus Ibsen
Hi

There is no specific reason. We welcome contributions so feel free to
log a JIRA and if possible provide a patch with this improvement.

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


On Sun, Sep 1, 2013 at 7:11 PM, lmanchanda75  wrote:
> Hi,The camel cache implementation which provides an ehcache integration
> component forces a serializable object though ehcache allows
> non-serializable objects too if clustering is not required. This makes in
> unusable for some scenarios. Any specific reason for doing so?Regdslalit
>
>
>
> --
> View this message in context: 
> http://camel.465427.n5.nabble.com/camel-cache-tp5738435.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


Re: Referencing OSGi services with RouteBuilder classes for use in CamelContext

2013-09-02 Thread Claus Ibsen
Hi

Do you have the stacktrace for this?

Not sure why blueprint gives you the proxy class, could be that the
osgi registry in camel-core-osgi should detect its a proxy class and
get the target class automatic. But a stacktrace / or sample project
to reproduce would be lovely to play with.

On Mon, Jun 24, 2013 at 2:20 PM, Martin Stiborský
 wrote:
> Hello guys,
> I'd like to ask first if I'm wrong or not...
> I have a bundle, where is defined CamelContext in blueprint XML. In
> this XML, I'd like to reference services from n other bundles, which
> exposes services with routes - RouteBuilder class(es).
>
> How should be the route class for the bundles exposed? Something like this 
> (?):
>
> 
> 
>
> Then, in the "main" bundle, where is CamelContext defined, I can catch
> the reference:
>
>  interface="org.apache.camel.RoutesBuilder"/>
>
> The problem is, it kind of doesn't work for me :(
> The service is exposed, the reference is not null, but class type is wrong:
>
> Caused by: org.apache.camel.NoSuchBeanException: Found bean:
> avatarRoutes in BlueprintContainer:
> org.apache.aries.blueprint.container.BlueprintContainerImpl@50a28
> b65 of type: Proxybad2ac0c_5c42_4054_bf65_7566a287f4c8 expected type
> was: class org.apache.camel.builder.RouteBuilder
>
> Camel 2.11 / Karaf 2.3.1
> According this answer from Claus
> (http://stackoverflow.com/a/13439844/805219) I guess the idea is
> possible, just my implementation is wrong.
>
> --
> S pozdravem / Best regards
> Martin Stiborský
>
> Jabber: st...@njs.netlab.cz
> Twitter: http://www.twitter.com/stibi



-- 
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


Re: camel cache

2013-09-02 Thread lmanchanda75
Hi Claus,

I have created the following Jira ticket.

https://issues.apache.org/jira/browse/CAMEL-6698

Will work to do the improvement and submit.

Regds
lalit



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


Re: New book about Apache Camel

2013-09-02 Thread ABouchama
Congratulations! We have ordered a copy, and we are waiting now the delivery
:) 

Regards, 
Abdellatif



--
View this message in context: 
http://camel.465427.n5.nabble.com/New-book-about-Apache-Camel-tp5738426p5738514.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Problem with FailOverLoadBalancer

2013-09-02 Thread Sebastian Bösl
Hi,

I've a problem calling a REST based service with dynamic uris in combination 
with a failover load balancer.
Below is how I do it at the moment but I'm open to better solutions.
It would also be great if there is a way that I can inject a dynamic number of 
endpoints, so I could inject a thrid cluster node without changing the code.

I've designed the route as 
from("direct:a")
 .loadBalance()
 .failover(-1, false, false)
 .recipientList(simple(endpoints[0]))
 .recipientList(simple(endpoints[1]))
 .end()

Which leads to this exception:
Caused by: java.lang.ClassCastException: 
org.apache.camel.model.LoadBalanceDefinition cannot be cast to 
org.apache.camel.model.ExpressionNode
at com.sbo.MyRouteBuilder.configure(QuovaRouteBuilder.java:52)
at 
org.apache.camel.builder.RouteBuilder.checkInitialized(RouteBuilder.java:322)
at 
org.apache.camel.builder.RouteBuilder.configureRoutes(RouteBuilder.java:276)
at 
org.apache.camel.builder.RouteBuilder.addRoutesToCamelContext(RouteBuilder.java:262)
at 
org.apache.camel.impl.DefaultCamelContext.addRoutes(DefaultCamelContext.java:650)
at 
org.apache.camel.core.xml.AbstractCamelContextFactoryBean.installRoutes(AbstractCamelContextFactoryBean.java:658)
at 
org.apache.camel.core.xml.AbstractCamelContextFactoryBean.afterPropertiesSet(AbstractCamelContextFactoryBean.java:282)
at 
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1541)
at 
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1479)
... 50 more

If I change the route to 
from("direct:a")
 .loadBalance()
 .failover(-1, false, false)
 .process(new RecipientList(getContext(), simple(endpoints[0])))
 .process(new RecipientList(getContext(), simple(endpoints[1])))
 .end()
It works as expected, so I guess there is an internal bug somewhere.

Thanks,

Sebastian


Help required with Camel for HTTP service.

2013-09-02 Thread yvsandeep
Hi,

I am new to Apache Camel.I am trying to create a HTTP ping-pong service
using Apache Camel.Here is the flow.

 HTTP Client <-> Apache Camel <-> HTTP Webserver

Here are the programs that I am using.

Main pgm
---
import org.apache.camel.spring.Main;

public class Test 
{

public static void main(String[] args) throws Exception  
{
Main start = new Main();
start.enableHangupSupport();
System.out.println("Starting the listener");
start.run(); 
System.out.println("Exit");
}

}

Routes

import org.apache.camel.builder.RouteBuilder;

public class HTTPListener extends RouteBuilder {

@Override
public void configure() throws Exception 
{
System.out.println("Routing");

from("jetty:http://0.0.0.0:61000/myapp/myservice";).to("jetty://http://remoteIP:61050/Dummy";);
}

}

I have posted the message to /myapp/myservice.However,I do not see the
request being routed to the remote http web server.Also,what should I do to
get the response from the web server and send it to the http client?



--
View this message in context: 
http://camel.465427.n5.nabble.com/Help-required-with-Camel-for-HTTP-service-tp5738518.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Referencing OSGi services with RouteBuilder classes for use in CamelContext

2013-09-02 Thread Claus Ibsen
I was able to reproduce the issue and logged a ticket
https://issues.apache.org/jira/browse/CAMEL-6699

On Mon, Sep 2, 2013 at 1:19 PM, Claus Ibsen  wrote:
> Hi
>
> Do you have the stacktrace for this?
>
> Not sure why blueprint gives you the proxy class, could be that the
> osgi registry in camel-core-osgi should detect its a proxy class and
> get the target class automatic. But a stacktrace / or sample project
> to reproduce would be lovely to play with.
>
> On Mon, Jun 24, 2013 at 2:20 PM, Martin Stiborský
>  wrote:
>> Hello guys,
>> I'd like to ask first if I'm wrong or not...
>> I have a bundle, where is defined CamelContext in blueprint XML. In
>> this XML, I'd like to reference services from n other bundles, which
>> exposes services with routes - RouteBuilder class(es).
>>
>> How should be the route class for the bundles exposed? Something like this 
>> (?):
>>
>> 
>> 
>>
>> Then, in the "main" bundle, where is CamelContext defined, I can catch
>> the reference:
>>
>> > interface="org.apache.camel.RoutesBuilder"/>
>>
>> The problem is, it kind of doesn't work for me :(
>> The service is exposed, the reference is not null, but class type is wrong:
>>
>> Caused by: org.apache.camel.NoSuchBeanException: Found bean:
>> avatarRoutes in BlueprintContainer:
>> org.apache.aries.blueprint.container.BlueprintContainerImpl@50a28
>> b65 of type: Proxybad2ac0c_5c42_4054_bf65_7566a287f4c8 expected type
>> was: class org.apache.camel.builder.RouteBuilder
>>
>> Camel 2.11 / Karaf 2.3.1
>> According this answer from Claus
>> (http://stackoverflow.com/a/13439844/805219) I guess the idea is
>> possible, just my implementation is wrong.
>>
>> --
>> S pozdravem / Best regards
>> Martin Stiborský
>>
>> Jabber: st...@njs.netlab.cz
>> Twitter: http://www.twitter.com/stibi
>
>
>
> --
> 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



-- 
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


Re: Referencing OSGi services with RouteBuilder classes for use in CamelContext

2013-09-02 Thread Martin Stiborský
wow you are fast, thank for checking this out


On Mon, Sep 2, 2013 at 3:35 PM, Claus Ibsen  wrote:

> I was able to reproduce the issue and logged a ticket
> https://issues.apache.org/jira/browse/CAMEL-6699
>
> On Mon, Sep 2, 2013 at 1:19 PM, Claus Ibsen  wrote:
> > Hi
> >
> > Do you have the stacktrace for this?
> >
> > Not sure why blueprint gives you the proxy class, could be that the
> > osgi registry in camel-core-osgi should detect its a proxy class and
> > get the target class automatic. But a stacktrace / or sample project
> > to reproduce would be lovely to play with.
> >
> > On Mon, Jun 24, 2013 at 2:20 PM, Martin Stiborský
> >  wrote:
> >> Hello guys,
> >> I'd like to ask first if I'm wrong or not...
> >> I have a bundle, where is defined CamelContext in blueprint XML. In
> >> this XML, I'd like to reference services from n other bundles, which
> >> exposes services with routes - RouteBuilder class(es).
> >>
> >> How should be the route class for the bundles exposed? Something like
> this (?):
> >>
> >> 
> >> 
> >>
> >> Then, in the "main" bundle, where is CamelContext defined, I can catch
> >> the reference:
> >>
> >>  >> interface="org.apache.camel.RoutesBuilder"/>
> >>
> >> The problem is, it kind of doesn't work for me :(
> >> The service is exposed, the reference is not null, but class type is
> wrong:
> >>
> >> Caused by: org.apache.camel.NoSuchBeanException: Found bean:
> >> avatarRoutes in BlueprintContainer:
> >> org.apache.aries.blueprint.container.BlueprintContainerImpl@50a28
> >> b65 of type: Proxybad2ac0c_5c42_4054_bf65_7566a287f4c8 expected type
> >> was: class org.apache.camel.builder.RouteBuilder
> >>
> >> Camel 2.11 / Karaf 2.3.1
> >> According this answer from Claus
> >> (http://stackoverflow.com/a/13439844/805219) I guess the idea is
> >> possible, just my implementation is wrong.
> >>
> >> --
> >> S pozdravem / Best regards
> >> Martin Stiborský
> >>
> >> Jabber: st...@njs.netlab.cz
> >> Twitter: http://www.twitter.com/stibi
> >
> >
> >
> > --
> > 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
>
>
>
> --
> 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
>



-- 
S pozdravem / Best regards
Martin Stiborský

Jabber: st...@njs.netlab.cz
Twitter: http://www.twitter.com/stibi


Re: Help required with Camel for HTTP service.

2013-09-02 Thread Christian Posta
The jetty component is by default in-out.. so there isn't anything special
you need to do to get the response from remoteIP to get sent back to the
calling HTTP client. The real question here is, what does this do? Do you
see your debug statements printing out ("Routing")? Do you see any
exception stack traces?


On Mon, Sep 2, 2013 at 5:57 AM, yvsandeep  wrote:

> Hi,
>
> I am new to Apache Camel.I am trying to create a HTTP ping-pong service
> using Apache Camel.Here is the flow.
>
>  HTTP Client <-> Apache Camel <-> HTTP Webserver
>
> Here are the programs that I am using.
>
> Main pgm
> ---
> import org.apache.camel.spring.Main;
>
> public class Test
> {
>
> public static void main(String[] args) throws Exception
> {
> Main start = new Main();
> start.enableHangupSupport();
> System.out.println("Starting the listener");
> start.run();
> System.out.println("Exit");
> }
>
> }
>
> Routes
> 
> import org.apache.camel.builder.RouteBuilder;
>
> public class HTTPListener extends RouteBuilder {
>
> @Override
> public void configure() throws Exception
> {
> System.out.println("Routing");
>
> from("jetty:http://0.0.0.0:61000/myapp/myservice";).to("jetty://
> http://remoteIP:61050/Dummy";);
> }
>
> }
>
> I have posted the message to /myapp/myservice.However,I do not see the
> request being routed to the remote http web server.Also,what should I do to
> get the response from the web server and send it to the http client?
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/Help-required-with-Camel-for-HTTP-service-tp5738518.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>



-- 
*Christian Posta*
http://www.christianposta.com/blog
twitter: @christianposta


Re: Help required with Camel for HTTP service.

2013-09-02 Thread yvsandeep
Hi,

Thank you for clarifying on the jetty component.This application will start
off as a proxy service doing nothing but passing the requests/responses
between the clients and servers.We will add additional functionality such as
XML transformation etc in future.

  Yes,I do see the debug messages being printed out.I am using Jmeter to
post messages to Camel.I get an exception in Jmeter telling that the remote
host has not responded.



--
View this message in context: 
http://camel.465427.n5.nabble.com/Help-required-with-Camel-for-HTTP-service-tp5738518p5738522.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: camel-exception-handler

2013-09-02 Thread Christian Müller
Checkout [1].

A global scoped example:

  java.lang.Exception
  



  
  


A route scoped example:

  
  
java.lang.Exception

  
  


[1] http://camel.apache.org/exception-clause.html

Best,
Christian
-

Software Integration Specialist

Apache Camel committer: https://camel.apache.org/team
V.P. Apache Camel: https://www.apache.org/foundation/
Apache Member: https://www.apache.org/foundation/members.html

https://www.linkedin.com/pub/christian-mueller/11/551/642


On Mon, Sep 2, 2013 at 11:25 AM, mahii.in87  wrote:

> Hi ,
>
> How to handle target invocation exception in camel.The secnario is like
> this
> .If the target  in the jaxwsclient throws any invocation exception .The
> exception hadler shoud handle the exception and update the database table
> with sme error information.What change should i need to make in this below
> code.
>
> 
> 
>   
> 
>
> java.lang.Exception
> 
> 
>
>
>
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/camel-exception-handler-tp5738496.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>


Re: Help required with Camel for HTTP service.

2013-09-02 Thread Christian Posta
Maybe you can try a curl command on the remoteIP endpoint to make sure it's
responding?


On Mon, Sep 2, 2013 at 8:10 AM, yvsandeep  wrote:

> Hi,
>
> Thank you for clarifying on the jetty component.This application will start
> off as a proxy service doing nothing but passing the requests/responses
> between the clients and servers.We will add additional functionality such
> as
> XML transformation etc in future.
>
>   Yes,I do see the debug messages being printed out.I am using Jmeter to
> post messages to Camel.I get an exception in Jmeter telling that the remote
> host has not responded.
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/Help-required-with-Camel-for-HTTP-service-tp5738518p5738522.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>



-- 
*Christian Posta*
http://www.christianposta.com/blog
twitter: @christianposta


Re: Netty and requestTimeout

2013-09-02 Thread fbarbat
Hi,

This test reproduces the exception. The System.in.read() at the end is just
to wait for the exception to appear. Any ideas?

Thanks.

package camel.test;

import java.io.IOException;

import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.test.junit4.CamelTestSupport;
import org.junit.Assert;
import org.junit.Test;

public class CamelNettyTest extends CamelTestSupport {

@Override
protected RouteBuilder createRouteBuilder() throws Exception {
return new RouteBuilder() {

@Override
public void configure() throws Exception {
from("direct:out").to(

"netty:tcp://localhost:8080?requestTimeout=5000");

from("netty:tcp://localhost:8080")

.to("log:nettyCase?showAll=true&multiline=true");
;

}
};
}

@Test
public void test() throws IOException {
String result = template.requestBody("direct:out", "hello",
String.class);
Assert.assertEquals("hello", result);
System.in.read();
}
}





--
View this message in context: 
http://camel.465427.n5.nabble.com/Netty-and-requestTimeout-tp5738341p5738533.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Netty and requestTimeout

2013-09-02 Thread fbarbat
Sorry, I forgot to mention I'm using 2.11.1



--
View this message in context: 
http://camel.465427.n5.nabble.com/Netty-and-requestTimeout-tp5738341p5738534.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: camel-cxf and HTTP BASIC authentication

2013-09-02 Thread Christian Müller
Yes, we got it working. I can post the relevant code snippets here tomorrow.

Best,
Christian
-

Software Integration Specialist

Apache Camel committer: https://camel.apache.org/team
V.P. Apache Camel: https://www.apache.org/foundation/
Apache Member: https://www.apache.org/foundation/members.html

https://www.linkedin.com/pub/christian-mueller/11/551/642


On Tue, Aug 27, 2013 at 9:00 PM, contactreji  wrote:

> Hi Christian.. did you get a work around the problem?
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/camel-cxf-and-HTTP-BASIC-authentication-tp5716163p5738071.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>


Re: Netty and requestTimeout

2013-09-02 Thread fbarbat
As a workaround, I implemented a handler which modifies the pipeline on every
request so the ReadTimeoutHandler is removed once the response is read.
Specifically, a CamelRequestTimeoutHandler is inserted before Camel's
ClientChannelHandler. My handler inserts a ReadTimeoutHandler on write and
removes it on read. 
This has no problems with Camel use of Netty because of the pool of
channels. If the access to a single channel had been concurrent, this
workaround wouldn't have worked. I can send you a patch if you are
interested.





--
View this message in context: 
http://camel.465427.n5.nabble.com/Netty-and-requestTimeout-tp5738341p5738536.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Time to deliver a message?

2013-09-02 Thread Christian Müller
I'm afraid we need a (simple) unit test which shows this issue to
investigate on it.
We also using ActiveMQ in our PROD environment and don't see this issue.
May be it's related to your use of the producer template or an issue in
your custom code...
Can you share your original route (if you are not able to provide a simple
unit test) and your custom beans/processors?

Best,
Christian
-

Software Integration Specialist

Apache Camel committer: https://camel.apache.org/team
V.P. Apache Camel: https://www.apache.org/foundation/
Apache Member: https://www.apache.org/foundation/members.html

https://www.linkedin.com/pub/christian-mueller/11/551/642


On Thu, Aug 22, 2013 at 12:13 PM, John D. Ament wrote:

> Oh, right now we're in dev mode only.  It's noticeable after a few
> minutes of operating.  The time will fluctuate.  In some cases, I see
> it almost immediately processed and in others I've seen it wait up to
> 10 minutes to process a message (if it takes longer than this we've
> been giving up and trying again).
> Yes, we're using embedded activemq as our broker.
> Most of what we have is operating like a message translator, an in
> bound webservice request gets turned into a POJO and queued (manually,
> via a producer template).  From that point on we simply have bean
> translators (enrichers and filters only) converting the object from
> one type to another until finally it's sent over to the final
> destination in the right format.
> I'm not sure where there would be a memory leak, since we're just
> doing some POJO manipulation and web service invocations.  No, I don't
> have a simple test case that reproduces this yet; though I'll see if
> it happens in other scenarios.
>
> On Thu, Aug 22, 2013 at 5:55 AM, Christian Müller
>  wrote:
> > Details like:
> > - Which message broker do you use? Which version?
> >   - If you use ActiveMQ, do you use an embedded or external broker?
> > - How does your route look like (Which message exchange pattern do you
> use?
> > Which payload do you use?)
> > - What exactly do you mean with "over the time"? Minutes, hours, days,
> > weeks, ...
> > - How long does it take at the beginning and how long dos it takes after
> x
> > minutes/hours/days/weeks?
> > - Do you have a test case which reproduce the issue?
> > - Did you checked whether there is a memory leak?
> >
> > Best,
> > Christian
> > -
> >
> > Software Integration Specialist
> >
> > Apache Camel committer: https://camel.apache.org/team
> > V.P. Apache Camel: https://www.apache.org/foundation/
> > Apache Member: https://www.apache.org/foundation/members.html
> >
> > https://www.linkedin.com/pub/christian-mueller/11/551/642
> >
> >
> > On Wed, Aug 21, 2013 at 3:18 PM, John D. Ament  >wrote:
> >
> >> I guess one other important thing to point out is that this is camel
> >> 2.10.6 on service mix 4.5.3.
> >>
> >> On Wed, Aug 21, 2013 at 9:17 AM, John D. Ament 
> >> wrote:
> >> > Not sure what more details I could provide.
> >> >
> >> > Basically, I have a polling consumer on a queue.  I see that polling
> >> > consumer polling all the time.  DOesn't see a message, even though the
> >> > message was sent (based on log messages) several minutes back.  Then
> >> > finally after a little bit more the message gets plucked.
> >> >
> >> > On Wed, Aug 21, 2013 at 6:06 AM, Christian Müller
> >> >  wrote:
> >> >> No, this is not expected. Can you provide more details?
> >> >>
> >> >> Best,
> >> >> Christian
> >> >> Am 21.08.2013 05:55 schrieb "John D. Ament"  >:
> >> >>
> >> >>> Hi,
> >> >>>
> >> >>> Assuming that I'm using activemq queues as my components, how
> quickly
> >> >>> should a message be delivered?
> >> >>>
> >> >>> In a number of routes, I'm moving data from one queue to another
> >> >>> queue, and over time the amount of time that it takes for a message
> to
> >> >>> go from A to B to C is steadily increasing.  Is this expected?
> >> >>>
> >> >>> Thanks,
> >> >>>
> >> >>> John
> >> >>>
> >>
>


Re: JAAS Basic Auth using http:conduit

2013-09-02 Thread Christian Müller
{http://example.com/}HelloWorldServicePort.http-conduit ==
{}.http-conduit

The configuration you posted is, I assume, borrowed from [1] and shows the
client side configuration. But you are asking for the server side
configuration...

I will post my solution tomorrow in the other thread you are asking for
help [2].

[1]
http://cxf.apache.org/docs/client-http-transport-including-ssl-support.html#ClientHTTPTransport%28includingSSLsupport%29-BasicAuthentication
[2]
camel.465427.n5.nabble.com/camel-cxf-and-HTTP-BASIC-authentication-td5716163.html

Best,
Christian
-

Software Integration Specialist

Apache Camel committer: https://camel.apache.org/team
V.P. Apache Camel: https://www.apache.org/foundation/
Apache Member: https://www.apache.org/foundation/members.html

https://www.linkedin.com/pub/christian-mueller/11/551/642


On Wed, Aug 28, 2013 at 9:44 AM, contactreji  wrote:

> Hi Guys
>
> Can you please guide me in securing a simple CXF endpoint using
> *
>  name="{http://example.com/}HelloWorldServicePort.http-conduit";
> xmlns:sec="
> http://cxf.apache.org/configuration/security";
> xmlns="
> http://cxf.apache.org/transports/http/configuration";>
>
> 
>
> myuser
>
> mypasswd
>
>
> Basic
>
> 
> *
>
> Am not sure what to enter in place of
> {http://example.com/}HelloWorldServicePort.http-conduit}
> My endpoint address is
>
>
> https://server:8181/mes/bw/TESTINGJAAS?handlers=securityHandler&matchOnUriPrefix=true
>
> Can you please guide me in setting up basic auth on this endpoint
>
> Reji
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/JAAS-Basic-Auth-using-http-conduit-tp5738124.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>


Re: Time to deliver a message?

2013-09-02 Thread John D. Ament
Yeah, one theory I have is that the webservice we have to call in the
middle is taking longer than expected.  I also found an issue (on my
side) where certain routes weren't getting set up right.

I'm going to leave debug on for a while on my machine, see what the
logs produce and go from there.  Will write back if something looks
off.

John

On Mon, Sep 2, 2013 at 4:09 PM, Christian Müller
 wrote:
> I'm afraid we need a (simple) unit test which shows this issue to
> investigate on it.
> We also using ActiveMQ in our PROD environment and don't see this issue.
> May be it's related to your use of the producer template or an issue in
> your custom code...
> Can you share your original route (if you are not able to provide a simple
> unit test) and your custom beans/processors?
>
> Best,
> Christian
> -
>
> Software Integration Specialist
>
> Apache Camel committer: https://camel.apache.org/team
> V.P. Apache Camel: https://www.apache.org/foundation/
> Apache Member: https://www.apache.org/foundation/members.html
>
> https://www.linkedin.com/pub/christian-mueller/11/551/642
>
>
> On Thu, Aug 22, 2013 at 12:13 PM, John D. Ament wrote:
>
>> Oh, right now we're in dev mode only.  It's noticeable after a few
>> minutes of operating.  The time will fluctuate.  In some cases, I see
>> it almost immediately processed and in others I've seen it wait up to
>> 10 minutes to process a message (if it takes longer than this we've
>> been giving up and trying again).
>> Yes, we're using embedded activemq as our broker.
>> Most of what we have is operating like a message translator, an in
>> bound webservice request gets turned into a POJO and queued (manually,
>> via a producer template).  From that point on we simply have bean
>> translators (enrichers and filters only) converting the object from
>> one type to another until finally it's sent over to the final
>> destination in the right format.
>> I'm not sure where there would be a memory leak, since we're just
>> doing some POJO manipulation and web service invocations.  No, I don't
>> have a simple test case that reproduces this yet; though I'll see if
>> it happens in other scenarios.
>>
>> On Thu, Aug 22, 2013 at 5:55 AM, Christian Müller
>>  wrote:
>> > Details like:
>> > - Which message broker do you use? Which version?
>> >   - If you use ActiveMQ, do you use an embedded or external broker?
>> > - How does your route look like (Which message exchange pattern do you
>> use?
>> > Which payload do you use?)
>> > - What exactly do you mean with "over the time"? Minutes, hours, days,
>> > weeks, ...
>> > - How long does it take at the beginning and how long dos it takes after
>> x
>> > minutes/hours/days/weeks?
>> > - Do you have a test case which reproduce the issue?
>> > - Did you checked whether there is a memory leak?
>> >
>> > Best,
>> > Christian
>> > -
>> >
>> > Software Integration Specialist
>> >
>> > Apache Camel committer: https://camel.apache.org/team
>> > V.P. Apache Camel: https://www.apache.org/foundation/
>> > Apache Member: https://www.apache.org/foundation/members.html
>> >
>> > https://www.linkedin.com/pub/christian-mueller/11/551/642
>> >
>> >
>> > On Wed, Aug 21, 2013 at 3:18 PM, John D. Ament > >wrote:
>> >
>> >> I guess one other important thing to point out is that this is camel
>> >> 2.10.6 on service mix 4.5.3.
>> >>
>> >> On Wed, Aug 21, 2013 at 9:17 AM, John D. Ament 
>> >> wrote:
>> >> > Not sure what more details I could provide.
>> >> >
>> >> > Basically, I have a polling consumer on a queue.  I see that polling
>> >> > consumer polling all the time.  DOesn't see a message, even though the
>> >> > message was sent (based on log messages) several minutes back.  Then
>> >> > finally after a little bit more the message gets plucked.
>> >> >
>> >> > On Wed, Aug 21, 2013 at 6:06 AM, Christian Müller
>> >> >  wrote:
>> >> >> No, this is not expected. Can you provide more details?
>> >> >>
>> >> >> Best,
>> >> >> Christian
>> >> >> Am 21.08.2013 05:55 schrieb "John D. Ament" > >:
>> >> >>
>> >> >>> Hi,
>> >> >>>
>> >> >>> Assuming that I'm using activemq queues as my components, how
>> quickly
>> >> >>> should a message be delivered?
>> >> >>>
>> >> >>> In a number of routes, I'm moving data from one queue to another
>> >> >>> queue, and over time the amount of time that it takes for a message
>> to
>> >> >>> go from A to B to C is steadily increasing.  Is this expected?
>> >> >>>
>> >> >>> Thanks,
>> >> >>>
>> >> >>> John
>> >> >>>
>> >>
>>


Programmatic vs URI based endpoint definition

2013-09-02 Thread Tom Ellis
Hi All,

I asked this on stackoverflow [1] and didn't get a response, but this
is obviously a better spot to get questions answered.

Consider the following:

public class MyRouteBuilder extends RouteBuilder {

  @Override
  public void configure() throws Exception {
  FileEndpoint dropLocation = new FileEndpoint();
  dropLocation.setCamelContext(getContext());
  dropLocation.setFile(new File("/data"));
  dropLocation.setRecursive(true);
  dropLocation.setPreMove(".polled");
  dropLocation.setNoop(true);
  dropLocation.setMaxMessagesPerPoll(1);

  from(dropLocation).to(...

versus

public class MyBuilder extends RouteBuilder {

  @Override
  public void configure() throws Exception {
  
from("file://data?recursive=true&preMove=.polled&noop=true&maxMessagesPerPoll=1").to(...

Programmatically I get code completion and the like, whereas with the
URI everything is in a single line. I've noticed that the JMX beans
also don't seem to build the URI for stuff like hawt.io if you build
the endpoint with the programmatic way as well. What are the other
pros/cons for each?

Pretty much all the examples I see utilise the URI method - is this
the preferred way?

Could it be possible to use the builder pattern or something to build
up an endpoint, e.g.

FileEndpoint dropLocation = new
FileEndpoint.Builder().camelContext(getContext()).file(new
File("/data")).recursive().preMove().noop().maxMessagesPerPoll(1).build();

Cheers,

Tom Ellis

[1] - 
http://stackoverflow.com/questions/18361234/what-are-the-pros-cons-when-defining-an-endpoint-as-a-uri-over-defining-it-progr


Re: camel-jetty + authentication JAAS

2013-09-02 Thread contactreji
Hi Charles

I am also in the task of achieving the JAAS auth. I need your help.
Would you mind posting the dependencies  you have used. Would be really nice
if you let me know how did you configure the JAAS. Have you pasted the above
code in a separate XML file?

I am getting issues with resolving dependency. Could you post a copy of your
POM file and the Jetty/Conduit configuration which you have used.

Cheers
Reji



--
View this message in context: 
http://camel.465427.n5.nabble.com/camel-jetty-authentication-JAAS-tp3293819p5738549.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Programmatic vs URI based endpoint definition

2013-09-02 Thread James Strachan
On 2 September 2013 21:52, Tom Ellis  wrote:
> Hi All,
>
> I asked this on stackoverflow [1] and didn't get a response, but this
> is obviously a better spot to get questions answered.
>
> Consider the following:
>
> public class MyRouteBuilder extends RouteBuilder {
>
>   @Override
>   public void configure() throws Exception {
>   FileEndpoint dropLocation = new FileEndpoint();
>   dropLocation.setCamelContext(getContext());
>   dropLocation.setFile(new File("/data"));
>   dropLocation.setRecursive(true);
>   dropLocation.setPreMove(".polled");
>   dropLocation.setNoop(true);
>   dropLocation.setMaxMessagesPerPoll(1);
>
>   from(dropLocation).to(...
>
> versus
>
> public class MyBuilder extends RouteBuilder {
>
>   @Override
>   public void configure() throws Exception {
>   
> from("file://data?recursive=true&preMove=.polled&noop=true&maxMessagesPerPoll=1").to(...
>
> Programmatically I get code completion and the like, whereas with the
> URI everything is in a single line.

Agreed. Using many parameters soon gets messy with the URI. Plus bean
properties works much nicer with dependency injection frameworks &
IDEs.

So unless its just 1 parameter; I prefer the Java API to URIs really.


> I've noticed that the JMX beans
> also don't seem to build the URI for stuff like hawt.io if you build
> the endpoint with the programmatic way as well. What are the other
> pros/cons for each?

I think this is down to many endpoints not being able to auto-create
the URI string on the endpoint property so its probably not exposed in
JMX.

Though we could maybe fix that; since we now know - for many endpoints
now - which properties are URI parameters due to the use of @UriParam,
we could generate the URI string dynamically based on the property
values if folks have configured the endpoint as a bean, rather than
from a URI string?
https://cwiki.apache.org/confluence/display/CAMEL/Endpoint+Annotations


> Pretty much all the examples I see utilise the URI method - is this
> the preferred way?

It is often easier for many simple URIs; but either approach is valid really.


> Could it be possible to use the builder pattern or something to build
> up an endpoint, e.g.
>
> FileEndpoint dropLocation = new
> FileEndpoint.Builder().camelContext(getContext()).file(new
> File("/data")).recursive().preMove().noop().maxMessagesPerPoll(1).build();

another option is to use both :)


  FileEndpoint  dropLocation  = endpoint("file://data", FileEndpoint.class);
  // now configure extra properties...


On the builder front; I wonder if we could use a tool like JAnnocessor
- or hack some APT processing tool or something - to automatically
create builder friendly APIs to endpoints annotated with @UriParam?
Then we'd get an automatically generated nice builder API? i.e. add
builder style methods to the endpoint classes (which already have
getter and setters - but add a builder like method facade above the
setters)?

e.g. if we code generated methods like this at build time:

public class FileEndpoint {

  // these are code generated at APT compile time...
  public FileEndpoint recursive() {
 setRecursive(true);
 return this;
  }
  
}

then the code could be like this...

  from(endpoint("file://data",
FileEndpoint.class).recursive().preMove().noop().maxMessagesPerPoll(1)).
to(endpoint("activemq:foo",
ActiveMQEndpoint.class).transactional().concurrentConsumers(5))

and have the URI strings generated for the above for tooling & JMX?

-- 
James
---
Red Hat

Email: jstra...@redhat.com
Web: http://fusesource.com
Twitter: jstrachan, fusenews
Blog: http://macstrac.blogspot.com/

Open Source Integration