Can't make camel-example-spring-security works

2016-08-17 Thread olivier
Hi,

This is probably a basic issue but i'm not very familiar with neither Camel,
nor Maven.

I'm simply trying to run the camel-example-spring-security provided with
Camel 2.17.3 version.

I'm running Maven 3.2.3 with Java 1.8.0_101.

In the instructions it says to run:
mvn clean install
And then:
mvn jetty:run

The "mvn clean install" works, no problem. But when I run "mvn jetty:run", I
get the following errors:

2016-08-17 12:43:43,909 [main   ] ERROR ContextLoader 
- Context initialization failed
org.springframework.beans.factory.BeanCreationException: *Error creating
bean with name 'accessDecisionManager' defined in class path resource
[camel-context.xml]: Instantiation of bean failed; nested exception is
org.springframework.beans.BeanInstantiationException: Failed to instantiate
[org.springframework.security.access.vote.AffirmativeBased]: No default
constructor found; nested exception is java.lang.NoSuchMethodException*:
org.springframework.security.access.vote.AffirmativeBased.()
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:1105)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1050)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:510)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482)
at
org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)
at
org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
at
org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)
at
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
at
org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:772)
at
org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:839)
at
org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:538)
at
org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:444)
at
org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:326)
at
org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:107)
at
org.eclipse.jetty.server.handler.ContextHandler.callContextInitialized(ContextHandler.java:782)
at
org.eclipse.jetty.servlet.ServletContextHandler.callContextInitialized(ServletContextHandler.java:424)
at
org.eclipse.jetty.server.handler.ContextHandler.startContext(ContextHandler.java:774)
at
org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:249)
at
org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1242)
at
org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:717)
at
org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:494)
at
org.mortbay.jetty.plugin.JettyWebAppContext.doStart(JettyWebAppContext.java:298)
at
org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64)
at
org.eclipse.jetty.server.handler.HandlerCollection.doStart(HandlerCollection.java:229)
at
org.eclipse.jetty.server.handler.ContextHandlerCollection.doStart(ContextHandlerCollection.java:172)
at
org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64)
at
org.eclipse.jetty.server.handler.HandlerCollection.doStart(HandlerCollection.java:229)
at
org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64)
at
org.eclipse.jetty.server.handler.HandlerWrapper.doStart(HandlerWrapper.java:95)
at org.eclipse.jetty.server.Server.doStart(Server.java:282)
at org.mortbay.jetty.plugin.JettyServer.doStart(JettyServer.java:65)
at
org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64)
at
org.mortbay.jetty.plugin.AbstractJettyMojo.startJetty(AbstractJettyMojo.java:520)
at
org.mortbay.jetty.plugin.AbstractJettyMojo.execute(AbstractJettyMojo.java:365)
at
org.mortbay.jetty.plugin.JettyRunMojo.execute(JettyRunMojo.java:523)
at
org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:132)
at
org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:

Binary Data Structure Marshalling and Unmarshalling

2016-08-17 Thread Pratik Thacker
We need to decode and encode binary data structure.
We explored several data formats available in
http://camel.apache.org/data-format.html. But couldn't find relevant data
format for binary structured record.

For example:
If my data structure of a record is like:
SampleStructure bytes(12){
   int num1: bytes(1);
   int num2: bytes(2);
   string results: bytes(9);
}
And Data is like:
Record-1{
  num1: 100;
  num2: 300;
  results: "Test_Test";
}
For above sample data, file would be of 12 bytes containing one record.
* 1st byte representing byte form of integer 100.
* 2nd and 3rd byte representing byte form of integer 300. Here, it would be
great if we have choice to choose among big-endian and little-endian format.
* next 9 bytes representing byte form of ascii value of each character of
the string "Test_Test".

Similarly a file can contain multiple consecutive records.

Please suggest if we can unmarshal such formats and directly get a POJO
object, just like we get it for the csv, xml or flat file formats. Here are
the references we already explored and found it to be non-relevant for our
case.
   1. Bindy : http://camel.apache.org/bindy.html
   2. Bean IO: http://camel.apache.org/beanio.html
   3. Flatpack : http://camel.apache.org/flatpack-dataformat.html



