Re: polling consumer with acknowledgement

2013-12-23 Thread Tarun Kumar
Hi Kraythe,

Thanks for replying.

Here is how my route looks like:

camel:route id=createMigrationRoute

 camel:from uri=timer://foo?period=1000/camel:from

 camel:transacted

 camel:doTry

  camel:bean ref=abc method=fetchMessage/camel:bean

camel:bean ref=pqr method=processMessage/camel:bean

camel:doCatch

  camel:exceptionjava.lang.IOException/camel:exception

  camel:bean ref=def method=handleException /

  /camel:doCatch

  camel:doFinally

  camel:bean ref=dsd method=me2/camel:bean

  /camel:doFinally

 /camel:doTry

 /camel:transacted

 /camel:route


And beans looks like this:


 bean id=catalogJms class=org.apache.camel.component.jms.JmsComponent

 property name=connectionFactory

 bean class=org.apache.activemq.ActiveMQConnectionFactory

  property name=brokerURL

  valuetcp://localhost:61616/value

  /property

 /bean

 /property

 property name=transacted value=true/property

 property name=transactionManager ref=jmsTransactionManager /

 property name=acknowledgementModeName

 valueCLIENT_ACKNOWLEDGE/value

 /property

/bean


bean id=poolConnectionFactory class=
org.apache.activemq.pool.PooledConnectionFactory

 property name=maxConnections value=8 /

 property name=connectionFactory ref=jmsConnectionFactory /

/bean


 bean id=jmsConnectionFactory class=
org.apache.activemq.ActiveMQConnectionFactory

 property name=brokerURL

 value=
vm://localhost:61616?broker.persistent=falseamp;broker.useJmx=false /

/bean


 !-- setup spring jms TX manager --

bean id=jmsTransactionManager

 class=org.springframework.jms.connection.JmsTransactionManager

 property name=connectionFactory ref=poolConnectionFactory /

/bean


And fetchMessage in abc bean class looks like:


public String fetchMessage() {

 Exchange exchange = consumer

  .receive(
catalogJms:queue:queue1?mapJmsMessage=falseacknowledgementModeName=CLIENT_ACKNOWLEDGEtransacted=true,
5000);

return exchange.getIn().getBody(TextMessage.class).toString();

}


It still consumes message (QueueSize decreases by one) even when it fails
in pqr bean with any exception apart from IOException.

Please let me know what am i missing here?




On Sat, Dec 21, 2013 at 10:01 PM, kraythe . kray...@gmail.com wrote:

 In that case you are going about it wrong. Camel has this support built in
 for you. If the route is declared to be transacted with
 .transacted(myRequirdPolicy) then camel will handle that all for you with
 that one line. Put the transacted line right after your exception handleing
 and before the main route and then go about your business. If you want a
 composite transaction that rolls back both the DB and JMS work then you
 will need to configure a jta transaction manager. Just google 'camel
 jta transacted route' and you will get code examples and so on.

 On Saturday, December 21, 2013, Tarun Kumar wrote:

  Thanks for replying. Here is my usecase:
 
  consume a message from the queue. Do some transformation on the messge.
  Then, persist the transformed message to datastore.
  Once, transformed message is written to datastore, send ack. Reason i
 want
  to send ack later is, in case my application goes down post message
  consumption and before writing to datastore, i should be able to fetch
 same
  message again from JMS queue. Hope that clarifies.
 
  Thanks!
 
 
 
  On Sat, Dec 21, 2013 at 9:14 PM, kraythe . kray...@gmail.com
 javascript:;
  wrote:
 
   I don't think the question is quite clear. In JMS you can only consume
 a
   message off a queue once. You can't consume it and leave it on the
 queue.
   Why do want to not ack the message? Queues are like throwing candy
 into a
   room of kindergarten children. All will scramble for the candy but each
   piece will get consumed by only one child. The only time JMS messages
   aren't caked is when they are failed in delivery. And even then, the
 only
   use case for leaving them on the queue is because of a failed
 transaction
   in a transactional route,
  
   Tell me what is the use case you are trying to implement and I might be
   able to help you down another path.
  
   On Saturday, December 21, 2013, Tarun Kumar wrote:
  
