@RecipientList and ProducerTemplate (Camel 1.6 and 1.5)

2009-02-26 Thread paquettd

I'm seeing a behavior in camel 1.6 I don't understand. when I used the
producerTemplate to kickoff a workflow that
includes a @RecipientList component I seem to get back the result of the
recipient list... but my other services
end up being called (and their results simply lost to the ether).

Here are some details (scrubbed of the real names; but the same idea)

?xml version=1.0 encoding=UTF-8?
beans xmlns=http://www.springframework.org/schema/beans;
xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;
xmlns:camel=http://activemq.apache.org/camel/schema/spring;
xsi:schemaLocation=http://www.springframework.org/schema/beans 

http://www.springframework.org/schema/beans/spring-beans.xsd
http://activemq.apache.org/camel/schema/spring
http://activemq.apache.org/camel/schema/spring/camel-spring.xsd;

bean id=serviceA class=example.ServiceAImpl/
bean id=serviceB class=example.ServiceAImpl/
bean id=serviceC class=example.ServiceAImpl/

bean id=myRouter class=example.MyRouter
property name=passUrl value=direct:needABC/
property name=failUrl value=direct:needBC/
/bean

camelContext xmlns=http://activemq.apache.org/camel/schema/spring;
template id=myCamelTemplate defaultEndpoint=direct:test/

route
from uri=direct:test/
bean ref=myRouter/
/route

route
from uri=direct:needABC/
bean ref=serviceA/
to uri=direct:needBC/
/route

route
from uri=direct:needBC/
bean ref=serviceB/
bean ref=serviceC/
/route

/camelContext

bean id=myTester class=example.MyTester
property name=producerTemplate ref=myCamelTemplate/
/bean
/beans



My router class looks like:

public class MyRouter{

public String passUrl = null;
public String failUrl = null;

@RecipientList
public String route(String body) {
// for testing always return passUrl
return passUrl;
}

public void setPassUrl(String url) {
passUrl = url;
}

public void setFailUrl(String url) {
failUrl = url;
}
}

And finally my tester does this:

template.requestBody(template.getDefaultEndpoint(), Hello World)

All my services expect a String in this test; they just mutate it
(capitalize, reverse, other trival ops)
for the purpose of testing. I get to all those breakpoints.

Anyway.. requestBody returns direct:needABC to me... but then I see
services A,B and C getting called.
If I changed direct:test to seda:test I get back my original input... and
services A,B and C still get called.
Both ways the result are lost.

Am I missing something very obvious?

FYI I was trying to avoid using @RecipientList and using choosewhen etc
with groovy or javascript to do my
content based routing. Unfortunatly I'm using Java 5 without
javax.scripting. I tried installing
the javax.scripting implementation from java.net but couldn't quite get it
going in my OSGi container.
I guess that's a different question; but that would be my preferred
implementation.
-- 
View this message in context: 
http://www.nabble.com/%40RecipientList-and-ProducerTemplate-%28Camel-1.6-and-1.5%29-tp7016p7016.html
Sent from the Camel - Users (activemq) mailing list archive at Nabble.com.



Re: @RecipientList and ProducerTemplate (Camel 1.6 and 1.5)

2009-02-26 Thread paquettd

Looking into this more it seems to be because I am ending up in a
BeanProcessor. Line 120 of the bean processor is where the output of the
@RecipientList method is overwriting the Out part of the exchange (which
actually has the right data in it at that point).

Using the Spring DSL is there a way for me to change the Processor being
used? Or declare my @RecipientList pojo within the RecipientList tag.