--
View this message in context: 
http://camel.465427.n5.nabble.com/Binary-Data-Structure-Marshalling-and-Unmarshalling-tp5786529.html
Sent from the Camel - Users mailing list archive at Nabble.com.


date function source

2016-08-17 Thread Mark Lybarger
i have a camel route that uses a date function:

.setProperty("dateNow",simple("${date:now:HHmmssSSS}"))
.log("dateNow:${property.dateNow}")

I'm curious what controls the date stamp here.  on some systems, it uses
clock time, and on some it uses gmt time.  on my windows system, it uses
clock time, on one RHEL system it uses clock time, on serveral other RHEL
systems, it uses gmt time.

java has user.timezone set on all the systems, on RHEL, it is US/Eastern,
and on my windows workstation, it is America/New_York.

thanks!


Disabling concurrency in camel route

2016-08-17 Thread robina
Hi,

I've encountered a scenario in a camel route involving (I believe)
concurrency:

My route has a netty4 tcp consumer, which then uses a multicast to pass the
message through a number of xsl transformers which then output to ActiveMQ
endpoints.

I've observed that when I receive a large XML message, followed almost
immediately (approx. 1 millisecond) by a smaller XML message, the smaller
message passes through the route before the large message (obviously to do
with the cost of the transformation process).  The order of the messages is
important, so I'd like to control this behaviour.

I'm trying to ensure that only one message is processed by the route at any
given time, so would the solution be as simple as setting maxPoolSize=1 on
the netty4 consumer?

I'm having a hard time understanding the threading/concurrency model in
camel, so can anyone help me with a good description somewhere of the
lifecycle of a message through a camel route?

Thank you in advance,
Rob



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


Re: Disabling concurrency in camel route

2016-08-17 Thread Vitalii Tymchyshyn
You should also do "synchronous=true". Otherwise you may experience
reordering on any asynchronous producer.
Another option is to use http://camel.apache.org/resequencer.html when you
want the sequence restored.

Best regards, Vitalii Tymchyshyn

Ср, 17 серп. 2016 о 09:28 robina  пише:

> Hi,
>
> I've encountered a scenario in a camel route involving (I believe)
> concurrency:
>
> My route has a netty4 tcp consumer, which then uses a multicast to pass the
> message through a number of xsl transformers which then output to ActiveMQ
> endpoints.
>
> I've observed that when I receive a large XML message, followed almost
> immediately (approx. 1 millisecond) by a smaller XML message, the smaller
> message passes through the route before the large message (obviously to do
> with the cost of the transformation process).  The order of the messages is
> important, so I'd like to control this behaviour.
>
> I'm trying to ensure that only one message is processed by the route at any
> given time, so would the solution be as simple as setting maxPoolSize=1 on
> the netty4 consumer?
>
> I'm having a hard time understanding the threading/concurrency model in
> camel, so can anyone help me with a good description somewhere of the
> lifecycle of a message through a camel route?
>
> Thank you in advance,
> Rob
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/Disabling-concurrency-in-camel-route-tp5786531.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>


Re: Disabling concurrency in camel route

2016-08-17 Thread robina
Thanks for the reply Vitalii,

Would setting synchronous=true on its own ensure that only one message is
processed by the route at any given time? Or is it the combination of the
maxPoolSize of 1 and synchronous=true setting?

Regards,
Rob



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


Re: Disabling concurrency in camel route

2016-08-17 Thread Karts
I believe you can just set .threads(1)



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


Camel SEDA timeout: Update it at runtime

2016-08-17 Thread dcparga
Hi all,

I'm trying to implement a seda route to handle rest calls asynchronously.
The point is, that I would like to handle different timeouts per call, which
leads the problem to be able to change the timeout of the seda route using a
parameter on the HTTP header. As far as I know, the timeout it's only set
when the route is created, and the purpose of these APIs are for a high
performance service, it's not a solution to stop and start the route for
every single call, so, my ideal approach would be to be able to change the
timeout dynamically accessing to the endpoint through the context.

