Re: Apply change to a route after loading camelcontext xml using GenericApplicationContext

2013-08-20 Thread Claus Ibsen
The spring code starts the Camel since you load the app context, call
refresh and getting the bean, etc.
So its already started when you use the Camel main class.

On Tue, Aug 20, 2013 at 2:45 AM, bonnahu bonn...@gmail.com wrote:
 Hi Christian,
 Thanks for your response. However, I don't understand that why I need to
 stop the route first, since I haven't started the route yet until
 main.run(); Please explain it a little bit more.

 thanks





 --
 View this message in context: 
 http://camel.465427.n5.nabble.com/Apply-change-to-a-route-after-loading-camelcontext-xml-using-GenericApplicationContext-tp5737541p5737544.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: Getting a Header property on a exception in the DSL

2013-08-20 Thread Bart Horré
Hello,

I don't think there is a need to concatenate like that (header. +  ... ).
In my experience with using simples in log messages you can just write:
Client config not found for id ${header.myHeader}.

Or you could check out the docs below:

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


On Tue, Aug 20, 2013 at 6:42 AM, abdiels abdi...@gmail.com wrote:

 Hello,

 I am trying to print the client id on a exception message like this:

 from(seda:AddDataToCache).routeId(AddDataToCache)
 .threads()
 .choice()
 .when(header(CamelJdbcRowCount).isEqualTo(0))
 .log(No database record)
 .throwException(new
 ConfigurationNotFoundException(Client Configuration not found for
 clientid:
 ${header. + FMSHeaders.CLIENT_ID + }))
 .otherwise()
 .log(FOUND database record)
 .end()
 ;

 Now that of course does not work since we are passing a string to a
 constructor and the simple language will not kick in...I tried this

 new ConfigurationNotFoundException((new SimpleBuilder(
 Client Configuration not found for clientid:
 ${header. + FMSHeaders.CLIENT_ID + })).evaluate(???,String.class))

 but I don't know how to get the exchange...Is there a way to accomplish
 putting this client id here?  I know I can get in the error handler itself
 for example and I could do other things, but I am wondering if there is a
 way to just grab data like this from the message sort of mixing simple with
 strings.  Please let me know your thoughts.

 Thank you,

 Abdiel




 --
 View this message in context:
 http://camel.465427.n5.nabble.com/Getting-a-Header-property-on-a-exception-in-the-DSL-tp5737551.html
 Sent from the Camel - Users mailing list archive at Nabble.com.




-- 
Bart Horré
Anova rd bvba


[Splitter] Problem with stopOnException when using threadPoolExecutor

2013-08-20 Thread Aida
Hi,

I'm working with a little proof of concept because I'm having trouble
managing exceptions in splitter when I combine stopOnException and the usage
of a threadPoolExecutor.

I have been working with documentation, and Camel In Action book and source
examples but I'm not able to solve this.

My route is this one:

//Error handling
onException(Throwable.class)
.to(URI_STOP_WHEN_EXCEPTION);

from(URI_START_PROCESSING)

.split(body()).aggregationStrategy(myAggregationStrategy).executorService(threadPoolExecutor).stopOnException()
.process(new Processor() {
@Override
public void process(Exchange exchange) throws Exception 
{
if( 
(:).equals(exchange.getIn().getBody(String.class)))  ||  (world
.equals(exchange.getIn().getBody(String.class))) ){
throw new RuntimeCamelException();
}
}
})
.end()
.to(URI_STOP_WITHOUT_EXCEPTION);


What I expected to happen is that, when an error occurs in the splitter,
only one (and no more) messages arrive to URI_STOP_WHEN_EXCEPTION.

If I send a body like: 
ListString body = Arrays.asList(Hello , world , :));

The result of this is that world  and  :) arrive to
URI_STOP_WHEN_EXCEPTION (these are the bodies that the processor inside the
splitter will use to throw an exception).

If I don´t use a threadPoolExecutor only one error happens in the same
instant, so I have the expected behaviour, but using the threadPoolExecutor
(size 10) happens what I explained.

At this point I thought that maybe using the aggregationStrategy to
propagate back the exception was a good alternative. I removed the
stopOnException() and used the MyPropagateFailureAggregationStrategy that
appears in the book of Camel In Action (page 265, I don´t know if I'm
allowed to paste the source code). So my route now looks like:

//Error handling
onException(Throwable.class)
.to(URI_STOP_WHEN_EXCEPTION);

from(URI_START_PROCESSING)

.split(body()).aggregationStrategy(myPropagateFailureAggregationStrategy).executorService(threadPoolExecutor)
.process(new Processor() {
@Override
public void process(Exchange exchange) throws Exception 
{
if( 
(:).equals(exchange.getIn().getBody(String.class)))  ||  (world
.equals(exchange.getIn().getBody(String.class))) ){
throw new RuntimeCamelException();
}
}
})
.end()
.to(URI_STOP_WITHOUT_EXCEPTION);


Nevertheless the result is the same in this case ... I don´t know if the
paralellism could be a problem, I suppose that I'm missing something
important

I'm working with Camel 2.10.4

Thanks in advance for your time.

  Aida.



--
View this message in context: 
http://camel.465427.n5.nabble.com/Splitter-Problem-with-stopOnException-when-using-threadPoolExecutor-tp5737562.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: [Splitter] Problem with stopOnException when using threadPoolExecutor

2013-08-20 Thread Claus Ibsen
When you use a thread pool then paralllel work happens and the order
they are processed can be anyhow the JDK thread pool executes them.

If you are not using thread pool then the order is sequential and only
1 work at a time.

So with thread pool and stop on exception then the JDK may have
already started the other tasks and they cannot be stopped etc. Only
the non-started tasks will be stopped when stopOnException is
triggered.

On Tue, Aug 20, 2013 at 10:08 AM, Aida ai.d...@gmail.com wrote:
 Hi,

 I'm working with a little proof of concept because I'm having trouble
 managing exceptions in splitter when I combine stopOnException and the usage
 of a threadPoolExecutor.

 I have been working with documentation, and Camel In Action book and source
 examples but I'm not able to solve this.

 My route is this one:

 //Error handling
 onException(Throwable.class)
 .to(URI_STOP_WHEN_EXCEPTION);

 from(URI_START_PROCESSING)

 .split(body()).aggregationStrategy(myAggregationStrategy).executorService(threadPoolExecutor).stopOnException()
 .process(new Processor() {
 @Override
 public void process(Exchange exchange) throws 
 Exception {
 if( 
 (:).equals(exchange.getIn().getBody(String.class)))  ||  (world
 .equals(exchange.getIn().getBody(String.class))) ){
 throw new RuntimeCamelException();
 }
 }
 })
 .end()
 .to(URI_STOP_WITHOUT_EXCEPTION);


 What I expected to happen is that, when an error occurs in the splitter,
 only one (and no more) messages arrive to URI_STOP_WHEN_EXCEPTION.

 If I send a body like:
 ListString body = Arrays.asList(Hello , world , :));

 The result of this is that world  and  :) arrive to
 URI_STOP_WHEN_EXCEPTION (these are the bodies that the processor inside the
 splitter will use to throw an exception).

 If I don´t use a threadPoolExecutor only one error happens in the same
 instant, so I have the expected behaviour, but using the threadPoolExecutor
 (size 10) happens what I explained.

 At this point I thought that maybe using the aggregationStrategy to
 propagate back the exception was a good alternative. I removed the
 stopOnException() and used the MyPropagateFailureAggregationStrategy that
 appears in the book of Camel In Action (page 265, I don´t know if I'm
 allowed to paste the source code). So my route now looks like:

 //Error handling
 onException(Throwable.class)
 .to(URI_STOP_WHEN_EXCEPTION);

 from(URI_START_PROCESSING)

 .split(body()).aggregationStrategy(myPropagateFailureAggregationStrategy).executorService(threadPoolExecutor)
 .process(new Processor() {
 @Override
 public void process(Exchange exchange) throws 
 Exception {
 if( 
 (:).equals(exchange.getIn().getBody(String.class)))  ||  (world
 .equals(exchange.getIn().getBody(String.class))) ){
 throw new RuntimeCamelException();
 }
 }
 })
 .end()
 .to(URI_STOP_WITHOUT_EXCEPTION);


 Nevertheless the result is the same in this case ... I don´t know if the
 paralellism could be a problem, I suppose that I'm missing something
 important

 I'm working with Camel 2.10.4

 Thanks in advance for your time.

   Aida.



 --
 View this message in context: 
 http://camel.465427.n5.nabble.com/Splitter-Problem-with-stopOnException-when-using-threadPoolExecutor-tp5737562.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: CookieStore

2013-08-20 Thread Markus Wolf
Hi Claus,

thank for your feedback. I've currently override the CookieStore with
a noop store.
I'll have a deeper look and give you an update or a patch I've I
manage to create something :)

Cheers
Markus

