Re: karaf 2.2.5, cxf 2.6.0 and camel 2.9.0 install problem

2012-04-30 Thread Christian Schneider

Can you try if this still happens with the new versions?

Karaf 2.2.7
Camel 2.9.2
CXF 2.6.0

Christian

Am 30.04.2012 06:38, schrieb Fitzcaraldo:

I’m trying to run the Camel OSGi blueprint example using karaf2.2.5, camel
2.9.0 and cxf 2.6.0.

I followed the instructions here:
http://camel.apache.org/cxf-example-osgi-blueprint.html
http://camel.apache.org/cxf-example-osgi-blueprint.html

jdk 1.6.0_25-b06

Fresh install of karaf. Copied jar.properties.cxf to jre.properties.
Restart.

I ran the commands in this sequence

features:addurl mvn:org.apache.cxf.karaf/apache-cxf/2.6.0/xml/features
features:addUrl mvn:org.apache.camel.karaf/apache-camel/2.9.0/xml/features
features:install war
features:install cxf
features:install camel-jaxb
features:install camel-blueprint
features:install camel-cxf

When I installed the war, I noticed (in the webconsole) that apache-cxf
v2.5.1 had been added as a repo (as well as 2.6.0).  Is there a dependency?

All then goes well until features:install camel-cxf which fails with:

Error executing command: Could not start bundle
mvn:org.ops4j.pax.web/pax-web-extender-whiteboard/1.0.7 in feature(s)
cxf-war-java5-2.5.1: Activator start error in bundle
org.ops4j.pax.web.pax-web-extender-whiteboard [173].

Looks like it’s trying to load a pax-web-extender-whiteboard V1.0.7 from a
cxf 2.5.1 jar.  V1.0.8 is already installed.

Should I raise a jira?



--
View this message in context: 
http://camel.465427.n5.nabble.com/karaf-2-2-5-cxf-2-6-0-and-camel-2-9-0-install-problem-tp5675060.html
Sent from the Camel - Users mailing list archive at Nabble.com.



--

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

Open Source Architect
Talend Application Integration Division http://www.talend.com



Re: Logging from route not working

2012-04-30 Thread Claus Ibsen
Its the name such as you define with this code

   Logger log =
LoggerFactory.getLogger(SampleRouteBuilder.class.getName());

Where the name of the logger is this
SampleRouteBuilder.class.getName()

So if you want to use the same name, then you need to use the above
name in the Camel log in the DSL.



On Mon, Apr 30, 2012 at 7:18 AM, Nestor Urquiza
nestor.urqu...@gmail.com wrote:
 I am not sure I understand what logName refers to: The final log stream, the
 appender, the category?

 Here is my log4j.properties relevant section:

 log4j.rootLogger=WARN, logfile
 log4j.appender.logfile=org.apache.log4j.RollingFileAppender
 log4j.appender.logfile.layout=org.apache.log4j.PatternLayout
 log4j.appender.logfile.layout.ConversionPattern=%d %p [%c] -
 %X{remoteAddress} %X{sessionId} %m%n
 log4j.appender.logfile.File=${catalina.home}/logs/nestorurquiza-app.log
 log4j.appender.logfile.MaxFileSize=200MB
 log4j.appender.logfile.MaxBackupIndex=3
 log4j.logger.com.nestorurquiza.orchestration.camel.route=DEBUG

 As per your suggestion I used:
 from(direct:start).log(LoggingLevel.DEBUG, logfile, Processing ${id});
 and
 from(direct:start).log(LoggingLevel.DEBUG,
 com.nestorurquiza.orchestration.camel.route, Processing ${id});

 --
 View this message in context: 
 http://camel.465427.n5.nabble.com/Logging-from-route-not-working-tp5674964p5675092.html
 Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-
CamelOne 2012 Conference, May 15-16, 2012: http://camelone.com
FuseSource
Email: cib...@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/


Re: karaf 2.2.5, cxf 2.6.0 and camel 2.9.0 install problem

2012-04-30 Thread Fitzcaraldo
Good call.

With karaf v2.2.7, cxf v2.6.0 and camel v2.9.2 - it installs cleanly.   This
time the war didn't pull in an earlier version of cxf.

Thanks

--
View this message in context: 
http://camel.465427.n5.nabble.com/karaf-2-2-5-cxf-2-6-0-and-camel-2-9-0-install-problem-tp5675060p5675234.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: karaf 2.2.5, cxf 2.6.0 and camel 2.9.0 install problem

2012-04-30 Thread Jean-Baptiste Onofré

Hi guys,

As reminder, CXF 2.6/Camel 2.9 requires at least Karaf 2.2.6 due to the 
introduction of a new feature provided by Karaf.
More over, due to an issue on ConfigAdmin/FileInstall, I heavily advice 
to use Karaf 2.2.7.


Regards
JB

On 04/30/2012 08:50 AM, Fitzcaraldo wrote:

Good call.

With karaf v2.2.7, cxf v2.6.0 and camel v2.9.2 - it installs cleanly.   This
time the war didn't pull in an earlier version of cxf.

Thanks

--
View this message in context: 
http://camel.465427.n5.nabble.com/karaf-2-2-5-cxf-2-6-0-and-camel-2-9-0-install-problem-tp5675060p5675234.html
Sent from the Camel - Users mailing list archive at Nabble.com.