If I'm missing something, or there is an existing solution for this problem,
please let me know and excuse me.

Thank you



--
View this message in context: 
http://camel.465427.n5.nabble.com/Camel-SEDA-timeout-Update-it-at-runtime-tp5786538.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Disabling concurrency in camel route

2016-08-17 Thread Vitalii Tymchyshyn
You would need a combination.

Ср, 17 серп. 2016 09:41 користувач robina  пише:

> Thanks for the reply Vitalii,
>
> Would setting synchronous=true on its own ensure that only one message is
> processed by the route at any given time? Or is it the combination of the
> maxPoolSize of 1 and synchronous=true setting?
>
> Regards,
> Rob
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/Disabling-concurrency-in-camel-route-tp5786531p5786533.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>


Re: Camel SEDA timeout: Update it at runtime

2016-08-17 Thread José Luis Pedrosa
I think this may require a small change on seda component to accept values
in a haeader for example. I think maybe a Jira ticket should be better?

Claus?

Rgds

On Aug 17, 2016 16:46, "dcparga"  wrote:

> Hi all,
>
> I'm trying to implement a seda route to handle rest calls asynchronously.
> The point is, that I would like to handle different timeouts per call,
> which
> leads the problem to be able to change the timeout of the seda route using
> a
> parameter on the HTTP header. As far as I know, the timeout it's only set
> when the route is created, and the purpose of these APIs are for a high
> performance service, it's not a solution to stop and start the route for
> every single call, so, my ideal approach would be to be able to change the
> timeout dynamically accessing to the endpoint through the context.
>
> If I'm missing something, or there is an existing solution for this
> problem,
> please let me know and excuse me.
>
> Thank you
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.
> com/Camel-SEDA-timeout-Update-it-at-runtime-tp5786538.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>


Re: Camel SEDA timeout: Update it at runtime

2016-08-17 Thread Brad Johnson
Are the REST timeouts the same for a given resource or would it change even
for the resource?  The reason I ask is that you could have a seda queue per
method/resource and use a recipientList to route to the correct queue
associated with that request.

Obviously this also depends some on how you do your REST.  If you have an
API interface and expose it via CXF it is easy to use the opertionName to
route.  I'm using direct-vm in this case as I usually have the actual
implemention in a different bundle with a different camel context and if I
want to switch to SEDA I do it internally in the implementing bundle.



direct-vm:${header.operationName}



On Wed, Aug 17, 2016 at 9:52 AM, José Luis Pedrosa 
wrote:

> I think this may require a small change on seda component to accept values
> in a haeader for example. I think maybe a Jira ticket should be better?
>
> Claus?
>
> Rgds
>
> On Aug 17, 2016 16:46, "dcparga"  wrote:
>
> > Hi all,
> >
> > I'm trying to implement a seda route to handle rest calls asynchronously.
> > The point is, that I would like to handle different timeouts per call,
> > which
> > leads the problem to be able to change the timeout of the seda route
> using
> > a
> > parameter on the HTTP header. As far as I know, the timeout it's only set
> > when the route is created, and the purpose of these APIs are for a high
> > performance service, it's not a solution to stop and start the route for
> > every single call, so, my ideal approach would be to be able to change
> the
> > timeout dynamically accessing to the endpoint through the context.
> >
> > If I'm missing something, or there is an existing solution for this
> > problem,
> > please let me know and excuse me.
> >
> > Thank you
> >
> >
> >
> > --
> > View this message in context: http://camel.465427.n5.nabble.
> > com/Camel-SEDA-timeout-Update-it-at-runtime-tp5786538.html
> > Sent from the Camel - Users mailing list archive at Nabble.com.
> >
>


Re: Camel SEDA timeout: Update it at runtime