2013/8/19 Claus Ibsen claus.ib...@gmail.com:
 I dont think this is supported. Feel free to dive into to see what a
 solution could be. And if so log a JIRA and if possible provide a
 patch. We love contributions

 On Mon, Aug 19, 2013 at 4:56 PM, Markus Wolf
 markus.w...@sinnerschrader.com wrote:
 Hallo camel users,

 currently we use the http4-endpoint as proxy bridge endpoint for
 another webservice in a server side application. This service returns
 some cookies which seem to be stored in the cookie store of the
 httpclient.
 During the runtime of our server it seems to never clear the cookie
 store and the memory consumption is constantly growing.

 Is there a way to have camel clean the cookie store after each bridged
 requrest in a per request save way?

 Thanks for any help
 Markus
 --
 Markus Wolf, Technical Director

 markus.w...@sinnerschrader.com
 https://twitter.com/KnisterPeter
 M +49 172 7393808

 SinnerSchrader Deutschland GmbH | SinnerSchrader Group
 Völckersstraße 38, 22765 Hamburg, Germany

 Amtsgericht Hamburg HRB-Nr. 63663
 Geschäftsführer: Matthias Schrader (Sprecher), Holger Blank,
 Thomas Dyckhoff, Dr. Lars Finke, Martin Gassner, Nils Wollny

 Büros: Hamburg, Frankfurt a. M., München, Prag

 http://www.sinnerschrader.com | Radical Relationships



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



-- 
Markus Wolf, Technical Director

markus.w...@sinnerschrader.com
https://twitter.com/KnisterPeter
M +49 172 7393808

SinnerSchrader Deutschland GmbH | SinnerSchrader Group
Völckersstraße 38, 22765 Hamburg, Germany

Amtsgericht Hamburg HRB-Nr. 63663
Geschäftsführer: Matthias Schrader (Sprecher), Holger Blank,
Thomas Dyckhoff, Dr. Lars Finke, Martin Gassner, Nils Wollny

Büros: Hamburg, Frankfurt a. M., München, Prag

http://www.sinnerschrader.com | Radical Relationships


Re: [Splitter] Problem with stopOnException when using threadPoolExecutor

2013-08-20 Thread Aida
Hi Claus,

Thank you for your response, it makes sense. I suppose than then the right
way to go would be use the aggregationStrategy to propagate back the
exception. As in this case I have the same behaviour and only for checking:
threadPool shouldn´t interfere in this case, right?


Thanks.



--
View this message in context: 
http://camel.465427.n5.nabble.com/Splitter-Problem-with-stopOnException-when-using-threadPoolExecutor-tp5737562p5737570.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: [Splitter] Problem with stopOnException when using threadPoolExecutor

2013-08-20 Thread Claus Ibsen
Yeah the aggregate method in AggregationStrategy is thread-safe, and
its also invoked in the order, eg first splitted message, 2nd
splitted message, ... N splitted message.

Though stop on exception can still make a little sense if the data you
split is bigger than the thread pool size + queue size, in case some
exception occurred, then the splitter wont have to split all messages,
for then to fail after that.

On Tue, Aug 20, 2013 at 11:19 AM, Aida ai.d...@gmail.com wrote:
 Hi Claus,

 Thank you for your response, it makes sense. I suppose than then the right
 way to go would be use the aggregationStrategy to propagate back the
 exception. As in this case I have the same behaviour and only for checking:
 threadPool shouldn´t interfere in this case, right?


 Thanks.



 --
 View this message in context: 
 http://camel.465427.n5.nabble.com/Splitter-Problem-with-stopOnException-when-using-threadPoolExecutor-tp5737562p5737570.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: How to add Vendor Specific Optional Parameter in CamelSmppOptionalParameters

2013-08-20 Thread Christian Müller
Yes, you have to create a different account [1].
Afterwards you can create an enhancement request at [2].
And as you may know, we love contributions [3]. Feel free to attach your
proposed solution which should include unit tests.
And helping out with the documentation is also welcome [4].

[1] https://issues.apache.org/jira/secure/Dashboard.jspa
[2] https://issues.apache.org/jira/browse/CAMEL
[3] http://camel.apache.org/contributing.html
[4] http://camel.apache.org/how-do-i-edit-the-website.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 Fri, Aug 16, 2013 at 6:59 PM, cartoondog cartoon...@hotmail.com wrote:

 Hi Chris,

 Do I have to create another account to log in ASF JIRA?  My user id here
 cannot log in ASF JIRA.

 After looking into the source code, I found that we can add support to
 Vendor Specific Optional Parameter
 by adding some codes in the AbstractSmppCommand class like below.  Please
 correct me if I am wrong.

