Re: camel cache configurationFile

2015-11-30 Thread ncasaux
Hello,

In my route, I'm using this URI, which seems OK with the bean to me:

.to("cache://TestCache2")



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


Re: camel cache configurationFile

2015-11-30 Thread Minh Tran
Hi

That TestCache2 in your uri is not the name of the bean, it’s the name of the 
cache. 

The easiest way to fix your problem is to set the id your spring bean from 
“TestCache2" to “cache” in your xml earlier

> On 30 Nov 2015, at 7:32 PM, ncasaux  wrote:
> 
> Hello,
> 
> In my route, I'm using this URI, which seems OK with the bean to me:
> 
> .to("cache://TestCache2")
> 
> 
> 
> --
> View this message in context: 
> http://camel.465427.n5.nabble.com/camel-cache-configurationFile-tp5774492p5774549.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



Re: camel cache configurationFile

2015-11-30 Thread ncasaux
Thanks for your suggestion.

However, I did as you recommand : 





but I still get the "No configuration found" when I update the bundle.



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


Re: camel cache configurationFile

2015-11-30 Thread Minh Tran
Is there an exception/stacktrace with the error? That might give you a clue as 
to what the problem is.

The only thing I can think of is perhaps your ehcache.xml doesn’t contain the 
TestCache2 region defined in there.

> On 30 Nov 2015, at 8:06 PM, ncasaux  wrote:
> 
> Thanks for your suggestion.
> 
> However, I did as you recommand : 
> 
> 
> value="file:D:\\Tools\\apache-servicemix-6.0.1\\etc\\ehcache.xml"/>
> 
> 
> but I still get the "No configuration found" when I update the bundle.
> 
> 
> 
> --
> View this message in context: 
> http://camel.465427.n5.nabble.com/camel-cache-configurationFile-tp5774492p5774552.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



Re: camel cache configurationFile

2015-11-30 Thread ncasaux
I just noticed something I can't understand:

In my bean, I have also this piece of code for monitoring my cache
configuration:


  

  
  

  
  
  
  
  


During my bundle start, I can see in the logs:

2015-11-30 11:16:01,486 | WARN  | xtenderThread-30 | ConfigurationFactory   
 
| 242 - net.sf.ehcache - 2.9.1 | No configuration found

2015-11-30 11:16:01,558 | INFO  | xtenderThread-30 |
DefaultCacheManagerFactory   | 243 - org.apache.camel.camel-cache -
2.15.3 | Creating CacheManager usin
g camel-cache configuration:
file:D:\\Tools\\apache-servicemix-6.0.1-DUPLICATE\\etc\\ehcache.xml

However, when I look at the cache configuration created, the values are not
the ones from my ehcache.xml



When I remove the bean "ehCacheManagementService" and I restart the bundle,
I can see in the logs:
:

2015-11-30 11:19:26,318 | INFO  | xtenderThread-32 |
DefaultCacheManagerFactory   | 243 - org.apache.camel.camel-cache -
2.15.3 | Creating CacheManager usin
g camel-cache configuration:
file:D:\\Tools\\apache-servicemix-6.0.1-DUPLICATE\\etc\\ehcache.xml

So, no more warning "No configuration found", but I can't check if my cache
configuration is OK.


Is that possible that the monitoring bean I use prevent my cache from being
created as per my ehcache.xml file ?




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


camel-servlet is no-longer working in 2.16.1 (works in 2.15.3 and 2.16.0)

2015-11-30 Thread MEL
I am using the camel-servlet component, in an app hosted in tomcat, to
trigger a route via a URL such as this

http://localhost:9090/appcontext/triggerimport/

When upgrading to 2.16.1 the URL fails to trigger the route;  the URL works
if I downgrade to 2.15.3 or 2.16.0 (looks like CAMEL-9263 may have
introduced the issue)




web.xml



MyTriggerImportServlet
Trigger import of JArchive content

org.apache.camel.component.servlet.CamelHttpTransportServlet
2

ignoreDuplicateServletName
true