2016-08-17 Thread Vitalii Tymchyshyn
You can try using dynamic to (
http://camel.apache.org/how-to-use-a-dynamic-uri-in-to.html) to set timeout
option from header.

Best regards, Vitalii Tymchyshyn

Ср, 17 серп. 2016 10:45 користувач dcparga  пише:

> Hi all,
>
> I'm trying to implement a seda route to handle rest calls asynchronously.
> The point is, that I would like to handle different timeouts per call,
> which
> leads the problem to be able to change the timeout of the seda route using
> a
> parameter on the HTTP header. As far as I know, the timeout it's only set
> when the route is created, and the purpose of these APIs are for a high
> performance service, it's not a solution to stop and start the route for
> every single call, so, my ideal approach would be to be able to change the
> timeout dynamically accessing to the endpoint through the context.
>
> If I'm missing something, or there is an existing solution for this
> problem,
> please let me know and excuse me.
>
> Thank you
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/Camel-SEDA-timeout-Update-it-at-runtime-tp5786538.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>


Re: Camel SEDA timeout: Update it at runtime

2016-08-17 Thread chandler
It would be nice if ALL the JMS/Exchange system headers/properties were
persevered in the SEDA Queue. Example: /replyto correlationID, .../



--
View this message in context: 
http://camel.465427.n5.nabble.com/Camel-SEDA-timeout-Update-it-at-runtime-tp5786538p5786544.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Request-Reply and Publish

2016-08-17 Thread chandler
 Incoming endpoint is /Jetty/REST/ with/ Pattern="InOut"/. I then publish the
request message on a topic.  With multiple consumers. I only want one of the
consumers (Service Activator) to reply.

I tried putting a /pattern="InOnly"/ on the "to" of the Service Activators
(camel components) that I did not want to respond. And it responded any how. 

In the diagram I want to select which App A or B replies:

 



--
View this message in context: 
http://camel.465427.n5.nabble.com/Request-Reply-and-Publish-tp5786546.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Camel idempotent // TTL

2016-08-17 Thread contactreji
Hello guys

Is there a way we can define a lifetime or a TTL for a duplicate message.
There are chances I might have to remove duplicates which come in a span of
6 hours. And after 6 hours I might need to allow the message with same key.

Reji



-
Reji Mathews
Sr. Developer - Middleware Integration / SOA ( Open Source - Apache Camel & 
Jboss Fuse ESB | Mule ESB )
LinkedIn - http://in.linkedin.com/pub/reji-mathews/31/9a2/40a
Twitter - reji_mathews
--
View this message in context: 
http://camel.465427.n5.nabble.com/Camel-idempotent-TTL-tp5786550.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Camel idempotent // TTL

2016-08-17 Thread Claus Ibsen
Hi

Not out of the box.

You can add your own idempotent repository that keeps track of age,
and then removes > 6h.



On Thu, Aug 18, 2016 at 8:04 AM, contactreji  wrote:
> Hello guys
>
> Is there a way we can define a lifetime or a TTL for a duplicate message.
> There are chances I might have to remove duplicates which come in a span of
> 6 hours. And after 6 hours I might need to allow the message with same key.
>
> Reji
>
>
>
> -
> Reji Mathews
> Sr. Developer - Middleware Integration / SOA ( Open Source - Apache Camel & 
> Jboss Fuse ESB | Mule ESB )
> LinkedIn - http://in.linkedin.com/pub/reji-mathews/31/9a2/40a
> Twitter - reji_mathews
> --
> View this message in context: 
> http://camel.465427.n5.nabble.com/Camel-idempotent-TTL-tp5786550.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



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


Re: date function source

2016-08-17 Thread Claus Ibsen
It uses the JDK Date API so whatever it uses - is used by Camel.


On Wed, Aug 17, 2016 at 3:20 PM, Mark Lybarger  wrote:
> i have a camel route that uses a date function:
>
> .setProperty("dateNow",simple("${date:now:HHmmssSSS}"))
> .log("dateNow:${property.dateNow}")
>
> I'm curious what controls the date stamp here.  on some systems, it uses
> clock time, and on some it uses gmt time.  on my windows system, it uses
> clock time, on one RHEL system it uses clock time, on serveral other RHEL
> systems, it uses gmt time.
>
> java has user.timezone set on all the systems, on RHEL, it is US/Eastern,
> and on my windows workstation, it is America/New_York.
>
> thanks!



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


Re: Retrieve all properties in CamelContext

2016-08-17 Thread Claus Ibsen
Are you talking about property placeholders? And if you are using
Spring then those properties are from Spring. There is no API in Camel
to get all properties. Its not possible and easy to do.

If your properties are externailized to .properties files, then you
can find those files and read the properties yourself to list.

On Wed, Aug 17, 2016 at 12:03 AM, Gershaw, Geoffrey A.
 wrote:
> Hello,
>
>
> I have seen the question asked, but I don't see a clean solution to get all 
> the properties from a CamelContext so that I may print them out.  I'm using 
> the BridgePropertyPlaceholderConfigurer. I am at Camel 2.16.x. Any advice is 
> appreciated
>
>
>
> Thanks much,
>
>
>
> Geoff
>
> ===
> Please access the attached hyperlink for an important electronic 
> communications disclaimer:
> http://www.credit-suisse.com/legal/en/disclaimer_email_ib.html
> ===



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


Re: poll enrich and file endpoint

2016-08-17 Thread Claus Ibsen
Its easier to do a message transformation and set the body as a java.io.File


  {{env:HOME}}/my-dir/${body}



On Tue, Aug 16, 2016 at 8:39 PM, Alex Soto  wrote:
> Hello,
>
> I am experiencing erratic results when using the Poll Enrich with a static 
> file.
> The file is static in the sense that it never changes, so I am setting both 
> the noop=true and the idempotent=false.
> Basically I need to be able to serve this same files for ever, and not move 
> it or deleted it.
>
> My route sets the body with the file name, then it continues with:
>
> 
>
> file:{{env:HOME}}/my-dir?noop=true&fileName=${body}&idempotent=false
> 
>
> It works a few times, but after this is executed several times (from multiple 
> clients concurrently), the body becomes null, even though, the file is still 
> present in the directory.
> Am I setting the options correctly?  How can this be accomplished?
>
> Best regards,
> Alex soto
>
>
>



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


Re: Rest DSL & CORS

2016-08-17 Thread Claus Ibsen
You can try set a header with the value you want.

The CORS in Camel may preserve existing headers (cannot remember)

On Tue, Aug 16, 2016 at 4:22 AM, dmitriyC300  wrote:
> Hi Guys,
> Is there a way to dynamically set/reset Access-Control-Allow-Origin response
> header based on incoming request's Origin header?  It looks like static
> setting can be applied via rest configuration, but I couldn't figure out how
> to do it dynamically apart from managing response CORS headers directly.
>
> In the use case I am trying to allow cross origin requests from a limited
> list of known domains/sub-domains, but cannot use "*" for security reasons
> when credential flag is enabled.
>
> "Response to preflight request doesn't pass access control check: A wildcard
> '*' cannot be used in the 'Access-Control-Allow-Origin' header when the
> credentials flag is true."
>
> Dmitriy
>
>
>
> --
> View this message in context: 
> http://camel.465427.n5.nabble.com/Rest-DSL-CORS-tp5786416.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



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


Re: ftp advanced filtering

2016-08-17 Thread Claus Ibsen
On Sat, Aug 13, 2016 at 11:56 PM, gonzo  wrote:
> Hello,
>
> I need to add some database checks into my filter. Having file name is not
> enough for my case.
> I'm wondering if there is any other option of file filtering than using
> GenericFileFilter in uri?
> Example:
> from("ftp://user@host/Downloads?password=password&delete=true&filter=#myFileFilter";)
> ('delete=true' is added on purpose. By default I need files to be deleted.)
>
> 1. May I add any argument to '#myFileFilter(userId)' in uri?

No

But the implementation of the filter, is just a java class so you can
create that instance anyhow you want and configure it.


> 2. Can I use '.process()' and '.stop()' combination to prevent some files
> from deleting?

No

> 3. Can '.filter(new Predicate() ...)' be used in ftp route?
>

Yes but the file is downloaded from FTP and then filtered afterwards
in the Camel route, and if you have delete=true the file is also
deleted regardless of that filter.


> Regards,
> Jared
>
>
>
> --
> View this message in context: 
> http://camel.465427.n5.nabble.com/ftp-advanced-filtering-tp5786379.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



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