@SuppressWarnings(rawtypes)
 protected ListOptionalParameter createOptionalParameters(MapString,
 String optinalParamaters) {
 ListOptionalParameter optParams = new
 ArrayListOptionalParameter();

 for (EntryString, String entry : optinalParamaters.entrySet()) {
 OptionalParameter optParam = null;

 try {

 //add a checking to distinguish Vendor Specfic Optional Parameter
 //from other static defined optional parameters

 if
 (((String)entry.getKey()).equals.(VENDOR_SPECFIC_OPTIONAL_PARAMETER){
  optParam = generateVenderSpecificOptParam(entry) ;
 } else {
 Tag tag = Tag.valueOf(entry.getKey());
 Class type = determineTypeClass(tag);

 if (OctetString.class.equals(type)) {
   optParam = new
 OptionalParameter.OctetString(tag.code(), entry.getValue());
 } else if (COctetString.class.equals(type)) {
optParam = new
 OptionalParameter.COctetString(tag.code(), entry.getValue());
 } else if
 (org.jsmpp.bean.OptionalParameter.Byte.class.equals(type)) {
optParam = new OptionalParameter.Byte(tag.code(),
 Byte.valueOf(entry.getValue()));
 } else if
 (org.jsmpp.bean.OptionalParameter.Int.class.equals(type)) {
optParam = new OptionalParameter.Int(tag.code(),
 Integer.valueOf(entry.getValue()));
 } else if
 (org.jsmpp.bean.OptionalParameter.Short.class.equals(type)) {
optParam = new OptionalParameter.Short(tag.code(),
 Short.valueOf(entry.getValue()));
 } else if
 (org.jsmpp.bean.OptionalParameter.Null.class.equals(type)) {
   optParam = new OptionalParameter.Null(tag);
 }
 }
 optParams.add(optParam);
 } catch (Exception e) {
 log.info(Couldn't determine optional parameter for key {}
 and value {}. Skip this one., entry.getKey(), entry.getValue());
 }
 }

 return optParams;
 }

 /*
pSince it is vendor specified, so users must have the code and type,
 therefore users should concatenate these information as a string
 using a separator(:) and pass this in as the Entry's value
/p
pUsage: EntryString, String
   String key must equal
 VENDOR_SPECIFIC_OPTIONAL_PARAMETER
   String value should be code:type:param_value
 */
 protected OptionalParameter
 generateVendorSpecificOptParam(EntryString,
 String entry)
   throws SecurityException, IllegalArgumentException,
 IllegalAccessException{

   OptionalParameter optParam = null ;

//code must be in 4 character and can be parsed into a hex
 String code = entry.getValue().substring(0,4) ;
//code must fall inside the ranges specified in SMPP 3.4 specification
//0x1400 - 0x3FFF
 if ( !(code = 0x1400 or code = 0x3FFF)
  throw new IllegalArgumentException() ;

   //type must be one of the defined Class and must be in uppercase

 int pos2 = entry.getValue().indexOf(':', 5) ;
 String type = entry.getValue().substring(5,pos2-1) ;
 if ( type.equals(OCTETSTRING) ){
optParam = new OptionalParameter.OctetString(hexcode,
 entry.getValue().substring(pos2+1) ;
 }else if (type.equals(COCTETSTRING) ) {
optParam = new OptionalParameter.COctetString(hexcode,
 entry.getValue().substring(pos2+1 );
 }else if(type.equals(BYTE) ){
optParam = new OptionalParameter.Byte(hexcode,
 

Re: Getting a Header property on a exception in the DSL

2013-08-20 Thread abdiels
barthorre,

First, thanks for replying and second, I do that all the time too!!!
However, in this particular it does not work.  Look at the code, I am
passing it when throwing the exception, it is not in the regular DSL where
simple will just work.  You can try it and you will see.  What comes in the
Exception string is:  Client Configuration not found for clientid:
${header.ClientID}.  If you try to add simple around it, it does not work
since simple returns a SimpleBuilder so I tried the other code that I showed
on my post, but I am not sure how to get the exchange so I have not been
able to get the value here.




--
View this message in context: 
http://camel.465427.n5.nabble.com/Getting-a-Header-property-on-a-exception-in-the-DSL-tp5737551p5737592.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Apply change to a route after loading camelcontext xml using GenericApplicationContext

2013-08-20 Thread bonnahu
Hi Claus, thanks for your reply! So do think whether there is way to set the 
autoStartup property to a route before the spring code starts the Camel,  if
I don't want to change the existing camelcontext.xml. 
Thanks again!



--
View this message in context: 
http://camel.465427.n5.nabble.com/Apply-change-to-a-route-after-loading-camelcontext-xml-using-GenericApplicationContext-tp5737541p5737595.html
Sent from the Camel - Users mailing list archive at Nabble.com.


JSSE for CXF Endpoint

2013-08-20 Thread Gnanaguru S
Hi 

I went through Camel configuration utilities documentation, It is mentioned
that it is directly supported in some components. Which I am able to
understand. 

http://camel.apache.org/camel-configuration-utilities.html

Also It is mentioned that it is indirectly supported in CXF and HTTP
components ? Is there any example/reference document for that ?

I am actually working on a SSL based Camel flow using http:conduit.

Will this JSSE be a different approach ? Please help. 

Thanks
Guru
@gnanagurus
www.gnanaguru.com



--
View this message in context: 
http://camel.465427.n5.nabble.com/JSSE-for-CXF-Endpoint-tp5737596.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Apply change to a route after loading camelcontext xml using GenericApplicationContext

2013-08-20 Thread Claus Ibsen
You can use property placeholders for the auto startup option, then
you can control it using that way. And dont have to change the XML.

On Tue, Aug 20, 2013 at 3:41 PM, bonnahu bonn...@gmail.com wrote:
 Hi Claus, thanks for your reply! So do think whether there is way to set the
 autoStartup property to a route before the spring code starts the Camel,  if
 I don't want to change the existing camelcontext.xml.
 Thanks again!



 --
 View this message in context: 
 http://camel.465427.n5.nabble.com/Apply-change-to-a-route-after-loading-camelcontext-xml-using-GenericApplicationContext-tp5737541p5737595.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


Netty UDP and SNMP

2013-08-20 Thread Tyler Durvik
I am trying to develop a program that receives SNMP messages over UDP port
161.  I have set up a Netty endpoint listening on port 161:

from(netty:udp://127.0.0.1:161?sync=false)
.log(NETTY)

When I run this, I never receive any data even though wireshark shows
packets coming in.  I have tried the same approach with mina2 with no
success. However, when I set up a snmp endpoint, data will be received by
Netty:

from(snmp://
127.0.0.1:161?protocol=udpsnmpVersion=1delay=5snmpCommunity=publictype=POLLoids=x.y.z
)
.log(SNMP)

I verify this with the log messages.  I will receive NETTY log entries
but never see any SNMP messages in the logs.

Could someone explain why this is happening.


Re: Why can not get the data

2013-08-20 Thread nandla
camel route:from( http://localhost:8080/wms/
http://localhost:8080/wms/query_all_handlover_note?type=source  
query_all_handlover_note?type=source http://www.cricscores1.com/teams.html 
).to(file:d:/temp/outbox?fileName=data1.txt)



--
View this message in context: 
http://camel.465427.n5.nabble.com/Why-can-not-get-the-data-tp5737243p5737594.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Issues with Camel startup...

2013-08-20 Thread Harish Shindhe (hashinde)
Hi,

We are using Camel 2.9 in our application. The role of which is to read the 
message from one end point and pass it to another endpoint which is a POJO 
which takes care of processing the message.

We use Spring xml based configuration to define the JNDITemplate and endpoints 
and things worked fine until few days back.

Recently there was a network upgrade and a WAS patch upgrade after which there 
is no consumption of messages from the defined jms end point. We have looked at 
all the configurations and everything seems to be fine.

Is there a diagnostic tool that when run as a standalone program tells me the 
health of the camel initialization and its readiness to consume messages.

Please help.

Regards,
Harish


Re: Issues with Camel startup...

2013-08-20 Thread Claus Ibsen
Hi

Please do not cross post the same message to many mailing lists.
The correct mailinglists for getting help with Camel is the user mailinglist.

Also please do not mail the Camel team directly. Apache Camel is an open project
and all discussions should happen in the open so everyone can see / participate.

See these links for points how to ask for help etc.
http://camel.apache.org/support
http://camel.apache.org/mailing-lists.html
http://camel.apache.org/discussion-forums.html

On Tue, Aug 20, 2013 at 4:08 PM, Harish Shindhe (hashinde)
hashi...@cisco.com wrote:
 Hi,

 We are using Camel 2.9 in our application. The role of which is to read the 
 message from one end point and pass it to another endpoint which is a POJO 
 which takes care of processing the message.

 We use Spring xml based configuration to define the JNDITemplate and 
 endpoints and things worked fine until few days back.

 Recently there was a network upgrade and a WAS patch upgrade after which 
 there is no consumption of messages from the defined jms end point. We have 
 looked at all the configurations and everything seems to be fine.

 Is there a diagnostic tool that when run as a standalone program tells me the 
 health of the camel initialization and its readiness to consume messages.

 Please help.

 Regards,
 Harish



-- 
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: Getting a Header property on a exception in the DSL

2013-08-20 Thread Claus Ibsen
This is not possible as you use the new constructor in Java that will
instantiate the exception once.

What you want is to create a new exception when it happens with data
from the message. For that you can call a method and let it throw the
exception.

For throwException to work with your use case, it would require to not
use the new constructor, and let Camel instantiate the exception and
evaluate eg any simple expresisons prior etc.

eg we could do something alike,

throwException(ConfigurationNotFoundException.class, simple(Something
got wrong due ${header.bar}))

which then would create the exception using a 1 arg constructor,
assuming that would be a String type etc.

Though when you need 2+ args then it gets more complicated.

Also we should also try to avoid keep expanding the DSL to avoid it
growing to large. Though I can see your use-case is probably more
common to create an exception with a cause String message that has
details from the Camel message.

If other feel we need something a like this, then we could raise a JIRA



On Tue, Aug 20, 2013 at 2:25 PM, abdiels abdi...@gmail.com wrote:
 barthorre,

 First, thanks for replying and second, I do that all the time too!!!
 However, in this particular it does not work.  Look at the code, I am
 passing it when throwing the exception, it is not in the regular DSL where
 simple will just work.  You can try it and you will see.  What comes in the
 Exception string is:  Client Configuration not found for clientid:
 ${header.ClientID}.  If you try to add simple around it, it does not work
 since simple returns a SimpleBuilder so I tried the other code that I showed
 on my post, but I am not sure how to get the exchange so I have not been
 able to get the value here.




 --
 View this message in context: 
 http://camel.465427.n5.nabble.com/Getting-a-Header-property-on-a-exception-in-the-DSL-tp5737551p5737592.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: Load test on camel-netty

2013-08-20 Thread Claus Ibsen
I would suggest to remove the 100 thread pool sizes as the out of the box
settings from Netty is better. Netty is asynchronous and it creates thread
pools based on the number of CPU cores etc.

Netty creates the threads up-front so having 100+ threads take up some
unnecessary memory.


On Tue, Aug 13, 2013 at 5:02 PM, Flavio Magacho - M4U 
flavio.maga...@m4u.com.br wrote:

 Hi, 

 I'm expecting some problems while running a load test on camel-netty
 component.

 ** **

 This is the route configuration:

 route id=rtRead

 from
 uri=netty:tcp://pos-tcp-server.host:9000?decoder=#myDecoderamp;encoder=#myEncoderamp;sync=trueamp;reuseAddress=trueamp;synchronous=falseamp;workerCount=100amp;maximumPoolSize=100”/
 

 log message=Lendo ${body} /

 to uri=ejb:local/GatewayBean?method=process /

 /route

 ** **

 After some test cycles, we receive some exceptions like this:

 2013-08-13 11:25:33,398 WARNING
 [org.jboss.netty.channel.DefaultChannelPipeline] [New I/O  worker #32] An
 exception was thrown by a user handler while handling an exception event
 ([id: 0x8c7d41bd, /10.10.0.28:53469 = /10.11.234.38:9000] EXCEPTION:
 java.lang.OutOfMemoryError: unable to create new native thread)

 java.lang.OutOfMemoryError: unable to create new native thread

 at java.lang.Thread.start0(Native Method)

 at java.lang.Thread.start(Thread.java:640)

 at
 java.util.concurrent.ThreadPoolExecutor.addIfUnderCorePoolSize(ThreadPoolExecutor.java:703)
 

 at
 java.util.concurrent.ThreadPoolExecutor.execute(ThreadPoolExecutor.java:652)
 

 at
 org.jboss.netty.handler.execution.MemoryAwareThreadPoolExecutor.doUnorderedExecute(MemoryAwareThreadPoolExecutor.java:452)
 

 at
 org.jboss.netty.handler.execution.OrderedMemoryAwareThreadPoolExecutor$ChildExecutor.execute(OrderedMemoryAwareThreadPoolExecutor.java:292)
 

 at
 org.jboss.netty.handler.execution.OrderedMemoryAwareThreadPoolExecutor.doExecute(OrderedMemoryAwareThreadPoolExecutor.java:242)
 

 at
 org.jboss.netty.handler.execution.MemoryAwareThreadPoolExecutor.execute(MemoryAwareThreadPoolExecutor.java:437)
 

 at
 org.jboss.netty.handler.execution.ExecutionHandler.handleUpstream(ExecutionHandler.java:172)
 

 at
 org.jboss.netty.channel.Channels.fireExceptionCaught(Channels.java:533)***
 *

 at org.jboss.netty.channel.Channels$7.run(Channels.java:507)

 at
 org.jboss.netty.channel.socket.ChannelRunnableWrapper.run(ChannelRunnableWrapper.java:41)
 

 at
 org.jboss.netty.channel.socket.nio.AbstractNioWorker.processEventQueue(AbstractNioWorker.java:453)
 

 at
 org.jboss.netty.channel.socket.nio.AbstractNioWorker.run(AbstractNioWorker.java:330)
 

 at
 org.jboss.netty.channel.socket.nio.NioWorker.run(NioWorker.java:35)

 at
 java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
 

 at
 java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
 

 at java.lang.Thread.run(Thread.java:662)

 ** **

 ** **

 It sounds strange, our test case has only 5 simultaneous opened
 connections.

 For me we are heaving some leak of threads or we are having some problems
 to close the SocketChannel correctly.

 ** **

 Thanks,

 *Flavio Magacho*

 *Gerente de Desenvolvimento*

 Diretoria de Tecnologia da Informação

 [image: cid:image001.gif@01CB90D9.07FBDA40]  *M4U*
 +55 (21) 2546-4050 ▪ Ramal: 4082

 +55 (21) 8889-1572

 *þ** *Antes de imprimir, pense em sua responsabilidade e compromisso com
 o Meio Ambiente.

 *O conteúdo desta mensagem é confidencial e pode ser privilegiado. **É
 vedada a sua cópia ou divulgação.*

 *The contents of this message are confidential and may be privileged.
 Copying or disclosing is prohibited.*

 ** **




-- 
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: Netty UDP and SNMP

2013-08-20 Thread Claus Ibsen
Can you try with 2.12 SNAPSHOT and use the networkInterface to specify
the network interface to join the existing multicast group.

See the page about the option.
http://camel.apache.org/netty

On Tue, Aug 20, 2013 at 4:40 PM, Tyler Durvik phangb...@gmail.com wrote:
 I am trying to develop a program that receives SNMP messages over UDP port
 161.  I have set up a Netty endpoint listening on port 161:

 from(netty:udp://127.0.0.1:161?sync=false)
 .log(NETTY)

 When I run this, I never receive any data even though wireshark shows
 packets coming in.  I have tried the same approach with mina2 with no
 success. However, when I set up a snmp endpoint, data will be received by
 Netty:

 from(snmp://
 127.0.0.1:161?protocol=udpsnmpVersion=1delay=5snmpCommunity=publictype=POLLoids=x.y.z
 )
 .log(SNMP)

 I verify this with the log messages.  I will receive NETTY log entries
 but never see any SNMP messages in the logs.

 Could someone explain why this is happening.



-- 
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: Spring Bean represented as endpoint

2013-08-20 Thread Claus Ibsen
What version of Camel do you use?

On Fri, Aug 16, 2013 at 10:35 PM, MichaelAtSAG mebevilac...@gmail.com wrote:
 All,
 I am trying to move endpoint properties into a bean, yet the endpoint is not
 working this way. I think it is a simple typo but can't find it:

 
 THIS WORKS
 

 ?xml version=1.0 encoding=UTF-8?
 beans
 camelContext
 endpoint id=websocketEndpoint
 uri=websocket://{{wsHost}}:{{wsPort}}/nerv-tweet?staticResources=classpath:.amp;sendToAll=true
 /
 /camelContext
 /beans

 
 AND THIS DOES NOT WORK, YET FUNCTIONALLY THE SAME
 

 ?xml version=1.0 encoding=UTF-8?
 beans
 bean id=appWebSocket
 class=org.apache.camel.component.websocket.WebsocketComponent
 property name=host value=localhost /
 property name=port value=9090 /
 property name=staticResources value=classpath:. /
 /bean
 camelContext
 endpoint id=websocketEndpoint
 uri=appWebSocket://nerv-tweet?sendToAll=true /
 /camelContext
 /beans

 Any help to see the problem would be most welcome!
 Thanks,
 Michael



 --
 View this message in context: 
 http://camel.465427.n5.nabble.com/Spring-Bean-represented-as-endpoint-tp5737433.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


Field support for OGNL/simple

2013-08-20 Thread jamie3
The camel documentation for the simple component shows that it doesn't
support fields except in 2.11 onwards for the .length in java arrays.

Are fields expected to be added in the future?

If not can you tell the simple component to provide a custom getter class
for the object? For example (psuedo code):

from(direct:somewhere)
.log(Value is ${customRenderer:body})

where custom customRenderer points to a bean somewhere in the context that
can fetch the field value?



--
View this message in context: 
http://camel.465427.n5.nabble.com/Field-support-for-OGNL-simple-tp5737609.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: MTOM message part not formatted correctly according to RFC 1341 using CRLFLF instead of CRLFCRLF

2013-08-20 Thread Clay
This bug is fixed in CXF-4482!+



--
View this message in context: 
http://camel.465427.n5.nabble.com/MTOM-message-part-not-formatted-correctly-according-to-RFC-1341-using-CRLFLF-instead-of-CRLFCRLF-tp5737366p5737610.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Getting a Header property on a exception in the DSL

2013-08-20 Thread abdiels
Thanks Claus...I can find many ways around it, I was just wondering if
there was something I was missing or doing wrong...What you are saying
makes sense and I don't think we need to add that at this point.


On Tue, Aug 20, 2013 at 10:59 AM, Claus Ibsen-2 [via Camel] 
ml-node+s465427n5737601...@n5.nabble.com wrote:

 This is not possible as you use the new constructor in Java that will
 instantiate the exception once.

 What you want is to create a new exception when it happens with data
 from the message. For that you can call a method and let it throw the
 exception.

 For throwException to work with your use case, it would require to not
 use the new constructor, and let Camel instantiate the exception and
 evaluate eg any simple expresisons prior etc.

 eg we could do something alike,

 throwException(ConfigurationNotFoundException.class, simple(Something
 got wrong due ${header.bar}))

 which then would create the exception using a 1 arg constructor,
 assuming that would be a String type etc.

 Though when you need 2+ args then it gets more complicated.

 Also we should also try to avoid keep expanding the DSL to avoid it
 growing to large. Though I can see your use-case is probably more
 common to create an exception with a cause String message that has
 details from the Camel message.

 If other feel we need something a like this, then we could raise a JIRA



 On Tue, Aug 20, 2013 at 2:25 PM, abdiels [hidden 
 email]http://user/SendEmail.jtp?type=nodenode=5737601i=0
 wrote:

  barthorre,
 
  First, thanks for replying and second, I do that all the time too!!!
  However, in this particular it does not work.  Look at the code, I am
  passing it when throwing the exception, it is not in the regular DSL
 where
  simple will just work.  You can try it and you will see.  What comes in
 the
  Exception string is:  Client Configuration not found for clientid:
  ${header.ClientID}.  If you try to add simple around it, it does not
 work
  since simple returns a SimpleBuilder so I tried the other code that I
 showed
  on my post, but I am not sure how to get the exchange so I have not been
  able to get the value here.
 
 
 
 
  --
  View this message in context:
 http://camel.465427.n5.nabble.com/Getting-a-Header-property-on-a-exception-in-the-DSL-tp5737551p5737592.html

  Sent from the Camel - Users mailing list archive at Nabble.com.



 --
 Claus Ibsen
 -
 Red Hat, Inc.
 Email: [hidden email]http://user/SendEmail.jtp?type=nodenode=5737601i=1
 Twitter: davsclaus
 Blog: http://davsclaus.com
 Author of Camel in Action: http://www.manning.com/ibsen


 --
  If you reply to this email, your message will be added to the discussion
 below:

 http://camel.465427.n5.nabble.com/Getting-a-Header-property-on-a-exception-in-the-DSL-tp5737551p5737601.html
  To unsubscribe from Getting a Header property on a exception in the DSL, 
 click
 herehttp://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_codenode=5737551code=YWJkaWVsc0BnbWFpbC5jb218NTczNzU1MXwtNjU1OTY1MDc=
 .
 NAMLhttp://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewerid=instant_html%21nabble%3Aemail.namlbase=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespacebreadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml





--
View this message in context: 
http://camel.465427.n5.nabble.com/Getting-a-Header-property-on-a-exception-in-the-DSL-tp5737551p5737611.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Spring Bean represented as endpoint

2013-08-20 Thread MichaelAtSAG
Apache Camel 2.11.0



--
View this message in context: 
http://camel.465427.n5.nabble.com/Spring-Bean-represented-as-endpoint-tp5737433p5737614.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Apply change to a route after loading camelcontext xml using GenericApplicationContext

2013-08-20 Thread bonnahu
Hi Claus,
If I understand correctly, you are saying adding a property placeholders for
the auto startup option,

 propertyPlaceholder id=properties
location=autostartup.properties
xmlns=http://camel.apache.org/schema/spring/

In autostartup.properties, define

autostartupOption = true/false


Then in the route,  add the autoStartup property like followings?
route id=subscribeDsp4Route autoStartup={{autostartupOption}}
startupOrder=200



--
View this message in context: 
http://camel.465427.n5.nabble.com/Apply-change-to-a-route-after-loading-camelcontext-xml-using-GenericApplicationContext-tp5737541p5737615.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Mina Synchronous Communication

2013-08-20 Thread milltj
I am currently using Mina2 V2.11.1.

My decoder looks like

 @Override
protected boolean doDecode(IoSession is, IoBuffer ib,
ProtocolDecoderOutput pdo) throws Exception {
int headerSize=28;
byte[] header = new byte[headerSize];
byte[] xmlBuffer = null;
byte[] fullMessage = null;

int xmlLength = -1;
ib.get(header);

xmlLength = convertBytesToInt(Arrays.copyOfRange(header, 16, 20));

xmlBuffer = new byte[xmlLength];
ib.get(xmlBuffer);

pdo.write(xmlc.convertXmlToObject(xmlBuffer));

return true;

}

I am finding that I get that error message no matter what options I add to
the url.  I discovered that my clients have a number of different requests
that will be sent, some require a response, others do not.  When I don't
return a response it closes the connection, which I do not want, I want the
connection to remain open at all times. So I tried to set the url to


camel:from
uri=mina2:tcp://10.5.60.60:9000?disconnectOnNoReply=false;codec=#gilbarcoDecoder
/

But I still get the same error.
Error: 
org.apache.mina.filter.codec.ProtocolDecoderException: 
org.apache.mina.core.buffer.BufferDataException: dataLength: 1347375948 




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


AMQ DeadLetterStrategy Not Being Respected

2013-08-20 Thread nezor
I'm using the standard activemq-broker.xml which comes pre-installed with
Fuse with a slight change. I have added a deadLetterStrategy for Topics and
Queues as indicated by this page 
http://activemq.apache.org/message-redelivery-and-dlq-handling.html
http://activemq.apache.org/message-redelivery-and-dlq-handling.html  

destinationPolicy
policyMap
  policyEntries
policyEntry topic= producerFlowControl=true memoryLimit=1mb
  pendingSubscriberPolicy
vmCursor /
  /pendingSubscriberPolicy
  deadLetterStrategy
individualDeadLetterStrategy queueSuffix=.DLQ
useQueueForTopicMessages=true/
  /deadLetterStrategy
/policyEntry
policyEntry queue= producerFlowControl=true memoryLimit=1mb
  deadLetterStrategy
individualDeadLetterStrategy queueSuffix=.DLQ
useQueueForQueueMessages=true/
  /deadLetterStrategy
/policyEntry
  /policyEntries
/policyMap
/destinationPolicy 

The transportConnector are default,
transportConnectors
 transportConnector name=openwire uri=tcp://localhost:61616/
 transportConnector name=stomp uri=stomp://localhost:61613/
/transportConnectors

Next, the ActiveMQConnectionFactory is configured to use the default broker
from the activemq-broker.xml and my redelivery policy.
bean id=jmsConnectionFactory
class=org.apache.activemq.ActiveMQConnectionFactory
property name=brokerURL
  valuetcp://localhost:61616/value 
/property
property name=redeliveryPolicy ref=standardRedeliveryPolicy/
/bean

The rest of the configuration is standard my JmsConfiguration has transacted
= true.

My route takes a message from a topic consumer and attempts to send the
message to an http endpoint using transacted
ref=PROPAGATION_REQUIRES_NEW/. The http endpoint is offline so the
message fails I watch the transaction rollback and replay 5 times, as
configured by the redelivery policy. But after the 5 tries the message is
dumped into the default DLQ, ActiveMQ.DLQ, instead of the configured
/queue/topic name.DLQ/.

What am I missing here? Any help would be greatly appreciated, thank you!



--
View this message in context: 
http://camel.465427.n5.nabble.com/AMQ-DeadLetterStrategy-Not-Being-Respected-tp5737613.html
Sent from the Camel - Users mailing list archive at Nabble.com.


RE: Load test on camel-netty

2013-08-20 Thread Flavio Magacho - M4U
Claus, 
Thanks for your answer, we have done that and nothing changes.


Flavio Magacho
Gerente de Desenvolvimento
Diretoria de Tecnologia da Informação
  M4U
+55 (21) 2546-4050 ▪ Ramal: 4082
+55 (21) 8889-1572
 Antes de imprimir, pense em sua responsabilidade e compromisso com o Meio 
Ambiente.
O conteúdo desta mensagem é confidencial e pode ser privilegiado. É vedada a 
sua cópia ou divulgação.
The contents of this message are confidential and may be privileged. Copying or 
disclosing is prohibited.


-Original Message-
From: Claus Ibsen [mailto:claus.ib...@gmail.com] 
Sent: terça-feira, 20 de agosto de 2013 12:00
To: users@camel.apache.org
Subject: Re: Load test on camel-netty

I would suggest to remove the 100 thread pool sizes as the out of the box 
settings from Netty is better. Netty is asynchronous and it creates thread 
pools based on the number of CPU cores etc.

Netty creates the threads up-front so having 100+ threads take up some 
unnecessary memory.


On Tue, Aug 13, 2013 at 5:02 PM, Flavio Magacho - M4U  
flavio.maga...@m4u.com.br wrote:

 Hi, 

 I'm expecting some problems while running a load test on camel-netty
 component.

 ** **

 This is the route configuration:

 route id=rtRead

 from
 uri=netty:tcp://pos-tcp-server.host:9000?decoder=#myDecoderamp;encod
 er=#myEncoderamp;sync=trueamp;reuseAddress=trueamp;synchronous=fals
 eamp;workerCount=100amp;maximumPoolSize=100”/
 

 log message=Lendo ${body} /

 to uri=ejb:local/GatewayBean?method=process /

 /route

 ** **

 After some test cycles, we receive some exceptions like this:

 2013-08-13 11:25:33,398 WARNING
 [org.jboss.netty.channel.DefaultChannelPipeline] [New I/O  worker #32] 
 An exception was thrown by a user handler while handling an exception 
 event
 ([id: 0x8c7d41bd, /10.10.0.28:53469 = /10.11.234.38:9000] EXCEPTION:
 java.lang.OutOfMemoryError: unable to create new native thread)

 java.lang.OutOfMemoryError: unable to create new native thread

 at java.lang.Thread.start0(Native Method)

 at java.lang.Thread.start(Thread.java:640)

 at
 java.util.concurrent.ThreadPoolExecutor.addIfUnderCorePoolSize(ThreadP
 oolExecutor.java:703)
 

 at
 java.util.concurrent.ThreadPoolExecutor.execute(ThreadPoolExecutor.jav
 a:652)
 

 at
 org.jboss.netty.handler.execution.MemoryAwareThreadPoolExecutor.doUnor
 deredExecute(MemoryAwareThreadPoolExecutor.java:452)
 

 at
 org.jboss.netty.handler.execution.OrderedMemoryAwareThreadPoolExecutor
 $ChildExecutor.execute(OrderedMemoryAwareThreadPoolExecutor.java:292)
 

 at
 org.jboss.netty.handler.execution.OrderedMemoryAwareThreadPoolExecutor
 .doExecute(OrderedMemoryAwareThreadPoolExecutor.java:242)
 

 at
 org.jboss.netty.handler.execution.MemoryAwareThreadPoolExecutor.execut
 e(MemoryAwareThreadPoolExecutor.java:437)
 

 at
 org.jboss.netty.handler.execution.ExecutionHandler.handleUpstream(Exec
 utionHandler.java:172)
 

 at
 org.jboss.netty.channel.Channels.fireExceptionCaught(Channels.java:533
 )***
 *

 at 
 org.jboss.netty.channel.Channels$7.run(Channels.java:507)

 at
 org.jboss.netty.channel.socket.ChannelRunnableWrapper.run(ChannelRunna
 bleWrapper.java:41)
 

 at
 org.jboss.netty.channel.socket.nio.AbstractNioWorker.processEventQueue
 (AbstractNioWorker.java:453)
 

 at
 org.jboss.netty.channel.socket.nio.AbstractNioWorker.run(AbstractNioWo
 rker.java:330)
 

 at
 org.jboss.netty.channel.socket.nio.NioWorker.run(NioWorker.java:35)***
 *

 at
 java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecu
 tor.java:886)
 

 at
 java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.
 java:908)
 

 at java.lang.Thread.run(Thread.java:662)

 ** **

 ** **

 It sounds strange, our test case has only 5 simultaneous opened
 connections.

 For me we are heaving some leak of threads or we are having some 
 problems to close the SocketChannel correctly.

 ** **

 Thanks,

 *Flavio Magacho*

 *Gerente de Desenvolvimento*

 Diretoria de Tecnologia da Informação

 [image: cid:image001.gif@01CB90D9.07FBDA40]  *M4U*
 +55 (21) 2546-4050 ▪ Ramal: 4082

 +55 (21) 8889-1572

 *þ** *Antes de imprimir, pense em sua responsabilidade e compromisso 
 com o Meio Ambiente.

 *O conteúdo desta mensagem é confidencial e pode ser privilegiado. **É 
 vedada a sua cópia ou divulgação.*

 *The contents of this message are confidential and may be privileged.
 Copying or disclosing is prohibited.*

 ** **




--
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: Load test on camel-netty

2013-08-20 Thread Babak Vahdat
If Oracle/Sun JDK is in use then maybe ask for a heap dump as the
OutOfMemoryError happens:

http://docs.oracle.com/cd/E15289_01/doc.40/e15062/optionxx.htm#BABBBEAJ

Then you could analyze the dump (e.g. using http://www.eclipse.org/mat/) to
see where that huge memory consumption or the leak (if any) comes from.

Babak


flavio.magacho wrote
 Claus, 
 Thanks for your answer, we have done that and nothing changes.
 
 
 Flavio Magacho
 Gerente de Desenvolvimento
 Diretoria de Tecnologia da Informação
   M4U
 +55 (21) 2546-4050 ▪ Ramal: 4082
 +55 (21) 8889-1572
  Antes de imprimir, pense em sua responsabilidade e compromisso com o
 Meio Ambiente.
 O conteúdo desta mensagem é confidencial e pode ser privilegiado. É vedada
 a sua cópia ou divulgação.
 The contents of this message are confidential and may be privileged.
 Copying or disclosing is prohibited.
 
 
 -Original Message-
 From: Claus Ibsen [mailto:

 claus.ibsen@

 ] 
 Sent: terça-feira, 20 de agosto de 2013 12:00
 To: 

 users@.apache

 Subject: Re: Load test on camel-netty
 
 I would suggest to remove the 100 thread pool sizes as the out of the box
 settings from Netty is better. Netty is asynchronous and it creates thread
 pools based on the number of CPU cores etc.
 
 Netty creates the threads up-front so having 100+ threads take up some
 unnecessary memory.
 
 
 On Tue, Aug 13, 2013 at 5:02 PM, Flavio Magacho - M4U  

 flavio.magacho@.com

 wrote:
 
 Hi, 

 I'm expecting some problems while running a load test on camel-netty
 component.

 ** **

 This is the route configuration:

 
 route id=rtRead
 

 
 from

  uri=netty:tcp://pos-tcp-server.host:9000?decoder=#myDecoderamp;encod
 er=#myEncoderamp;sync=trueamp;reuseAddress=trueamp;synchronous=fals
 eamp;workerCount=100amp;maximumPoolSize=100”/
 

 
 log message=Lendo ${body} /
 

 
 to uri=ejb:local/GatewayBean?method=process /
 

 
 /route
 

 ** **

 After some test cycles, we receive some exceptions like this:

 2013-08-13 11:25:33,398 WARNING
 [org.jboss.netty.channel.DefaultChannelPipeline] [New I/O  worker #32] 
 An exception was thrown by a user handler while handling an exception 
 event
 ([id: 0x8c7d41bd, /10.10.0.28:53469 = /10.11.234.38:9000] EXCEPTION:
 java.lang.OutOfMemoryError: unable to create new native thread)

 java.lang.OutOfMemoryError: unable to create new native thread

 at java.lang.Thread.start0(Native Method)

 at java.lang.Thread.start(Thread.java:640)

 at
 java.util.concurrent.ThreadPoolExecutor.addIfUnderCorePoolSize(ThreadP
 oolExecutor.java:703)
 

 at
 java.util.concurrent.ThreadPoolExecutor.execute(ThreadPoolExecutor.jav
 a:652)
 

 at
 org.jboss.netty.handler.execution.MemoryAwareThreadPoolExecutor.doUnor
 deredExecute(MemoryAwareThreadPoolExecutor.java:452)
 

 at
 org.jboss.netty.handler.execution.OrderedMemoryAwareThreadPoolExecutor
 $ChildExecutor.execute(OrderedMemoryAwareThreadPoolExecutor.java:292)
 

 at
 org.jboss.netty.handler.execution.OrderedMemoryAwareThreadPoolExecutor
 .doExecute(OrderedMemoryAwareThreadPoolExecutor.java:242)
 

 at
 org.jboss.netty.handler.execution.MemoryAwareThreadPoolExecutor.execut
 e(MemoryAwareThreadPoolExecutor.java:437)
 

 at
 org.jboss.netty.handler.execution.ExecutionHandler.handleUpstream(Exec
 utionHandler.java:172)
 

 at
 org.jboss.netty.channel.Channels.fireExceptionCaught(Channels.java:533
 )***
 *

 at 
 org.jboss.netty.channel.Channels$7.run(Channels.java:507)

 at
 org.jboss.netty.channel.socket.ChannelRunnableWrapper.run(ChannelRunna
 bleWrapper.java:41)
 

 at
 org.jboss.netty.channel.socket.nio.AbstractNioWorker.processEventQueue
 (AbstractNioWorker.java:453)
 

 at
 org.jboss.netty.channel.socket.nio.AbstractNioWorker.run(AbstractNioWo
 rker.java:330)
 

 at
 org.jboss.netty.channel.socket.nio.NioWorker.run(NioWorker.java:35)***
 *

 at
 java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecu
 tor.java:886)
 

 at
 java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.
 java:908)
 

 at java.lang.Thread.run(Thread.java:662)

 ** **

 ** **

 It sounds strange, our test case has only 5 simultaneous opened
 connections.

 For me we are heaving some leak of threads or we are having some 
 problems to close the SocketChannel correctly.

 ** **

 Thanks,

 *Flavio Magacho*

 *Gerente de Desenvolvimento*

 Diretoria de Tecnologia da Informação

 [image: cid:image001.gif@01CB90D9.07FBDA40]  *M4U*
 +55 (21) 2546-4050 ▪ Ramal: 4082

 +55 (21) 8889-1572

 *þ** *Antes de imprimir, pense em sua responsabilidade e compromisso 
 com o Meio Ambiente.

 *O conteúdo desta mensagem é confidencial e pode ser privilegiado. **É 
 vedada a sua cópia ou divulgação.*

 

RE: Load test on camel-netty

2013-08-20 Thread Flavio Magacho - M4U
Thank you Vahdat, we will check this out!

Flavio Magacho
Gerente de Desenvolvimento
Diretoria de Tecnologia da Informação
  M4U
+55 (21) 2546-4050 ▪ Ramal: 4082
+55 (21) 8889-1572
 Antes de imprimir, pense em sua responsabilidade e compromisso com o Meio 
Ambiente.
O conteúdo desta mensagem é confidencial e pode ser privilegiado. É vedada a 
sua cópia ou divulgação.
The contents of this message are confidential and may be privileged. Copying or 
disclosing is prohibited.


-Original Message-
From: Babak Vahdat [mailto:babak.vah...@swissonline.ch] 
Sent: terça-feira, 20 de agosto de 2013 15:32
To: users@camel.apache.org
Subject: RE: Load test on camel-netty

If Oracle/Sun JDK is in use then maybe ask for a heap dump as the 
OutOfMemoryError happens:

http://docs.oracle.com/cd/E15289_01/doc.40/e15062/optionxx.htm#BABBBEAJ

Then you could analyze the dump (e.g. using http://www.eclipse.org/mat/) to see 
where that huge memory consumption or the leak (if any) comes from.

Babak


flavio.magacho wrote
 Claus,
 Thanks for your answer, we have done that and nothing changes.
 
 
 Flavio Magacho
 Gerente de Desenvolvimento
 Diretoria de Tecnologia da Informação
   M4U
 +55 (21) 2546-4050 ▪ Ramal: 4082
 +55 (21) 8889-1572
 þ Antes de imprimir, pense em sua responsabilidade e compromisso com o 
 Meio Ambiente.
 O conteúdo desta mensagem é confidencial e pode ser privilegiado. É 
 vedada a sua cópia ou divulgação.
 The contents of this message are confidential and may be privileged.
 Copying or disclosing is prohibited.
 
 
 -Original Message-
 From: Claus Ibsen [mailto:

 claus.ibsen@

 ]
 Sent: terça-feira, 20 de agosto de 2013 12:00
 To: 

 users@.apache

 Subject: Re: Load test on camel-netty
 
 I would suggest to remove the 100 thread pool sizes as the out of the 
 box settings from Netty is better. Netty is asynchronous and it 
 creates thread pools based on the number of CPU cores etc.
 
 Netty creates the threads up-front so having 100+ threads take up some 
 unnecessary memory.
 
 
 On Tue, Aug 13, 2013 at 5:02 PM, Flavio Magacho - M4U 

 flavio.magacho@.com

 wrote:
 
 Hi, 

 I'm expecting some problems while running a load test on camel-netty
 component.

 ** **

 This is the route configuration:

 
 route id=rtRead
 

 
 from

  
 uri=netty:tcp://pos-tcp-server.host:9000?decoder=#myDecoderamp;encod
 er=#myEncoderamp;sync=trueamp;reuseAddress=trueamp;synchronous=fal
 s eamp;workerCount=100amp;maximumPoolSize=100”/
 

 
 log message=Lendo ${body} /
 

 
 to uri=ejb:local/GatewayBean?method=process /
 

 
 /route
 

 ** **

 After some test cycles, we receive some exceptions like this:

 2013-08-13 11:25:33,398 WARNING
 [org.jboss.netty.channel.DefaultChannelPipeline] [New I/O  worker 
 #32] An exception was thrown by a user handler while handling an 
 exception event
 ([id: 0x8c7d41bd, /10.10.0.28:53469 = /10.11.234.38:9000] EXCEPTION:
 java.lang.OutOfMemoryError: unable to create new native thread)

 java.lang.OutOfMemoryError: unable to create new native thread

 at java.lang.Thread.start0(Native Method)

 at java.lang.Thread.start(Thread.java:640)

 at
 java.util.concurrent.ThreadPoolExecutor.addIfUnderCorePoolSize(Thread
 P
 oolExecutor.java:703)
 

 at
 java.util.concurrent.ThreadPoolExecutor.execute(ThreadPoolExecutor.ja
 v
 a:652)
 

 at
 org.jboss.netty.handler.execution.MemoryAwareThreadPoolExecutor.doUno
 r
 deredExecute(MemoryAwareThreadPoolExecutor.java:452)
 

 at
 org.jboss.netty.handler.execution.OrderedMemoryAwareThreadPoolExecuto
 r
 $ChildExecutor.execute(OrderedMemoryAwareThreadPoolExecutor.java:292)
 

 at
 org.jboss.netty.handler.execution.OrderedMemoryAwareThreadPoolExecuto
 r
 .doExecute(OrderedMemoryAwareThreadPoolExecutor.java:242)
 

 at
 org.jboss.netty.handler.execution.MemoryAwareThreadPoolExecutor.execu
 t
 e(MemoryAwareThreadPoolExecutor.java:437)
 

 at
 org.jboss.netty.handler.execution.ExecutionHandler.handleUpstream(Exe
 c
 utionHandler.java:172)
 

 at
 org.jboss.netty.channel.Channels.fireExceptionCaught(Channels.java:53
 3
 )***
 *

 at
 org.jboss.netty.channel.Channels$7.run(Channels.java:507)

 at
 org.jboss.netty.channel.socket.ChannelRunnableWrapper.run(ChannelRunn
 a
 bleWrapper.java:41)
 

 at
 org.jboss.netty.channel.socket.nio.AbstractNioWorker.processEventQueu
 e
 (AbstractNioWorker.java:453)
 

 at
 org.jboss.netty.channel.socket.nio.AbstractNioWorker.run(AbstractNioW
 o
 rker.java:330)
 

 at
 org.jboss.netty.channel.socket.nio.NioWorker.run(NioWorker.java:35)**
 *
 *

 at
 java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExec
 u
 tor.java:886)
 

 at
 java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.
 java:908)
 


Solace Integration with Camel

2013-08-20 Thread ganeshkumar.kanagavel
Hi,
Can you please advise if Camel based Routes can be integrated with Solace 
channels?

Any samples on TIBCO EMS or Solace channels help us a lot.

Thanks
Ganesh

___

This message is for information purposes only, it is not a recommendation, 
advice, offer or solicitation to buy or sell a product or service nor an 
official confirmation of any transaction. It is directed at persons who are 
professionals and is not intended for retail customer use. Intended for 
recipient only. This message is subject to the terms at: 
www.barclays.com/emaildisclaimer.

For important disclosures, please see: 
www.barclays.com/salesandtradingdisclaimer regarding market commentary from 
Barclays Sales and/or Trading, who are active market participants; and in 
respect of Barclays Research, including disclosures relating to specific 
issuers, please see http://publicresearch.barclays.com.

___


stream result of iterator to a file

2013-08-20 Thread anoordover
I have two questions:
I would like to stream the result of an iterator to a file.
I succeeded in doing that using a split with a factory class that creates my
iterator.
The name of the file is set dynamically in the header of the exchange.
So far I have no problem at all.

But I also want to write the stream to the database in a BLOB.
For this I have a kind of a writer which adapts a dao (not a real dao but
an interface that is made available via camel using the activemq component)
so that I am able to stream to this BLOB.
But the problem is that the first time I write a set of results to the
database a UID is generated for this row.
The next write use this UID to retrieve the stored document and append the
new set of result.
I must do it this way because the interaction with this database is only
available via a camel activemq endpoint. In the interface on this route I
have two methods available (saveDocument, appendToDocument).

For this solution I need to instantiate that writer for each master
exchange.
How can I make this instance (on a per exchange basis) available in my route
as a consumer?

Should I think about another solution?




--
View this message in context: 
http://camel.465427.n5.nabble.com/stream-result-of-iterator-to-a-file-tp5737624.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: AMQ DeadLetterStrategy Not Being Respected

2013-08-20 Thread Christian Müller
You should may ask this on the ActiveMQ user mailing list...

Best,
Christian
Am 20.08.2013 20:02 schrieb nezor kyle.eckh...@oeconnection.com:

 I'm using the standard activemq-broker.xml which comes pre-installed with
 Fuse with a slight change. I have added a deadLetterStrategy for Topics and
 Queues as indicated by this page
 http://activemq.apache.org/message-redelivery-and-dlq-handling.html
 http://activemq.apache.org/message-redelivery-and-dlq-handling.html

 destinationPolicy
 policyMap
   policyEntries
 policyEntry topic= producerFlowControl=true
 memoryLimit=1mb
   pendingSubscriberPolicy
 vmCursor /
   /pendingSubscriberPolicy
   deadLetterStrategy
 individualDeadLetterStrategy queueSuffix=.DLQ
 useQueueForTopicMessages=true/
   /deadLetterStrategy
 /policyEntry
 policyEntry queue= producerFlowControl=true
 memoryLimit=1mb
   deadLetterStrategy
 individualDeadLetterStrategy queueSuffix=.DLQ
 useQueueForQueueMessages=true/
   /deadLetterStrategy
 /policyEntry
   /policyEntries
 /policyMap
 /destinationPolicy

 The transportConnector are default,
 transportConnectors
  transportConnector name=openwire uri=tcp://localhost:61616/
  transportConnector name=stomp uri=stomp://localhost:61613/
 /transportConnectors

 Next, the ActiveMQConnectionFactory is configured to use the default broker
 from the activemq-broker.xml and my redelivery policy.
 bean id=jmsConnectionFactory
 class=org.apache.activemq.ActiveMQConnectionFactory
 property name=brokerURL
   valuetcp://localhost:61616/value
 /property
 property name=redeliveryPolicy ref=standardRedeliveryPolicy/
 /bean

 The rest of the configuration is standard my JmsConfiguration has
 transacted
 = true.

 My route takes a message from a topic consumer and attempts to send the
 message to an http endpoint using transacted
 ref=PROPAGATION_REQUIRES_NEW/. The http endpoint is offline so the
 message fails I watch the transaction rollback and replay 5 times, as
 configured by the redelivery policy. But after the 5 tries the message is
 dumped into the default DLQ, ActiveMQ.DLQ, instead of the configured
 /queue/topic name.DLQ/.

 What am I missing here? Any help would be greatly appreciated, thank you!



 --
 View this message in context:
 http://camel.465427.n5.nabble.com/AMQ-DeadLetterStrategy-Not-Being-Respected-tp5737613.html
 Sent from the Camel - Users mailing list archive at Nabble.com.



Re: Apply change to a route after loading camelcontext xml using GenericApplicationContext

2013-08-20 Thread bonnahu
thanks



--
View this message in context: 
http://camel.465427.n5.nabble.com/Apply-change-to-a-route-after-loading-camelcontext-xml-using-GenericApplicationContext-tp5737541p5737628.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Solace Integration with Camel

2013-08-20 Thread Willem jiang
Hi,

I think you can write a component[1] to do this kind of job.

[1]http://camel.apache.org/component.html  

--  
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 Wednesday, August 21, 2013 at 5:12 AM, ganeshkumar.kanaga...@barclays.com 
wrote:

 Hi,
 Can you please advise if Camel based Routes can be integrated with Solace 
 channels?
  
 Any samples on TIBCO EMS or Solace channels help us a lot.
  
 Thanks
 Ganesh
  
 ___
  
 This message is for information purposes only, it is not a recommendation, 
 advice, offer or solicitation to buy or sell a product or service nor an 
 official confirmation of any transaction. It is directed at persons who are 
 professionals and is not intended for retail customer use. Intended for 
 recipient only. This message is subject to the terms at: 
 www.barclays.com/emaildisclaimer (http://www.barclays.com/emaildisclaimer).
  
 For important disclosures, please see: 
 www.barclays.com/salesandtradingdisclaimer regarding market commentary from 
 Barclays Sales and/or Trading, who are active market participants; and in 
 respect of Barclays Research, including disclosures relating to specific 
 issuers, please see http://publicresearch.barclays.com.
  
 ___  




Re: Mina Synchronous Communication

2013-08-20 Thread Willem jiang
From the stack trace, it looks like the decoder cannot interpret the data 
length rightly.
Can you double check it with your application?


--  
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 Wednesday, August 21, 2013 at 12:55 AM, milltj wrote:

 I am currently using Mina2 V2.11.1.
  
 My decoder looks like
  
 @Override
 protected boolean doDecode(IoSession is, IoBuffer ib,
 ProtocolDecoderOutput pdo) throws Exception {
 int headerSize=28;
 byte[] header = new byte[headerSize];
 byte[] xmlBuffer = null;
 byte[] fullMessage = null;
  
 int xmlLength = -1;
 ib.get(header);
  
 xmlLength = convertBytesToInt(Arrays.copyOfRange(header, 16, 20));
  
 xmlBuffer = new byte[xmlLength];
 ib.get(xmlBuffer);
  
 pdo.write(xmlc.convertXmlToObject(xmlBuffer));
  
 return true;
  
 }
  
 I am finding that I get that error message no matter what options I add to
 the url. I discovered that my clients have a number of different requests
 that will be sent, some require a response, others do not. When I don't
 return a response it closes the connection, which I do not want, I want the
 connection to remain open at all times. So I tried to set the url to
  
  
 camel:from
 uri=mina2:tcp://10.5.60.60:9000?disconnectOnNoReply=false;codec=#gilbarcoDecoder
 /
  
 But I still get the same error.
 Error:  
 org.apache.mina.filter.codec.ProtocolDecoderException:  
 org.apache.mina.core.buffer.BufferDataException: dataLength: 1347375948  
  
  
  
  
 --
 View this message in context: 
 http://camel.465427.n5.nabble.com/Mina-Synchronous-Communication-tp5737223p5737612.html
 Sent from the Camel - Users mailing list archive at Nabble.com 
 (http://Nabble.com).





Re: Spring Bean represented as endpoint

2013-08-20 Thread Willem jiang
I think you need to setup the CamelContext on the appWebSocket bean.
BTW, what's the exception that you get when using the appWebSocket.

--  
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 Saturday, August 17, 2013 at 4:35 AM, MichaelAtSAG wrote:

 All,
 I am trying to move endpoint properties into a bean, yet the endpoint is not
 working this way. I think it is a simple typo but can't find it:
  
 
 THIS WORKS
 
  
 ?xml version=1.0 encoding=UTF-8?
 beans  
 camelContext
 endpoint id=websocketEndpoint
 uri=websocket://{{wsHost}}:{{wsPort}}/nerv-tweet?staticResources=classpath:.amp;sendToAll=true
 /  
 /camelContext
 /beans
  
 
 AND THIS DOES NOT WORK, YET FUNCTIONALLY THE SAME
 
  
 ?xml version=1.0 encoding=UTF-8?
 beans  
 bean id=appWebSocket
 class=org.apache.camel.component.websocket.WebsocketComponent
 property name=host value=localhost /
 property name=port value=9090 /
 property name=staticResources value=classpath:. /
 /bean
 camelContext
 endpoint id=websocketEndpoint
 uri=appWebSocket://nerv-tweet?sendToAll=true /  
 /camelContext
 /beans
  
 Any help to see the problem would be most welcome!
 Thanks,
 Michael
  
  
  
 --
 View this message in context: 
 http://camel.465427.n5.nabble.com/Spring-Bean-represented-as-endpoint-tp5737433.html
 Sent from the Camel - Users mailing list archive at Nabble.com 
 (http://Nabble.com).





Re: Issues with Camel startup...

2013-08-20 Thread Willem jiang
Did you try to use JConsole to look up the status of camel routes[1]?

From your description I double if the camel-jms can access the JMS broker 
rightly.

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


--  
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 Tuesday, August 20, 2013 at 10:08 PM, Harish Shindhe (hashinde) wrote:

 Hi,
  
 We are using Camel 2.9 in our application. The role of which is to read the 
 message from one end point and pass it to another endpoint which is a POJO 
 which takes care of processing the message.
  
 We use Spring xml based configuration to define the JNDITemplate and 
 endpoints and things worked fine until few days back.
  
 Recently there was a network upgrade and a WAS patch upgrade after which 
 there is no consumption of messages from the defined jms end point. We have 
 looked at all the configurations and everything seems to be fine.
  
 Is there a diagnostic tool that when run as a standalone program tells me the 
 health of the camel initialization and its readiness to consume messages.
  
 Please help.
  
 Regards,
 Harish





Re: reading integer values from properties file

2013-08-20 Thread Willem jiang
Can you try it with the latest Camel?
As you know you don't provide community support for very old version of Camel.


--  
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 Wednesday, August 21, 2013 at 7:11 AM, bxkrish wrote:

 Hi  
  
 I am using Camel API propertyPlaceholder to access my properties. All the
 String values are resolved without any issues. Can you please provide any
 insight on reading integer values?  
  
 Camel Version = 2.4
  
 *Configuration:*
  
 camelContext..
 propertyPlaceholder id=properties
 location=file:/usr/config/properties/params.properties /
 ...
  
 property name=retryLimit value={{maxRetries.DEV}} /
  
 *params.properties*
 maxRetries.DEV = 10
  
 *Exception:*
  
 org.apache.camel.RuntimeCamelException: java.lang.NumberFormatException: For
 input string: {{maxRetries.DEV}}
  
 Please help.
  
 Thanks
 Bala
  
  
  
 --
 View this message in context: 
 http://camel.465427.n5.nabble.com/reading-integer-values-from-properties-file-tp5737629.html
 Sent from the Camel - Users mailing list archive at Nabble.com 
 (http://Nabble.com).





Time to deliver a message?

2013-08-20 Thread 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: How to add Vendor Specific Optional Parameter in CamelSmppOptionalParameters

2013-08-20 Thread cartoondog
Hi Christ,

Jira created.  #CAMEL-6655.


I think I have messed up the code in my last post and revised the method as
below.  Kindly check and advise if this can work.

/*
pSince it is vendor specified, so users must have the code and type,
 therefore users should concatenate these information as a string
 using a separator(:) and pass this in as the Entry's value
/p
pUsage: EntryString, String
   String key must equal
 VENDOR_SPECIFIC_OPTIONAL_PARAMETER
   String value should be code:type:param_value
*/
   protected OptionalParameter generateVendorSpecificOptParam(EntryString,
String entry)
   throws SecurityException, IllegalArgumentException,
IllegalAccessException{

   OptionalParameter optParam = null ;

   String valueStr = (String)entry.getValue() ;
   String[] inputStr = valueStr.split(:, 3) ; 
   short code = Short.parseShort(inputStr[0]) ;
  //code must fall inside the ranges specified in SMPP 3.4 specification
  //0x1400 - 0x3FFF
 if ( !(code = 0x1400 or code = 0x3FFF)
  throw new IllegalArgumentException() ;

  //type must be one of the defined Class and must be in uppercase

String type = inputStr[1] ;
if ( type.equals(OCTETSTRING) ){
 optParam = new OptionalParameter.OctetString(code,
inputStr[2]) ;   
}else if (type.equals(COCTETSTRING) ) {
 optParam = new OptionalParameter.COctetString(code,
inputStr[2]) ; 
}else if(type.equals(BYTE) ){
 optParam = new OptionalParameter.Byte(code,
Byte.valueOf(inputStr[2])) ; 
}else if (type.equals(INT) ){
optParam = new OptionalParameter.Int(code,
Integer.valueOf(inputStr[2]));
}else if (type.equals(SHORT) ) {
optParam = new OptionalParameter.Short(code,
Short.valueOf(inputStr[2]));
}else if (type.equals(NULL) )
optParam = new OptionalParameter.Null(code);
}else
throw new IllegualArgumentException() ;
}
 return optParam ;
   } 





--
View this message in context: 
http://camel.465427.n5.nabble.com/How-to-add-Vendor-Specific-Optional-Parameter-in-CamelSmppOptionalParameters-tp5737268p5737639.html
Sent from the Camel - Users mailing list archive at Nabble.com.