Hi,
   
Any help here will be highly appreciated.
   
   
On Fri, Dec 20, 2013 at 9:55 AM, Tarun Kumar 
  agrawal.taru...@gmail.com javascript:;
   javascript:;
wrote:
   
 I am using polling consumer.

 from(timer://foo?period=5000).bean(cool, someBusinessLogic);

 public static class MyCoolBean {

   private ConsumerTemplate consumer;

public void setConsumer(ConsumerTemplate consumer) {
 this.consumer = consumer;
 }

public void someBusinessLogic() {

   Exchange exchange
 =
   
  
 
 consumer.receive(catalogJms:queue:queueName?mapJmsMessage=falseacknowledgementModeName=CLIENT_ACKNOWLEDGE);

 }


 Even though i am not sending acknowledgement for received message,
  each
 time it is polling different message. Any idea why that's
 

Re: RecipientList or DynamicRouter or RoutingSlip

2013-12-23 Thread ABouchama
Thanks for your response,I thought to a solution, if it is possible to use
?Use RecipientList with list of wiretap with defined headereg:wiretap:uri
=activemq: queue: A,header=Awiretap:uri =activemq: queue: B,header=Bis it
possible ?Thanks in advance,



--
View this message in context: 
http://camel.465427.n5.nabble.com/RecipientList-or-DynamicRouter-or-RoutingSlip-tp5745069p5745182.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Problem with exception handler (onException) on Camel 2.12.X routes.

2013-12-23 Thread jguerra
Good news Please could you provide more information about the scenarios
you test?. Did you handle java.sql.SQLException?. What kind of environment
did you test it.?. Could you please attach the whole dependency tree running
in your tests for your handlers (Database, Spring, etc...)?





--
View this message in context: 
http://camel.465427.n5.nabble.com/Problem-with-exception-handler-onException-on-Camel-2-12-X-routes-tp5742605p5745185.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: SMPP to SMPP using camel

2013-12-23 Thread rehmanadil

We are also looking for a similar solution that provides SMPP Router/Gateway
functionality by supporting incoming and outgoing SMPP connections. Has
anyone got experience with building something similar using open-source
products?





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


SOAP Web service Calling using camel.

2013-12-23 Thread viral.patel69
Dear All,

Without creating client can it be possible to call web method of web
service. 

I have a Web Service deployed, WSDL for same has been given bellow

wsdl:definitions xmlns:soapenc12=http://www.w3.org/2003/05/soap-encoding;
xmlns:tns=http://service.application.buzzor.atpl.com;
xmlns:wsdl=http://schemas.xmlsoap.org/wsdl/;
xmlns:xsd=http://www.w3.org/2001/XMLSchema;
xmlns:soap11=http://schemas.xmlsoap.org/soap/envelope/;
xmlns:wsdlsoap=http://schemas.xmlsoap.org/wsdl/soap/;
xmlns:soapenc11=http://schemas.xmlsoap.org/soap/encoding/;
xmlns:soap12=http://www.w3.org/2003/05/soap-envelope;
targetNamespace=http://service.application.buzzor.atpl.com;
wsdl:types
xsd:schema xmlns:xsd=http://www.w3.org/2001/XMLSchema;
attributeFormDefault=qualified elementFormDefault=qualified
targetNamespace=http://service.application.buzzor.atpl.com;
xsd:element name=getApplication
xsd:complexType/
/xsd:element
xsd:element name=getApplicationResponse
xsd:complexType
xsd:sequence
xsd:element maxOccurs=1 minOccurs=1 name=out nillable=true
type=xsd:string/
/xsd:sequence
/xsd:complexType
/xsd:element
/xsd:schema
/wsdl:types
wsdl:message name=getApplicationResponse
wsdl:part name=parameters
element=tns:getApplicationResponse/wsdl:part
/wsdl:message
wsdl:message name=getApplicationRequest
wsdl:part name=parameters element=tns:getApplication/wsdl:part
/wsdl:message
wsdl:portType name=ApplicationServicePortType
wsdl:operation name=getApplication
wsdl:input name=getApplicationRequest
message=tns:getApplicationRequest/wsdl:input
wsdl:output name=getApplicationResponse
message=tns:getApplicationResponse/wsdl:output
/wsdl:operation
/wsdl:portType
wsdl:binding name=ApplicationServiceHttpBinding
type=tns:ApplicationServicePortType
wsdlsoap:binding style=document
transport=http://schemas.xmlsoap.org/soap/http/
wsdl:operation name=getApplication
wsdlsoap:operation soapAction=/
wsdl:input name=getApplicationRequest
wsdlsoap:body use=literal/
/wsdl:input
wsdl:output name=getApplicationResponse
wsdlsoap:body use=literal/
/wsdl:output
/wsdl:operation
/wsdl:binding
wsdl:service name=ApplicationService
wsdl:port name=ApplicationServiceHttpPort
binding=tns:ApplicationServiceHttpBinding
wsdlsoap:address
location=http://192.168.2.66:8081/buzzor-service/services/ApplicationService/
/wsdl:port
/wsdl:service
/wsdl:definitions

As you see in WSDL i need to call getApplication() method. 

I am new in camel, and in example i found how to expose your web service
using camel. but i need a example sample code which will call this web
service using JAVA DSL.

Please help me

Thanks in Advance.






--
View this message in context: 
http://camel.465427.n5.nabble.com/SOAP-Web-service-Calling-using-camel-tp5745180.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Camel Jetty component and overlapping urls when a consumer

2013-12-23 Thread Claus Ibsen
On Sat, Dec 21, 2013 at 9:48 PM, samslara samsl...@yahoo.com wrote:
 I'm sorry you're right.  Our 20+ routes do have matchOnUriPrefix such as:
 from uri=jetty:http://0.0.0.0:8080/...?matchUriOnPrefix=true; /

 In my original scenario but with this additional change what would happen?


Dont ask us. Ask the computer instead (eg try it out and see what happens)

 eg:
 route1:
 from uri=jetty:http://0.0.0.0:8080/?matchOnUriPrefix=true/
 ...

 route2:
 from uri=jetty:http://0.0.0.0:8080/application1?matchOnUriPrefix=true/
 ...

 request:
 http://myip:8080/application1/a/b/c





 --
 View this message in context: 
 http://camel.465427.n5.nabble.com/Camel-Jetty-component-and-overlapping-urls-when-a-consumer-tp5745068p5745161.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
Make your Camel applications look hawt, try: http://hawt.io


Processing Error queue and handling them appropriately

2013-12-23 Thread vinayk0889
Hi..

I am new to apache camel.. my requirement is Processing Error queue and
handling them appropriately. Please suggest me a best approach for error
handling in camel.

my actual requirement is am using timer component every 5 min hitting the
endpoint getting response. in mean while if any error need to put in to the
queue and handle that error. please suggest me a best way how can i
implement this use case.

Thanks



--
View this message in context: 
http://camel.465427.n5.nabble.com/Processing-Error-queue-and-handling-them-appropriately-tp5745188.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Processing Error queue and handling them appropriately

2013-12-23 Thread Darwish
Hi,
You can user DeadLetterChannel error handler as bellow 

errorHandler id=myDLC type=DeadLetterChannel
deadLetterUri=AMQ:queue:ERROR_Q useOriginalMessage=true/

in the timer route you need to force using that error handler  using
errorHandlerRef=myDLC

then start new route to consume error messages from AMQ:queue:ERROR_Q 







-
Othman Darwish
ProgressSoft Corp.

--
View this message in context: 
http://camel.465427.n5.nabble.com/Processing-Error-queue-and-handling-them-appropriately-tp5745188p5745189.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: FuseIDE in combination with routeContext elements from external files

2013-12-23 Thread kraythe .
That brings up the interesting question of why even use FUSE at all if they
are still running 2.9 and their update speed makes turtles look fast.
Honestly working with the straight code and, if you must do redhat, in
straight JBoss is easier and more flexible.

*Robert Simmons Jr. MSc. - Lead Java Architect @ EA*
*Author of: Hardcore Java (2003) and Maintainable Java (2012)*
*LinkedIn: **http://www.linkedin.com/pub/robert-simmons/40/852/a39
http://www.linkedin.com/pub/robert-simmons/40/852/a39*


On Thu, Dec 19, 2013 at 3:39 AM, Claus Ibsen claus.ib...@gmail.com wrote:

 Hi

 I suggest to get in touch with the Fuse IDE community at github
 https://github.com/fusesource/fuseide

 You can log a ticket in their issue tracker
 https://github.com/fusesource/fuseide/issues


 On Mon, Dec 16, 2013 at 5:18 PM, Ronny Aerts ronny.ae...@intris.be
 wrote:

   Hello camel community,
 
 
 
  I started about a half year ago using Camel in combination ActiveMQ and I
  feel good with this esb solution. I created all xml files and related
 files
  using an xml or text editor. I would like to switch to a more visual
 editor
  and I came across the FuseIDE. Everthing seems to work fine except for my
  sub-routes. I use the routeContext functionality as sub-routes in the
 main
  route file. A sub-routes are predefined reusable routes which, dependable
  on the customer, are included or not (in the main file). I already have a
  collection of sub-routes which is extending every week.
 
 
 
  My example main route file is called TrisESB-config-intris-erp.xml and
 the
  sub-route are attached.
 
 
 
  I found the same issue in eclipse-344 (
  http://fusesource.com/forums/thread.jspa?messageID=17641)  but it should
  have solved quite some time ago. I am very confused about the version
  information for the FuseIDE product. Eclipse-344 indicates that this
 issue
  is solved in version 2.1.0 but I can't find this version number
 anywhere. I
  download the FuseIDE as part of the jboss fuse page and this gives me a
  download file FuseIDE-6.0.0.129-win32.win32.x86_64.zip. A see here a
  version 6.0.0.129 and zip contains a folder FuseIDE-6.0.0.
 
  The About FuseIDE window (in eclipse) shows a version 7.6.2 (but I
 think
  this is the eclipse.exe version).
 
 
 
  Can someone please clear out this version confusion? Can someone tell me
  why my sub-route design windows is blank when I open it?
 
 
 
  --
 
  Kind regards,
  Ronny Aerts ronny.ae...@intris.be – Intris nv – Wapenstilstandlaan 47,
  2600 Berchem, Belgium
  RD Integration Architect
 
  Prince II certified
 
  Tel: +32-3-326.50.75
 
 
 
  Intris nv
  Wapenstilstandlaan 47
  B-2600 Berchem
   Tel.  +32 3 326 50 75
  Fax  +32 3 326 42 23
  *www.intris.be* http://www.intris.be/
  DISCLAIMER
  This is an e-mail from Intris. The information contained in this
  communication is intended solely for use by the individual or entity to
  whom it is addressed.
  Use of this communication by others is prohibited. If the e-mail message
  was sent to you by mistake, please notify supp...@intris.be, destroy it
  without reading, using, copying or disclosing its contents to any other
  person.
  We accept no liability for damage related to data and/or documents which
  are communicated by electronic mail.
 



 --
 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
 Make your Camel applications look hawt, try: http://hawt.io



Re: compatible version of apache cxf, spring and camel

2013-12-23 Thread kraythe .
If you are building with maven, use 'mvn dependency:tree' and look for CXF
dependency. It would vary depending upon what version of camel you are
using.

*Robert Simmons Jr. MSc. - Lead Java Architect @ EA*
*Author of: Hardcore Java (2003) and Maintainable Java (2012)*
*LinkedIn: **http://www.linkedin.com/pub/robert-simmons/40/852/a39
http://www.linkedin.com/pub/robert-simmons/40/852/a39*


On Thu, Dec 19, 2013 at 5:21 AM, reena upadhyay reena2...@outlook.comwrote:

 I am trying to deploy apache cxf service on camel.Can anybody tell me the
 stable compatible version of apache cxf, spring and camel.I am facing jar
 compatbility issue with different versions.



Re: Aggregator, beyond the simple string example

2013-12-23 Thread kraythe .
I think I can share this one. .. its a pretty mundane one I've used in more
than one company.

public class ListAggregationStrategyT implements AggregationStrategy {
  /** The comparator used to keep the list sorted if any. */
  final ComparatorT comparator;

  /**
   * @param comparator The comparator used to keep the list sorted if any;
if this is null then the list will not be kept sorted.
   */

  public ListAggregationStrategy(final ComparatorT comparator) {
this.comparator = comparator;
  }

  @Override
  public Exchange aggregate(final Exchange aggregatedExchange,
finalExchange newExchange) {
final T newBody = (T) newExchange.getIn().getBody();
ListT exchangeBodies = null;
if (aggregatedExchange == null) {
  exchangeBodies = new LinkedList();
  exchangeBodies.add(newBody);
  newExchange.getIn().setBody(exchangeBodies);
  return newExchange;
}
exchangeBodies = aggregatedExchange.getIn().getBody(List.class);
exchangeBodies.add(newBody);
if (null != this.comparator) Collections.sort(exchangeBodies, this.
comparator);
return aggregatedExchange;
  }
}

*Robert Simmons Jr. MSc. - Lead Java Architect @ EA*
*Author of: Hardcore Java (2003) and Maintainable Java (2012)*
*LinkedIn: **http://www.linkedin.com/pub/robert-simmons/40/852/a39
http://www.linkedin.com/pub/robert-simmons/40/852/a39*


On Thu, Dec 19, 2013 at 7:39 AM, Cecilio Alvarez 
cecilio.alva...@hotmail.com wrote:

 Hi,

 I did long time ago a test to add a child node to an xml root, you could
 modify it.

 public class XmlAggregator implements AggregationStrategy {

 public Exchange aggregate(Exchange oldExchange, Exchange
 newExchange) {

 Document oldBody =
 oldExchange.getIn().getBody(org.w3c.dom.Document.class);
 Document newBody =
 newExchange.getIn().getBody(org.w3c.dom.Document.class);

 NodeList list = newBody.getElementsByTagName(tag);

 Element element = (Element) list.item(0);

 Node copiedNode = oldBody.importNode(element, true);

 oldBody.getDocumentElement().appendChild(copiedNode);

 oldExchange.getIn().setBody(oldBody);

 return oldExchange;
 }
 }

 Hope it help.














 --
 View this message in context:
 http://camel.465427.n5.nabble.com/Aggregator-beyond-the-simple-string-example-tp5745012p5745055.html
 Sent from the Camel - Users mailing list archive at Nabble.com.



Re: Route message based on Tag Value - Apache Camel Spring

2013-12-23 Thread kraythe .
This page will probably help.

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


*Robert Simmons Jr. MSc. - Lead Java Architect @ EA*
*Author of: Hardcore Java (2003) and Maintainable Java (2012)*
*LinkedIn: **http://www.linkedin.com/pub/robert-simmons/40/852/a39
http://www.linkedin.com/pub/robert-simmons/40/852/a39*


On Fri, Dec 20, 2013 at 9:03 AM, raheelhasanfsd . raheelhasan@gmail.com
 wrote:

 I am trying to learn Apache Camel Routes. For a basic example, I would like
 to know how to route based on values in an XML tag. For example, if we have
 3 xml files with parent tags:

 item type=n1 /item type=n2 /item type=n3 /


 I want to route these 3 into 3 different pipes...

 so here is my idea (in Spring):

 route id=NormalizeMessageData
 from uri=jms:incomingOrders /convertBodyTo type=java.lang.String /
 choicewhen
   simple${body} contains '?xml'/simple !-- to make sure its xml
 file only --
   *
   *
   *
   unmarshal
 jaxb contextPath=org.fusesource.camel /
   /unmarshal
   to uri=jms:orders //when/choice


 see the stars (*), this is where we need to put some checking. But how?


 --
 Regards,
 Raheel Hasan



Re: polling consumer with acknowledgement

2013-12-23 Thread kraythe .
Ewww... I hate spring xml DSL (fluent Java or Scala is much better) ..
anyway after my eyes are done bleeding ... it seems like you are wrapping
the possible failure calls in a doTry/catch. Since you are handling the
transactions, camel assumes all is well and that you meant to do that, so
an exception wont be propagated and the transaction wont be rolled back. If
you want to have a transaction be rolled back you have to let the exception
propagate while you have a transaction error handler in scope or
setRollbackOnly() on the transaction when you catch the exception: Such as:

from(endpointAMQ(QUEUE_DB_MONITOR_EVENT)) // Monitor the event queue
.routeId(ROUTE_ID_AUTOMATION_CASES_DB_PROCESSOR) // give the route
an ID

.onException(Exception.class).useOriginalMessage().handled(true).maximumRedeliveries(0)
// catch exceptions
.setHeader(Exchange.FAILURE_ROUTE_ID, property(Exchange.
FAILURE_ROUTE_ID)) // set route that errored
.setHeader(Exchange.EXCEPTION_CAUGHT, simple(
${exception.stacktrace})) // Store reason for error
.to(ExchangePattern.InOnly,
endpointAMQ(QUEUE_CASE_AUTOMATION_DEAD)).end()
// to DLQ
.transacted(KEY_TXPOLICY_REQUIRED) // make the route transacted
// rest of route

As you can see I store the exception stack trace and other information in
the headers of the failed exchange, send the exchange to the dead letter
queue and then so on. So if there is an exception in this route, NOTHING
will get rolled back which is what I want since I cant reprocess the
message. So why transacted? If someone pulls the plug on the machine or
uses kill -9 on the process, I want AMQ to retain the message. Now if I
wanted a rollback I could add the call .rollback() right after my onException()
call and before the .end call. That would tell the exception error handler
(which is a transaction handler) to rollback AMQ.

Now if you want to rollback both a database and AMQ transaction you will
need a JTA transaction manager.



*Robert Simmons Jr. MSc. - Lead Java Architect @ EA*
*Author of: Hardcore Java (2003) and Maintainable Java (2012)*
*LinkedIn: **http://www.linkedin.com/pub/robert-simmons/40/852/a39
http://www.linkedin.com/pub/robert-simmons/40/852/a39*


On Mon, Dec 23, 2013 at 2:11 AM, Tarun Kumar agrawal.taru...@gmail.comwrote:

 Hi Kraythe,

 Thanks for replying.

 Here is how my route looks like:

 camel:route id=createMigrationRoute

  camel:from uri=timer://foo?period=1000/camel:from

  camel:transacted

  camel:doTry

   camel:bean ref=abc method=fetchMessage/camel:bean

 camel:bean ref=pqr method=processMessage/camel:bean

 camel:doCatch

   camel:exceptionjava.lang.IOException/camel:exception

   camel:bean ref=def method=handleException /

   /camel:doCatch

   camel:doFinally

   camel:bean ref=dsd method=me2/camel:bean

   /camel:doFinally

  /camel:doTry

  /camel:transacted

  /camel:route


 And beans looks like this:


  bean id=catalogJms class=org.apache.camel.component.jms.JmsComponent

  property name=connectionFactory

  bean class=org.apache.activemq.ActiveMQConnectionFactory

   property name=brokerURL

   valuetcp://localhost:61616/value

   /property

  /bean

  /property

  property name=transacted value=true/property

  property name=transactionManager ref=jmsTransactionManager /

  property name=acknowledgementModeName

  valueCLIENT_ACKNOWLEDGE/value

  /property

 /bean


 bean id=poolConnectionFactory class=
 org.apache.activemq.pool.PooledConnectionFactory

  property name=maxConnections value=8 /

  property name=connectionFactory ref=jmsConnectionFactory /

 /bean


  bean id=jmsConnectionFactory class=
 org.apache.activemq.ActiveMQConnectionFactory

  property name=brokerURL

  value=
 vm://localhost:61616?broker.persistent=falseamp;broker.useJmx=false /

 /bean


  !-- setup spring jms TX manager --

 bean id=jmsTransactionManager

  class=org.springframework.jms.connection.JmsTransactionManager

  property name=connectionFactory ref=poolConnectionFactory /

 /bean


 And fetchMessage in abc bean class looks like:


 public String fetchMessage() {

  Exchange exchange = consumer

   .receive(

 catalogJms:queue:queue1?mapJmsMessage=falseacknowledgementModeName=CLIENT_ACKNOWLEDGEtransacted=true,
 5000);

 return exchange.getIn().getBody(TextMessage.class).toString();

 }


 It still consumes message (QueueSize decreases by one) even when it fails
 in pqr bean with any exception apart from IOException.

 Please let me know what am i missing here?




 On Sat, Dec 21, 2013 at 10:01 PM, kraythe . kray...@gmail.com wrote:

  In that case you are going about it wrong. Camel has this support built
 in
  for you. If the route is declared to be transacted with
  .transacted(myRequirdPolicy) then camel will handle that all for you with
  that one line. Put the transacted line right after your exception
 handleing
  and before the main route and then go about your business. If you want a
  composite transaction that rolls back 

Re: RecipientList or DynamicRouter or RoutingSlip

2013-12-23 Thread kraythe .
not a good idea. Wiretap makes a copy of an exchange and is used for things
like logging and monitoring. You are using a wrench to cut down a tree. You
might cut it down but the next guy will have no idea why the wrench is the
tool. Use the right tool, either recipient list or dynamic router.

*Robert Simmons Jr. MSc. - Lead Java Architect @ EA*
*Author of: Hardcore Java (2003) and Maintainable Java (2012)*
*LinkedIn: **http://www.linkedin.com/pub/robert-simmons/40/852/a39
http://www.linkedin.com/pub/robert-simmons/40/852/a39*


On Mon, Dec 23, 2013 at 2:16 AM, ABouchama tit...@yahoo.fr wrote:

 Thanks for your response,I thought to a solution, if it is possible to use
 ?Use RecipientList with list of wiretap with defined headereg:wiretap:uri
 =activemq: queue: A,header=Awiretap:uri =activemq: queue: B,header=Bis it
 possible ?Thanks in advance,



 --
 View this message in context:
 http://camel.465427.n5.nabble.com/RecipientList-or-DynamicRouter-or-RoutingSlip-tp5745069p5745182.html
 Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Problem with exception handler (onException) on Camel 2.12.X routes.

2013-12-23 Thread kraythe .
Uhh probably not. Proprietary code you know. I would look for another
problem. I know the exception handlers are working fine so if you say you
are getting an exception without even the processor in the route, its time
to turn the tracer to max and pretend you are the computer. Something weird
is going on there.

*Robert Simmons Jr. MSc. - Lead Java Architect @ EA*
*Author of: Hardcore Java (2003) and Maintainable Java (2012)*
*LinkedIn: **http://www.linkedin.com/pub/robert-simmons/40/852/a39
http://www.linkedin.com/pub/robert-simmons/40/852/a39*


On Mon, Dec 23, 2013 at 4:51 AM, jguerra jg.gue...@gmail.com wrote:

 Good news Please could you provide more information about the scenarios
 you test?. Did you handle java.sql.SQLException?. What kind of environment
 did you test it.?. Could you please attach the whole dependency tree
 running
 in your tests for your handlers (Database, Spring, etc...)?





 --
 View this message in context:
 http://camel.465427.n5.nabble.com/Problem-with-exception-handler-onException-on-Camel-2-12-X-routes-tp5742605p5745185.html
 Sent from the Camel - Users mailing list archive at Nabble.com.



Re: Processing Error queue and handling them appropriately

2013-12-23 Thread kraythe .
Weird question. There are a billion ways to do this. it depends upon your
base requirements. Typically you consume from the queue and invoke some
logic in the route and then pass off the results to another system. What
are your actual requirements?

*Robert Simmons Jr. MSc. - Lead Java Architect @ EA*
*Author of: Hardcore Java (2003) and Maintainable Java (2012)*
*LinkedIn: **http://www.linkedin.com/pub/robert-simmons/40/852/a39
http://www.linkedin.com/pub/robert-simmons/40/852/a39*


On Mon, Dec 23, 2013 at 8:38 AM, Darwish othman.darw...@progressoft.comwrote:

 Hi,
 You can user DeadLetterChannel error handler as bellow

 errorHandler id=myDLC type=DeadLetterChannel
 deadLetterUri=AMQ:queue:ERROR_Q useOriginalMessage=true/

 in the timer route you need to force using that error handler  using
 errorHandlerRef=myDLC

 then start new route to consume error messages from AMQ:queue:ERROR_Q







 -
 Othman Darwish
 ProgressSoft Corp.

 --
 View this message in context:
 http://camel.465427.n5.nabble.com/Processing-Error-queue-and-handling-them-appropriately-tp5745188p5745189.html
 Sent from the Camel - Users mailing list archive at Nabble.com.



Unique instance per route but shared on the route.

2013-12-23 Thread kraythe .
Here is a tricky question.

I have a route that is defined with concurrent consumers. Currently it
creates a single instance of a data format and then uses it in the route
several times:

public void configureARoute() {
  final ObjectMapper mapper = mapperBuilderMethod();
  final JacksonDataFormat recfmt = new JacksonDataFormat(mapper,
Record.class);
  from(activemq:queue:src?concurrentConsumers=3)
.unmarshal(recfmt)
// [do things here]
.marshal(recfmt)
.to(activemq:queue:dest);
}

The problem is I am not so sure the object mapper is totally thread safe so
I would like to create an instance of the mapper per concurrent consumer
but NOT per marshal / unmarshal call (because the actual object is used a
lot and I would have 5 of them per consumer). So what I am looking for is a
way to build an object per route concurrent consumer and use that object
throughout the route. Any ideas?

Thanks in advance.

*Robert Simmons Jr. MSc. - Lead Java Architect @ EA*
*Author of: Hardcore Java (2003) and Maintainable Java (2012)*
*LinkedIn: **http://www.linkedin.com/pub/robert-simmons/40/852/a39
http://www.linkedin.com/pub/robert-simmons/40/852/a39*


Re: Unique instance per route but shared on the route.

2013-12-23 Thread Richard Kettelerij
What's your concern with Jackson ObjectMappers? These actually are
thread-safe, see http://wiki.fasterxml.com/JacksonFAQThreadSafety.


On Mon, Dec 23, 2013 at 11:12 PM, kraythe . kray...@gmail.com wrote:

 Here is a tricky question.

 I have a route that is defined with concurrent consumers. Currently it
 creates a single instance of a data format and then uses it in the route
 several times:

 public void configureARoute() {
   final ObjectMapper mapper = mapperBuilderMethod();
   final JacksonDataFormat recfmt = new JacksonDataFormat(mapper,
 Record.class);
   from(activemq:queue:src?concurrentConsumers=3)
 .unmarshal(recfmt)
 // [do things here]
 .marshal(recfmt)
 .to(activemq:queue:dest);
 }

 The problem is I am not so sure the object mapper is totally thread safe so
 I would like to create an instance of the mapper per concurrent consumer
 but NOT per marshal / unmarshal call (because the actual object is used a
 lot and I would have 5 of them per consumer). So what I am looking for is a
 way to build an object per route concurrent consumer and use that object
 throughout the route. Any ideas?

 Thanks in advance.

 *Robert Simmons Jr. MSc. - Lead Java Architect @ EA*
 *Author of: Hardcore Java (2003) and Maintainable Java (2012)*
 *LinkedIn: **http://www.linkedin.com/pub/robert-simmons/40/852/a39
 http://www.linkedin.com/pub/robert-simmons/40/852/a39*