MyTriggerImportServlet
/triggerimport/*




camel-config.xml












--
View this message in context: 
http://camel.465427.n5.nabble.com/camel-servlet-is-no-longer-working-in-2-16-1-works-in-2-15-3-and-2-16-0-tp5774558.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Camel JMSConsumer creating lots of ActiveMQ Session Task

2015-11-30 Thread vsk
Yes. The connections are pooled. 

   PooledConnectionFactory pooled = new
PooledConnectionFactory(coreConnectionFactory);
pooled.setMaxConnections(2);
pooled.setMaximumActiveSessionPerConnection(3);
component.setUsePooledConnection(true);
component.setConnectionFactory(pooled);
component.setConfiguration(jmsConfiguration);



--
View this message in context: 
http://camel.465427.n5.nabble.com/Camel-JMSConsumer-creating-lots-of-ActiveMQ-Session-Task-tp5774232p5774557.html
Sent from the Camel - Users mailing list archive at Nabble.com.


CSV marshaller problem - accumulating columns

2015-11-30 Thread ftoresan
Hi,

I have a route that exports data from a database to a csv file, and is
reused across several tables. The problem is that the CsvMarshaller always
adds up to its column list all the columns of the record being marshalled.
It's probably the same issue being reported  here
  .
First table is ok, second table (if it is a different one) is marshalled
wrong, with all its columns and the previous table columns.

Is it a wrong usage of the CSV marshaller? If it is possible I'd like to
reset its state without recreating the route.

Cheers,

Fabricio Toresan



--
View this message in context: 
http://camel.465427.n5.nabble.com/CSV-marshaller-problem-accumulating-columns-tp5774556.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Camel - Spock test cases

2015-11-30 Thread contactreji
Hi friends

I am trying to write few test cases using spock. My Aim here is to start the
routes in a class which extends RouteBuilder class and it has few camel
routes in the configure() method.

I use groovy dsl and gradle as build tool.

My spock test cases look like follows :- 
*
package unittest.groovy

import com.groovy.routes.VMMBrandIntegrationRoute
import org.apache.camel.impl.DefaultCamelContext
import spock.lang.Specification
import java.net.*;

/**
 * Created by Z001NLH on 11/30/2015.
 */
class SpockTestCases extends Specification{

   // URL url =
VMMBrandIntegrationRoute.class.getClassLoader().getResource("appConfigs.groovy")
//Available blocks in SPOCK - setup(given), when, then, expect, cleanup,
and where

   def "Firewall Rules"()
{
def portAvailable
Socket socket = new Socket()
when:
socket.connect new InetSocketAddress("stgibp.target.com", 443);
portAvailable = socket.isConnected();
then:
portAvailable

cleanup:
socket.close()

}

def "Dummy Test Case"()
{
setup:
def stack = new Stack()
def elem = "push me"
when:
stack.push(elem)
then:
!stack.empty
stack.size() == 1
stack.peek() == elem

}

def "Test Function"()
{
setup:
def camelContext = new DefaultCamelContext()
when:
camelContext.addRoutes(VMMBrandIntegrationRoute)
camelContext.start()
then:
camelContext.isStarted()

}

}
*


However, I get following exception
-
*No signature of method:
org.apache.camel.impl.DefaultCamelContext.addRoutes() is applicable for
argument types: (java.lang.Class) values: [class
com.groovy.routes.VMMBrandIntegrationRoute]
Possible solutions: addRoutes(org.apache.camel.RoutesBuilder), getRoutes(),
setRoutes(java.util.List), getRoute(java.lang.String)
groovy.lang.MissingMethodException: No signature of method:
org.apache.camel.impl.DefaultCamelContext.addRoutes() is applicable for
argument types: (java.lang.Class) values: [class
com.groovy.routes.VMMBrandIntegrationRoute]
Possible solutions: addRoutes(org.apache.camel.RoutesBuilder), getRoutes(),
setRoutes(java.util.List), getRoute(java.lang.String)
at unittest.groovy.SpockTestCases.Test 
Function(SpockTestCases.groovy:50)*

I understand that camelContext.addRoutes() takes RoutesBuilder as argument.
Is there a way I can load routes from the groovy class below which extends
RouteBuilder class. Following class contains my camel routes.