--
Jean-Baptiste Onofré
jbono...@apache.org
http://blog.nanthrax.net
Talend - http://www.talend.com


Re: Logging from route not working

2012-04-30 Thread Łukasz Dywicki

Use .log(priority, category, message). In your case .log(priority, message) 
goes to category named as route id. If you have no id set on route it will be 
generated.

Regards,
Lukasz


Wiadomość napisana przez Claus Ibsen w dniu 30 kwi 2012, o godz. 08:18:

 Its the name such as you define with this code
 
   Logger log =
 LoggerFactory.getLogger(SampleRouteBuilder.class.getName());
 
 Where the name of the logger is this
 SampleRouteBuilder.class.getName()
 
 So if you want to use the same name, then you need to use the above
 name in the Camel log in the DSL.
 
 
 
 On Mon, Apr 30, 2012 at 7:18 AM, Nestor Urquiza
 nestor.urqu...@gmail.com wrote:
 I am not sure I understand what logName refers to: The final log stream, the
 appender, the category?
 
 Here is my log4j.properties relevant section:
 
 log4j.rootLogger=WARN, logfile
 log4j.appender.logfile=org.apache.log4j.RollingFileAppender
 log4j.appender.logfile.layout=org.apache.log4j.PatternLayout
 log4j.appender.logfile.layout.ConversionPattern=%d %p [%c] -
 %X{remoteAddress} %X{sessionId} %m%n
 log4j.appender.logfile.File=${catalina.home}/logs/nestorurquiza-app.log
 log4j.appender.logfile.MaxFileSize=200MB
 log4j.appender.logfile.MaxBackupIndex=3
 log4j.logger.com.nestorurquiza.orchestration.camel.route=DEBUG
 
 As per your suggestion I used:
 from(direct:start).log(LoggingLevel.DEBUG, logfile, Processing ${id});
 and
 from(direct:start).log(LoggingLevel.DEBUG,
 com.nestorurquiza.orchestration.camel.route, Processing ${id});
 
 --
 View this message in context: 
 http://camel.465427.n5.nabble.com/Logging-from-route-not-working-tp5674964p5675092.html
 Sent from the Camel - Users mailing list archive at Nabble.com.
 
 
 
 -- 
 Claus Ibsen
 -
 CamelOne 2012 Conference, May 15-16, 2012: http://camelone.com
 FuseSource
 Email: cib...@fusesource.com
 Web: http://fusesource.com
 Twitter: davsclaus, fusenews
 Blog: http://davsclaus.blogspot.com/
 Author of Camel in Action: http://www.manning.com/ibsen/



Re: Logging from route not working

2012-04-30 Thread Nestor Urquiza
I have changed the code by:
private static final String LOG_NAME = SampleRouteBuilder.class.getName();
private static final Logger log = LoggerFactory.getLogger(LOG_NAME);
...
log.debug(Configuring dummy route);
from(direct:start).log(LoggingLevel.DEBUG, LOG_NAME, Processing ${id});

I still do not get the camel log message. Any ideas?

--
View this message in context: 
http://camel.465427.n5.nabble.com/Logging-from-route-not-working-tp5674964p5675622.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: file info lost in Exchange when passing through SEDA

2012-04-30 Thread Mark Webb
That was it.  I fell into the trap of using getOut().  Thank you.