paquettd wrote:
 
 I'm seeing a behavior in camel 1.6 I don't understand. when I used the
 producerTemplate to kickoff a workflow that
 includes a @RecipientList component I seem to get back the result of the
 recipient list... but my other services
 end up being called (and their results simply lost to the ether).
 
 Here are some details (scrubbed of the real names; but the same idea)
 
 ?xml version=1.0 encoding=UTF-8?
 beans xmlns=http://www.springframework.org/schema/beans;
   xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;
   xmlns:camel=http://activemq.apache.org/camel/schema/spring;
   xsi:schemaLocation=http://www.springframework.org/schema/beans 
 
 http://www.springframework.org/schema/beans/spring-beans.xsd
   http://activemq.apache.org/camel/schema/spring
 http://activemq.apache.org/camel/schema/spring/camel-spring.xsd;
 
 bean id=serviceA class=example.ServiceAImpl/
 bean id=serviceB class=example.ServiceAImpl/
 bean id=serviceC class=example.ServiceAImpl/
 
 bean id=myRouter class=example.MyRouter
 property name=passUrl value=direct:needABC/
 property name=failUrl value=direct:needBC/
 /bean
 
 camelContext xmlns=http://activemq.apache.org/camel/schema/spring;
 template id=myCamelTemplate defaultEndpoint=direct:test/
 
 route
 from uri=direct:test/
 bean ref=myRouter/
 /route
 
 route
 from uri=direct:needABC/
 bean ref=serviceA/
 to uri=direct:needBC/
 /route
 
 route
 from uri=direct:needBC/
 bean ref=serviceB/
 bean ref=serviceC/
 /route
 
 /camelContext
 
 bean id=myTester class=example.MyTester
 property name=producerTemplate ref=myCamelTemplate/
 /bean
 /beans
 
 
 
 My router class looks like:
 
 public class MyRouter{
 
   public String passUrl = null;
   public String failUrl = null;
   
   @RecipientList
   public String route(String body) {
   // for testing always return passUrl
   return passUrl;
   }
   
   public void setPassUrl(String url) {
   passUrl = url;
   }
   
   public void setFailUrl(String url) {
   failUrl = url;
   }
 }
 
 And finally my tester does this:
 
 template.requestBody(template.getDefaultEndpoint(), Hello World)
 
 All my services expect a String in this test; they just mutate it
 (capitalize, reverse, other trival ops)
 for the purpose of testing. I get to all those breakpoints.
 
 Anyway.. requestBody returns direct:needABC to me... but then I see
 services A,B and C getting called.
 If I changed direct:test to seda:test I get back my original input... and
 services A,B and C still get called.
 Both ways the result are lost.
 
 Am I missing something very obvious?
 
 FYI I was trying to avoid using @RecipientList and using choosewhen
 etc with groovy or javascript to do my
 content based routing. Unfortunatly I'm using Java 5 without
 javax.scripting. I tried installing
 the javax.scripting implementation from java.net but couldn't quite get it
 going in my OSGi container.
 I guess that's a different question; but that would be my preferred
 implementation.
 

-- 
View this message in context: 
http://www.nabble.com/%40RecipientList-and-ProducerTemplate-%28Camel-1.6-and-1.5%29-tp7016p9622.html
Sent from the Camel - Users (activemq) mailing list archive at Nabble.com.



ExchangePattern.InOut ActiveMq exception

2009-02-26 Thread Joe White
In Camel 1.5 when using the ExchangePattern.InOut I get an exception
when tearing down the activemq broker the exception occurs no matter how
the thread is stopped. Is there configuration to allow the InOut pattern
to work without causing exceptions when the broker is shut-down? The
exception received at shutdown is below along with the spring config for
the my current activemq setup.

 

Thanks

Joe

 