*
public class VMMBrandIntegrationRoute extends RouteBuilder{
//Use Case taken from VMM Brand Integration
URL url =
VMMBrandIntegrationRoute.class.getClassLoader().getResource("appConfigs.groovy")
def config = new ConfigSlurper().parse(url)

void configure() throws Exception {

final Namespaces ns = new Namespaces("ns",
"http://target.com/2012/03/01/canonical/BusinessPartner";)

   
from("timer://BRANDJOB_Scheduler?fixedRate=true&period="+config.brandJobScheduleInterval+"%amp;delay=0")
.routeId("BRAND_APIConnectRoute")
   
.setHeader("jobID_BRND",simple('VMMBRANDJOB${date:now:MMddHHmmss}'))
.inOnly("seda:setJobStartTimeMetrics_BRND")
.inOnly("seda:StoreJOBIdInCache_BRND")
.setProperty("limit",constant(config.brandAPILimit))
   
.setProperty("updatedOffset",constant(config.brandAPIInitialOffset))
.setHeader("Content-Type",constant("application/xml;
charset=UTF-8"))
.setHeader("CamelHttpMethod",constant("GET"))
   
.setHeader("CamelHttpQuery",simple(config.brandAPIURLOptions+'&offset=${property.updatedOffset}&limit=${property.limit}'))
.log('Initial HttpQuery = ${in.header.CamelHttpQuery}')
   
.to("https4://"+config.brandAPIUrl+"?authUsername="+config.brandAPIUserName+"&authPassword="+config.brandAPIPassword+"&disableStreamCache=true")
.convertBodyTo(java.lang.String.class)
   
.setHeader("CamelFileName",simple('Download_${date:now:MMddHHmmss}_${date:now:HHmmss}'))
.inOnly("seda:ProcessVMMRecords_BRND")
   
.setProperty("TotalRecordCount",ns.xpath('ns:brand_list/ns:record_count/text()',Integer.class))
.log('The total count is ${property.TotalRecordCount}')
.processRef("CalculateCycles")
.loop(simple('${property.RemainingCycles}'))
.processRef("UpdateOffsetValue")
.log('updated offset = ${property.updatedOffset}')
   
.setHeader("CamelHttpQuery",simple(config.brandAPIURLOptions+'&offset=${property.updatedOffset}&limit=${property.limit}'))
.log('Updated HttpQuery = ${in.header.CamelHttpQuery}')
   
.to("https4://"+config.brandAPIUrl+"?authUsername="+conf

How to obtain Exchange object in TypeConverter?

2015-11-30 Thread dominic.mic...@kaufhof.de
Hi.

I'm using Camel 2.16.0 and wrote a TypeConverter which expects the Exchange
Object as a second method parameter, as described in
http://camel.apache.org/type-converter.html#TypeConverter-Exchangeparameter
However, the Exchange Parameter is received as null because when calling
camelContext.getTypeConverter.mandatoryConvertTo[(clazz, body) it just calls
mandatoryConvertTo(type, null, value); (Exchange is the second parameter
here)

Now i'm trying to figure out what's the best way to obtain an Exchange
object in my Converter. Since my converter doesn't know about the
CamelContext or the endpoint, i cannot create a new DefaultExchange.
Any help is appreciated.

Kind regards,
Dominic



--
View this message in context: 
http://camel.465427.n5.nabble.com/How-to-obtain-Exchange-object-in-TypeConverter-tp5774573.html
Sent from the Camel - Users mailing list archive at Nabble.com.


[ANNOUNCEMENT] Apache Camel 2.15.5 Released

2015-11-30 Thread Gregor Zurowski
The Camel community announces the immediate availability of the new
patch release Camel 2.15.5. This release contains 19 fixes applied in
the past few weeks by the community on the Camel 2.15.x maintenance
branch. This release also updates the Apache Commons Collections
library to version 3.2.2 [1] that contains a patch for a recently
reported object de-serialization vulnerability [2].

The artifacts are published and ready for you to download [3] either
from the Apache mirrors or from the Central Maven repository. For more
details please take a look at the release notes [4, 5].

Many thanks to all who made this release possible.

On behalf of the Camel PMC,
Gregor Zurowski

[1] https://commons.apache.org/proper/commons-collections/release_3_2_2.html
[2] 
https://blogs.apache.org/foundation/entry/apache_commons_statement_to_widespread
[3] http://camel.apache.org/download.html
[4] http://camel.apache.org/camel-2155-release.html
[5] 
https://issues.apache.org/jira/secure/ReleaseNote.jspa?projectId=12311211&version=12333895