On Mon, Apr 30, 2012 at 12:17 AM, Claus Ibsen claus.ib...@gmail.com wrote:
 Hi

 Sounds like you do something wrong in your custom processor that
 removes the message body.
 See this FAQ
 http://camel.apache.org/using-getin-or-getout-methods-on-exchange.html

 On Mon, Apr 30, 2012 at 3:19 AM, Mark Webb elihusma...@gmail.com wrote:
 I have a couple routes set up, shown below:

        camel:route
                camel:from uri=file:data/dropdir?noop=true /
                camel:to uri=seda:analyzer /
        /camel:route

        camel:route
                camel:from uri=seda:analyzer /
                camel:process ref=FileDataProcessor /
                camel:choice
                        camel:when
                                camel:simple${in.header.status} == 
 'fail'/camel:simple
                                camel:to uri=file:data/failure /
                        /camel:when
                /camel:choice
        /camel:route

 I would like my FileDataProcessor bean to process the data that comes
 in to it, but the exchange is null.  I turned tracing on in the
 CamelContext and receive the following:

 [-1) thread #1 - file://data/dropdir] Tracer                      INFO
  myhost-62196-1335748044869-0-2  (route1)
 from(file://data/dropdir?noop=true) -- seda://analyzer 
 Pattern:InOnly, Headers:{CamelFileName=testdata.dat,
 breadcrumbId=myhost-62196-1335748044869-0-1,
 CamelFileParent=data/dropdir, CamelFileLastModified=Sun Apr 29
 21:07:33 EDT 2012, CamelFileAbsolute=false,
 CamelFilePath=data/dropdir/testdata.dat, CamelFileLength=151,
 CamelFileNameOnly=testdata.dat,
 CamelFileAbsolutePath=/Users/mark/workspace/CamelFileAnalyzer/data/dropdir/testdata.dat,
 CamelFileRelativePath=testdata.dat},
 BodyType:org.apache.camel.component.file.GenericFile, Body:[Body is
 file based: GenericFile[testdata.dat]]
 [-1) thread #2 - seda://analyzer] Tracer                         INFO
 myhost-62196-1335748044869-0-3  (route2) from(seda://analyzer) --
  Pattern:InOnly, Headers:{CamelFileRelativePath=testdata.dat,
 CamelFilePath=data/dropdir/testdata.dat, CamelFileLength=151,
 CamelFileNameOnly=testdata.dat, CamelFileParent=data/dropdir,
 CamelFileAbsolute=false, CamelFileLastModified=Sun Apr 29 21:07:33 EDT
 2012, 
 CamelFileAbsolutePath=/Users/mark/workspace/CamelFileAnalyzer/data/dropdir/testdata.dat,
 CamelFileName=testdata.dat,
 breadcrumbId=myhost-62196-1335748044869-0-1},
 BodyType:org.apache.camel.component.file.GenericFile, Body:[Body is
 file based: GenericFile[testdata.dat]]
 [-1) thread #2 - seda://analyzer] FileDataProcessor   INFO  Exchange[null]
 [-1) thread #2 - seda://analyzer] Tracer                         INFO
 myhost-62196-1335748044869-0-3  (route2)  -- choice 
 Pattern:InOnly, Headers:{status=pass}, BodyType:null, Body:[Body is
 null]
 [-1) thread #2 - seda://analyzer] Tracer                         INFO
 myhost-62196-1335748044869-0-3  (route2) choice -- choice 
 Pattern:InOnly, Headers:{status=pass}, BodyType:null, Body:[Body is
 null]


 Can File-based Exchanges not pass through SEDA destinations or
 something like that?

 Thanks,
 Mark



 --
 Claus Ibsen
 -
 CamelOne 2012 Conference, May 15-16, 2012: http://camelone.com
 FuseSource
 Email: cib...@fusesource.com
 Web: http://fusesource.com
 Twitter: davsclaus, fusenews
 Blog: http://davsclaus.blogspot.com/
 Author of Camel in Action: http://www.manning.com/ibsen/


Re: File Processor Not deleting the files

2012-04-30 Thread rdifrango
So, I converted this over to Java and it is exhibiting the same behavior. 
What did I do wrong:

public class JavaSplitPerfProcessor {
static class LineSplitter implements Processor {
static final String format = INSERT INTO EVT_PERF ( 
EVT_PERF_ID,
CRLTN_ID, USER_ID, APPN_SYS_CD, HOST_NM, WEBLOGIC_INSTNC_NM,
WEB_ANLYTCS_CRLTN_ID, LOGGER_CLASS_NM, EXEC_TIME ) values (
EVT_PERF_ID_SEQ.NEXTVAL, ''{0}'', ''{1}'', ''{2}'', ''{3}'', ''{4}'',
''{5}'', ''{6}'', {7} );

@Override
public void process(Exchange exchange) throws Exception {
// Get the incoming line from the message exchange
String line = exchange.getIn().getBody(String.class);
// Remove the first part of the log message
String[] lineSplit = line.split(\\[\\]\\: );
// Break it down into the individual components
String[] split = lineSplit[1].split( );
// Build the insert statement
String x = MessageFormat
.format(format, split[0], split[1], 
split[2], split[3],
split[4], split[5], 
split[7], split[10]);
// Replace the incoming message with the insert 
statement
exchange.getIn().setBody(x);
}
}

public static void main(String[] args) throws Exception {
// Build the connection pool
BasicDataSource ds = new BasicDataSource();
ds.setDriverClassName(oracle.jdbc.OracleDriver);
ds.setUrl(jdbc:oracle:thin:@localhost:1521:xe);
ds.setUsername();
ds.setPassword();
// Register it with Camel
SimpleRegistry reg = new SimpleRegistry();
reg.put(dataSource, ds);

final LineSplitter lineSplitter = new LineSplitter();

CamelContext context = new DefaultCamelContext(reg);
context.addRoutes(new RouteBuilder() {
public void configure() {

from(file:perf?delete=true).split(body().tokenize(\n))

.streaming().process(lineSplitter)

.to(jdbc:dataSource?resetAutoCommit=false).end();
}
});

context.start();
Thread.sleep(6);
context.stop();
}
}

--
View this message in context: 
http://camel.465427.n5.nabble.com/File-Processor-Not-deleting-the-files-tp5670301p5675961.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Logging from route not working

2012-04-30 Thread Christian Müller
Did you send a message to your direct endpoint?

Best,
Christian

On Mon, Apr 30, 2012 at 12:54 PM, Nestor Urquiza
nestor.urqu...@gmail.comwrote:

 I have changed the code by:
 private static final String LOG_NAME = SampleRouteBuilder.class.getName();
 private static final Logger log = LoggerFactory.getLogger(LOG_NAME);
 ...
 log.debug(Configuring dummy route);
 from(direct:start).log(LoggingLevel.DEBUG, LOG_NAME, Processing ${id});

 I still do not get the camel log message. Any ideas?

 --
 View this message in context:
 http://camel.465427.n5.nabble.com/Logging-from-route-not-working-tp5674964p5675622.html
 Sent from the Camel - Users mailing list archive at Nabble.com.



Re: New JMS connection being created for every message

2012-04-30 Thread weberj
No, the resource adapter is fine. I wrote a simple MDB that uses the RA and
just echoes back a message to the reply Q. In the onMessage() call I create
and close the connection. This MDB can handle 20 messages/s, whereas Camel
handles only one.


--
View this message in context: 
http://camel.465427.n5.nabble.com/New-JMS-connection-being-created-for-every-message-tp5637735p5676000.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: karaf 2.2.5, cxf 2.6.0 and camel 2.9.0 install problem

2012-04-30 Thread Daniel Kulp
On Sunday, April 29, 2012 11:50:05 PM Fitzcaraldo wrote:
 Good call.
 
 With karaf v2.2.7, cxf v2.6.0 and camel v2.9.2 - it installs cleanly.  
 This time the war didn't pull in an earlier version of cxf.

If using CXF 2.6.0, you really need Camel 2.9.1 or newer (2.9.2 obviously 
preferred).2.9.0 was release way too long before 2.6.0 was really 
ready and thus was not tested with 2.6.0.   2.9.2 is definitely known to 
work well with CXF 2.6.0.  

Dan


 
 Thanks
 
 --
 View this message in context:
 http://camel.465427.n5.nabble.com/karaf-2-2-5-cxf-2-6-0-and-camel-2-9-0-i
 nstall-problem-tp5675060p5675234.html Sent from the Camel - Users mailing
 list archive at Nabble.com.
-- 
Daniel Kulp
d...@kulp.com
http://dankulp.com/blog



Re: Logging from route not working

2012-04-30 Thread Nestor Urquiza
Thanks Christian. That is of course a good point.

To test this works right away from the container I run the below and I got
the messages as expected:
from(quartz://group1/timer1?job.name=job1stateful=truetrigger.repeatInterval=5000trigger.repeatCount=0)
.log(LoggingLevel.INFO, LOG_NAME, Triggered group1/timer1 ${id});

Thanks to you all guys for helping me on clarifying how to use the log DSL.

Best regards,
-Nestor

--
View this message in context: 
http://camel.465427.n5.nabble.com/Logging-from-route-not-working-tp5674964p5676078.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Java heap space issue with Aggregation

2012-04-30 Thread ebinsingh
I am very sorry for not understanding this properly.
Please accept my apologies if am wasting your time.

I am totally missing something here.
Below is the change I had made (Hopeing that this is what you meant by
saying Mutate the old exchange).

I am using StringBuilder so that the process os faster and also helps not
creating many String objects.

1. when I use String.class all works fine until am running out of heapspace.
2. If I use StringBuilder, I get the following nullPointer.
3. Looks like there is no converter type to conver from String to
StringBuilder.


2012-04-30 10:34:38,087 INFO  [Camel (camel-1) thread #2 -
seda://streamQueue] ipdr.GlobalAggrStratergy -  is oldExchange null:
Exchange[null] AND is newExchange null: Exchange[null]
2012-04-30 10:34:38,087 INFO  [Camel (camel-1) thread #2 -
seda://streamQueue] ipdr.GlobalAggrStratergy - Aggregate old orders: null
2012-04-30 10:34:38,087 INFO  [Camel (camel-1) thread #2 -
seda://streamQueue] ipdr.GlobalAggrStratergy - Aggregate new order: null
2012-04-30 10:34:38,087 ERROR [Camel (camel-1) thread #2 -
seda://streamQueue] ipdr.GlobalAggrStratergy - Error aggregating
java.lang.NullPointerException
at
com.vzw.fp.ipdr.GlobalAggrStratergy.aggregate(GlobalAggrStratergy.java:26)



@Override
public Exchange aggregate(Exchange oldExchange, Exchange newExchange) {
try{
log.info( is oldExchange null: +oldExchange+ AND is 
newExchange null:
+newExchange);
if (oldExchange == null) {
return newExchange;
} else { 
log.info(Aggregate old orders:  +
oldExchange.getIn().getBody(StringBuilder.class));
log.info(Aggregate new order:  +
newExchange.getIn().getBody(StringBuilder.class));
oldExchange.getIn().setBody(

oldExchange.getIn().getBody(StringBuilder.class).

append(newExchange.getIn().getBody(StringBuilder.class)+\n)); 
counter++;
}
}catch(Exception ex){
log.error(Error aggregating, ex);
}
oldExchange.setProperty(Exchange.CONTENT_LENGTH, counter);
if(counter = 5)
counter = 0;
oldExchange.getIn().setHeader(Exchange.FILE_NAME_ONLY,
newExchange.getProperty(Exchange.FILE_NAME_ONLY));
return oldExchange;
}

--
View this message in context: 
http://camel.465427.n5.nabble.com/Java-heap-space-issue-with-Aggregation-tp5670608p5676110.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Fwd: Question regarding loop in camel

2012-04-30 Thread Hoang-Vu PHUNG
-- Forwarded message --
From: Hoang-Vu PHUNG hvu.ph...@gmail.com
Date: 2012/4/30
Subject: Question regarding loop in camel
To: users-h...@camel.apache.org


Hi all,

So far the loop construction in camel has a fixed number of iterations.
Is it possible some how to :

1. dynamically change the count of interations
2. or exit the loop earlier
3. or better use a Predicate that is re-evaluated to decide to continue to
iterate or not ?

My project is to use camel to simulate a process workflow. I prefer camel
because of its simplicity of usage.
My only problem is how to simulate a while loop. I can do something like
fixing a high number of iterations and then use a choice condition to
decide to execute the process but we waste the resources unnecessarily.

Thanks for your answer.
Regards,
Hoang-Vu


Fwd: Question regarding loop in camel

2012-04-30 Thread Hoang-Vu PHUNG
-- Forwarded message --
From: Hoang-Vu PHUNG hvu.ph...@gmail.com
Date: 2012/4/30
Subject: Question regarding loop in camel
To: users-h...@camel.apache.org


Hi all,

So far the loop construction in camel has a fixed number of iterations.
Is it possible some how to :

1. dynamically change the count of interations
2. or exit the loop earlier
3. or better use a Predicate that is re-evaluated to decide to continue to
iterate or not ?

My project is to use camel to simulate a process workflow. I prefer camel
because of its simplicity of usage.
My only problem is how to simulate a while loop. I can do something like
fixing a high number of iterations and then use a choice condition to
decide to execute the process but we waste the resources unnecessarily.

Thanks for your answer.
Regards,
Hoang-Vu


Re: Question regarding loop in camel

2012-04-30 Thread Claus Ibsen
On Mon, Apr 30, 2012 at 5:03 PM, Hoang-Vu PHUNG hvu.ph...@gmail.com wrote:
 -- Forwarded message --
 From: Hoang-Vu PHUNG hvu.ph...@gmail.com
 Date: 2012/4/30
 Subject: Question regarding loop in camel
 To: users-h...@camel.apache.org


 Hi all,

 So far the loop construction in camel has a fixed number of iterations.
 Is it possible some how to :

 1. dynamically change the count of interations

No

 2. or exit the loop earlier

Yes using stop. See the StopProcessor source code

 3. or better use a Predicate that is re-evaluated to decide to continue to
 iterate or not ?


There is a JIRA to make the loop like a while loop so we can use a
predicate to know if we should continue looping or not.
So someday in a future Camel release you can do it.

 My project is to use camel to simulate a process workflow. I prefer camel
 because of its simplicity of usage.
 My only problem is how to simulate a while loop. I can do something like
 fixing a high number of iterations and then use a choice condition to
 decide to execute the process but we waste the resources unnecessarily.

 Thanks for your answer.
 Regards,
 Hoang-Vu



-- 
Claus Ibsen
-
CamelOne 2012 Conference, May 15-16, 2012: http://camelone.com
FuseSource
Email: cib...@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/


Re: Using JdbcDataSourceName with Quickfix component

2012-04-30 Thread Marek Strejczek
Thank you for quick response and action.
I see another problem with Quickfix engine configuration - if a setting
(e.g. SETTING_JDBC_DS_NAME) is in a non-default section of the config file
(i.e. [Session]) then it is not recognized by Camel. 
I guess it is because the SessionSettings.isSetting method checks only the
[Default] part of the settings.
This issue is a bit trickier to solve. If you confirm that it's a problem
then I'll raise a JIRA issue and can work on the patch next.

BR,
Marek


--
View this message in context: 
http://camel.465427.n5.nabble.com/Using-JdbcDataSourceName-with-Quickfix-component-tp5659708p5676219.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: File Processor Not deleting the files

2012-04-30 Thread Claus Ibsen
On Mon, Apr 30, 2012 at 3:27 PM, rdifrango ron.difra...@gmail.com wrote:
 So, I converted this over to Java and it is exhibiting the same behavior.
 What did I do wrong:

 public class JavaSplitPerfProcessor {
        static class LineSplitter implements Processor {
                static final String format = INSERT INTO EVT_PERF ( 
 EVT_PERF_ID,
 CRLTN_ID, USER_ID, APPN_SYS_CD, HOST_NM, WEBLOGIC_INSTNC_NM,
 WEB_ANLYTCS_CRLTN_ID, LOGGER_CLASS_NM, EXEC_TIME ) values (
 EVT_PERF_ID_SEQ.NEXTVAL, ''{0}'', ''{1}'', ''{2}'', ''{3}'', ''{4}'',
 ''{5}'', ''{6}'', {7} );

                @Override
                public void process(Exchange exchange) throws Exception {
                        // Get the incoming line from the message exchange
                        String line = exchange.getIn().getBody(String.class);
                        // Remove the first part of the log message
                        String[] lineSplit = line.split(\\[\\]\\: );
                        // Break it down into the individual components
                        String[] split = lineSplit[1].split( );
                        // Build the insert statement
                        String x = MessageFormat
                                        .format(format, split[0], split[1], 
 split[2], split[3],
                                                        split[4], split[5], 
 split[7], split[10]);
                        // Replace the incoming message with the insert 
 statement
                        exchange.getIn().setBody(x);
                }
        }

        public static void main(String[] args) throws Exception {
                // Build the connection pool
                BasicDataSource ds = new BasicDataSource();
                ds.setDriverClassName(oracle.jdbc.OracleDriver);
                ds.setUrl(jdbc:oracle:thin:@localhost:1521:xe);
                ds.setUsername();
                ds.setPassword();
                // Register it with Camel
                SimpleRegistry reg = new SimpleRegistry();
                reg.put(dataSource, ds);

                final LineSplitter lineSplitter = new LineSplitter();

                CamelContext context = new DefaultCamelContext(reg);
                context.addRoutes(new RouteBuilder() {
                        public void configure() {
                                
 from(file:perf?delete=true).split(body().tokenize(\n))
                                                
 .streaming().process(lineSplitter)
                                                
 .to(jdbc:dataSource?resetAutoCommit=false).end();
                        }
                });

                context.start();
                Thread.sleep(6);
                context.stop();
        }
 }

 --
 View this message in context: 
 http://camel.465427.n5.nabble.com/File-Processor-Not-deleting-the-files-tp5670301p5675961.html
 Sent from the Camel - Users mailing list archive at Nabble.com.

Windows is always a bit tricky with its file system.

I suspect this line
    String line = exchange.getIn().getBody(String.class);

Despite we close the buffers un the hood, the JDK may not close
wrapped buffers, which may lead
to the FileInputStream not being closed, and Windows not able to
delete the source file when the processing is done.

I got a XP box for testing. So let see what that old fella says.



-- 
Claus Ibsen
-
CamelOne 2012 Conference, May 15-16, 2012: http://camelone.com
FuseSource
Email: cib...@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/


Re: Java heap space issue with Aggregation

2012-04-30 Thread ebinsingh
Hi Claus,

I aplogise for not understanding your comments (mutate the existing
oldExchange).  Please help me understand if you have sometime.

I am doing as I did because of the following ...

1. I guess that the old exchange is null only once for every aggregation
block (i.e Since I have the completion size as 5, the old exchange will
be null once every 5000 data). I guess this would not be a overhead causing
the outage.
2. Since there is no defauls converter to StringBuilder, I had to make the
oldExchange contents as StringBuilder as it enhances the performance by a
big margin. 

But now have come to a conclusion that Java cannot handle this big a data
(5 payload). But the concern really is that it was not able to handle
5000 payloads. Size of a payload would be equal or less than a swaps product
entity.

Thanks  regards,
Ebe

--
View this message in context: 
http://camel.465427.n5.nabble.com/Java-heap-space-issue-with-Aggregation-tp5670608p5676295.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: File Processor Not deleting the files

2012-04-30 Thread rdifrango
Thanks, in the meantime I'm going to see if I can get this running on a Unix
box.

--
View this message in context: 
http://camel.465427.n5.nabble.com/File-Processor-Not-deleting-the-files-tp5670301p5676398.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: A simple that was working before is not working now (2.10-SNAPSHOT)

2012-04-30 Thread soumya_sd

Tim wrote
 
 These exhausted after ... errors usually follow another exception. Can
 you check the logs for that exception?
 

Tim, this is the only thing I see on the tomcat log. 



--
View this message in context: 
http://camel.465427.n5.nabble.com/A-simple-that-was-working-before-is-not-working-now-2-10-SNAPSHOT-tp5669186p5676543.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Consuming JMS messages and sending them to WS

2012-04-30 Thread Christian Müller
I would suggest something like below:

from(jms://...)
  .to(xslt://...)
  .to(cxf://...);

I'm not sure whether you are looking for the Camel XSLT component or not.
Camel also supports XPath...
The Camel CXF components supports HTTPS.

Best,
Christian

On Mon, Apr 30, 2012 at 5:30 PM, saiya-jin 
martin.franci...@barclayswealth.com wrote:

 Hello,
 I have been given a task to create app that will consume JMS messages from
 one source (it will be SOAP over JMS), do some XPath-related transformation
 to the content and post this content to existing Web Service on the other
 end. No need to create Java-XML binding for the content.
 What would be the easiest solution to this? Would it support HTTPS if we
 decide go that way one day?
 Thank You for suggestions ;)

 --
 View this message in context:
 http://camel.465427.n5.nabble.com/Consuming-JMS-messages-and-sending-them-to-WS-tp5676211.html
 Sent from the Camel - Users mailing list archive at Nabble.com.



Re: Java heap space issue with Aggregation

2012-04-30 Thread Christian Müller
What's about this:

public class GlobalAggrStratergy implements AggregationStrategy {

private static final transient Logger log =
LoggerFactory.getLogger(GlobalAggrStratergy.class);

private int counter = 0;

@Override
public Exchange aggregate(Exchange oldExchange, Exchange newExchange) {
try {
log.info(oldExchange: {}, oldExchange);
log.info(newExchange: {}, newExchange);

// happens only the first time
if (oldExchange == null) {
// create and initialize the StringBuilder
newExchange.getIn().setBody(new
StringBuilder(newExchange.getIn().getBody(String.class)));
return newExchange;
}

// append the new payload to the old exchange
StringBuilder stringBuilder =
oldExchange.getIn().getBody(StringBuilder.class);
stringBuilder.append(\n);
stringBuilder.append(newExchange.getIn().getBody(String.class));

counter++;
} catch (Exception ex) {
throw new RuntimeException(ex);
}

oldExchange.setProperty(AGGREGATION_COUNTER, counter);
if (counter == 5) {
counter = 0;
}

return oldExchange;
}
}



Best,
Christian

On Mon, Apr 30, 2012 at 4:50 PM, ebinsingh 
ebenezer.si...@verizonwireless.com wrote:

 I am very sorry for not understanding this properly.
 Please accept my apologies if am wasting your time.

 I am totally missing something here.
 Below is the change I had made (Hopeing that this is what you meant by
 saying Mutate the old exchange).

 I am using StringBuilder so that the process os faster and also helps not
 creating many String objects.

 1. when I use String.class all works fine until am running out of
 heapspace.
 2. If I use StringBuilder, I get the following nullPointer.
 3. Looks like there is no converter type to conver from String to
 StringBuilder.


 2012-04-30 10:34:38,087 INFO  [Camel (camel-1) thread #2 -
 seda://streamQueue] ipdr.GlobalAggrStratergy -  is oldExchange null:
 Exchange[null] AND is newExchange null: Exchange[null]
 2012-04-30 10:34:38,087 INFO  [Camel (camel-1) thread #2 -
 seda://streamQueue] ipdr.GlobalAggrStratergy - Aggregate old orders: null
 2012-04-30 10:34:38,087 INFO  [Camel (camel-1) thread #2 -
 seda://streamQueue] ipdr.GlobalAggrStratergy - Aggregate new order: null
 2012-04-30 10:34:38,087 ERROR [Camel (camel-1) thread #2 -
 seda://streamQueue] ipdr.GlobalAggrStratergy - Error aggregating
 java.lang.NullPointerException
at
 com.vzw.fp.ipdr.GlobalAggrStratergy.aggregate(GlobalAggrStratergy.java:26)



@Override
public Exchange aggregate(Exchange oldExchange, Exchange
 newExchange) {
try{
log.info( is oldExchange null: +oldExchange+
 AND is newExchange null:
 +newExchange);
if (oldExchange == null) {
return newExchange;
} else {
log.info(Aggregate old orders:  +
 oldExchange.getIn().getBody(StringBuilder.class));
log.info(Aggregate new order:  +
 newExchange.getIn().getBody(StringBuilder.class));
oldExchange.getIn().setBody(

  oldExchange.getIn().getBody(StringBuilder.class).

  append(newExchange.getIn().getBody(StringBuilder.class)+\n));
 counter++;
}
}catch(Exception ex){
log.error(Error aggregating, ex);
}
 oldExchange.setProperty(Exchange.CONTENT_LENGTH, counter);
 if(counter = 5)
counter = 0;
 oldExchange.getIn().setHeader(Exchange.FILE_NAME_ONLY,
 newExchange.getProperty(Exchange.FILE_NAME_ONLY));
return oldExchange;
}

 --
 View this message in context:
 http://camel.465427.n5.nabble.com/Java-heap-space-issue-with-Aggregation-tp5670608p5676110.html
 Sent from the Camel - Users mailing list archive at Nabble.com.



Re: karaf 2.2.5, cxf 2.6.0 and camel 2.9.0 install problem

2012-04-30 Thread Fitzcaraldo
I'm now trying to add ActiveMQ 5.5.1 to the above container (karaf 2.2.7, cxf
2.6.0, camel 2.9.2)

features:addUrl mvn:org.apache.activemq/activemq-karaf/5.5.1/xml/features

then

features:install activemq-spring

This fails with the message:

Error executing command: Could not start bundle
mvn:org.apache.activemq/activemq-spring/5.5.1 in feature(s)
activemq-spring-5.5.1: Unresolved constraint in bundle
org.apache.activemq.activemq-spring [199]: Unable to resolve 199.0: missing
requirement [199.0] package;
((package=org.apache.activemq)(version=5.5.0)(!(version=6.0.0)))

As well as the dependency in AMQ V5.5.0 shown this step also pulls in cxf
2.5.2 again!

Is there another dependency I'm not aware of?

Can someone recommend a combination of the 4 products that work together.



--
View this message in context: 
http://camel.465427.n5.nabble.com/karaf-2-2-5-cxf-2-6-0-and-camel-2-9-0-install-problem-tp5675060p5677249.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: karaf 2.2.5, cxf 2.6.0 and camel 2.9.0 install problem

2012-04-30 Thread Daniel Kulp

May be ordering

Try:
1) Karaf 2.2.7 with the jre.properties.cxf
2) Install the ActiveMQ 5.5.1 feature.xml
3) Install the CXF 2.6.0 feature.xml
4) Install the Camel 2.9.2 feature.xml

Then install the various features themselves, likely in roughly the same 
order.  ActiveMQ first, CXF next, then Camel.

Dan


On Monday, April 30, 2012 05:54:39 PM Fitzcaraldo wrote:
 I'm now trying to add ActiveMQ 5.5.1 to the above container (karaf 2.2.7,
 cxf 2.6.0, camel 2.9.2)
 
 features:addUrl mvn:org.apache.activemq/activemq-karaf/5.5.1/xml/features
 
 then
 
 features:install activemq-spring
 
 This fails with the message:
 
 Error executing command: Could not start bundle
 mvn:org.apache.activemq/activemq-spring/5.5.1 in feature(s)
 activemq-spring-5.5.1: Unresolved constraint in bundle
 org.apache.activemq.activemq-spring [199]: Unable to resolve 199.0:
 missing requirement [199.0] package;
 ((package=org.apache.activemq)(version=5.5.0)(!(version=6.0.0)))
 
 As well as the dependency in AMQ V5.5.0 shown this step also pulls in cxf
 2.5.2 again!
 
 Is there another dependency I'm not aware of?
 
 Can someone recommend a combination of the 4 products that work together.
 
 
 
 --
 View this message in context:
 http://camel.465427.n5.nabble.com/karaf-2-2-5-cxf-2-6-0-and-camel-2-9-0-i
 nstall-problem-tp5675060p5677249.html Sent from the Camel - Users mailing
 list archive at Nabble.com.
-- 
Daniel Kulp
dk...@apache.org - http://dankulp.com/blog
Talend Community Coder - http://coders.talend.com



Re: karaf 2.2.5, cxf 2.6.0 and camel 2.9.0 install problem

2012-04-30 Thread Fitzcaraldo
Trying that now...

Thanks Dan.  Much appreciated.

Do you guys ever sleep?

--
View this message in context: 
http://camel.465427.n5.nabble.com/karaf-2-2-5-cxf-2-6-0-and-camel-2-9-0-install-problem-tp5675060p5677295.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: karaf 2.2.5, cxf 2.6.0 and camel 2.9.0 install problem

2012-04-30 Thread Fitzcaraldo
Dan

Did as you suggested and it installed cleanly.

Sequence

features:addUrl mvn:org.apache.activemq/activemq-karaf/5.5.1/xml/features
features:addurl mvn:org.apache.cxf.karaf/apache-cxf/2.6.0/xml/features
features:addurl mvn:org.apache.camel.karaf/apache-camel/2.9.2/xml/features

features:install activemq-spring
features:install webconsole

features:install war
features:install cxf
features:install camel

install -s mvn:org.apache.activemq/activemq-camel/5.5.1

features:install camel-jms
features:install camel-jaxb
features:install camel-blueprint
features:install camel-cxf

After I installed webconsole I notice that something (suspect ActiveMQ) had
pulled in cxf 2.5.2. But didn't seem to matter.

Thanks


--
View this message in context: 
http://camel.465427.n5.nabble.com/karaf-2-2-5-cxf-2-6-0-and-camel-2-9-0-install-problem-tp5675060p5677424.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: File Processor Not deleting the files

2012-04-30 Thread rdifrango
I wonder if using one the Marshalling frameworks would solve this?

--
View this message in context: 
http://camel.465427.n5.nabble.com/File-Processor-Not-deleting-the-files-tp5670301p5676645.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Invoking a bean returned by a previous bean invocation

2012-04-30 Thread Purple Tea
Hi,

I have a route that returns a bean, and I would like to call a method in the
bean that was returned (which isn't in the registry). 
I've been looking at the bean binding documentation but I didn't find this
scenario.

Bellow is a sample code:

bean id=myBean class=com.MyBean
/bean

route
  from uri=direct:start /
  to ref=myBean method=getBean /
   
  to ref=myReturnedBean method=doSomething /
/route


class MyBean  {
 MyReturnedBean getBean () {
 return new MyReturnedBean();
}
}

class MyReturnedBean {
 void doSomething() {
 }
}

I really appreciate your help.

--
View this message in context: 
http://camel.465427.n5.nabble.com/Invoking-a-bean-returned-by-a-previous-bean-invocation-tp5676696.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Invoking a bean returned by a previous bean invocation

2012-04-30 Thread Claus Ibsen
On Mon, Apr 30, 2012 at 9:26 PM, Purple Tea maisa_man...@hotmail.com wrote:
 Hi,

 I have a route that returns a bean, and I would like to call a method in the
 bean that was returned (which isn't in the registry).
 I've been looking at the bean binding documentation but I didn't find this
 scenario.

 Bellow is a sample code:

 bean id=myBean class=com.MyBean
 /bean

 route
      from uri=direct:start /
      to ref=myBean method=getBean /

      to ref=myReturnedBean method=doSomething /
 /route


You would need to use a dynamic language or simple language to invoke
a method on the message body.
And use the message translator EIP

For example the simple language supports OGNL like method invocation
chains. See more at
http://camel.apache.org/simple

And for bean parameter bindings you can see details at
http://camel.apache.org/bean-binding.html

So you should be able to do something a like this:

 route
      from uri=direct:start /
      to ref=myBean method=getBean /
  transformsimple${body.doSomething}/simple/transform
 /route



 class MyBean  {
     MyReturnedBean getBean () {
         return new MyReturnedBean();
    }
 }

 class MyReturnedBean {
     void doSomething() {
     }
 }

 I really appreciate your help.

 --
 View this message in context: 
 http://camel.465427.n5.nabble.com/Invoking-a-bean-returned-by-a-previous-bean-invocation-tp5676696.html
 Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-
CamelOne 2012 Conference, May 15-16, 2012: http://camelone.com
FuseSource
Email: cib...@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/