16:47:00,284 INFO  [AdvisoryConsumer] (ActiveMQ Connection Worker:
tcp://localhost/127.0.0.1:61616) Failed to send remove command:
javax.jms.JMSException: Channel was inactive for too long:
localhost/127.0.0.1:61616

javax.jms.JMSException: Channel was inactive for too long:
localhost/127.0.0.1:61616

  at
org.apache.activemq.util.JMSExceptionSupport.create(JMSExceptionSupport.
java:62)

... 

org.springframework.jms.listener.AbstractJmsListeningContainer.refreshSh
aredConnection(AbstractJmsListeningContainer.java:385)

  at
org.springframework.jms.listener.SimpleMessageListenerContainer.onExcept
ion(SimpleMessageListenerContainer.java:206)

  at
org.apache.activemq.ActiveMQConnection$4.run(ActiveMQConnection.java:177
9)

  ...

Caused by: org.apache.activemq.transport.InactivityIOException: Channel
was inactive for too long: localhost/127.0.0.1:61616

  at
org.apache.activemq.transport.InactivityMonitor.oneway(InactivityMonitor
.java:225)

  at
org.apache.activemq.transport.TransportFilter.oneway(TransportFilter.jav
a:83)

  at
org.apache.activemq.transport.WireFormatNegotiator.oneway(WireFormatNego
tiator.java:100)

  at
org.apache.activemq.transport.MutexTransport.oneway(MutexTransport.java:
40)

  at
org.apache.activemq.transport.ResponseCorrelator.oneway(ResponseCorrelat
or.java:60)

  at
org.apache.activemq.ActiveMQConnection.doAsyncSendPacket(ActiveMQConnect
ion.java:1214)

  ... 10 more

 

 

 

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

property name=connectionFactory

  bean
class=org.apache.activemq.spring.ActiveMQConnectionFactory

property name=brokerURL
value=tcp://localhost:61616?wireFormat.maxInactivityDuration=0 /

property name=closeTimeout value=0/

  /bean

/property

  /bean

  

  broker:broker useJmx=false persistent=false
brokerName=localhost

broker:transportConnectors

broker:transportConnector name=tcp
uri=tcp://localhost:61616/

/broker:transportConnectors

/broker:broker



Re: Restlet Component Fault Handling

2009-02-26 Thread William Tam
I submitted a fix.  Restlet component now checks for
Exchange.isFailed() and looks at Fault message to prepare a response
when isFailed() is true.   It is consistent with HTTP component.

https://issues.apache.org/activemq/browse/CAMEL-1400


On Thu, Feb 26, 2009 at 10:55 AM, William Tam email.w...@gmail.com wrote:
 Hi Todd,

 Thanks for your feedback.  Fault handler of Restlet component should
 be consistent with other components.  It sounds like it isn't.   Let
 me look into it.

 Cheers,
 William

 On Mon, Feb 23, 2009 at 7:21 PM, tfredrich tfredr...@yahoo.com wrote:

 I'm utilizing the Restlet component (via a Trunk build) and am interested in
 better understanding error handling behavior via the exchange fault message.
 BTW, I appreciate your work on this component!  Good stuff, indeed.

 In essence, I'm simply using camel-restlet to expose a JSON RESTful service
 with CRUD behavior.  The route looks something like this:

 from(restlet:http://localhost:8080/people/person/{userId}?restletMethod=GET;)
    .intercept(new AuthenticationInterceptor())
    .process(new QueryStringProcessor())
    .process(new GetPersonProcessor())
    .marshal(format)
    .process(new JsonpProcessor());

 Of interest for my question is the GetPersonProcessor, which is responsible
 for retrieving the person object from a storage repository.  When a
 non-existent userId is requested, the GetPersonProcessor does not return a
 person object and, instead sets the restlet response header to 404 (not
 found).  After reading the Camel manual, I thought it best to set the 404
 along with a fault message on the exchange, but the restlet component
 doesn't appear to acknowledge the fault and composes its response from the
 out message.  So, unless I misunderstand, I have to set the 404 on the out
 message header (for the restlet component) and set the body on the fault
 message (for camel to terminate the pipeline).

 Now for the question:  Is this the way I should be doing things?  Or
 could/should the DefaultRestletBinding utilize the fault message to compose
 its response, if a fault message exists?  Your feedback is much appreciated.

 Thanks,
 --Todd
 --
 View this message in context: 
 http://www.nabble.com/Restlet-Component-Fault-Handling-tp22173327p22173327.html
 Sent from the Camel - Users (activemq) mailing list archive at Nabble.com.





NoClassDefFoundError for unrelated classes

2009-02-26 Thread skappel

The Timer or Quartz components and DSL as in: from(timer://foo?period=6)
appear to generate NoClassDefFoundError and ClassNotFound exceptions for
unrelated components, such as Scala, Mina, Http,etc.  There are also many
warnings with org.apache.camel.util.ResolverUtil addIfMatching.  The timers
do function, and the exceptions and warnings go away if parameters in the
URI are removed.  How do you make this Camel happy?
-- 
View this message in context: 
http://www.nabble.com/NoClassDefFoundError-for-unrelated-classes-tp22239685p22239685.html
Sent from the Camel - Users (activemq) mailing list archive at Nabble.com.



Re: NoClassDefFoundError for unrelated classes

2009-02-26 Thread Claus Ibsen
On Fri, Feb 27, 2009 at 6:07 AM, skappel skap...@finobra.com wrote:

 The Timer or Quartz components and DSL as in: from(timer://foo?period=6)
 appear to generate NoClassDefFoundError and ClassNotFound exceptions for
 unrelated components, such as Scala, Mina, Http,etc.  There are also many
 warnings with org.apache.camel.util.ResolverUtil addIfMatching.  The timers
 do function, and the exceptions and warnings go away if parameters in the
 URI are removed.  How do you make this Camel happy?
Hi

At what level do they occur in the log? It should be DEBUG/TRACE.

It would help a lot of you provided the stacktraces. What version are
you using. And which classes do you have in classpath.
And does it only occur at initialization or at every time event?

But its odd that they go away with or without parameters?

Can you show an example with warnings
And an example without warnings.

And which classes do you have on the classpath, or what are you maven deps.



 --
 View this message in context: 
 http://www.nabble.com/NoClassDefFoundError-for-unrelated-classes-tp22239685p22239685.html
 Sent from the Camel - Users (activemq) mailing list archive at Nabble.com.





-- 
Claus Ibsen
Apache Camel Committer

Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/